---
layout: default
file: "src/Examples/Classical/Lattices/L2.lagda.md"
title: "Examples.Classical.Lattices.L2 module"
date: "2026-05-31"
author: "the agda-algebras development team"
---
### Worked Example: `π³π = (Bool, _β§_, _β¨_)` as a Boolean lattice {#examples-classical-lattices-L2}
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`.
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module Examples.Classical.Lattices.L2 where
open import Data.Bool using ( Bool ; _β§_ ; _β¨_ )
open import Data.Bool.Properties using ( β§-assoc ; β§-comm ; β§-idem ; β¨-assoc ; β¨-comm ; β¨-idem )
renaming ( β§-abs-β¨ to β§-absorbs-β¨ ; β¨-abs-β§ to β¨-absorbs-β§ )
open import Relation.Binary.PropositionalEquality using ( _β‘_ ; refl ; trans )
open import Classical.Bundles.Lattice using ( β¨_β©Λ‘α΅ ; βͺ_β«Λ‘α΅ )
open import Classical.Small.Structures.Lattice using ( Lattice ; eqsToLattice )
import Classical.Structures.Lattice as Polymorphic
```
-->
#### Deriving the second absorption equation {#absorbR}
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.
```agda
Bool-absorbΚ³ : β a b β (a β§ b) β¨ a β‘ a
Bool-absorbΚ³ a b = trans (β¨-comm (a β§ b) a) (β¨-absorbs-β§ a b)
```
#### The lattice `π³π = (Bool, _β§_, _β¨_)` {#bool-lattice}
```agda
π³π : Lattice
π³π = eqsToLattice Bool _β§_ _β¨_
β§-assoc β§-comm β§-idem β¨-assoc β¨-comm β¨-idem β§-absorbs-β¨ Bool-absorbΚ³
```
#### Acceptance checks {#acceptance}
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`.
```agda
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` {#roundtrip}
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](../../docs/adr/002-classical-layer-design.md) Β§6).
```agda
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.