module Cat.Functor.Subcategory where
Subcategoriesπ
A subcategory is specified by a predicate on objects, and a predicate on morphisms between objects within that is closed under identities and composites.
To start, we package up all the data required to define a subcategory up into a record. Note that we omit the requirement that the predicate on objects is a proposition; this tends to be ill-behaved unless the is univalent.
module _ {o β} (C : Precategory o β) where
open Cat.Reasoning C
record Subcat (o' β' : Level) : Type (o β β β lsuc o' β lsuc β') where
no-eta-equality
field
: Ob β Type o'
is-ob : β {x y} (f : Hom x y) β is-ob x β is-ob y β Type β'
is-hom
is-hom-prop: β {x y} (f : Hom x y) (px : is-ob x) (py : is-ob y)
β is-prop (is-hom f px py)
: β {x} β (px : is-ob x) β is-hom id px px
is-hom-id
is-hom-β: β {x y z} {f : Hom y z} {g : Hom x y}
β {px : is-ob x} {py : is-ob y} {pz : is-ob z}
β is-hom f py pz β is-hom g px py
β is-hom (f β g) px pz
Morphisms of wide subcategories are defined as morphisms in where holds.
module _ {o o' β β'} {C : Precategory o β} (subcat : Subcat C o' β') where
open Cat.Reasoning C
open Subcat subcat
record Subcat-hom (x y : Ξ£[ ob β Ob ] (is-ob ob)) : Type (β β β') where
no-eta-equality
constructor sub-hom
field
: Hom (x .fst) (y .fst)
hom : subcat .is-hom hom (x .snd) (y .snd)
witness
open Subcat-hom
module _ {o β} {C : Precategory o β} where
private module C = Precategory C
instance
: β {o' β'} β Membership C.Ob (Subcat C o' β') _
Membership-subcat-ob = record { _β_ = Ξ» o S β o β S .Subcat.is-ob }
Membership-subcat-ob
module _ {o o' β β'} {C : Precategory o β} {S : Subcat C o' β'} where
open Cat.Reasoning C
open Subcat S
Subcat-hom-pathp: {x x' y y' : Ξ£[ ob β C ] (ob β S)}
β {f : Subcat-hom S x y} {g : Subcat-hom S x' y'}
β (p : x β‘ x') (q : y β‘ y')
β PathP (Ξ» i β Hom (p i .fst) (q i .fst)) (f .hom) (g .hom)
β PathP (Ξ» i β Subcat-hom S (p i) (q i)) f g
.hom = r i
Subcat-hom-pathp p q r i {f = f} {g = g} p q r i .witness =
Subcat-hom-pathp (Ξ» i β is-hom-prop (r i) (p i .snd) (q i .snd)) (f .witness) (g .witness) i
is-propβpathp
instance
Extensional-subcat-hom: β {βr x y} β¦ sa : Extensional (Hom (x .fst) (y .fst)) βr β¦
β Extensional (Subcat-hom S x y) βr
= injectionβextensional!
Extensional-subcat-hom β¦ sa β¦ (Subcat-hom-pathp refl refl) sa
Funlike-Subcat-hom: β {β β'} {A : Type β} {B : A β Type β'} {x y}
β β¦ _ : Funlike (Hom (x .fst) (y .fst)) A B β¦ β Funlike (Subcat-hom S x y) A B
= record { _#_ = Ξ» f x β apply (f .hom) x }
Funlike-Subcat-hom β¦ i β¦
: β {x y n} β H-Level (Subcat-hom S x y) (2 + n)
H-Level-Subcat-hom = basic-instance 2 $ Isoβis-hlevel 2 eqv $
H-Level-Subcat-hom 2 (Hom-set _ _) Ξ» _ β
Ξ£-is-hlevel 1 (is-hom-prop _ _ _)
is-hlevel-suc where unquoteDecl eqv = declare-record-iso eqv (quote Subcat-hom)
We can then use this data to construct a category.
module _ {o o' β β'} {C : Precategory o β} (subcat : Subcat C o' β') where
open Cat.Reasoning C
open Subcat subcat
: Precategory (o β o') (β β β')
Subcategory .Precategory.Ob = β«β subcat
Subcategory .Precategory.Hom = Subcat-hom subcat
Subcategory .Precategory.Hom-set _ _ = hlevel 2
Subcategory .Precategory.id .hom = id
Subcategory .Precategory.id .witness = is-hom-id _
Subcategory .Precategory._β_ f g .hom = f .hom β g .hom
Subcategory .Precategory._β_ f g .witness = is-hom-β (f .witness) (g .witness)
Subcategory .Precategory.idr f = ext (idr _)
Subcategory .Precategory.idl f = ext (idl _)
Subcategory .Precategory.assoc f g h = ext (assoc _ _ _) Subcategory
From pseudomonic functorsπ
There is another way of representing subcategories: By giving a faithful functor
module _
{o o' β β'} {C : Precategory o β} {D : Precategory o' β'}
{F : Functor C D}
(faithful : is-faithful F)
where
open Functor F
private
module C = Cat.Reasoning C
module D = Cat.Reasoning D
We construct a subcategory from a faithful functor by restricting to the objects in the essential image of and restricting the morphisms to those that lie in the image of
: Subcat D (o β β') (β β β')
Faithful-subcat .Subcat.is-ob x = Essential-fibre F x
Faithful-subcat .Subcat.is-hom f (y , y-es) (z , z-es) =
Faithful-subcat .Hom y z ] (D.to z-es D.β Fβ g D.β D.from y-es β‘ f)
Ξ£[ g β C.Subcat.is-hom-prop f (y , y-es) (z , z-es) (g , p) (h , q) =
Faithful-subcat
Ξ£-prop-path! $
faithful $.isoβepic (y-es D.Isoβ»ΒΉ) _ _ $
D.isoβmonic z-es _ _ $
D
p β sym q.Subcat.is-hom-id (y , y-es) =
Faithful-subcat .id , apβ D._β_ refl (D.eliml F-id) β D.invl y-es
C.Subcat.is-hom-β
Faithful-subcat {f = f} {g = g} {x , x-es} {y , y-es} {z , z-es} (h , p) (i , q) =
(h C.β i) ,
.push-inner (F-β h i)
D.insert-inner (D.invr y-es)
Β·Β· D._β_ (sym (D.assoc _ _ _) β p) q Β·Β· apβ D
There is an equivalence between canonical subcategory associated with and
: Functor (Subcategory Faithful-subcat) C
Faithful-subcat-domain .Functor.Fβ (x , x-es) = x-es .fst
Faithful-subcat-domain .Functor.Fβ f = f .witness .fst
Faithful-subcat-domain .Functor.F-id = refl
Faithful-subcat-domain .Functor.F-β _ _ = refl
Faithful-subcat-domain
: is-fully-faithful Faithful-subcat-domain
Faithful-subcat-domain-is-ff {x = x , x' , x-es} {y = y , y' , y-es} =
Faithful-subcat-domain-is-ff
is-isoβis-equiv $ iso(Ξ» f β sub-hom (D.to y-es D.β Fβ f D.β D.from x-es) (f , refl))
(Ξ» _ β refl)
(Ξ» f β ext (f .witness .snd))
: is-split-eso Faithful-subcat-domain
Faithful-subcat-domain-is-split-eso =
Faithful-subcat-domain-is-split-eso x (Fβ x , x , D.id-iso) , C.id-iso
There is a faithful functor from a subcategory on to
module _ {o o' β β'} {C : Precategory o β} {S : Subcat C o' β'} where
open Cat.Reasoning C
private module Sub = Cat.Reasoning (Subcategory S)
open Subcat S
: Functor (Subcategory S) C
Forget-subcat .Functor.Fβ (x , _) = x
Forget-subcat .Functor.Fβ f = f .hom
Forget-subcat .Functor.F-id = refl
Forget-subcat .Functor.F-β _ _ = refl
Forget-subcat
: is-faithful Forget-subcat
is-faithful-Forget-subcat = ext is-faithful-Forget-subcat
Furthermore, if the subcategory contains all of the isomorphisms of then the forgetful functor is pseudomonic.
is-pseudomonic-Forget-subcat: (β {x y} {f : Hom x y} {px : x β S} {py : y β S}
β is-invertible f β S .is-hom f px py)
β is-pseudomonic Forget-subcat
.is-pseudomonic.faithful =
is-pseudomonic-Forget-subcat invert
is-faithful-Forget-subcat.is-pseudomonic.isos-full f =
is-pseudomonic-Forget-subcat invert .make-iso
pure $ Sub(sub-hom (f .to) (invert (isoβinvertible f)))
(sub-hom (f .from) (invert (isoβinvertible (f Isoβ»ΒΉ))))
(ext (f .invl))
(ext (f .invr)) , trivial!
Univalent subcategoriesπ
Let be a univalent category. A subcategory of is univalent when the predicate on objects is a proposition.
: β {x y : Ξ£[ x β Ob ] (x β S)} β x Sub.β
y β x .fst β
y .fst
subcat-isoβiso = make-iso (Sub.to f .hom) (Sub.from f .hom)
subcat-isoβiso f (ap hom (Sub.invl f)) (ap hom (Sub.invr f))
subcat-is-category: is-category C
β (β x β is-prop (x β S))
β is-category (Subcategory S)
.to-path {a , pa} {b , pb} f =
subcat-is-category cat ob-prop (cat .to-path (subcat-isoβiso f))
Ξ£-prop-path ob-prop .to-path-over p =
subcat-is-category cat ob-prop .β
-pathp refl _ $
Sub_ $
Subcat-hom-pathp refl (Ξ» _ β to) (cat .to-path-over (subcat-isoβiso p)) apd