definition example

is the Symmetric Monoidal Preorder on the Booleans with monoidal unit and monoidal product AND. Identifying , , is multiplication:

Sources: 7 Sketches Example 2.27, Exercises 2.29, 2.84, 2.93, Theorem 2.49; DaoFP §20.1 (“the monoidal walking arrow”); Kittenlab Lecture 14.

As a base of enrichment. -categories are exactly preorders (Preorders are Bool-Categories): the underlying set says “getting from to is a true/false question”; the unit says “you can always get from to ”; the product says “if you can get from to AND from to then from to ”; the “if–then” is the order . DaoFP calls the walking arrow made monoidal by , everything else .

Properties. is monoidal closed with hom-element implication (7S Exercise 2.84) and is a Quantale with joins given by OR (7S Exercise 2.93); the empty join is (7S Exercise 2.92). Its identity -matrix is the usual identity with on the diagonal.

The other structure. is also a symmetric monoidal preorder (7S Exercise 2.29), but it is not closed (Example 2.85): closedness would need ; for the right side always holds while the left side fails.

Maps. Monoidal monotones (, ) and (“is ?”, “is ?”) connect preorders and metric spaces via Change of Base. -profunctors are feasibility relations (Chapter 4).

Docs: Kittenlab Lecture 14

Builds on: Preorder (Preorder) — run that note’s Julia code first.

struct BoolPre <: Preorder{Bool} end
leq(::BoolPre, a::Bool, b::Bool) = a <= b       # false ≤ true
otimes(::BoolPre, a, b) = a && b
munit(::BoolPre) = true
hom(::BoolPre, v, w) = !v || w                  # v ⊸ w = (v ⇒ w)
join(::BoolPre, a, b) = a || b
-- Bool is a Boolean algebra: ⊓ = and, ⊔ = or, ⇨ = implication (the closed structure)
example : BooleanAlgebra Bool := inferInstance
example (a v w : Bool) : (a ⊓ v ≤ w) ↔ (a ≤ v ⇨ w) := le_himp_iff
-- Prop is the "large" version: a Heyting algebra with → as internal hom
example (a v w : Prop) : (a ∧ v → w) ↔ (a → v → w) := ⟨fun h ha hv => h ⟨ha, hv⟩, fun h ⟨ha, hv⟩ => h ha hv⟩
import Data.Monoid (All(..))
-- (Bool, &&, True) is the monoid All; with False <= True it is the monoidal preorder Bool
instance Preorder All where leq (All a) (All b) = a <= b
instance MonoidalPreorder All
 
implies :: Bool -> Bool -> Bool   -- the hom-element v ⊸ w
implies v w = not v || w