open import Cat.Displayed.Cartesian
open import Cat.Displayed.Base
open import Cat.Prelude

import Cat.Displayed.Univalence
import Cat.Displayed.Reasoning
import Cat.Displayed.Morphism
import Cat.Reasoning as Cr

module Cat.Displayed.Univalence.Reasoning
{o β o' β'} {B : Precategory o β} (E : Displayed B o' β')
where


Note that, over a univalent base, univalence of displayed categories is equivalent to fibrewise univalence; Over a precategorical base, displayed univalence is a stronger condition, but it still implies that each fibre is univalent. Moreover, since isomorphisms in fibres are equivalent to vertical isomorphisms, if is a displayed univalent category, then vertical isomorphism is an identity system on each type of objects-over.

private module B = Cr B

open Cat.Displayed.Univalence E
open Cat.Displayed.Reasoning E
open Cat.Displayed.Morphism E
open Displayed E
open _β[_]_

ββ-identity-system
: β {x} β is-category-displayed
β is-identity-system (_ββ_ {x = x}) (Ξ» _ β id-isoβ)
ββ-identity-system e-cat .to-path {a} {b} i =
ap fst $e-cat B.id-iso a (a , id-isoβ) (b , i) β β-identity-system e-cat .to-path-over {a} {b} i = ap snd$ e-cat B.id-iso a (a , id-isoβ) (b , i)


Therefore, we have an equivalence between paths of objects-over the same base object and vertical isomorphisms, regardless of whether the base category is univalent or not. Much like in the non-displayed case, this equivalence lets us compute transports of morphisms-over (along their domain and codomain, rather than over their base morphism) in terms of pre/post-composition with a vertical isomorphism.

pathβvertical-iso
: β {x} {xβ xβ : Ob[ x ]} β xβ β‘ xβ β xβ ββ xβ
pathβvertical-iso {xβ = xβ} p = transport (Ξ» i β xβ ββ p i) id-isoβ

vertical-isoβpath
: β {x} {xβ xβ : Ob[ x ]}
β is-category-displayed
β xβ ββ xβ β xβ β‘ xβ
vertical-isoβpath e = ββ-identity-system e .to-path


The transport and dependent path lemmas are straightforward generalisations of their non-displayed counterparts. Note that while we only need to talk about vertical isomorphisms, the proofs work over an arbitrary morphism in the base. They are also generalised over an arbitrary identification between e.g.Β  in the base.

private variable
x y : B.Ob
f : B.Hom x y
xβ xβ yβ yβ x' y' : Ob[ x ]

abstract
Hom[]-transport
: (Ξ± : f β‘ B.id B.β f B.β B.id) (p : xβ β‘ xβ) (q : yβ β‘ yβ)
β (f' : Hom[ f ] xβ yβ)
β transport (Ξ» i β Hom[ f ] (p i) (q i)) f' β‘[ Ξ± ]
pathβvertical-iso q .to' β' f' β' pathβvertical-iso p .from'

Hom[]-pathp-iso
: (e-cat : is-category-displayed)
β (Ξ± : B.id B.β f B.β B.id β‘ f)
β (p : xβ ββ xβ) (q : yβ ββ yβ) (f' : Hom[ f ] xβ yβ) (g' : Hom[ f ] xβ yβ)
β q .to' β' f' β' p .from' β‘[ Ξ± ] g'
β PathP (Ξ» i β Hom[ f ] (vertical-isoβpath e-cat p i)
(vertical-isoβpath e-cat q i))
f' g'

Hom[]-pathp-refll-iso
: (e-cat : is-category-displayed) (Ξ± : f B.β B.id β‘ f)
β (p : xβ ββ xβ) (f' : Hom[ f ] xβ y') (g' : Hom[ f ] xβ y')
β f' β' p .from' β‘[ Ξ± ] g'
β PathP (Ξ» i β Hom[ f ] (vertical-isoβpath e-cat p i) y') f' g'

These lemmas all have scary type signatures and nightmare proofs. Therefore, theyβre hidden away down here.
  Hom[]-transport {f = f} {xβ = xβ} {yβ = yβ} Ξ± p q f' =
Jβ (Ξ» xβ yβ p q β transport (Ξ» i β Hom[ f ] (p i) (q i)) f'
β‘[ Ξ± ] pathβvertical-iso q .to' β' f' β' pathβvertical-iso p .from')
(to-pathpβ» (sym
(ap hom[] (from-pathpβ» (eliml' refl (transport-refl _) {q = B.idl _})
Β·Β· ap hom[] (from-pathpβ» (elimr' refl (transport-refl _) {q = B.idr f}))
Β·Β· hom[]-β _ _)
Β·Β· hom[]-β _ _
Β·Β· reindex _ _)))
p q

Hom[]-pathp-refll-iso e-cat Ξ± p f' g' Ξ² = to-pathp $from-pathpβ» (Hom[]-transport (sym (B.idl _ β Ξ±)) (vertical-isoβpath e-cat p) refl f') Β·Β· ap hom[] ( apβ (Ξ» a b β a β' f' β' b) (transport-refl _) (from-pathp (Ξ» i β β β-identity-system e-cat .to-path-over p i .from')) β from-pathpβ» (idl' (f' β' p .from'))) Β·Β· (hom[]-β _ _ Β·Β· reindex _ _ Β·Β· from-pathp Ξ²) Hom[]-pathp-iso e-cat Ξ± p q f' g' Ξ² = to-pathp$
from-pathpβ» (Hom[]-transport (sym Ξ±) (vertical-isoβpath e-cat p) (vertical-isoβpath e-cat q) f')
Β·Β· ap hom[] (apβ (Ξ» a b β a β' f' β' b)
(from-pathp (Ξ» i β ββ-identity-system e-cat .to-path-over q i .to'))
(from-pathp (Ξ» i β ββ-identity-system e-cat .to-path-over p i .from')))
Β·Β· from-pathp Ξ²