Setoid.Homomorphisms.Basic¶
Homomorphisms of Algebras over Setoids¶
This is the Setoid.Homomorphisms.Basic module of the Agda Universal Algebra Library.
module _ {π : Signature π π₯} (π¨ : Algebra {π = π} Ξ± Οα΅)(π© : Algebra Ξ² Οα΅) where open _βΆ_ {a = Ξ±}{Οα΅}{Ξ²}{Οα΅}{From = π»[ π¨ ]}{To = π»[ π© ]} renaming (to to _β¨$β©_ ) compatible-map-op : (π»[ π¨ ] βΆ π»[ π© ]) β OperationSymbolsOf π β Type (π₯ β Ξ± β Οα΅) compatible-map-op h f = β {a} β h β¨$β© (f ^ π¨) a ββ (f ^ π©) Ξ» x β h β¨$β© a x where open Setoid π»[ π© ] using() renaming ( _β_ to _ββ_ ) compatible-map : (π»[ π¨ ] βΆ π»[ π© ]) β Type (π β π₯ β Ξ± β Οα΅) compatible-map h = β {f} β compatible-map-op h f -- The property of being a homomorphism. record IsHom (h : π»[ π¨ ] βΆ π»[ π© ]) : Type (π β π₯ β Ξ± β Οα΅ β Οα΅) where constructor mkIsHom field compatible : compatible-map h hom : Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) hom = Ξ£ (π»[ π¨ ] βΆ π»[ π© ]) IsHom -- Smart constructor for a homomorphism: bundle a setoid map with its -- compatibility proof, hiding the Ξ£ / IsHom plumbing. mkhom : (h : π»[ π¨ ] βΆ π»[ π© ]) β compatible-map h β hom mkhom h c = h , mkIsHom c
Monomorphisms and epimorphisms¶
record IsMon (h : π»[ π¨ ] βΆ π»[ π© ]) : Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) where field isHom : IsHom h isInjective : IsInjective h HomReduct : hom HomReduct = h , isHom mon : Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) mon = Ξ£ (π»[ π¨ ] βΆ π»[ π© ]) IsMon monβhom : mon β hom monβhom h = IsMon.HomReduct (projβ h) record IsEpi (h : π»[ π¨ ] βΆ π»[ π© ]) : Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) where field isHom : IsHom h isSurjective : IsSurjective h HomReduct : hom HomReduct = h , isHom epi : Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) epi = Ξ£ (π»[ π¨ ] βΆ π»[ π© ]) IsEpi epiβhom : epi β hom epiβhom h = IsEpi.HomReduct (projβ h) module _ {π : Signature π π₯} (π¨ : Algebra {π = π} Ξ± Οα΅)(π© : Algebra Ξ² Οα΅) where open IsEpi open IsMon monβintohom : mon π¨ π© β Ξ£[ h β hom π¨ π© ] IsInjective (projβ h) monβintohom (hh , hhM) = (hh , isHom hhM) , isInjective hhM epiβontohom : epi π¨ π© β Ξ£[ h β hom π¨ π© ] IsSurjective (projβ h) epiβontohom (hh , hhE) = (hh , isHom hhE) , isSurjective hhE
Finally, we define the identity homomorphism for setoid algebras.
module _ {π : Signature π π₯} {π¨ : Algebra {π = π} Ξ± Οα΅} where open Setoid π»[ π¨ ] using ( reflexive ) πΎπΉ : hom π¨ π¨ πΎπΉ = ππ , mkIsHom (reflexive refl)