Skip to content

Examples.Setoid.SubgroupLattice

Worked example: the subgroup lattice of the Klein four-group

This is the Examples.Setoid.SubgroupLattice module of the Agda Universal Algebra Library.

We formalize the Klein four-group Vβ‚„ = β„€/2β„€ Γ— β„€/2β„€ as a setoid algebra over the group signature Sig-Group and study its lattice of subuniverses via Setoid.Subalgebras.CompleteLattice.

Two remarks make this a group-theoretic example rather than a bare subset example. First, because Sig-Group carries the binary βˆ™, the unary inverse ⁻¹, and the nullary identity Ξ΅, a subuniverse (i.e., a subset closed under all the operations) is exactly a subgroup. Second, the nullary Ξ΅ forces every subuniverse to contain the identity, so the bottom subuniverse Sg βˆ… is already the trivial subgroup {e}; we get it for free as the lattice bottom 0Λ’.

Vβ‚„ has exactly five subgroups: the trivial group {e}, the whole group, and three non-trivial, order-two subgroups in between, pairwise incomparable, any two of which meet at {e} and join to the whole group. That is the lattice M₃ β€” the five-element diamond, and the smallest non-distributive lattice.

This module exhibits the three middle subgroups as elements of Sub Vβ‚„, instantiates the lattice bundles, and proves that the subgroup lattice is an M₃ lattice: the three atoms are pairwise incomparable and proper, any two meet at {e}, and any two join to the whole group. The one piece left for future work is to prove that these five are the only subgroups.

{-# OPTIONS --cubical-compatible --exact-split --safe #-}

module Examples.Setoid.SubgroupLattice where

-- Imports from the Agda Standard Library ---------------------------------------
open import Data.Bool.Base                         using ( Bool ; true ; false ; _xor_ )
open import Data.Empty                             using ( βŠ₯ )
open import Data.Fin.Patterns                      using ( 0F ; 1F )
open import Data.Product                           using ( _Γ—_ ; _,_ ; proj₁ ; projβ‚‚ )
open import Data.Sum.Base                          using ( inj₁ ; injβ‚‚ )
open import Data.Unit.Base                         using ( tt )
open import Function                               using ( Func )
open import Level                                  using ( 0β„“ ; lift )
open import Relation.Binary                        using ( Setoid )
open import Relation.Binary.PropositionalEquality  using ( _≑_ ; refl ; congβ‚‚ ; setoid )
open import Relation.Nullary                       using ( Β¬_ )
open import Relation.Unary                         using ( Pred ; _∈_ )

-- Imports from the Agda Universal Algebra Library ------------------------------
open import Classical.Signatures.Group             using ( Sig-Group ; βˆ™-Op ; Ξ΅-Op ; ⁻¹-Op )
open import Setoid.Algebras {𝑆 = Sig-Group}        using ( Algebra )
open import Setoid.Signatures                      using  ( ⟨_⟩ )

open Func renaming ( to to _⟨$⟩_ )

The Klein four-group Vβ‚„

The carrier is Bool Γ— Bool; the group operation is componentwise exclusive-or, every element is its own inverse, and the identity is (false , false). We define _βŠ•_ through the projections (rather than by matching the pairs) so that it computes on arbitrary (not just literal) arguments, which keeps the closure proofs below definitional.

infixl 6 _βŠ•_
_βŠ•_ : Bool Γ— Bool β†’ Bool Γ— Bool β†’ Bool Γ— Bool
x βŠ• y = proj₁ x xor proj₁ y , projβ‚‚ x xor projβ‚‚ y

Vβ‚„ : Algebra 0β„“ 0β„“
Vβ‚„ = record { Domain = setoid (Bool Γ— Bool) ; Interp = interp }
  where
  interp : Func (⟨ Sig-Group ⟩ (setoid (Bool Γ— Bool))) (setoid (Bool Γ— Bool))
  interp ⟨$⟩ (βˆ™-Op , args) = args 0F βŠ• args 1F
  interp ⟨$⟩ (Ρ-Op , _)  = false , false
  interp ⟨$⟩ (⁻¹-Op , args) = args 0F
  cong interp {βˆ™-Op , _} {.βˆ™-Op , _} (refl , aβ‰ˆ) = congβ‚‚ _βŠ•_ (aβ‰ˆ 0F) (aβ‰ˆ 1F)
  cong interp {Ξ΅-Op , _} {.Ξ΅-Op , _} (refl , _) = refl
  cong interp {⁻¹-Op , _} {.⁻¹-Op , _} (refl , aβ‰ˆ) = aβ‰ˆ 0F

The three order-two subgroups

Each order-two subgroup is cut out by one linear condition on the coordinates: H₁ = {(0,y)} (first coordinate trivial), Hβ‚‚ = {(x,0)} (second coordinate trivial), and Hβ‚Œ = {(x,x)} (the diagonal). Each is closed under the operations, hence a subuniverse: closure under βˆ™ is xor respecting the condition (via congβ‚‚), closure under Ξ΅ is immediate, and closure under ⁻¹ is trivial since the inverse is the identity map.

open import Setoid.Subalgebras.Subuniverses {𝑆 = Sig-Group}
  using ( Subuniverses ; var ; app )

H₁ Hβ‚‚ Hβ‚Œ : Pred (Bool Γ— Bool) 0β„“
H₁ x = proj₁ x ≑ false
Hβ‚‚ x = projβ‚‚ x ≑ false
Hβ‚Œ x = proj₁ x ≑ projβ‚‚ x

H₁-isSub : H₁ ∈ Subuniverses Vβ‚„
H₁-isSub βˆ™-Op _ im = congβ‚‚ _xor_ (im 0F) (im 1F)
H₁-isSub Ξ΅-Op _ _ = refl
H₁-isSub ⁻¹-Op _ im = im 0F

Hβ‚‚-isSub : Hβ‚‚ ∈ Subuniverses Vβ‚„
Hβ‚‚-isSub βˆ™-Op _ im = congβ‚‚ _xor_ (im 0F) (im 1F)
Hβ‚‚-isSub Ξ΅-Op _ _ = refl
Hβ‚‚-isSub ⁻¹-Op _ im = im 0F

Hβ‚Œ-isSub : Hβ‚Œ ∈ Subuniverses Vβ‚„
Hβ‚Œ-isSub βˆ™-Op _ im = congβ‚‚ _xor_ (im 0F) (im 1F)
Hβ‚Œ-isSub Ξ΅-Op _ _ = refl
Hβ‚Œ-isSub ⁻¹-Op _ im = im 0F

Instantiating the lattice bundles

With base level β„“β‚€ = 0β„“ the absorbing level L is 0β„“. We open Sublattice Vβ‚„ 0β„“ to bring the order, operations, bounds, and bundles into scope specialized to Vβ‚„ β€” so we write 𝑯₁ ≀ 𝑯₂, 𝑯₁ ∧ 𝑯₂, 0Λ’, etc. directly. All three bundles type-check.

open import Setoid.Subalgebras.CompleteLattice {𝑆 = Sig-Group}
  using ( module Sublattice )
open Sublattice Vβ‚„ 0β„“

-- The three middle subgroups as elements of Sub Vβ‚„.
𝑯₁ 𝑯₂ π‘―β‚Œ : Subα΄Έ
𝑯₁ = H₁ , H₁-isSub
𝑯₂ = Hβ‚‚ , Hβ‚‚-isSub
π‘―β‚Œ = Hβ‚Œ , Hβ‚Œ-isSub

The M₃ shape

Each middle subgroup lies strictly between the bottom {e} and the top: it is above 0Λ’ (every subgroup is, since 0Λ’ is least) and below 1Λ’ (likewise), and it is proper β€” distinct from the top, because it omits some element of the group.

0≀𝑯₁ : 0Λ’ ≀ 𝑯₁
0≀𝑯₁ = 0Λ’-minimum 𝑯₁

𝑯₁≀1 : 𝑯₁ ≀ 1Λ’
𝑯₁≀1 _ = lift tt

-- 𝑯₁ is a *proper* subgroup: the top is not contained in it (it omits (true , false)).
1⋬𝑯₁ : Β¬ ( 1Λ’ ≀ 𝑯₁ )
1⋬𝑯₁ le = ex falso
  where
  ex : (true , false) ∈ proj₁ 𝑯₁ β†’ βŠ₯
  ex ()

  falso : (true , false) ∈ proj₁ 𝑯₁
  falso = le {true , false} (lift tt)

0≀𝑯₂ : 0Λ’ ≀ 𝑯₂
0≀𝑯₂ = 0Λ’-minimum 𝑯₂

𝑯₂≀1 : 𝑯₂ ≀ 1Λ’
𝑯₂≀1 _ = lift tt

-- 𝑯₂ omits (false , true) (its second coordinate is not trivial).
1⋬𝑯₂ : Β¬ ( 1Λ’ ≀ 𝑯₂ )
1⋬𝑯₂ le = ex falso
  where
  ex : (false , true) ∈ proj₁ 𝑯₂ β†’ βŠ₯
  ex ()
  falso : (false , true) ∈ proj₁ 𝑯₂
  falso = le {false , true} (lift tt)

0β‰€π‘―β‚Œ : 0Λ’ ≀ π‘―β‚Œ
0β‰€π‘―β‚Œ = 0Λ’-minimum π‘―β‚Œ

π‘―β‚Œβ‰€1 : π‘―β‚Œ ≀ 1Λ’
π‘―β‚Œβ‰€1 _ = lift tt

-- π‘―β‚Œ omits (true , false) (its coordinates differ).
1β‹¬π‘―β‚Œ : Β¬ ( 1Λ’ ≀ π‘―β‚Œ )
1β‹¬π‘―β‚Œ le = ex (le (lift tt))
  where
  ex : (true , false) ∈ proj₁ π‘―β‚Œ β†’ βŠ₯
  ex ()

The three middle subgroups are pairwise incomparable: each contains a non-identity element the others lack β€” (false , true) ∈ H₁, (true , false) ∈ Hβ‚‚, (true , true) ∈ Hβ‚Œ.

𝑯₁⋬𝑯₂ : Β¬ ( 𝑯₁ ≀ 𝑯₂ )
𝑯₁⋬𝑯₂ le = ex (le refl)
  where
  ex : (false , true) ∈ proj₁ 𝑯₂ β†’ βŠ₯
  ex ()

𝑯₂⋬𝑯₁ : Β¬ ( 𝑯₂ ≀ 𝑯₁ )
𝑯₂⋬𝑯₁ le = ex (le refl)
  where
  ex : (true , false) ∈ proj₁ 𝑯₁ β†’ βŠ₯
  ex ()

π‘―β‚β‹¬π‘―β‚Œ : Β¬ ( 𝑯₁ ≀ π‘―β‚Œ )
π‘―β‚β‹¬π‘―β‚Œ le = ex (le refl)
  where
  ex : (false , true) ∈ proj₁ π‘―β‚Œ β†’ βŠ₯
  ex ()

π‘―β‚Œβ‹¬π‘―β‚ : Β¬ ( π‘―β‚Œ ≀ 𝑯₁ )
π‘―β‚Œβ‹¬π‘―β‚ le = ex (le refl)
  where
  ex : (true , false) ∈ proj₁ 𝑯₁ β†’ βŠ₯
  ex ()

π‘―β‚‚β‹¬π‘―β‚Œ : Β¬ ( 𝑯₂ ≀ π‘―β‚Œ )
π‘―β‚‚β‹¬π‘―β‚Œ le = ex (le refl)
  where
  ex : (true , false) ∈ proj₁ π‘―β‚Œ β†’ βŠ₯
  ex ()

π‘―β‚Œβ‹¬π‘―β‚‚ : Β¬ ( π‘―β‚Œ ≀ 𝑯₂ )
π‘―β‚Œβ‹¬π‘―β‚‚ le = ex (le refl)
  where
  ex : (true , true) ∈ proj₁ 𝑯₂ β†’ βŠ₯
  ex ()

Together these facts give the order skeleton of M₃: three pairwise-incomparable proper subgroups, each strictly between 0Λ’ = {e} and 1Λ’.

The meet/join table: M₃ is non-distributive

The lattice is M₃: any two atoms meet at {e} and join to the whole group.

For a meet, an element trivial in both relevant coordinates is the identity (false , false), which the nullary Ξ΅ generates, so it lies in 0Λ’ = Sg βˆ….

For a join, the union of two atoms generates all four elements β€” the fourth as the βŠ• of the other two atom witnesses (e.g., (true , true) = (false , true) βŠ• (true , false)).

π‘―β‚βˆ§π‘―β‚‚β‰ˆβŠ₯ : 𝑯₁ ∧ 𝑯₂ β‰ˆ 0Λ’
π‘―β‚βˆ§π‘―β‚‚β‰ˆβŠ₯ = m , 0Λ’-minimum (𝑯₁ ∧ 𝑯₂)
  where m : 𝑯₁ ∧ 𝑯₂ ≀ 0Λ’
        m (refl , refl) = app Ξ΅-Op (Ξ» ()) Ξ» ()

π‘―β‚βˆ§π‘―β‚Œβ‰ˆβŠ₯ : (𝑯₁ ∧ π‘―β‚Œ) β‰ˆ 0Λ’
π‘―β‚βˆ§π‘―β‚Œβ‰ˆβŠ₯ = m , 0Λ’-minimum (𝑯₁ ∧ π‘―β‚Œ)
  where m : (𝑯₁ ∧ π‘―β‚Œ) ≀ 0Λ’
        m  (refl , refl) = app Ξ΅-Op (Ξ» ()) (Ξ» ())

π‘―β‚‚βˆ§π‘―β‚Œβ‰ˆβŠ₯ : (𝑯₂ ∧ π‘―β‚Œ) β‰ˆ 0Λ’
π‘―β‚‚βˆ§π‘―β‚Œβ‰ˆβŠ₯ = m , 0Λ’-minimum (𝑯₂ ∧ π‘―β‚Œ)
  where m : (𝑯₂ ∧ π‘―β‚Œ) ≀ 0Λ’
        m (refl , refl) = app Ξ΅-Op (Ξ» ()) (Ξ» ())

π‘―β‚βˆ¨π‘―β‚‚β‰ˆβŠ€ : (𝑯₁ ∨ 𝑯₂) β‰ˆ 1Λ’
π‘―β‚βˆ¨π‘―β‚‚β‰ˆβŠ€ = (Ξ» _ β†’ lift tt) , j
  where
  j : 1Λ’ ≀ (𝑯₁ ∨ 𝑯₂)
  j {false , false} _ = var (inj₁ refl)
  j {false , true} _ = var (inj₁ refl)
  j {true , false} _ = var (injβ‚‚ refl)
  j {true , true} _ = app βˆ™-Op (Ξ» { 0F β†’ false , true ; 1F β†’ true , false })
                               (Ξ» { 0F β†’ var (inj₁ refl) ; 1F β†’ var (injβ‚‚ refl) })

π‘―β‚βˆ¨π‘―β‚Œβ‰ˆβŠ€ : (𝑯₁ ∨ π‘―β‚Œ) β‰ˆ 1Λ’
π‘―β‚βˆ¨π‘―β‚Œβ‰ˆβŠ€ = (Ξ» _ β†’ lift tt) , j
  where
  j : 1Λ’ ≀ (𝑯₁ ∨ π‘―β‚Œ)
  j {false , false} _ = var (inj₁ refl)
  j {false , true} _ = var (inj₁ refl)
  j {true , true} _ = var (injβ‚‚ refl)
  j {true , false} _ = app βˆ™-Op (Ξ» { 0F β†’ false , true ; 1F β†’ true , true })
                                (Ξ» { 0F β†’ var (inj₁ refl) ; 1F β†’ var (injβ‚‚ refl) })

π‘―β‚‚βˆ¨π‘―β‚Œβ‰ˆβŠ€ : (𝑯₂ ∨ π‘―β‚Œ) β‰ˆ 1Λ’
π‘―β‚‚βˆ¨π‘―β‚Œβ‰ˆβŠ€ = (Ξ» _ β†’ lift tt) , j
  where
  j : 1Λ’ ≀ (𝑯₂ ∨ π‘―β‚Œ)
  j {false , false} _ = var (inj₁ refl)
  j {true , false} _ = var (inj₁ refl)
  j {true , true} _ = var (injβ‚‚ refl)
  j {false , true} _ = app βˆ™-Op (Ξ» { 0F β†’ true , false ; 1F β†’ true , true })
                                (Ξ» { 0F β†’ var (inj₁ refl) ; 1F β†’ var (injβ‚‚ refl) })

These equalities are exactly non-distributivity: with x = 𝑯₁, y = 𝑯₂, z = π‘―β‚Œ, the meet x ∧ (y ∨ z) = x ∧ 1Λ’ = x (a proper, nonzero subgroup), whereas (x ∧ y) ∨ (x ∧ z) = 0Λ’ ∨ 0Λ’ = 0Λ’ β€” so M₃ is not distributive.

Remaining work

What remains is completeness: that 0Λ’, 1Λ’, 𝑯₁, 𝑯₂, π‘―β‚Œ are all the subgroups β€” a finite case analysis over the four group elements.