Overture.Adjunction.Galois¶
Galois Connections¶
This is the Overture.Adjunction.Galois module of the Agda Universal Algebra Library.
If ๐จ = (A, โค) and ๐ฉ = (B, โค) are two partially ordered sets (posets), then a
Galois connection between ๐จ and ๐ฉ is a pair (F , G) of functions such that
F : A โ BG : B โ Aโ (a : A)(b : B) โ F(a) โค b โ a โค G(b)โ (a : A)(b : B) โ a โค G(b) โ F(a) โค b
In other terms, F is a left adjoint of G and G is a right adjoint of F.
module _ (๐จ : Poset ฮฑ โแต ฯแต)(๐ฉ : Poset ฮฒ โแต ฯแต) where open Poset ๐จ renaming ( Carrier to A ; _โค_ to _โคแดฌ_ ) using () open Poset ๐ฉ renaming ( Carrier to B ; _โค_ to _โคแดฎ_ ) using () record Galois : Type (suc (ฮฑ โ ฮฒ โ ฯแต โ ฯแต)) where field F : A โ B G : B โ A GFโฅid : โ a โ a โคแดฌ G (F a) FGโฅid : โ b โ b โคแดฎ F (G b) module _ {๐ : Type ฮฑ}{โฌ : Type ฮฒ} where -- For A โ ๐, define A โ R = {b : b โ โฌ, โ a โ A โ R a b } _โ_ : โ {ฯแต ฯแต} โ Pred ๐ ฯแต โ REL ๐ โฌ ฯแต โ Pred โฌ (ฮฑ โ ฯแต โ ฯแต) A โ R = ฮป b โ A โ (ฮป a โ R a b) -- For B โ โฌ, define R โ B = {a : a โ ๐, โ b โ B โ R a b } _โ_ : โ {ฯแต ฯแต} โ REL ๐ โฌ ฯแต โ Pred โฌ ฯแต โ Pred ๐ (ฮฒ โ ฯแต โ ฯแต) R โ B = ฮป a โ B โ R a โโโฅid : โ {ฯแต ฯสณ} {A : Pred ๐ ฯแต} {R : REL ๐ โฌ ฯสณ} โ A โ R โ (A โ R) โโโฅid p b = b p โโโฅid : โ {ฯแต ฯสณ} {B : Pred โฌ ฯแต} {R : REL ๐ โฌ ฯสณ} โ B โ (R โ B) โ R โโโฅid p a = a p โโโโโ : โ {ฯแต ฯสณ} {A : Pred ๐ ฯแต}{R : REL ๐ โฌ ฯสณ} โ (R โ (A โ R)) โ R โ A โ R โโโโโ p a = p (ฮป z โ z a) โโโโโ : โ {ฯแต ฯสณ} {B : Pred โฌ ฯแต}{R : REL ๐ โฌ ฯสณ} โ R โ ((R โ B) โ R) โ R โ B โโโโโ p b = p (ฮป z โ z b) -- Definition of "closed" with respect to the closure operator ฮป A โ R โ (A โ R) โโClosed : โ {ฯแต ฯสณ} {A : Pred ๐ ฯแต} {R : REL ๐ โฌ ฯสณ} โ Type _ โโClosed {A = A}{R} = R โ (A โ R) โ A -- Definition of "closed" with respect to the closure operator ฮป B โ (R โ B) โ R โโClosed : โ {ฯแต ฯสณ} {B : Pred โฌ ฯแต}{R : REL ๐ โฌ ฯสณ} โ Type _ โโClosed {B = B}{R} = (R โ B) โ R โ B
The poset of subsets of a set¶
Here we define a type that represents the poset of subsets of a given set equipped with the usual set inclusion relation. (It seems there is no definition in the standard library of this important example of a poset; we should propose adding it.)
module _ {ฮฑ ฯ : Level} {๐ : Type ฮฑ} where _โ_ : Pred ๐ ฯ โ Pred ๐ ฯ โ Type (ฮฑ โ ฯ) P โ Q = (P โ Q) ร (Q โ P) open IsEquivalence -- renaming (refl to ref ; sym to symm ; trans to tran) โ-iseqv : IsEquivalence _โ_ refl โ-iseqv = id , id sym โ-iseqv = swap trans โ-iseqv (uโ , uโ) (vโ , vโ) = vโ โ uโ , uโ โ vโ module _ {ฮฑ : Level} (ฯ : Level) (๐ : Type ฮฑ) where open Poset using (Carrier ; _โ_ ; _โค_ ; isPartialOrder) open IsPartialOrder using (isPreorder ; antisym) open IsPreorder using (isEquivalence ; reflexive ; trans) PosetOfSubsets : Poset (ฮฑ โ suc ฯ) (ฮฑ โ ฯ) (ฮฑ โ ฯ) PosetOfSubsets .Carrier = Pred ๐ ฯ PosetOfSubsets ._โ_ = _โ_ PosetOfSubsets ._โค_ = _โ_ PosetOfSubsets .isPartialOrder .isPreorder .isEquivalence = โ-iseqv PosetOfSubsets .isPartialOrder .isPreorder .reflexive = projโ PosetOfSubsets .isPartialOrder .isPreorder .trans = ฮป u v โ v โ u PosetOfSubsets .isPartialOrder .antisym = _,_
A binary relation from one poset to another induces a Galois connection. This is akin to the situation with Adjunctions in Category Theory (unsurprisingly). In other words, there is likely a unit/counit definition that is more level polymorphic.
module _ {โ : Level}{๐ : Type โ} {โฌ : Type โ} where ๐ซ๐ ๐ซโฌ : Poset (suc โ) โ โ ๐ซ๐ = PosetOfSubsets โ ๐ ๐ซโฌ = PosetOfSubsets โ โฌ -- Every binary relation from one poset to another induces a Galois connection. RelโGal : (R : REL ๐ โฌ โ) โ Galois ๐ซ๐ ๐ซโฌ RelโGal R = record { F = _โ R ; G = R โ_ ; GFโฅid = ฮป _ โ โโโฅid ; FGโฅid = ฮป _ โ โโโฅid }