Legacy.Base.Structures.Sigma.Homs¶
Homomorphisms of general structures¶
{-# OPTIONS --cubical-compatible --exact-split --safe #-} module Legacy.Base.Structures.Sigma.Homs where open import Agda.Primitive using () renaming ( Set to Type ) -- Imports from the Agda Standard Library ---------------------------------------------------------- open import Data.Product using ( _,_ ; _Γ_ ; Ξ£-syntax ) renaming ( projβ to fst ; projβ to snd ) open import Level using ( _β_ ; Level ; Lift ; lift ; lower ) renaming ( 0β to ββ ; suc to lsuc ) open import Function.Base using ( _β_ ; id ) open import Relation.Binary.PropositionalEquality using ( _β‘_ ; cong ; refl ; module β‘-Reasoning ) -- Imports from the Agda Universal Algebra Library --------------------------------------------- open import Overture using ( β£_β£ ; β₯_β₯ ; _β_ ; _β»ΒΉ) open import Legacy.Base.Functions using ( IsInjective ; IsSurjective ) open import Legacy.Base.Relations using ( _|:_ ; 0[_] ; ker ; Equivalence ; Quotient ) using ( 0[_]Equivalence ; ker-IsEquivalence ; βͺ_β« ) using ( kerlift-IsEquivalence ; β_β ; βͺ_βΌ_β«-elim ; _/_ ) open import Legacy.Base.Equality using ( swelldef ) open import Legacy.Base.Structures.Sigma.Basic using ( Signature ; Structure ; Compatible ; _Κ³_ ; _α΅_ ) using ( Lift-StrucΚ³ ; Lift-StrucΛ‘ ; Lift-Struc ) private variable π πΉ : Signature -- Development for Structures (Sigma type representation) module _ {Ξ± Οα΅ : Level} (π¨ : Structure π πΉ {Ξ±}{Οα΅}) {Ξ² Οα΅ : Level} (π© : Structure π πΉ {Ξ²}{Οα΅}) where preserves : β£ π β£ β (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Οα΅ β Οα΅) preserves r h = β a β ((r Κ³ π¨) a) β ((r Κ³ π©) (h β a)) is-hom-rel : (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Οα΅ β Οα΅) is-hom-rel h = β r β preserves r h comp-op : β£ πΉ β£ β (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Ξ²) comp-op f h = β a β h ((f α΅ π¨) a) β‘ (f α΅ π©) (h β a) is-hom-op : (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Ξ²) is-hom-op h = β f β comp-op f h is-hom : (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Οα΅ β Ξ² β Οα΅) is-hom h = is-hom-rel h Γ is-hom-op h hom : Type (Ξ± β Οα΅ β Ξ² β Οα΅) hom = Ξ£[ h β (β£ π¨ β£ β β£ π© β£) ] is-hom h module _ {π πΉ : Signature} {Ξ± Οα΅ : Level}(π¨ : Structure π πΉ {Ξ±}{Οα΅}) {Ξ² Οα΅ : Level}{π© : Structure π πΉ {Ξ²}{Οα΅}} {Ξ³ ΟαΆ : Level}(πͺ : Structure π πΉ {Ξ³}{ΟαΆ}) where β-is-hom-rel : {f : β£ π¨ β£ β β£ π© β£}{g : β£ π© β£ β β£ πͺ β£} β is-hom-rel π¨ π© f β is-hom-rel π© πͺ g β is-hom-rel π¨ πͺ (g β f) β-is-hom-rel {f}{g} fhr ghr R a = Ξ» z β ghr R (Ξ» zβ β f (a zβ)) (fhr R a z) β-is-hom-op : {f : β£ π¨ β£ β β£ π© β£}{g : β£ π© β£ β β£ πͺ β£} β is-hom-op π¨ π© f β is-hom-op π© πͺ g β is-hom-op π¨ πͺ (g β f) β-is-hom-op {f}{g} fho gho π a = cong g (fho π a) β gho π (f β a) β-is-hom : {f : β£ π¨ β£ β β£ π© β£}{g : β£ π© β£ β β£ πͺ β£} β is-hom π¨ π© f β is-hom π© πͺ g β is-hom π¨ πͺ (g β f) β-is-hom {f} {g} fhro ghro = ihr , iho where ihr : is-hom-rel π¨ πͺ (g β f) ihr = β-is-hom-rel {f}{g} (fst fhro) (fst ghro) iho : is-hom-op π¨ πͺ (g β f) iho = β-is-hom-op {f}{g} (snd fhro) (snd ghro) β-hom : hom π¨ π© β hom π© πͺ β hom π¨ πͺ β-hom (f , fh) (g , gh) = g β f , β-is-hom {f}{g} fh gh module _ {Ξ± Ο : Level} where πΎπΉ : (π¨ : Structure π πΉ {Ξ±}{Ο}) β hom π¨ π¨ πΎπΉ _ = id , (Ξ» R a z β z) , (Ξ» f a β refl) module _ {Ξ± Οα΅ : Level} (π¨ : Structure π πΉ {Ξ±}{Οα΅}) {Ξ² Οα΅ : Level} (π© : Structure π πΉ {Ξ²}{Οα΅}) where is-mon : (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Οα΅ β Ξ² β Οα΅) is-mon g = is-hom π¨ π© g Γ IsInjective g mon : Type (Ξ± β Οα΅ β Ξ² β Οα΅) mon = Ξ£[ g β (β£ π¨ β£ β β£ π© β£) ] is-mon g is-epi : (β£ π¨ β£ β β£ π© β£) β Type (Ξ± β Οα΅ β Ξ² β Οα΅) is-epi g = is-hom π¨ π© g Γ IsSurjective g epi : Type (Ξ± β Οα΅ β Ξ² β Οα΅) epi = Ξ£[ g β (β£ π¨ β£ β β£ π© β£) ] is-epi g monβhom : mon β hom π¨ π© monβhom Ο = (fst Ο) , fst (snd Ο ) epiβhom : epi β hom π¨ π© epiβhom Ο = (fst Ο) , fst (snd Ο)
Next, lift and lower are (the maps of) homomorphisms.
module _ {π πΉ : Signature}{Ξ± Οα΅ : Level} where open Lift ππΎπ»π : (β Ο : Level)(π¨ : Structure π πΉ{Ξ±}{Οα΅}) β hom π¨ (Lift-Struc β Ο π¨) ππΎπ»π = Ξ» β Ο π¨ β lift , ( (Ξ» R a x β lift x) , Ξ» f a β refl ) πβ΄πβ―π : (β Ο : Level)(π¨ : Structure π πΉ{Ξ±}{Οα΅}) β hom (Lift-Struc β Ο π¨) π¨ πβ΄πβ―π = Ξ» β Ο π¨ β lower , (Ξ» R a x β lower x) , (Ξ» f a β refl) module _ {π πΉ : Signature}{Ξ± Οα΅ Ξ² Οα΅ : Level}{π πΉ : Signature} {π¨ : Structure π πΉ {Ξ±}{Οα΅}}{π© : Structure π πΉ {Ξ²}{Οα΅}} where Lift-Hom : (β Ο β' Ο' : Level) β hom π¨ π© β hom (Lift-Struc β Ο π¨) (Lift-Struc β' Ο' π©) Lift-Hom β Ο β' Ο' (h , hhom) = lift β h β lower , Goal where lABh : is-hom (Lift-Struc β Ο π¨) π© (h β lower) lABh = β-is-hom{π = π }{πΉ} (Lift-Struc β Ο π¨) π©{lower}{h} ((Ξ» R a x β lower x) , (Ξ» f a β refl)) hhom Goal : is-hom (Lift-Struc β Ο π¨) (Lift-Struc β' Ο' π©) (lift β h β lower) Goal = β-is-hom {π = π }{πΉ} (Lift-Struc β Ο π¨) (Lift-Struc β' Ο' π©) {h β lower}{lift} lABh ((Ξ» R a x β lift x) , (Ξ» f a β refl))
Kernels of homomorphisms of structures of sigma type¶
The kernel of a homomorphism is a congruence relation and conversely for
every congruence relation ΞΈ, there exists a homomorphism with kernel ΞΈ
(namely, that canonical projection onto the quotient modulo ΞΈ).
open β‘-Reasoning module _ {π πΉ : Signature} {Ξ± Οα΅ Ξ² Οα΅ : Level} {π¨ : Structure π πΉ {Ξ±}{Οα΅}}{π© : Structure π πΉ{Ξ²}{Οα΅}} where Homker-comp : swelldef ββ Ξ² β (h : hom π¨ π©) β Compatible π¨ (ker β£ h β£) Homker-comp wd h f {u}{v} kuv = (β£ h β£ ((f α΅ π¨) u)) β‘β¨(snd β₯ h β₯) f u β© ((f α΅ π©)(β£ h β£ β u)) β‘β¨ wd (f α΅ π©) (β£ h β£ β u) (β£ h β£ β v) kuv β© ((f α΅ π©)(β£ h β£ β v)) β‘β¨((snd β₯ h β₯) f v)β»ΒΉ β© (β£ h β£((f α΅ π¨) v)) β
(Notice, it is here that the swelldef postulate comes into play, and because it is needed to prove homker-comp, it is postulated by all the lemmas below that depend upon homker-comp.)
It is convenient to define a function that takes a homomorphism and constructs a congruence from its kernel. We call this function kercon.
kercon : swelldef π₯ π¦ β {π© : Algebra π¦ π} β hom π¨ π© β Con{π€}{π¦} π¨ kercon wd {π©} h = ker β£ h β£ , mkcon (ker-IsEquivalence β£ h β£)(homker-comp wd {π©} h)
\end{code}
With this congruence we construct the corresponding quotient, along with some syntactic sugar to denote it.
kerquo : swelldef π₯ π¦ β {π© : Algebra π¦ π} β hom π¨ π© β Algebra (π€ β lsuc π¦) π kerquo wd {π©} h = π¨ β± (kercon wd {π©} h)
ker[β]βΎ : (π¨ : Algebra π€ π)(π© : Algebra π¦ π) β hom π¨ π© β swelldef π₯ π¦ β Algebra (π€ β lsuc π¦) π ker[ π¨ β π© ] h βΎ wd = kerquo wd {π©} h
\end{code}
Thus, given h : hom π¨ π©, we can construct the quotient of π¨ modulo the kernel of h, and the syntax for this quotient in the agda-algebras library is π¨ [ π© ]/ker h βΎ fe.
The canonical projection¶
Given an algebra π¨ and a congruence ΞΈ, the canonical projection is a map from π¨ onto π¨ β± ΞΈ that is constructed, and proved epimorphic, as follows.
module _ {π€ π¦ : Level}{π¨ : Algebra π€ π} where Οepi : (ΞΈ : Con{π€}{π¦} π¨) β epi π¨ (π¨ β± ΞΈ) Οepi ΞΈ = (Ξ» a β βͺ a β«) , (Ξ» _ _ β refl) , cΟ-is-epic where cΟ-is-epic : IsSurjective (Ξ» a β βͺ a β«) cΟ-is-epic (C , (a , refl)) = Image_β_.im a
\end{code}
In may happen that we don't care about the surjectivity of Οepi, in which case would might prefer to work with the homomorphic reduct of Οepi. This is obtained by applying epi-to-hom, like so.
Οhom : (ΞΈ : Con{π€}{π¦} π¨) β hom π¨ (π¨ β± ΞΈ) Οhom ΞΈ = epi-to-hom (π¨ β± ΞΈ) (Οepi ΞΈ)
\end{code}
We combine the foregoing to define a function that takes π-algebras π¨ and π©, and a homomorphism h : hom π¨ π© and returns the canonical epimorphism from π¨ onto π¨ [ π© ]/ker h. (Recall, the latter is the special notation we defined above for the quotient of π¨ modulo the kernel of h.)
Οker : (wd : swelldef π₯ π¦){π© : Algebra π¦ π}(h : hom π¨ π©) β epi π¨ (ker[ π¨ β π© ] h βΎ wd) Οker wd {π©} h = Οepi (kercon wd {π©} h)
\end{code}
The kernel of the canonical projection of π¨ onto π¨ / ΞΈ is equal to ΞΈ, but since equality of inhabitants of certain types (like Congruence or Rel) can be a tricky business, we settle for proving the containment π¨ / ΞΈ β ΞΈ. Of the two containments, this is the easier one to prove; luckily it is also the one we need later.
open IsCongruence
ker-in-con : {wd : swelldef π₯ (π€ β lsuc π¦)}(ΞΈ : Con π¨) β β {x}{y} β β£ kercon wd {π¨ β± ΞΈ} (Οhom ΞΈ) β£ x y β β£ ΞΈ β£ x y
ker-in-con ΞΈ hyp = /-β‘ ΞΈ hyp
\end{code}
Product homomorphisms¶
Suppose we have an algebra π¨, a type I : Type π, and a family β¬ : I β Algebra π¦ π of algebras. We sometimes refer to the inhabitants of I as indices, and call β¬ an indexed family of algebras.
If in addition we have a family π½ : (i : I) β hom π¨ (β¬ i) of homomorphisms, then we can construct a homomorphism from π¨ to the product β¨
β¬ in the natural way.
module _ {π π¦ : Level}{I : Type π}(β¬ : I β Algebra π¦ π) where
β¨ -hom-co : funext π π¦ β {π€ : Level}(π¨ : Algebra π€ π) β (β(i : I) β hom π¨ (β¬ i)) β hom π¨ (β¨ β¬) β¨ -hom-co fe π¨ π½ = (Ξ» a i β β£ π½ i β£ a) , (Ξ» π πΆ β fe Ξ» i β β₯ π½ i β₯ π πΆ)
\end{code}
The family π½ of homomorphisms inhabits the dependent type Ξ i κ I , hom π¨ (β¬ i). The syntax we use to represent this type is available to us because of the way -Ξ is defined in the Type Topology library. We like this syntax because it is very close to the notation one finds in the standard type theory literature. However,
we could equally well have used one of the following alternatives, which may be closer to "standard Agda" syntax:
Ξ Ξ» i β hom π¨ (β¬ i) or (i : I) β hom π¨ (β¬ i) or β i β hom π¨ (β¬ i).
The foregoing generalizes easily to the case in which the domain is also a product of a family of algebras. That is, if we are given π : I β Algebra π€ π and β¬ : I β Algebra π¦ π (two families of π-algebras), and π½ : Ξ i κ I , hom (π i)(β¬ i) (a family of homomorphisms), then we can construct a homomorphism from β¨
π to β¨
β¬ in the following natural way.
β¨ -hom : funext π π¦ β {π€ : Level}(π : I β Algebra π€ π) β Ξ [ i κ I ] hom (π i)(β¬ i) β hom (β¨ π)(β¨ β¬) β¨ -hom fe π π½ = (Ξ» x i β β£ π½ i β£ (x i)) , (Ξ» π πΆ β fe Ξ» i β β₯ π½ i β₯ π (Ξ» x β πΆ x i))
\end{code}
Projection out of products¶
Later we will need a proof of the fact that projecting out of a product algebra onto one of its factors is a homomorphism.
β¨ -projection-hom : Ξ [ i κ I ] hom (β¨ β¬) (β¬ i) β¨ -projection-hom = Ξ» x β (Ξ» z β z x) , Ξ» _ _ β refl
\end{code}
We could prove a more general result involving projections onto multiple factors, but so far the single-factor result has sufficed.