Setoid.Categories.FullSubcategory¶
Full subcategories on an object predicate¶
This is the Setoid.Categories.FullSubcategory module of the Agda Universal Algebra Library.
FullSubcategory π P is the full subcategory of π whose objects are the
inhabitants of Ξ£ (Obj π) P β an object of π together with evidence that it
satisfies P β and whose morphisms, hom-equality, identity, composition, and laws
are inherited from π unchanged.
This is exactly the shape of the theory-satisfying classical structures
(Semigroup Ξ± Ο = Ξ£[ π¨ β Algebra Ξ± Ο ] π¨ β¨ Th-Semigroup, and likewise Monoid,
Group, etc.). Each is a full subcategory of the algebra category
Alg of its signature, because a homomorphism
between theory-satisfying algebras is just a homomorphism of the underlying
algebras; satisfaction of laws is a property of the objects, not structure
on the morphisms.
The full subcategory¶
module _ (π : Category o β e) where open Category π FullSubcategory : (P : Obj β Type p) β Category (o β p) β e FullSubcategory P = record { Obj = Ξ£ Obj P ; Hom = Ξ» (A B : Ξ£ Obj P) β Hom (projβ A) (projβ B) ; _β_ = _β_ ; id = id ; _β_ = _β_ ; β-equiv = β-equiv ; assoc = assoc ; identityΛ‘ = identityΛ‘ ; identityΚ³ = identityΚ³ ; β-resp-β = β-resp-β }
Restricting a functor to a full subcategory¶
FullSubcategoryF restricts a functor along the full-subcategory
construction. Given F : Functor π π and predicates P on the objects of π
and Q on the objects of π, the only new data required is a transfer proof
that F sends P-objects to Q-objects. On objects the restricted functor
pairs Fβ with that proof; on morphisms, on morphism equalities, and
on the identity and composition laws it is literally F, because a full
subcategory has exactly the morphisms of its ambient category.
open Category using (Obj) module _ {π : Category o β e} {π : Category oβ² ββ² eβ²} {P : Obj π β Type p} {Q : Obj π β Type q} (F : Functor π π) where open Functor F FullSubcategoryF : (transfer : {A : Obj π} β P A β Q (Fβ A)) β Functor (FullSubcategory π P) (FullSubcategory π Q) FullSubcategoryF transfer = record { Fβ = Ξ» A β ( Fβ (projβ A) , transfer (projβ A) ) ; Fβ = Fβ ; F-resp-β = F-resp-β ; identity = identity ; homomorphism = homomorphism }