module Cat.Displayed.Instances.Elements {o β„“ s} (B : Precategory o β„“)
  (P : Functor (B ^op) (Sets s)) where

The displayed category of elementsπŸ”—

It is useful to view the category of elements of a presheaf P as a displayed category. Instead of considering pairs of objects and sections we instead think of the set of sections as displayed over The story is similar for morphisms; instead of taking pairs of morphisms and fragments of data that we place those fragments over the morphism

In a sense, this is the more natural presentation of the category of elements, as we obtain the more traditional definition by taking the total category of ∫.

∫ : Displayed B s s
∫ .Displayed.Ob[_] X = P ʻ X
∫ .Displayed.Hom[_] f P[X] P[Y] = P.₁ f P[Y] ≑ P[X]
∫ .Displayed.Hom[_]-set _ _ _ = hlevel!
∫' = happly P.F-id _
∫ .Displayed._∘'_ {x = x} {y} {z} {f} {g} p q = pf where abstract
  pf : P.₁ (f ∘ g) z ≑ x
  pf =
    P.₁ (f ∘ g) z   β‰‘βŸ¨ happly (P.F-∘ g f) z βŸ©β‰‘
    P.₁ g (P.₁ f z) β‰‘βŸ¨ ap (P.₁ g) p βŸ©β‰‘
    P.₁ g y         β‰‘βŸ¨ q βŸ©β‰‘
    x               ∎
∫ .Displayed.idr'   _     = prop!
∫ .Displayed.idl'   _     = prop!
∫ .Displayed.assoc' _ _ _ = prop!