Setoid.Congruences.CompleteLattice¶
The Complete Lattice of Congruences¶
This is the Setoid.Congruences.CompleteLattice module of the Agda Universal Algebra Library.
Setoid.Congruences.Lattice gave the meet (intersection) and the
containment order, and Setoid.Congruences.Generation gave the join
ΞΈ β¨ Ο = Cg(ΞΈ βͺ Ο) via the congruence-generation theorem. This module assembles
those pieces into the congruence lattice of an algebra and shows it is
complete.
The one wrinkle is universe levels. The meet preserves the relation level β, but
the join lands at π β = π β π₯ β Ξ± β Ο β β (the closure quantifies over the
operations and the carrier). To make meet and join the same binary operation on a
single type, we evaluate the congruence lattice at a relation level that already
absorbs that bump: for a base level ββ, at which π L = L,
L = π β π₯ β Ξ± β Ο β ββ.
At level L both _β§_ and _β¨_ are operations on Con π¨ {L}, so they fit a
standard-library Lattice bundle, and with the bounds β₯/β€ a BoundedLattice.
For completeness we add infinitary meets β¨
(intersection of a family) and joins
β¨ (generated by the union of a family), each proved to be the relevant
greatest-lower / least-upper bound, and package them in the CompleteLattice record
of Order.CompleteLattice.
The family index I is required to live at the base level ββ, so the lattice is
complete with respect to ββ-small families β the usual predicative reading.
The congruence lattice at the absorbing level L¶
We fix an algebra π¨ and a base level ββ, and work with congruences whose
relation level is L = π β π₯ β Ξ± β Ο β ββ. Because level join is idempotent,
π L = L, so the join _β¨_ (whose codomain is Con π¨ {π L}) is an operation on
Con π¨ {L}, exactly like the meet.
module _ (π¨ : Algebra Ξ± Ο) (ββ : Level) where L : Level L = π β π₯ β Ξ± β Ο β ββ private Conα΄Έ : Type (Ξ± β Ο β ov L) Conα΄Έ = Con π¨ L
The join is the least upper bound: the two upper-bound facts come from Generation,
and the universality is β¨-least.
Con-supremum : Supremum (_β_ {π¨ = π¨} {L}) _β¨_ Con-supremum ΞΈ Ο = β¨-upperΛ‘ ΞΈ Ο , β¨-upperΚ³ ΞΈ Ο , Ξ» Ο ΞΈβΟ ΟβΟ β β¨-least ΞΈ Ο Ο ΞΈβΟ ΟβΟ
Assembling the partial order, the supremum, and the meet's infimum gives the lattice.
Con-isLattice : IsLattice (_β_ {π¨ = π¨} {L}) _β_ _β¨_ _β§_ Con-isLattice = record { isPartialOrder = β-isPartialOrder ; supremum = Con-supremum ; infimum = β§-infimum } Con-Lattice : Lattice (Ξ± β Ο β ov L) (Ξ± β L) (Ξ± β L) Con-Lattice = record { Carrier = Conα΄Έ ; _β_ = _β_ ; _β€_ = _β_ ; _β¨_ = _β¨_ ; _β§_ = _β§_ ; isLattice = Con-isLattice }
The bounds: zero and total congruences¶
The bottom congruence 0ᴬ is the diagonal congruence π[ π¨ ] and the top
congruence 1ᴬ is the total congruence π[ π¨ ], both from
Setoid.Congruences.Basic, taken at the absorbing level L. Their minimality
and maximality are the order facts π-min / π-max of
Setoid.Congruences.Lattice.
(The least congruence is the diagonal β the identity relation viewed as a
congruence β not the empty relation: the empty relation is not even reflexive, so
it is not a congruence at all. An earlier version defined 0ᴬ = Cg 0A as the
congruence generated by the empty relation; that is in fact the diagonal, since
Cg closes under reflexivity over β, but the direct definition π[ π¨ ] is the
standard and clearer one.)
0ᴬ : Conα΄Έ 0ᴬ = π[ π¨ ] {L} 1ᴬ : Conα΄Έ 1ᴬ = π[ π¨ ] {L} 0ᴬ-minimum : Minimum _β_ 0ᴬ 0ᴬ-minimum ΞΈ = π-min {β = L} ΞΈ 1ᴬ-maximum : Maximum _β_ 1ᴬ 1ᴬ-maximum ΞΈ = π-max ΞΈ
With the bounds the lattice becomes a bounded lattice (1ᴬ is the maximum, 0ᴬ the
minimum).
Con-isBoundedLattice : IsBoundedLattice (_β_ {π¨ = π¨} {L}) _β_ _β¨_ _β§_ 1ᴬ 0ᴬ Con-isBoundedLattice = record { isLattice = Con-isLattice ; maximum = 1ᴬ-maximum ; minimum = 0ᴬ-minimum } Con-BoundedLattice : BoundedLattice (Ξ± β Ο β ov L) (Ξ± β L) (Ξ± β L) Con-BoundedLattice = record { Carrier = Conα΄Έ ; _β_ = _β_ ; _β€_ = _β_ ; _β¨_ = _β¨_ ; _β§_ = _β§_ ; β€ = 1ᴬ ; β₯ = 0ᴬ ; isBoundedLattice = Con-isBoundedLattice }
Infinitary meets and joins¶
For a family f : I β Con π¨ {L} indexed by I : Type ββ, the infinitary meet is the
intersection β f (which holds at (x , y) iff every f i does), and the
infinitary join is the congruence generated by the union, β f = Cg(β f). Both stay
at level L because I is ββ-small. The meet is the greatest lower bound and the
join the least upper bound of the family.
module _ {I : Type ββ} (f : I β Conα΄Έ) where -- Infinitary meet: the intersection of the family. β : Conα΄Έ β = (Ξ» x y β (i : I) β projβ (f i) x y) , mkcon m-refl m-equiv m-comp where open Setoid π»[ π¨ ] using ( _β_ ) m-refl : β {aβ aβ} β aβ β aβ β (i : I) β projβ (f i) aβ aβ m-refl e i = reflexive (projβ (f i)) e m-equiv : IsEquivalence (Ξ» x y β (i : I) β projβ (f i) x y) m-equiv = record { refl = Ξ» i β IsEquivalence.refl (is-equivalence (projβ (f i))) ; sym = Ξ» p i β IsEquivalence.sym (is-equivalence (projβ (f i))) (p i) ; trans = Ξ» p q i β IsEquivalence.trans (is-equivalence (projβ (f i))) (p i) (q i) } m-comp : π¨ β£β (Ξ» x y β (i : I) β projβ (f i) x y) m-comp g h i = is-compatible (projβ (f i)) g (Ξ» k β h k i) -- Infinitary join: the congruence generated by the union of the family. β : Conα΄Έ β = Cg (Ξ» x y β Ξ£[ i β I ] projβ (f i) x y) β-lower : (i : I) β β β f i β-lower i p = p i β-greatest : (Ο : Conα΄Έ) β (β i β Ο β f i) β Ο β β β-greatest Ο Οβf p i = Οβf i p β-upper : (i : I) β f i β β β-upper i p = base (i , p) β-least : (Ο : Conα΄Έ) β (β i β f i β Ο) β β β Ο β-least Ο fβΟ = Cg-least {π¨ = π¨} Ο (Ξ» (i , p) β fβΟ i p)
The complete lattice¶
Packaging the order with the infinitary operations and their universal properties yields the complete lattice of congruences.
Con-CompleteLattice : CompleteLattice (Ξ± β Ο β ov L) (Ξ± β L) (Ξ± β L) ββ Con-CompleteLattice = record { Carrier = Conα΄Έ ; _β_ = _β_ ; _β€_ = _β_ ; isPartialOrder = β-isPartialOrder ; β¨ = β ; β¨ = β ; β¨-upper = Ξ» f i β β-upper f i ; β¨-least = Ξ» f x h β β-least f x h ; β¨ -lower = Ξ» f i β β-lower f i ; β¨ -greatest = Ξ» f x h β β-greatest f x h }