Legacy.Base.Structures.Homs¶
Homomorphisms of General Structures¶
This is the Legacy.Base.Structures.Homs module of the Agda Universal Algebra Library.
{-# OPTIONS --cubical-compatible --exact-split --safe #-} module Legacy.Base.Structures.Homs where open import Agda.Primitive using () renaming ( Set to Type ) -- Imports from the Agda Standard Library ------------------------------------------- open import Axiom.Extensionality.Propositional using () renaming (Extensionality to funext) open import Data.Product using ( _Γ_ ; Ξ£-syntax ; _,_ ) renaming ( projβ to fst ; projβ to snd ) open import Function.Base using ( _β_ ; id ) open import Level using ( _β_ ; suc ; Level ; Lift ; lift ) renaming ( 0β to ββ ) open import Relation.Binary using ( IsEquivalence ) open import Relation.Binary.PropositionalEquality using ( _β‘_ ; refl ; sym ; cong ; module β‘-Reasoning ; trans ) -- Imports from the Agda Universal Algebra Library --------------------------------------------- open import Overture using ( _β_ ; β£_β£ ; β₯_β₯ ; _β»ΒΉ ; Ξ -syntax ) open import Legacy.Base.Functions using ( Image_β_ ; IsSurjective ; IsInjective ) open import Legacy.Base.Relations using ( ker ; kerlift ; βͺ_β« ; mkblk ) open import Legacy.Base.Equality using ( swelldef ) open import Examples.Structures.Signatures using ( Sβ ) open import Legacy.Base.Structures.Basic using ( signature ; structure ; Lift-Struc ) using ( Lift-StrucΚ³ ; Lift-StrucΛ‘ ) using ( compatible ; siglΚ³ ; sigl ) open import Legacy.Base.Structures.Congruences using ( con ; _β±_) open import Legacy.Base.Structures.Products using ( β¨ ) open structure ; open signature private variable πβ π₯β πβ π₯β : Level πΉ : signature πβ π₯β π : signature πβ π₯β Ξ± Οα΅ Ξ² Οα΅ Ξ³ ΟαΆ β : Level module _ (π¨ : structure πΉ π {Ξ±}{Οα΅}) (π© : structure πΉ π {Ξ²}{Οα΅}) where private A = carrier π¨ B = carrier π© preserves : (symbol π ) β (A β B) β Type (siglΚ³ π β Ξ± β Οα΅ β Οα΅) preserves π h = β a β ((rel π¨) π a) β ((rel π©) π) (h β a) is-hom-rel : (A β B) β Type (sigl π β Ξ± β Οα΅ β Οα΅) is-hom-rel h = β (r : symbol π ) β preserves r h comm-op : (A β B) β (symbol πΉ) β Type (siglΚ³ πΉ β Ξ± β Ξ²) comm-op h f = β a β h (((op π¨) f) a) β‘ ((op π©) f) (h β a) is-hom-op : (A β B) β Type (sigl πΉ β Ξ± β Ξ²) is-hom-op h = β f β comm-op h f is-hom : (A β B) β Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) is-hom h = is-hom-rel h Γ is-hom-op h -- homomorphism hom : Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) hom = Ξ£[ h β (A β B) ] is-hom h -- endomorphism end : structure πΉ π {Ξ±}{Οα΅} β Type (sigl πΉ β sigl π β Ξ± β Οα΅) end π¨ = hom π¨ π¨ module _ {π¨ : structure πΉ π {Ξ±}{Οα΅}} {π© : structure πΉ π {Ξ²}{Οα΅}} {πͺ : structure πΉ π {Ξ³}{ΟαΆ}} where private A = carrier π¨ ; B = carrier π© ; C = carrier πͺ β-is-hom-rel : (f : A β B)(g : B β C) β 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 : A β B)(g : B β C) β 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 : A β B)(g : B β C) β 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 β£ fhro β£ β£ ghro β£ iho : is-hom-op π¨ πͺ (g β f) iho = β-is-hom-op f g β₯ fhro β₯ β₯ ghro β₯ β-hom : hom π¨ π© β hom π© πͺ β hom π¨ πͺ β-hom (f , fh) (g , gh) = g β f , β-is-hom f g fh gh πΎπΉ : {π¨ : structure πΉ π {Ξ±}{Οα΅}} β end π¨ πΎπΉ = id , (Ξ» _ _ z β z) , (Ξ» _ _ β refl) module _ {π¨ : structure πΉ π {Ξ±}{Οα΅}} {π© : structure πΉ π {Ξ²}{Οα΅}} where private A = carrier π¨ ; B = carrier π© is-mon : (A β B) β Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) is-mon g = is-hom π¨ π© g Γ IsInjective g mon : Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) mon = Ξ£[ g β (A β B) ] is-mon g monβhom : mon β hom π¨ π© monβhom Ο = β£ Ο β£ , fst β₯ Ο β₯ is-epi : (A β B) β Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) is-epi g = is-hom π¨ π© g Γ IsSurjective g epi : Type (sigl πΉ β sigl π β Ξ± β Οα΅ β Ξ² β Οα΅) epi = Ξ£[ g β (A β B) ] is-epi g epiβhom : epi β hom π¨ π© epiβhom Ο = β£ Ο β£ , fst β₯ Ο β₯ open Lift ππΎπ»πΛ‘ : {β : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom π¨ (Lift-StrucΛ‘ β π¨) ππΎπ»πΛ‘ = lift , (Ξ» _ _ x β x) , Ξ» _ _ β refl ππΎπ»πΚ³ : {Ο : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom π¨ (Lift-StrucΚ³ Ο π¨) ππΎπ»πΚ³ = id , (Ξ» _ _ x β lift x) , Ξ» _ _ β refl ππΎπ»π : {βΛ‘ βΚ³ : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom π¨ (Lift-Struc βΛ‘ βΚ³ π¨) ππΎπ»π = lift , ((Ξ» _ _ x β lift x) , Ξ» _ _ β refl) πβ΄πβ―πΛ‘ : {β : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom (Lift-StrucΛ‘ β π¨) π¨ πβ΄πβ―πΛ‘ = lower , (Ξ» _ _ x β x) , (Ξ» _ _ β refl) πβ΄πβ―πΚ³ : {Ο : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom (Lift-StrucΚ³ Ο π¨) π¨ πβ΄πβ―πΚ³ = id , ((Ξ» _ _ x β lower x) , Ξ» _ _ β refl) πβ΄πβ―π : {βΛ‘ βΚ³ : Level}{π¨ : structure πΉ π {Ξ±}{Οα΅}} β hom (Lift-Struc βΛ‘ βΚ³ π¨) π¨ πβ΄πβ―π = lower , (Ξ» _ _ x β lower x) , (Ξ» _ _ β refl)
Kernels of homomorphisms¶
open β‘-Reasoning module _ {π¨ : structure πΉ π {Ξ±}{Ξ² β Οα΅}}{π© : structure πΉ π {Ξ²} {Οα΅}} where homker-comp : (h : hom π¨ π©){wd : swelldef (siglΚ³ πΉ) Ξ²} β compatible π¨ (ker β£ h β£) homker-comp (h , hhom) {wd} f {u}{v} kuv = h (((op π¨)f) u) β‘β¨ β₯ hhom β₯ f u β© ((op π©) f)(h β u) β‘β¨ wd ((op π©)f) (h β u) (h β v) kuv β© ((op π©) f)(h β v) β‘β¨ (β₯ hhom β₯ f v)β»ΒΉ β© h (((op π¨)f) v) β kerlift-comp : (h : hom π¨ π©){wd : swelldef (siglΚ³ πΉ) Ξ²} β compatible π¨ (kerlift β£ h β£ (Ξ± β Οα΅) ) kerlift-comp (h , hhom) {wd} f {u}{v} kuv = lift goal where goal : h (op π¨ f u) β‘ h (op π¨ f v) goal = h (op π¨ f u) β‘β¨ β₯ hhom β₯ f u β© (op π© f)(h β u) β‘β¨ wd (op π© f)(h β u)(h β v)(lower β kuv) β© (op π© f)(h β v) β‘β¨ (β₯ hhom β₯ f v ) β»ΒΉ β© h (op π¨ f v) β kercon : hom π¨ π© β {wd : swelldef (siglΚ³ πΉ) Ξ²} β con π¨ kercon (h , hhom) {wd} = ((Ξ» x y β Lift (Ξ± β Οα΅) (h x β‘ h y)) , goal) , kerlift-comp (h , hhom) {wd} where goal : IsEquivalence (Ξ» x y β Lift (Ξ± β Οα΅) (h x β‘ h y)) goal = record { refl = lift refl ; sym = Ξ» p β lift (sym (lower p)) ; trans = Ξ» p q β lift (trans (lower p)(lower q)) } kerquo : hom π¨ π© β {wd : swelldef (siglΚ³ πΉ) Ξ²} β structure πΉ π {suc (Ξ± β Ξ² β Οα΅)} {Ξ² β Οα΅} kerquo h {wd} = π¨ β± (kercon h {wd}) ker[_β_] : (π¨ : structure πΉ π {Ξ±} {Ξ² β Οα΅} )(π© : structure πΉ π {Ξ²}{Οα΅} ) β hom π¨ π© β {wd : swelldef (siglΚ³ πΉ) Ξ²} β structure πΉ π ker[_β_] {Οα΅ = Οα΅} π¨ π© h {wd} = kerquo{Οα΅ = Οα΅}{π¨ = π¨}{π©} h {wd}
Canonical projections¶
module _ {π¨ : structure πΉ π {Ξ±}{Οα΅} } where open Image_β_ Οepi : (ΞΈ : con π¨) β epi {π¨ = π¨}{π© = π¨ β± ΞΈ} Οepi ΞΈ = (Ξ» a β βͺ a β« {fst β£ ΞΈ β£}) , (Ξ³rel , (Ξ» _ _ β refl)) , cΟ-is-epic where Ξ³rel : is-hom-rel π¨ (π¨ β± ΞΈ) (Ξ» a β βͺ a β« {fst β£ ΞΈ β£}) Ξ³rel R a x = x cΟ-is-epic : IsSurjective (Ξ» a β βͺ a β« {fst β£ ΞΈ β£}) cΟ-is-epic (C , mkblk a refl) = eq a refl Οhom : (ΞΈ : con π¨) β hom π¨ (π¨ β± ΞΈ) Οhom ΞΈ = epiβhom {π¨ = π¨} {π© = (π¨ β± ΞΈ)} (Οepi ΞΈ) module _ {π¨ : structure πΉ π {Ξ±}{Ξ² β Οα΅}}{π© : structure πΉ π {Ξ²} {Οα΅}} where Οker : (h : hom π¨ π©){wd : swelldef (siglΚ³ πΉ) Ξ²} β epi {π¨ = π¨} {π© = (ker[_β_]{Οα΅ = Οα΅} π¨ π© h {wd})} Οker h {wd} = Οepi (kercon{Οα΅ = Οα΅} {π¨ = π¨}{π© = π©} h {wd}) module _ {I : Type β} where module _ {π¨ : structure πΉ π {Ξ±}{Οα΅}}{β¬ : I β structure πΉ π {Ξ²}{Οα΅}} where β¨ -hom-co : funext β Ξ² β (β(i : I) β hom π¨ (β¬ i)) β hom π¨ (β¨ β¬) β¨ -hom-co fe h = (Ξ» a i β β£ h i β£ a) , (Ξ» R a x π¦ β fst β₯ h π¦ β₯ R a x) , Ξ» f a β fe (Ξ» i β snd β₯ h i β₯ f a) module _ {π : I β structure πΉ π {Ξ±}{Οα΅}} {β¬ : I β structure πΉ π {Ξ²}{Οα΅}} where β¨ -hom : funext β Ξ² β Ξ [ i β I ] hom (π i)(β¬ i) β hom (β¨ π)(β¨ β¬) β¨ -hom fe h = (Ξ» a i β β£ h i β£ (a i)) , (Ξ» R a x π¦ β fst β₯ h π¦ β₯ R (Ξ» z β a z π¦) (x π¦)) , Ξ» f a β fe (Ξ» i β snd β₯ h i β₯ f Ξ» z β a z i) -- Projection out of products module _ {π : I β structure πΉ π {Ξ±}{Οα΅}} where β¨ -projection-hom : Ξ [ i β I ] hom (β¨ π) (π i) β¨ -projection-hom = Ξ» x β (Ξ» z β z x) , (Ξ» R a z β z x) , Ξ» f a β refl -- The special case when π = β (i.e., purely algebraic structures) module _ {π¨ : structure πΉ Sβ {Ξ±}{ββ}} {π© : structure πΉ Sβ {Ξ²}{ββ}} where -- The type of homomorphisms from one algebraic structure to another. hom-alg : Type (sigl πΉ β Ξ± β Ξ²) hom-alg = Ξ£[ h β ((carrier π¨) β (carrier π©)) ] is-hom-op π¨ π© h