open import Cat.Prelude

module Cat.Functor.Base where

Functors🔗

This module defines the most important clases of functors: Full, faithful, fully faithful (abbreviated ff), split essentially surjective and (“merely”) essentially surjective.

A functor is full when its action on hom-sets is surjective:

is-full : Functor C D  Type _
is-full {C = C} {D = D} F =
   {x y} (g : D .Hom (F₀ F x) (F₀ F y))  ∃[ f  C .Hom x y ] (F₁ F f  g)

A functor is faithful when its action on hom-sets is injective:

is-faithful : Functor C D  Type _
is-faithful F =  {x y}  injective (F₁ F {x = x} {y})

ff Functors🔗

A functor is fully faithful (abbreviated ff) when its action on hom-sets is an equivalence. Since Hom-sets are sets, it suffices for the functor to be full and faithful; Rather than taking this conjunction as a definition, we use the more directly useful data as a definition and prove the conjunction as a theorem.

is-fully-faithful : Functor C D  Type _
is-fully-faithful F =  {x y}  is-equiv (F₁ F {x = x} {y})

fully-faithful→faithful : {F : Functor C D}  is-fully-faithful F  is-faithful F
fully-faithful→faithful {F = F} ff {_} {_} {x} {y} p =
  x                         ≡⟨ sym (equiv→retraction ff x) 
  equiv→inverse ff (F₁ F x) ≡⟨ ap (equiv→inverse ff) p 
  equiv→inverse ff (F₁ F y) ≡⟨ equiv→retraction ff y 
  y                         

full+faithful→ff
  : (F : Functor C D)  is-full F  is-faithful F  is-fully-faithful F
full+faithful→ff {C = C} {D = D} F surj inj .is-eqv = p where
  img-is-prop :  {x y} f  is-prop (fibre (F₁ F {x = x} {y}) f)
  img-is-prop f (g , p) (h , q) = Σ-prop-path  _  D .Hom-set _ _ _ _) (inj (p  sym q))

  p :  {x y} f  is-contr (fibre (F₁ F {x = x} {y}) f)
  p f .centre = ∥-∥-elim  _  img-is-prop f)  x  x) (surj f)
  p f .paths = img-is-prop f _

A very important property of fully faithful functors (like FF) is that they are conservative: If the image of f:xyf : x \to y under FF is an isomorphism FxFyFx \cong Fy, then ff was really an isomorphism f:xyf : x \cong y.

module _ {C : Precategory o h} {D : Precategory o₁ h₁} where
  private
    module C = Precategory C
    module D = Precategory D

  import Cat.Morphism C as Cm
  import Cat.Morphism D as Dm

  is-ff→is-conservative
    : {F : Functor C D}  is-fully-faithful F
      {X Y} (f : C.Hom X Y)   Dm.is-invertible (F₁ F f)
     Cm.is-invertible f
  is-ff→is-conservative {F = F} ff f isinv = i where
    open Cm.is-invertible
    open Cm.Inverses

Since the functor is ff, we can find a map “F11(f):yxF_1^{-1}(f) : y \to x” in the domain category to serve as an inverse for ff:

    g : C.Hom _ _
    g = equiv→inverse ff (isinv .Dm.is-invertible.inv)

    Ffog =
      F₁ F (f C.∘ g)    ≡⟨ F-∘ F _ _ 
      F₁ F f D.∘ F₁ F g ≡⟨ ap₂ D._∘_ refl (equiv→section ff _)  isinv .Dm.is-invertible.invl 
      D.id              

    Fgof =
      F₁ F (g C.∘ f)    ≡⟨ F-∘ F _ _ 
      F₁ F g D.∘ F₁ F f ≡⟨ ap₂ D._∘_ (equiv→section ff _) refl  isinv .Dm.is-invertible.invr 
      D.id              

    i : Cm.is-invertible _
    i .inv = g
    i .inverses .invl =
      f C.∘ g                           ≡⟨ sym (equiv→retraction ff _) 
      equiv→inverse ff (F₁ F (f C.∘ g)) ≡⟨ ap (equiv→inverse ff) (Ffog  sym (F-id F)) 
      equiv→inverse ff (F₁ F C.id)      ≡⟨ equiv→retraction ff _ 
      C.id                              
    i .inverses .invr =
      g C.∘ f                           ≡⟨ sym (equiv→retraction ff _) 
      equiv→inverse ff (F₁ F (g C.∘ f)) ≡⟨ ap (equiv→inverse ff) (Fgof  sym (F-id F)) 
      equiv→inverse ff (F₁ F C.id)      ≡⟨ equiv→retraction ff _ 
      C.id                              

  is-ff→essentially-injective
    : {F : Functor C D}  is-fully-faithful F
      {X Y}  F₀ F X Dm.≅ F₀ F Y
     X Cm.≅ Y
  is-ff→essentially-injective {F = F} ff
    record { to = to ; from = from ; inverses = inverses } =
    Cm.make-iso (equiv→inverse ff to) inv invl invr
    where
      D-inv : Dm.is-invertible to
      D-inv = record { inv = from ; inverses = inverses }
      open Cm.is-invertible
        (is-ff→is-conservative {F = F} ff
          (equiv→inverse ff to)
          (subst Dm.is-invertible (sym (equiv→section ff _)) D-inv))

Essential Fibres🔗

The essential fibre of a functor F:CDF : C \to D over an object y:Dy : D is the space of objects of CC which FF takes, up to isomorphism, to yy.

Essential-fibre : Functor C D  D .Ob  Type _
Essential-fibre {D = D} F y = Σ[ x  _ ] (F₀ F x  y)
  where open import Cat.Morphism D

A functor is split essentially surjective (abbreviated split eso) if there is a procedure for finding points in the essential fibre over any object. It’s essentially surjective if the this procedure merely, i.e. truncatedly, finds a point:

is-split-eso : Functor C D  Type _
is-split-eso F =  y  Essential-fibre F y

is-eso : Functor C D  Type _
is-eso F =  y   Essential-fibre F y