module Cat.Displayed.Comprehension.Coproduct
{ob βb od βd oe βe} {B : Precategory ob βb}
{D : Displayed B od βd} {E : Displayed B oe βe}
(D-fib : Cartesian-fibration D) (E-fib : Cartesian-fibration E)
(P : Comprehension-structure E)
whereprivate
open Cat.Reasoning B
module E = Displayed E
module D where
open Cat.Displayed.Reasoning D public
open Cartesian-fibration D D-fib public
module Dβ {Ξ} = Cat.Reasoning (Fibre D Ξ)
open Comprehension E E-fib P
module D* {Ξ Ξ : Ob} (Ο : Hom Ξ Ξ) = Functor (base-change D D-fib Ο)
module Ο* {Ξ : Ob} (x : E.Ob[ Ξ ]) = Functor (base-change D D-fib (ΟαΆ {x = x}))
open Functor
open _=>_Coproducts in comprehension categoriesπ
Let be a comprehension category and a fibration over the same base. We say that has when:
For every and there exists an object
Every projection induces a cocartesian map
For every cubical diagram as below, if is cartesian in and are cartesian in and is cocartesian in then is cocartesian in
From a type-theoretic perspective, the first two conditions are rather straightforward. The first condition establishes that we have a type former that can quantify over objects of The second condition defines an introduction rule of the following form:
The elimination rule comes from each being cocartesian, as cocartesian maps satisfy a mapping-out universal property, exactly like a coproduct should!
However, at a glance, the last condition is somewhat mysterious. It says that cocartesian maps over projections are stable: but what does that have to do with coproducts? This, like many other questions in category theory, is elucidated by thinking type-theoretically: A cartesian map in a comprehension category is essentially a substitution: the stability condition says that the introduction rule for coproducts is actually type-theoretic: stable under substitution.
record has-comprehension-coproducts : Type (ob β βb β od β βd β oe β βe) where
no-eta-equality
field
β : β {Ξ} β (x : E.Ob[ Ξ ]) (a : D.Ob[ Ξ β¨Ύ x ]) β D.Ob[ Ξ ]
β¨_,_β©
: β {Ξ} β (x : E.Ob[ Ξ ]) (a : D.Ob[ Ξ β¨Ύ x ])
β D.Hom[ ΟαΆ ] a (β x a)
β¨β©-cocartesian
: β {Ξ} β (x : E.Ob[ Ξ ]) (a : D.Ob[ Ξ β¨Ύ x ])
β is-cocartesian D ΟαΆ β¨ x , a β©
β-beck-chevalley
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ} {f : E.Hom[ Ο ] x y}
β is-cartesian E Ο f
β left-beck-chevalley D ΟαΆ (Ο β¨ΎΛ’ f) Ο ΟαΆ (sub-proj f) module β¨β©-cocartesian {Ξ} (x : E.Ob[ Ξ ]) (a : D.Ob[ Ξ β¨Ύ x ]) =
is-cocartesian (β¨β©-cocartesian x a)Now, some general facts about coproducts. To start, note that forming coproducts is a functorial operation. The proof is very routine β if youβve seen one functoriality argument, youβve seen them all β so weβve hidden it from the page.1
opaque
β[_]
: β {Ξ} {x : E.Ob[ Ξ ]} {a b : D.Ob[ Ξ β¨Ύ x ]}
β D.Hom[ id ] a b β D.Hom[ id ] (β x a) (β x b)
β[_] {Ξ} {x} {a} {b} f =
β¨β©-cocartesian.universal' x a id-comm-sym (β¨ x , b β© D.β' f)
β[]-id : β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} β β[ D.id' {x = a} ] β‘ D.id'
β[]-β
: β {Ξ} {x : E.Ob[ Ξ ]} {a b c : D.Ob[ Ξ β¨Ύ x ]}
β (f : D.Hom[ id ] b c) (g : D.Hom[ id ] a b)
β β[ f Dβ.β g ] D.β‘[ sym (idl _) ] β[ f ] D.β' β[ g ] β[]-natural
: β {Ξ} {x : E.Ob[ Ξ ]} {a b : D.Ob[ Ξ β¨Ύ x ]}
β (f : D.Hom[ id ] a b)
β β[ f ] D.β' β¨ x , a β© D.β‘[ id-comm-sym ] β¨ x , b β© D.β' f
β[]-natural {x = x} {a} {b} f =
β¨β©-cocartesian.commutesp x a _ _
β[]-id {x = x} {a = a} =
sym $ β¨β©-cocartesian.unique _ _ _ $ D.from-pathp[]β» $ D.cast[] $
D.id' D.β' β¨ x , a β© D.β‘[]β¨ D.idl' _ β©
β¨ x , a β© D.β‘[]β¨ symP (D.idr' _ ) β©
β¨ x , a β© D.β' D.id' β
β[]-β {x = x} {a = a} {b = b} {c = c} f g =
symP $ β¨β©-cocartesian.uniquep x a _ _ _ _ $
(β[ f ] D.β' β[ g ]) D.β' β¨ x , a β© D.β‘[]β¨ D.pullr[] _ (β[]-natural g) β©
β[ f ] D.β' β¨ x , b β© D.β' g D.β‘[]β¨ D.extendl[] _ (β[]-natural f) β©
β¨ x , c β© D.β' f D.β' g D.β‘[]β¨ D.to-pathp[] (D.unwhisker-r (ap (ΟαΆ β_) (idl _)) (idl _)) β©
β¨ x , c β© D.β' (f Dβ.β g) βWe can also re-package the cocartesianness of to give a method for constructing morphisms given morphisms Type theoretically, this gives a much more familiar presentation of the elimination rule.
opaque
β-elim
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β D.Hom[ id ] a (Ο*.Fβ x b)
β D.Hom[ id ] (β x a) b
β-elim {x = x} {a = a} {b = b} f =
β¨β©-cocartesian.universal' x a id-comm-sym (D.Ο* ΟαΆ b D.β' f)
β-elim-Ξ²
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] a (Ο*.Fβ x b))
β β-elim f D.β' β¨ x , a β© D.β‘[ id-comm-sym ] D.Ο* ΟαΆ b D.β' f
β-elim-Ξ² f = β¨β©-cocartesian.commutesp _ _ _ _Putting on our type-theorist goggles, weβre still missing one thing to call this a proper elimination rule: stability under substitution. In the categorical world, thatβs satisfied by the proof that the operation we just constructed is natural, given below.
β-elim-natural
: β {Ξ} {x : E.Ob[ Ξ ]} {a b : D.Ob[ Ξ β¨Ύ x ]} {c : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] b (Ο*.β x c)) (g : D.Hom[ id ] a b)
β β-elim f D.β' β[ g ] D.β‘[ idl _ ] β-elim (f Dβ.β g)
β-elim-natural {x = x} {a = a} {b = b} {c = c} f g =
β¨β©-cocartesian.uniquep x a _ _ _ (β-elim f D.β' β[ g ]) $
((β-elim f) D.β' β[ g ]) D.β' β¨ x , a β© D.β‘[]β¨ D.pullr[] _ (β[]-natural g) β©
β-elim f D.β' β¨ x , b β© D.β' g D.β‘[]β¨ D.extendl[] id-comm-sym (β¨β©-cocartesian.commutesp x b _ _) β©
D.Ο* ΟαΆ c D.β' f D.β' g D.β‘[]β¨ D.to-pathp[] (D.unwhisker-r (ap (ΟαΆ β_) (idl _)) (idl _)) β©
D.Ο* ΟαΆ c D.β' D.hom[] (f D.β' g) βConversely, we can make maps given maps This isnβt quite, type-theoretically, as the elimination principle: itβs a weird mash-up of the introduction rule for coproducts, followed by substitution.
opaque
β-transpose
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β D.Hom[ id ] (β x a) b
β D.Hom[ id ] a (Ο*.β x b)
β-transpose {x = x} {a = a} {b = b} f =
D.Ο*.universal' id-comm (f D.β' β¨ x , a β©) opaque
unfolding β-transpose
β-transpose-weaken
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] (β x a) b)
β D.Ο* ΟαΆ b D.β' β-transpose f D.β‘[ id-comm ] f D.β' β¨ x , a β©
β-transpose-weaken f = D.Ο*.commutesp id-comm _While β-transpose may not play
an obvious type-theoretic role, it is extremely important categorically,
since it is an inverse of β-elim!
Moreover, itβs also natural, but that proof is also hidden from
the page for brevity.
opaque
unfolding β-elim β-transpose
β-elim-transpose
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] (β x a) b)
β β-elim (β-transpose f) β‘ f
β-elim-transpose {x = x} {a = a} {b = b} f = sym $
β¨β©-cocartesian.uniquep x a _ _ _ f $ symP $
D.Ο*.commutesp id-comm (f D.β' β¨ x , a β©)
β-transpose-elim
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] a (Ο*.Fβ x b))
β β-transpose (β-elim f) β‘ f
β-transpose-elim {x = x} {a = a} {b = b} f = sym $
D.Ο*.uniquep _ _ _ f $ symP $
β¨β©-cocartesian.commutesp x a id-comm-sym (D.Ο* ΟαΆ b D.β' f) β-transpose-equiv
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b : D.Ob[ Ξ ]}
β is-equiv (β-transpose {a = a} {b = b})
β-transpose-equiv = is-isoβis-equiv $
iso β-elim β-transpose-elim β-elim-transpose
opaque
unfolding β-transpose
β-transpose-naturall
: β {Ξ} {x : E.Ob[ Ξ ]} {a b : D.Ob[ Ξ β¨Ύ x ]} {c : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] (β x b) c) (g : D.Hom[ id ] a b)
β β-transpose f D.β' g D.β‘[ idl _ ] β-transpose (f Dβ.β β[ g ])
β-transpose-naturall {x = x} {a = a} {b = b} {c = c} f g =
D.Ο*.uniquep _ _ _ (β-transpose f D.β' g) $
D.Ο* ΟαΆ c D.β' β-transpose f D.β' g D.β‘[]β¨ D.pulll[] id-comm (D.Ο*.commutesp _ _) β©
(f D.β' β¨ x , b β©) D.β' g D.β‘[]β¨ D.extendr[] _ (symP (β[]-natural g)) β©
(f D.β' β[ g ]) D.β' β¨ x , a β© D.β‘[ ap (_β ΟαΆ) (idl _) ]β¨ D.to-pathp[] (D.unwhisker-l (ap (_β ΟαΆ) (idl _)) (idl _)) β©
(f Dβ.β β[ g ]) D.β' β¨ x , a β© β
β-transpose-naturalr
: β {Ξ} {x : E.Ob[ Ξ ]} {a : D.Ob[ Ξ β¨Ύ x ]} {b c : D.Ob[ Ξ ]}
β (f : D.Hom[ id ] b c) (g : D.Hom[ id ] (β x a) b)
β Ο*.β x f D.β' β-transpose g D.β‘[ idl _ ] β-transpose (f Dβ.β g)
β-transpose-naturalr {x = x} {a = a} {b = b} {c = c} f g =
D.Ο*.uniquep _ _ _ (Ο*.Fβ x f D.β' β-transpose g) $
D.Ο* ΟαΆ c D.β' Ο*.β x f D.β' β-transpose g D.β‘[]β¨ D.pulll[] _ (D.Ο*.commutesp id-comm _) β©
(f D.β' D.Ο* ΟαΆ b) D.β' β-transpose g D.β‘[]β¨ D.extendr[] id-comm (D.Ο*.commutesp _ _) β©
(f D.β' g) D.β' β¨ x , a β© D.β‘[ ap (_β ΟαΆ) (idl _) ]β¨ D.to-pathp[] (D.unwhisker-l (ap (_β ΟαΆ) (idl _)) (idl _)) β©
D.hom[ idl id ] (f D.β' g) D.β' β¨ x , a β© βNext, we define an introduction rule for coproducts that also lets us apply a mediating substitution:
opaque
β¨_β¨Ύ_β©
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ}
β (f : E.Hom[ Ο ] x y) (a : D.Ob[ Ξ β¨Ύ y ])
β D.Hom[ ΟαΆ ] (D*.β (Ο β¨ΎΛ’ f) a) (D*.β Ο (β y a))
β¨_β¨Ύ_β© {x = x} {y = y} {Ο = Ο} f a =
D.Ο*.universal' (sym (sub-proj f)) $
β¨ y , a β© D.β' D.Ο* (Ο β¨ΎΛ’ f) a
β¨β¨Ύβ©-weaken
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ}
β (f : E.Hom[ Ο ] x y) (a : D.Ob[ Ξ β¨Ύ y ])
β D.Ο* Ο (β y a) D.β' β¨ f β¨Ύ a β©
D.β‘[ sym (sub-proj f) ] β¨ y , a β© D.β' D.Ο* (Ο β¨ΎΛ’ f) a
β¨β¨Ύβ©-weaken {y = y} {Ο = Ο} f a =
D.Ο*.commutesp (symP (sub-proj f)) _Because we have assumed that cocartesian maps are stable when pulled back along cartesian maps over projections2, this map is also cocartesian β and, you guessed it β the spiced-up introduction rule is also natural.
opaque
β¨β¨Ύβ©-cocartesian
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ} β {f : E.Hom[ Ο ] x y}
β is-cartesian E Ο f β (a : D.Ob[ Ξ β¨Ύ y ])
β is-cocartesian D ΟαΆ β¨ f β¨Ύ a β©
β¨β¨Ύβ©-cocartesian {x = x} {y = y} {Ο = Ο} {f = f} cart a =
β-beck-chevalley cart
(symP (β¨β¨Ύβ©-weaken f a))
(β¨β©-cocartesian y a)
D.Ο*.cartesian
D.Ο*.cartesian
module β¨β¨Ύβ©-cocartesian
{Ξ Ξ x y} {Ο : Hom Ξ Ξ} {f : E.Hom[ Ο ] x y}
(cart : is-cartesian E Ο f) (a : D.Ob[ Ξ β¨Ύ y ])
= is-cocartesian (β¨β¨Ύβ©-cocartesian cart a) opaque
unfolding β¨_β¨Ύ_β©
β¨β¨Ύβ©-natural
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ}
β {a b : D.Ob[ Ξ β¨Ύ y ]}
β (f : D.Hom[ id ] a b) (g : E.Hom[ Ο ] x y)
β β¨ g β¨Ύ b β© D.β' D*.β (Ο β¨ΎΛ’ g) f D.β‘[ id-comm ] D*.β Ο β[ f ] D.β' β¨ g β¨Ύ a β©
β¨β¨Ύβ©-natural {x = x} {y = y} {Ο = Ο} {a = a} {b = b} f g =
D.Ο*.uniquepβ _ _ _ _ _
(D.pulll[] _ (D.Ο*.commutesp (sym (sub-proj g)) _)
D.β[] D.pullr[] _ (D.Ο*.commutesp id-comm _))
(D.pulll[] _ (D.Ο*.commutesp id-comm _)
D.β[] D.pullr[] _ (β¨β¨Ύβ©-weaken g a)
D.β[] D.extendl[] _ (β[]-natural f))This lets us extend a substitution into a substitution
opaque
β-sub
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ} {f : E.Hom[ Ο ] x y}
β is-cartesian E Ο f β (a : D.Ob[ Ξ β¨Ύ y ])
β D.Hom[ id ] (D*.β Ο (β y a)) (β x (D*.β (Ο β¨ΎΛ’ f) a))
β-sub {x = x} {Ο = Ο} {f = f} cart a =
β¨β¨Ύβ©-cocartesian.universalv cart a β¨ x , (D*.β (Ο β¨ΎΛ’ f) a) β©
β-sub-β¨β¨Ύβ©
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ} {f : E.Hom[ Ο ] x y}
β (cart : is-cartesian E Ο f) β (a : D.Ob[ Ξ β¨Ύ y ])
β β-sub cart a D.β' β¨ f β¨Ύ a β© D.β‘[ idl _ ] β¨ x , (D*.β (Ο β¨ΎΛ’ f) a) β©
β-sub-β¨β¨Ύβ© cart a =
β¨β¨Ύβ©-cocartesian.commutesv cart a _
β-sub-natural
: β {Ξ Ξ x y} {Ο : Hom Ξ Ξ} {f : E.Hom[ Ο ] x y}
β {a b : D.Ob[ Ξ β¨Ύ y ]}
β (cart : is-cartesian E Ο f)
β (g : D.Hom[ id ] a b)
β β-sub cart b D.β' D*.β Ο β[ g ] β‘ β[ D*.β (Ο β¨ΎΛ’ f) g ] D.β' β-sub cart a
β-sub-natural {x = x} {y = y} {Ο = Ο} {f = f} {a = a} {b = b} cart g =
β¨β¨Ύβ©-cocartesian.uniquepβ cart a _ _ _ _ _
(D.pullr[] _ (symP (β¨β¨Ύβ©-natural g f))
D.β[] D.pulll[] _ (β¨β¨Ύβ©-cocartesian.commutesv cart b _))
(D.pullr[] _ (β¨β¨Ύβ©-cocartesian.commutesv cart a _)
D.β[] β[]-natural (D*.β (Ο β¨ΎΛ’ f) g))