Examples.Classical.Lattices.L2¶
Worked Example: π³π = (Bool, _β§_, _β¨_) as a Boolean lattice¶
This is the Examples.Classical.Lattices.L2 module of the Agda Universal Algebra Library.
Bool under meet and join forms the canonical two-element lattice. Built from
stdlib's Data.Bool.Properties lemmas; the only non-trivial step is deriving the
(a β§ b) β¨ a β‘ a form of absorption from stdlib's β¨-absorbs-β§ form via β¨-comm.
Deriving the second absorption equation¶
Our eqsToLattice takes the second absorption equation in the form (a β§ b) β¨ a β‘ a
(per Th-Lattice absorbΚ³ = AbsorbsRight β§-Op β¨-Op refl refl 0F 1F); stdlib's
Data.Bool.Properties.β¨-absorbs-β§ is a β¨ (a β§ b) β‘ a. One β¨-comm step bridges them.
Bool-absorbΚ³ : β a b β (a β§ b) β¨ a β‘ a Bool-absorbΚ³ a b = trans (β¨-comm (a β§ b) a) (β¨-absorbs-β§ a b)
The lattice π³π = (Bool, _β§_, _β¨_)¶
π³π : Lattice π³π = eqsToLattice Bool _β§_ _β¨_ β§-assoc β§-comm β§-idem β¨-assoc β¨-comm β¨-idem β§-absorbs-β¨ Bool-absorbΚ³
Acceptance checks¶
The Lattice-Op accessors interpret to stdlib's Bool._β§_ and Bool._β¨_ on the
nose: no opacity from eqsToLattice, from the factoring through opsToBareLattice,
or from Curryβ wrapping; discharged by refl.
open Polymorphic.Lattice-Op π³π renaming ( _β§_ to _ββ§_ ; _β¨_ to _ββ¨_ ) ββ§-is-β§-la : β (a b : Bool) β a ββ§ b β‘ a β§ b ββ§-is-β§-la a b = refl ββ¨-is-β¨-la : β (a b : Bool) β a ββ¨ b β‘ a β¨ b ββ¨-is-β¨-la a b = refl
Round-trip through Algebra.Lattice.Bundles.Lattice¶
The bundle bridge round-trips on Bool-lattice pointwise on both operations.
Both directions reduce by pair a b 0F β a and pair a b 1F β b, so
propositional refl discharges the obligation at the curried form
(per ADR-002 v2 Β§6).
open Polymorphic.Lattice-Op βͺ β¨ π³π β©Λ‘α΅ β«Λ‘α΅ using () renaming ( _β§_ to _ββ§'_ ; _β¨_ to _ββ¨'_ ) roundtrip-β§-la : β (a b : Bool) β a ββ§' b β‘ a β§ b roundtrip-β§-la a b = refl roundtrip-β¨-la : β (a b : Bool) β a ββ¨' b β‘ a β¨ b roundtrip-β¨-la a b = refl
This closes the third bullet of the M3-7 acceptance criteria.