module Cat.Displayed.Functor where

Displayed and fibred functorsπŸ”—

If you have a pair of categories displayed over a common base category it makes immediate sense to talk about functors you’d have an assignment of objects and an assignment of morphisms

which makes sense because lies over just as did, that a morphism is allowed to lie over a morphism But, in the spirit of relativising category theory, it makes more sense to consider functors between categories displayed over different bases, as in

with our displayed functor lying over an ordinary functor to mediate between the bases.

  record Displayed-functor : Type lvl where
    no-eta-equality
    field
      Fβ‚€' : βˆ€ {x} (o : β„°.Ob[ x ]) β†’ β„±.Ob[ F.β‚€ x ]
      F₁' : βˆ€ {a b} {f : A.Hom a b} {a' b'}
          β†’ β„°.Hom[ f ] a' b' β†’ β„±.Hom[ F.₁ f ] (Fβ‚€' a') (Fβ‚€' b')

In order to state the displayed functoriality laws, we require functoriality for our mediating functor Functors between categories displayed over the same base can be recovered as the β€œvertical displayed functors”, i.e., those lying over the identity functor.

      F-id' : βˆ€ {x} {o : β„°.Ob[ x ]}
            β†’ PathP (Ξ» i β†’ β„±.Hom[ F.F-id i ] (Fβ‚€' o) (Fβ‚€' o))
                    (F₁' β„°.id') β„±.id'
      F-∘' : βˆ€ {a b c} {f : A.Hom b c} {g : A.Hom a b} {a' b' c'}
               {f' : β„°.Hom[ f ] b' c'} {g' : β„°.Hom[ g ] a' b'}
           β†’ PathP (Ξ» i β†’ β„±.Hom[ F.F-∘ f g i ] (Fβ‚€' a') (Fβ‚€' c'))
                   (F₁' (f' β„°.∘' g'))
                   (F₁' f' β„±.∘' F₁' g')
    β‚€' = Fβ‚€'
    ₁' = F₁'

Note that, if and are fibred categories over their bases (rather than just displayed categories), then the appropriate notion of 1-cell are displayed functors that take Cartesian morphisms to Cartesian morphisms:

  is-fibred-functor : Displayed-functor β„° β„± F β†’ Type _
  is-fibred-functor F' =
    βˆ€ {a b a' b'} {f : A.Hom a b} (f' : β„°.Hom[ f ] a' b')
    β†’ is-cartesian β„° f f' β†’ is-cartesian β„± (F.₁ f) (F₁' f')
    where open Displayed-functor F'
  record Fibred-functor : Type (lvl βŠ” oβ‚‚ βŠ” β„“β‚‚) where
    no-eta-equality
    field
      disp : Displayed-functor β„° β„± F
      F-cartesian : is-fibred-functor disp

    open Displayed-functor disp public

One can also define the composition of displayed functors, which lies over the composition of the underlying functors.

  _F∘'_
    : Displayed-functor β„± β„‹ F
    β†’ Displayed-functor β„° β„± G
    β†’ Displayed-functor β„° β„‹ (F F∘ G)
  (F' F∘' G') .Fβ‚€' x = F' .Fβ‚€' (G' .Fβ‚€' x)
  (F' F∘' G') .F₁' f = F' .F₁' (G' .F₁' f)
  (F' F∘' G') .F-id' = to-pathp $
    hom[] (F' .F₁' (G' .F₁' β„°.id'))         β‰‘βŸ¨ reindex _ _ βˆ™ sym (hom[]-βˆ™ (ap F.F₁ G.F-id) F.F-id) βŸ©β‰‘
    hom[] (hom[] (F' .F₁' (G' .F₁' β„°.id'))) β‰‘βŸ¨ ap hom[] (shiftl _ Ξ» i β†’ F' .F₁' (G' .F-id' i)) βŸ©β‰‘
    hom[] (F' .F₁' β„±.id')                   β‰‘βŸ¨ from-pathp (F' .F-id') βŸ©β‰‘
    β„‹.id'                                   ∎
  (F' F∘' G') .F-∘' {f = f} {g = g} {f' = f'} {g' = g'} = to-pathp $
    hom[] (F' .F₁' (G' .F₁' (f' β„°.∘' g')))           β‰‘βŸ¨ reindex _ _ βˆ™ sym (hom[]-βˆ™ (ap F.F₁ (G.F-∘ f g)) (F.F-∘ (G.₁ f) (G.₁ g))) βŸ©β‰‘
    hom[] (hom[] (F' .F₁' (G' .F₁' (f' β„°.∘' g'))))   β‰‘βŸ¨ ap hom[] (shiftl _ Ξ» i β†’ F' .F₁' (G' .F-∘' {f' = f'} {g' = g'} i)) βŸ©β‰‘
    hom[] (F' .F₁' ((G' .F₁' f') β„±.∘' (G' .F₁' g'))) β‰‘βŸ¨ from-pathp (F' .F-∘') βŸ©β‰‘
    F' .F₁' (G' .F₁' f') β„‹.∘' F' .F₁' (G' .F₁' g')   ∎

Furthermore, there is a displayed identity functor that lies over the identity functor.

  Id' : Displayed-functor β„° β„° Id
  Id' .Fβ‚€' x = x
  Id' .F₁' f = f
  Id' .F-id' = refl
  Id' .F-∘'  = refl

The identity functor is obviously fibred.

  Id'-fibred : is-fibred-functor Id'
  Id'-fibred f cart = cart

  Idf' : Fibred-functor β„° β„° Id
  Idf' .Fibred-functor.disp = Id'
  Idf' .Fibred-functor.F-cartesian = Id'-fibred

Vertical functorsπŸ”—

Functors displayed over the identity functor are of particular interest. Such functors are known as vertical functors, and are commonly used to define fibrewise structure. However, they are somewhat difficult to work with if we define them directly as such, as the composite of two identity functors is not definitionally equal to the identity functor! To avoid this problem, we provide the following specialized definition.

  record Vertical-functor : Type (o βŠ” β„“ βŠ” o' βŠ” β„“' βŠ” o'' βŠ” β„“'') where
    no-eta-equality
    field
      Fβ‚€' : βˆ€ {x} (o : β„°.Ob[ x ]) β†’ β„±.Ob[ x ]
      F₁' : βˆ€ {a b} {f : B.Hom a b} {a' b'}
          β†’ β„°.Hom[ f ] a' b' β†’ β„±.Hom[ f ] (Fβ‚€' a') (Fβ‚€' b')
      F-id' : βˆ€ {x} {o : β„°.Ob[ x ]}
            β†’ PathP ( Ξ» _ β†’  β„±.Hom[ B.id ] (Fβ‚€' o) (Fβ‚€' o))
                         (F₁' β„°.id') β„±.id'
      F-∘' : βˆ€ {a b c} {f : B.Hom b c} {g : B.Hom a b} {a' b' c'}
                 {f' : β„°.Hom[ f ] b' c'} {g' : β„°.Hom[ g ] a' b'}
            β†’ PathP (Ξ» _ β†’ β„±.Hom[ f B.∘ g ] (Fβ‚€' a') (Fβ‚€' c')) (F₁' (f' β„°.∘' g'))
                         (F₁' f' β„±.∘' F₁' g')
    β‚€' = Fβ‚€'
    ₁' = F₁'

This definition is equivalent to a displayed functor over the identity functor.

  Displayed-functor→Vertical-functor
    : Displayed-functor β„° β„± Id β†’ Vertical-functor β„° β„±
  Displayed-functor→Vertical-functor F' = V where
    module F' = Displayed-functor F'
    open Vertical-functor

    V : Vertical-functor β„° β„±
    V .Fβ‚€' = F'.β‚€'
    V .F₁' = F'.₁'
    V .F-id' = F'.F-id'
    V .F-∘' = F'.F-∘'

  Vertical-functor→Displayed-functor
    : Vertical-functor β„° β„± β†’ Displayed-functor β„° β„± Id
  Vertical-functor→Displayed-functor V = F' where
    module V = Vertical-functor V
    open Displayed-functor

    F' : Displayed-functor β„° β„± Id
    F' .Fβ‚€' = V.β‚€'
    F' .F₁' = V.₁'
    F' .F-id' = V.F-id'
    F' .F-∘' = V.F-∘'

We also provide a specialized definition for vertical fibred functors.

  is-vertical-fibred : Vertical-functor β„° β„± β†’ Type _
  is-vertical-fibred F' =
    βˆ€ {a b a' b'} {f : B.Hom a b} (f' : β„°.Hom[ f ] a' b')
    β†’ is-cartesian β„° f f' β†’ is-cartesian β„± f (F₁' f')
    where open Vertical-functor F'
  record Vertical-fibred-functor : Type lvl where
    no-eta-equality
    field
      vert : Vertical-functor β„° β„±
      F-cartesian : is-vertical-fibred vert
    open Vertical-functor vert public

A functor displayed over the identity functor is fibred if and only if it is a vertical fibred functor.

  is-fibred→is-vertical-fibred
    : βˆ€ (F' : Displayed-functor β„° β„± Id)
    β†’ is-fibred-functor F'
    → is-vertical-fibred (Displayed-functor→Vertical-functor F')
  is-fibred→is-vertical-fibred F' F-fib = F-fib

  is-vertical-fibred→is-fibred
    : βˆ€ (F' : Vertical-functor β„° β„±)
    β†’ is-vertical-fibred F'
    → is-fibred-functor (Vertical-functor→Displayed-functor F')
  is-vertical-fibred→is-fibred F' F-fib = F-fib

  Fibred→Vertical-fibred
    : Fibred-functor β„° β„± Id β†’ Vertical-fibred-functor β„° β„±
  Fibred→Vertical-fibred F' .Vertical-fibred-functor.vert =
    Displayed-functor→Vertical-functor (Fibred-functor.disp F')
  Fibred→Vertical-fibred F' .Vertical-fibred-functor.F-cartesian =
    is-fibred→is-vertical-fibred
      (Fibred-functor.disp F')
      (Fibred-functor.F-cartesian F')

  Vertical-Fibred→Vertical
    : Vertical-fibred-functor β„° β„± β†’ Fibred-functor β„° β„± Id
  Vertical-Fibred→Vertical F' .Fibred-functor.disp =
    Vertical-functor→Displayed-functor (Vertical-fibred-functor.vert F')
  Vertical-Fibred→Vertical F' .Fibred-functor.F-cartesian =
    is-vertical-fibred→is-fibred
      (Vertical-fibred-functor.vert F')
      (Vertical-fibred-functor.F-cartesian F')

As promised, composition of vertical functors is much simpler.

  _V∘_ : Vertical-functor β„± β„‹ β†’ Vertical-functor β„° β„± β†’ Vertical-functor β„° β„‹
  (F' V∘ G') .Fβ‚€' x' = F' .Fβ‚€' (G' .Fβ‚€' x')
  (F' V∘ G') .F₁' f' = F' .F₁' (G' .F₁' f')
  (F' V∘ G') .F-id' = ap (F' .F₁') (G' .F-id') βˆ™ F' .F-id'
  (F' V∘ G') .F-∘' = ap (F' .F₁') (G' .F-∘') βˆ™ (F' .F-∘')

Furthermore, the composite of vertical fibred functors is also fibred.

  V∘-fibred
    : βˆ€ (F' : Vertical-functor β„± β„‹) (G' : Vertical-functor β„° β„±)
    β†’ is-vertical-fibred F' β†’ is-vertical-fibred G' β†’ is-vertical-fibred (F' V∘ G')
  V∘-fibred F' G' F'-fib G'-fib f' cart = F'-fib (G' .F₁' f') (G'-fib f' cart)

  _Vf∘_
    : Vertical-fibred-functor β„± β„‹
    β†’ Vertical-fibred-functor β„° β„±
    β†’ Vertical-fibred-functor β„° β„‹
  (F' Vf∘ G') .Vertical-fibred-functor.vert =
    Vertical-fibred-functor.vert F' V∘ Vertical-fibred-functor.vert G'
  (F' Vf∘ G') .Vertical-fibred-functor.F-cartesian =
    V∘-fibred
      (Vertical-fibred-functor.vert F')
      (Vertical-fibred-functor.vert G')
      (Vertical-fibred-functor.F-cartesian F')
      (Vertical-fibred-functor.F-cartesian G')

The identity functor is obviously fibred vertical.

  IdV : Vertical-functor β„° β„°
  IdV = Displayed-functor→Vertical-functor Id'

  IdV-fibred : is-vertical-fibred IdV
  IdV-fibred = is-fibred→is-vertical-fibred Id' Id'-fibred

  IdVf : Vertical-fibred-functor β„° β„°
  IdVf = Fibred→Vertical-fibred Idf'

Displayed natural transformationsπŸ”—

Just like we have defined a displayed functor lying over an ordinary functor we can define a displayed natural transformation. Assume are displayed functors over resp. and we have a natural transformation Than one can define a displayed natural transformation lying over

module
  _ {o β„“ o' β„“' oβ‚‚ β„“β‚‚ oβ‚‚' β„“β‚‚'}
    {A : Precategory o β„“}
    {B : Precategory oβ‚‚ β„“β‚‚}
    {β„° : Displayed A o' β„“'}
    {β„± : Displayed B oβ‚‚' β„“β‚‚'}
  where
  private
    module β„° = Displayed β„°
    module β„± = Displayed β„±
    open Displayed-functor
    open _=>_

    lvl : Level
    lvl = o βŠ” o' βŠ” β„“ βŠ” β„“' βŠ” β„“β‚‚'
  infix 20 _=[_]=>_

  record _=[_]=>_ {F : Functor A B} {G : Functor A B} (F' : Displayed-functor β„° β„± F)
                          (Ξ± : F => G) (G' : Displayed-functor β„° β„± G)
            : Type lvl where
    no-eta-equality

    field
      Ξ·' : βˆ€ {x} (x' : β„°.Ob[ x ]) β†’ β„±.Hom[ Ξ± .Ξ· x ] (F' .Fβ‚€' x') (G' .Fβ‚€' x')
      is-natural'
        : βˆ€ {x y f} (x' : β„°.Ob[ x ]) (y' : β„°.Ob[ y ]) (f' : β„°.Hom[ f ] x' y')
        β†’ Ξ·' y' β„±.∘' F' .F₁' f' β„±.≑[ Ξ± .is-natural x y f ] G' .F₁' f' β„±.∘' Ξ·' x'

Let be two vertical functors. A displayed natural transformation between and is called a vertical natural transformation if all components of the natural transformation are vertical.

  record _=>↓_ (F' G' : Vertical-functor β„° β„±) : Type lvl where
    no-eta-equality
    field
      Ξ·' : βˆ€ {x} (x' : β„°.Ob[ x ]) β†’ β„±.Hom[ id ] (F' .Fβ‚€' x') (G' .Fβ‚€' x')
      is-natural'
        : βˆ€ {x y f} (x' : β„°.Ob[ x ]) (y' : β„°.Ob[ y ]) (f' : β„°.Hom[ f ] x' y')
        β†’ Ξ·' y' β„±.∘' F' .F₁' f' β„±.≑[ id-comm-sym ] G' .F₁' f' β„±.∘' Ξ·' x'

This notion of natural transformation is also the correct one for fibred vertical functors, as there is no higher structure that needs to be preserved.

  _=>f↓_ : (F' G' : Vertical-fibred-functor β„° β„±) β†’ Type _
  F' =>f↓ G' = F' .vert =>↓ G' .vert
    where open Vertical-fibred-functor