module Cat.Functor.Hom {o h} (C : Precategory o h) where
The Hom functorπ
The assignment of in a precategory thought of as a function of two arguments valued in sets, extends naturally to a bifunctor A morphism acts on the left by precomposition, and on the right by postcompoosition,
Hom[-,-] : Bifunctor (C ^op) C (Sets h) Hom[-,-] = make-bifunctor record where Fβ X Y = el! (Hom X Y) lmap f = _β f rmap f = f β_
Both functoriality constraints, as well as the interchange law lrmap, boil down to the
category laws.
lmap-β f g = ext Ξ» h β h β g β f β‘β¨ assoc _ _ _ β©β‘ (h β g) β f β lmap-id = ext Ξ» h β idr _ rmap-β f g = ext Ξ» h β sym (assoc _ _ _) rmap-id = ext Ξ» h β idl _ lrmap f g = ext Ξ» h β sym (assoc _ _ _)
As a bifunctor,
has associated partial applications on either side. We use the intuitive
names Hom-from and Hom-into, instead of
directional names referring to βleftβ and βrightβ.
open Bifunctor Hom[-,-] public using () renaming (Left to Hom-into) open Functor Hom[-,-] public using () renaming (Fβ to Hom-from)
The Yoneda embeddingπ
The Yoneda embedding from a precategory into its category of presheaves is the functor which assigns to each object the partially applied of morphisms into that object.
Since is a functor it flips to give a functor this is Yoneda embedding.
γ : Bifunctor C (C ^op) (Sets h) γ = Flip Hom[-,-] open Functor γ renaming (Fβ to γβ) using () public
The action of γ on
morphisms has an inverse, given by evaluating the natural transformation
with the identity map; Hence, the Yoneda embedding functor is fully
faithful.
γ-is-fully-faithful : is-fully-faithful γ γ-is-fully-faithful = is-isoβis-equiv Ξ» where .is-iso.from nt β nt .Ξ· _ id .is-iso.rinv nt β ext Ξ» c g β nt .Ξ· _ id β g β‘β¨ sym (nt .is-natural _ _ _) $β _ β©β‘ nt .Ξ· c (id β g) β‘β¨ ap (nt .Ξ· c) (idl g) β©β‘ nt .Ξ· c g β .is-iso.linv _ β idr _
The covariant yoneda embeddingπ
One common point of confusion is why category theorists prefer presheaves over covariant functors into One key reason is that the yoneda embedding into presheaves is covariant, whereas the functor, thought of as an embedding into functors is contravariant. This makes the βcovariant Yoneda embeddingβ much less pleasant to work with, though we define it anyways for posterity.
γcov : Functor (C ^op) Cat[ C , Sets h ] γcov = Hom[-,-]
As expected, the covariant yoneda embedding is also fully faithful.
Hom[-,-]-is-fully-faithful : is-fully-faithful Hom[-,-] Hom[-,-]-is-fully-faithful = is-isoβis-equiv Ξ» where .is-iso.from nt β nt .Ξ· _ id .is-iso.rinv nt β ext Ξ» c g β sym (nt .is-natural _ _ _) $β _ β ap (nt .Ξ· c) (idr g) .is-iso.linv h β idl h