Setoid.Categories.Algebra¶
The category of π-algebras¶
This is the Setoid.Categories.Algebra module of the Agda Universal Algebra Library.
Alg π Ξ± Ο assembles the π-algebras at levels (Ξ± , Ο) into a
Category:
- objects inhabit
Algebra Ξ± Ο, - homs are the setoid homomorphisms
homof Setoid.Homomorphisms, - identity and composition are the
πΎπΉandβ-homof Setoid.Homomorphisms - the hom-equality
_β_is defined in this module and is pointwise equality: two homomorphisms are equal when their underlying maps agree on every element, in the codomain's setoid equality.
Pointwise hom-setoid equality is exactly what _β‘_ cannot provide under --safe,
and is why the Category record carries _β_ as a field.
The associative and identity laws hold by the codomain's refl (the underlying
maps are definitionally equal; β-hom is function composition, πΎπΉ the identity map);
β-resp-β is the one law with content, combining the codomain's trans with a hom's
cong.
Pointwise equality of homomorphisms¶
_β_ : {π : Signature π π₯}{π¨ π© : Algebra {π = π} Ξ± Ο} β hom π¨ π© β hom π¨ π© β Type (Ξ± β Ο) _β_ {π¨ = π¨} {π©} f g = β (x : π[ π¨ ]) β Setoid._β_ π»[ π© ] (projβ f β¨$β© x) (projβ g β¨$β© x) β-equiv : {π : Signature π π₯}{π¨ π© : Algebra {π = π} Ξ± Ο} β IsEquivalence (_β_ {π¨ = π¨} {π©}) β-equiv {π© = π©} = record { refl = Ξ» _ β Setoid.refl π»[ π© ] ; sym = Ξ» fβg x β Setoid.sym π»[ π© ] (fβg x) ; trans = Ξ» fβg gβh x β Setoid.trans π»[ π© ] (fβg x) (gβh x) }
The category¶
Alg Ξ± Ο is the category of π-algebras at a fixed pair of
levels: objects are algebras, morphisms are homomorphisms, and two morphisms are
identified when they agree pointwise up to the codomain's equality
(_β_, defined above).
Everything the Category record asks for is already at hand. The
identity is πΎπΉ and composition is β-hom with its
arguments flipped, since β-hom takes them in diagrammatic order
while a category's _β_ does not. Associativity and both unit laws hold on the
nose under _β_, so each is discharged by reflexivity of the
codomain's equality; only β-resp-β needs an argument, and that
argument is congruence of the underlying setoid functions.
Alg : {π : Signature π π₯}(Ξ± Ο : Level) β Category (π β π₯ β lsuc (Ξ± β Ο)) (π β π₯ β Ξ± β Ο) (Ξ± β Ο) Alg {π = π} Ξ± Ο = record { Obj = Algebra {π = π} Ξ± Ο ; Hom = hom ; _β_ = _β_ ; id = πΎπΉ ; _β_ = Ξ» g f β β-hom f g ; β-equiv = β-equiv ; assoc = Ξ» {_} {_} {_} {π«} _ β Setoid.refl π»[ π« ] ; identityΛ‘ = Ξ» {_} {π©} _ β Setoid.refl π»[ π© ] ; identityΚ³ = Ξ» {_} {π©} _ β Setoid.refl π»[ π© ] ; β-resp-β = Ξ» {_} {_} {πͺ} {_} {g} {h} fβg hβi x β Setoid.trans π»[ πͺ ] (fβg (projβ h β¨$β© x)) (cong (projβ g) (hβi x)) }