A Heyting algebra is a poset with finite meets , finite joins , top , bottom , and an implication characterized by
i.e. is a Galois Connection. Negation is . A Heyting algebra is exactly a thin Bicartesian Closed Category; it is a Boolean algebra when moreover (equivalently ).
Sources: 7 Sketches §7.4.3 (“the poset of predicates on forms what’s called a Heyting algebra”), §7.4.2, Exercises 7.11, 7.59, 7.60, Remark 7.33; DaoFP §6 (bicartesian closed categories).
- Examples: ; any Power Set; the open sets of a Topological Space with (Internal Logic of a Topos) — a frame, since it also has arbitrary joins, and hence a Quantale with (Remark 7.33); the subobjects of any object in a Topos, equivalently the predicates ; the upper sets of a preorder.
- The cartesian closed preorders are exactly the meet-semilattices with implication; a Quantale with , and is a complete Heyting algebra (7S Exercise 7.11), but not every cartesian closed preorder has all joins ( has no bottom).
- Closure operators on a Heyting algebra preserving are nuclei — the modalities of topos logic.
Docs: C-set morphisms · Graphs · Vignette: subgraphs
using Catlab
# Sub(G) of a C-set is a Heyting algebra: meet, join, top, bottom, implies, negate
G = cycle_graph(Graph, 4)
A = Subobject(G, V=[1, 2], E=[1]); B = Subobject(G, V=[2, 3], E=[2])
sh(s) = (c = components(s); (collect(c[:V]), collect(c[:E])))
sh(implies(A, B)) # ([2, 3, 4], [2, 3]): the largest r with r ∧ A ≤ B
sh(implies(A, B) ∧ A) # ([2], []) ⊆ B
sh(top(G)), sh(bottom(G))import Mathlib
#check @HeytingAlgebra -- class with ⇨ (himp) and ᶜ
#check @le_himp_iff -- a ≤ b ⇨ c ↔ a ⊓ b ≤ c
#check @HeytingAlgebra.toBooleanAlgebra -- not a thing: Boolean needs a ⊔ aᶜ = ⊤
example (X : Type) [TopologicalSpace X] : HeytingAlgebra (TopologicalSpace.Opens X) := inferInstanceclass Heyting h where
top, bot :: h
(/\), (\/), (==>) :: h -> h -> h
neg :: Heyting h => h -> h
neg p = p ==> bot
instance Heyting Bool where
top = True; bot = False
(/\) = (&&); (\/) = (||); p ==> q = not p || q