module Cat.Instances.Slice.Presheaf {o β„“} {C : Precategory o β„“} where

Slices of presheaf categoriesπŸ”—

We prove that slices of a presheaf category are again presheaf categories. Specifically, for a presheaf, we have an isomorphism where denotes the category of elements of

An object in the slice consists of a functor together with a natural transformation To transform this data into a functor observe that for each element in the fibre is a set. But why this choice in particular? Well, observe that is essentially the total space of β€” so that what we’re doing here is proving an equivalence between fibrations and dependent functions! This is in line with the existence of object classifiers, and in the 1-categorical level, with slices of Sets.

In fact, since we have that latter equivalence is a special case of the one constructed here β€” where in the calculation below, denotes the constant presheaf The category of elements of a presheaf consists of pairs where of which there is only one choice, and

module _ {P : Functor (C ^op) (Sets ΞΊ)} where
  private module P = Functor P

  slice-ob→presheaf
    : Ob (Slice Cat[ C ^op , Sets ΞΊ ] P)
    β†’ Functor (∫ C P ^op) (Sets ΞΊ)
  slice-ob→presheaf sl .F₀ (elem x s) = el! (fibre (sl .map .η x) s)

  slice-obβ†’presheaf sl .F₁ eh (i , p) =
      sl .domain .F₁ (eh .hom) i
    , happly (sl .map .is-natural _ _ _) _ Β·Β· ap (P.₁ _) p Β·Β· eh .commute

Keeping with the theme, in the other direction, we take a total space rather than a family of fibres, with fibration being the first projection fst:

  presheafβ†’slice-ob : Functor (∫ C P ^op) (Sets ΞΊ) β†’ Ob (Slice Cat[ C ^op , Sets ΞΊ ] P)
  presheaf→slice-ob y = obj where
    obj : /-Obj {C = Cat[ _ , _ ]} P
    obj .domain .Fβ‚€ c .∣_∣   = Ξ£[ sect ∈ P Κ» c ] y Κ» elem c sect
    obj .domain .Fβ‚€ c .is-tr = hlevel 2
    obj .domain .F₁ f (x , p) = P.₁ f x , y .F₁ (elem-hom f refl) p
    obj .map .Ξ· x = fst

Since the rest of the construction is routine calculation, we present it without comment.

  sliceβ†’total : Functor (Slice Cat[ C ^op , Sets ΞΊ ] P) Cat[ (∫ C P) ^op , Sets ΞΊ ]
  slice→total = func where
    func : Functor (Slice Cat[ C ^op , Sets κ ] P) Cat[ (∫ C P) ^op , Sets κ ]
    func .F₀ = slice-ob→presheaf
    func .F₁ {x} {y} h .Ξ· i arg =
      h .map .Ξ· (i .ob) (arg .fst) , h .commutes Ξ·β‚š _ $β‚š arg .fst βˆ™ arg .snd
    func .F₁ {x} {y} h .is-natural _ _ _ = funext Ξ» i β†’
      Ξ£-prop-path! (happly (h .map .is-natural _ _ _) _)

    func .F-id    = ext Ξ» x y p β†’ Ξ£-prop-path! refl
    func .F-∘ f g = ext Ξ» x y p β†’ Ξ£-prop-path! refl

  slice→total-is-ff : is-fully-faithful slice→total
  slice→total-is-ff {x} {y} = is-iso→is-equiv (iso inv rinv linv) where
    inv : Hom Cat[ ∫ C P ^op , Sets _ ] _ _
        β†’ Slice Cat[ C ^op , Sets _ ] P .Hom _ _
    inv nt .map .Ξ· i o = nt .Ξ· (elem _ (x .map .Ξ· i o)) (o , refl) .fst

    inv nt .map .is-natural _ _ f = funext Ξ» z β†’
        ap (Ξ» e β†’ nt .Ξ· _ e .fst) (Ξ£-prop-path! refl)
      βˆ™ ap fst (happly (nt .is-natural _ _
          (elem-hom f (happly (sym (x .map .is-natural _ _ _)) _))) _)

    inv nt .commutes = ext Ξ» z w β†’
      nt .Ξ· (elem _ (x .map .Ξ· _ _)) (w , refl) .snd

    rinv : is-right-inverse inv (F₁ sliceβ†’total)
    rinv nt = ext Ξ» where
      o z p β†’ Ξ£-prop-path! Ξ» i β†’
        nt .Ξ· (elem (o .ob) (p i)) (z , Ξ» j β†’ p (i ∧ j)) .fst

    linv : is-left-inverse inv (F₁ sliceβ†’total)
    linv sh = trivial!

  open is-precat-iso
  slice→total-is-iso : is-precat-iso slice→total
  slice→total-is-iso .has-is-ff = slice→total-is-ff
  slice→total-is-iso .has-is-iso = is-iso→is-equiv isom where
    open is-iso
    isom : is-iso slice-ob→presheaf
    isom .inv = presheaf→slice-ob

Proving that the constructions presheaf→slice-ob and slice-ob→presheaf are inverses is mosly incredibly fiddly path algebra, so we omit the proof.