module Cat.Displayed.Instances.Opposite
  {o β„“ o' β„“'} {B : Precategory o β„“} (E : Displayed B o' β„“')
  (cart : Cartesian-fibration E)
  where

The opposite of a fibrationπŸ”—

Source

The construction formalised here, defined in terms of an operation which assigns Cartesian lifts, is due to Sterling (2022); there it is introduced as a simplification of a construction to BΓ©nabou as relayed by Streicher (2023). In the univalent setting, the extra generality afforded by BΓ©nabou’s construction would only be relevant in the setting of uncloven fibrations of precategories; we have thus decided to avoid its complexity.

Since the theory of fibrations over behaves like ordinary category theory over we expect to find analogues of basic constructions such as functor categories, product categories, and, what concerns us here, opposite categories. Working at the level of displayed categories, fix a fibration we want to construct the fibration which classifies1

in other words, the fibration whose fibre categories are the opposites of those of Note that this is still a category over unlike in the case of the total opposite, which results in a category over β€” which, generally, will not be a fibration. The construction of the fibred opposite proceeds using base change functors. A morphism lying over a map is defined to be a map as indicated (in red) in the diagram below.

At the level of vertical maps, this says that a morphism is determined by a morphism hence by a morphism this correspondence trivially extends to an isomorphism of precategories between and If we have maps and we can obtain a map to stand for their opposite in by calculating

where the map is one of the structural morphisms expressing pseudofunctoriality of

_∘,_
  : βˆ€ {a b c} {x y z} {f : Hom b c} {g : Hom a b}
  β†’ (f' : Hom[ id ] (f ^* z) y) (g' : Hom[ id ] (g ^* y) x)
  β†’ Hom[ id {x = a} ] ((f ∘ g) ^* z) x
_∘,_ {g = g} f' g' = g' ∘v g [ f' ] ∘v Ξ³β†’

The coherence problemπŸ”—

Having done the mathematics behind the fibred opposite, we turn to teaching Agda about the construction. Recall that the algebraic laws (associativity, unitality) of a displayed category are dependent paths over the corresponding laws in Ordinarily, this dependence is strictly at the level of morphisms depending on morphisms, with the domain and codomain staying fixed β€” and we have an extensive toolkit of combinators for dealing with this indexing.

However, the fibred opposite mixes levels in a complicated way. For concreteness, let’s focus on the right identity law. We want to construct a path between some and the composite

but note that, while these are both vertical maps, they have different domains! While the path we’re trying to construct is allowed to depend on the witness that in introducing this dependency on the domain object actually complicates things even further. Our toolkit does not include very many tools for working with dependent identifications between maps whose source and target vary.

The solution is to reify the dependency of the identifications into a morphism, which we can then calculate with at the level of fibre categories. Given a path we obtain a vertical map which we call the adjustment induced by The explicit definition below is identical to transporting the identity map along but computes better:

private
  adjust
    : βˆ€ {a b} {f f' : Hom a b} {x : Ob[ b ]}
    β†’ (p : f ≑ f')
    β†’ Hom[ id ] (f' ^* x) (f ^* x)
  adjust p = has-lift.universal' _ _ (idr _ βˆ™ p) (has-lift.lifting _ _)

The point of introducing adjust is the following theorem, which connects transport in the domain of a vertical morphism with postcomposition along adjust. The proof is by path induction: it suffices to cover the case where the domain varies trivially, which leads to a correspondingly trivial adjustment.

  transp-lift
    : βˆ€ {a b} {f f' : Hom a b} {x : Ob[ b ]} {y : Ob[ a ]} {h : Hom[ id ] (f ^* x) y}
    β†’ (p : f ≑ f')
    β†’ transport (Ξ» i β†’ Hom[ id ] (p i ^* x) y) h ≑ h ∘v adjust p
  transp-lift {f = f} {x = x} {y} {h} =
    J (Ξ» f' p β†’ transport (Ξ» i β†’ Hom[ id ] (p i ^* x) y) h ≑ E.hom[ idl id ] (h ∘' adjust p))
      ( transport-refl _
      βˆ™ sym (ap E.hom[] (apβ‚‚ _∘'_ refl adjust-refl)
      βˆ™ ap E.hom[] (from-pathp⁻ (idr' h)) βˆ™ E.hom[]-βˆ™ _ _ βˆ™ E.liberate _))

To finish, we’ll need to connect the adjustment induced by the algebraic laws of with the pseudofunctoriality witnesses of

  adjust-idr
    : βˆ€ {a b} {f : Hom a b} {x : Ob[ b ]}
    β†’ adjust {x = x} (idr f) ≑ γ← ∘v ι←

  adjust-idl
    : βˆ€ {a b} {f : Hom a b} {x : Ob[ b ]}
    β†’ adjust {x = x} (idl f) ≑ γ← ∘v f [ ι← ]

  adjust-assoc
    : βˆ€ {a b c d} {f : Hom c d} {g : Hom b c} {h : Hom a b} {x : Ob[ d ]}
    β†’ adjust {x = x} (assoc f g h) ≑ γ← ∘v γ← ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’
The proofs here are nothing more than calculations at the level of the underlying displayed category. They’re not informative; it’s fine to take the three theorems above as given.
  adjust-idr {f = f} {x} = has-lift.uniquepβ‚‚ _ _ _ _ _ _ _ (Ο€-adjust (idr f))
    (   F.pulllf (has-lift.commutesv (f ∘ id) x (Ο€ ∘' Ο€))
    βˆ™[] E.pullr[] (idr id) (has-lift.commutesp id (f ^* x) (idr id) id')
    βˆ™[] idr' Ο€)

  adjust-idl {f = f} {x} = has-lift.uniquepβ‚‚ _ _ _ _ _ _ _ (Ο€-adjust (idl f))
    (   F.pulllf (has-lift.commutesv (id ∘ f) x (Ο€ ∘' Ο€))
    βˆ™[] E.pullr[] _ (has-lift.commutesp f (id ^* x) id-comm (ι← ∘' Ο€))
    βˆ™[] E.pulll[] _ (has-lift.commutesp id x (idr id) id') βˆ™[] idl' Ο€)

  adjust-assoc {f = f} {g} {h} = has-lift.uniquepβ‚‚ _ _ _ _ _ _ _ (Ο€-adjust (assoc f g h))
    (F.pulllf (has-lift.commutesv (f ∘ g ∘ h) _ _) βˆ™[] E.pullr[] _ (F.pulllf (has-lift.commutesp (g ∘ h) _ (idr (g ∘ h)) _))
    βˆ™[] (E.refl⟩∘'⟨ E.pullr[] (id-comm βˆ™ sym (idr (id ∘ h))) (F.pulllf (has-lift.commutesp _ _ _ _)))
    βˆ™[] (E.refl⟩∘'⟨ E.pulll[] _ (E.pulll[] (idr g) (has-lift.commutesp _ _ _ _)))
    βˆ™[] E.pulll[] _ (E.pulll[] _ (has-lift.commutes _ _ _ _))
    βˆ™[] E.pullr[] (idr h) (has-lift.commutesp _ _ _ _)
    βˆ™[] has-lift.commutes _ _ _ _)

The constructionπŸ”—

Using adjust, and the three theorems above, we can tackle each of the three laws in turn. Having boiled the proofs down to reasoning about coherence morphisms in a pseudofunctor, the proofs are… no more than reasoning about coherence morphisms in a pseudofunctor β€” which is to say, boring algebra. Let us make concrete note of the data of the fibrewise opposite before tackling the properties:

_^op' : Displayed B o' β„“'
_^op' .D.Ob[_] = Ob[_]
_^op' .D.Hom[_]     f x y = Hom[ id ] (f ^* y) x
_^op' .D.Hom[_]-set f x y = Hom[_]-set _ _ _
_^op' .D.id'  = Ο€
_^op' .D._∘'_ = _∘,_

We can look at the case of left identity as a representative example. Note that, after applying the generic transp-lift and the specific lemma β€” in this case, adjust-idl β€” we’re reasoning entirely in the fibres of This lets us side-step most of the indexed nonsense that otherwise haunts working with fibrations.

_^op' .D.idl' {x = x} {y} {f = f} f' = to-pathp $
  transport (Ξ» i β†’ Hom[ id ] (idl f i ^* y) x) _  β‰‘βŸ¨ transp-lift _ βˆ™ apβ‚‚ _∘v_ refl adjust-idl ⟩
  (f' ∘v f [ Ο€ ] ∘v Ξ³β†’) ∘v γ← ∘v f [ ι← ]         β‰‘βŸ¨ F.pullr (F.pullr refl) ⟩
  f' ∘v f [ Ο€ ] ∘v Ξ³β†’ ∘v (γ← ∘v f [ ι← ])         β‰‘βŸ¨ apβ‚‚ _∘v_ refl (apβ‚‚ _∘v_ refl (F.cancell (^*-comp .F.invl))) ⟩
  f' ∘v f [ Ο€ ] ∘v f [ ι← ]                       β‰‘βŸ¨ F.elimr (rebase.annihilate (E.cancel _ _ (has-lift.commutesv _ _ _))) ⟩
  f'                                              ∎

The next two cases are very similar, so we’ll present them without further comment.

_^op' .D.idr' {x = x} {y} {f} f' = to-pathp $
  transport (Ξ» i β†’ Hom[ id ] (idr f i ^* y) x) _  β‰‘βŸ¨ transp-lift _ βˆ™ apβ‚‚ _∘v_ refl adjust-idr ⟩
  (Ο€ ∘v id [ f' ] ∘v Ξ³β†’) ∘v γ← ∘v ι←              β‰‘βŸ¨ F.pullr (F.pullr (F.cancell (^*-comp .F.invl))) ⟩
  Ο€ ∘v id [ f' ] ∘v ι←                            β‰‘βŸ¨ ap (Ο€ ∘v_) (sym (base-change-id .Isoⁿ.from .is-natural _ _ _)) ⟩
  Ο€ ∘v ι← ∘v f'                                   β‰‘βŸ¨ F.cancell (base-change-id .Isoⁿ.invl Ξ·β‚š _) ⟩
  f'                                              ∎

_^op' .D.assoc' {x = x} {y} {z} {f} {g} {h} f' g' h' = to-pathp $
  transport (Ξ» i β†’ Hom[ id ] (assoc f g h i ^* _) _) (f' ∘, (g' ∘, h'))           β‰‘βŸ¨ transp-lift _ βˆ™ apβ‚‚ _∘v_ refl adjust-assoc ⟩
  ((h' ∘v h [ g' ] ∘v Ξ³β†’) ∘v (g ∘ h) [ f' ] ∘v Ξ³β†’) ∘v γ← ∘v γ← ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’  β‰‘βŸ¨ sym (F.assoc _ _ _) βˆ™ F.pullr (F.pullr (ap (Ξ³β†’ ∘v_) (F.pullr refl))) ⟩
  h' ∘v h [ g' ] ∘v Ξ³β†’ ∘v (g ∘ h) [ f' ] ∘v ⌜ Ξ³β†’ ∘v γ← ∘v γ← ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’ ⌝  β‰‘βŸ¨ ap (Ξ» e β†’ h' ∘v h [ g' ] ∘v Ξ³β†’ ∘v (g ∘ h) [ f' ] ∘v e) (F.cancell (^*-comp .F.invl))  ⟩
  h' ∘v h [ g' ] ∘v ⌜ Ξ³β†’ ∘v (g ∘ h) [ f' ] ∘v γ← ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’ ⌝              β‰‘βŸ¨ ap (Ξ» e β†’ h' ∘v h [ g' ] ∘v e) (F.extendl (sym (^*-comp-to-natural _))) ⟩
  h' ∘v h [ g' ] ∘v h [ g [ f' ] ] ∘v Ξ³β†’ ∘v γ← ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’                  β‰‘βŸ¨ apβ‚‚ _∘v_ refl (F.pulll (sym (rebase.F-∘ _ _)) βˆ™ apβ‚‚ _∘v_ refl (F.cancell (^*-comp .F.invl))) ⟩
  h' ∘v h [ g' ∘v g [ f' ] ] ∘v h [ Ξ³β†’ ] ∘v Ξ³β†’                                    β‰‘βŸ¨ ap (h' ∘v_) (rebase.pulll (F.pullr refl)) ⟩
  h' ∘v h [ g' ∘v g [ f' ] ∘v Ξ³β†’ ] ∘v Ξ³β†’                                          ∎

Having defined the fibration, we can prove the comparison theorem mentioned in the introductory paragraph, showing that passing from to inverts each fibre.

opposite-map : βˆ€ {a} {x y : Ob[ a ]} β†’ Fib.Hom E y x ≃ Fib.Hom _^op' x y
opposite-map .fst f = f ∘v Ο€
opposite-map .snd = is-iso→is-equiv $ iso
  (Ξ» f β†’ f ∘v has-lift.universalv id _ id')
  (Ξ» x β†’ F.cancelr (base-change-id .Isoⁿ.invr Ξ·β‚š _))
  (Ξ» x β†’ F.cancelr (base-change-id .Isoⁿ.invl Ξ·β‚š _))

Cartesian liftsπŸ”—

Since we defined the displayed morphism spaces directly in terms of base change, it’s not surprising that is itself a fibration. Indeed, if we have and a Cartesian lift of along in the opposite, boils down to asking for something to fit into the question mark in the diagram

It’s no coincidence that the boundary of the question mark is precisely that of the identity morphism. A mercifully short calculation establishes that this choice does furnish a Cartesian lift.

Opposite-cartesian : Cartesian-fibration _^op'
Opposite-cartesian .Cf.has-lift f y' = record
  { lifting   = id'
  ; cartesian = record
    { universal = Ξ» m h β†’ h ∘v γ←
    ; commutes  = Ξ» m h β†’ ∘,-idl (h ∘v γ←) βˆ™ F.cancelr (^*-comp .F.invr)
    ; unique    = Ξ» m h β†’ sym (F.cancelr (^*-comp .F.invl)) βˆ™ ap (_∘v γ←) (sym (∘,-idl m) βˆ™ h)
    }
  }

  1. Note that, strictly speaking, the construction of opposite categories can not be extended to a pseudofunctor While the opposite of a functor goes in the same direction as the original (i.e.Β  is taken to the opposite of a natural transformation has reversed direction β€” the dual of is To capture this, the β€œopposite category functor” would need to be typed instead, indicating that it reverses 2-cells.

    However, because the domain is locally discrete, all of its 2-cells are isomorphisms. Therefore, the pseudofunctor classified by a given fibration factors through the homwise core of β€” and the construction of opposite categories restricts to a map β†©οΈŽ


References