module Cat.Displayed.Comprehension.Coproduct.Strong where

Strong comprehension coproductsπŸ”—

Let D\mathcal{D} and E\mathcal{E} be a pair of comprehension categories over the same base category B\mathcal{B}, such that D\mathcal{D} has coproducts over E\mathcal{E}. Type theoretically, this (roughly) corresponds to a type theory with a pair of syntactic categories (for instance, types and kinds), along with mixed-mode Ξ£\Sigma types.

We can model this using coproducts over a comprehension category, but the elimination principle we get from this setup is pretty weak: we really only have a recursion principle, not an elimination principle. That has to be be captured through an extra condition.

We say that a comprehension category has strong comprehension coproducts if (it has comprehension coproducts, and) the canonical substitution Ο€E,⟨x,a⟩\pi_{\mathcal{E}}, \langle x , a \rangle forms an orthogonal factorisation system with the weakening maps Ο€D\pi_{\mathcal{D}}. In more elementary terms, this means that any square diagram, as below, has a unique diagonal filler.

strong-comprehension-coproducts : Type _ strong-comprehension-coproducts = βˆ€ {Ξ“ Ξ”} (x : E.Ob[ Ξ“ ]) (a : D.Ob[ Ξ“ Q.β¨Ύ x ]) (b : D.Ob[ Ξ” ]) β†’ mβŠ₯m B (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) (P.Ο€αΆœ {x = b})


That's a very concise definition: too concise. Let's dig a bit deeper.



In the diagram, $B$ is a type in some context $\Delta$, and we have a
substitution $\sigma : \Gamma , \coprod_X A \to \Delta$ --- but, for
intuition, we might as well zap $\sigma$ to the identity: $B$ is a type
in context $\Gamma, \coprod_X A$.
In this simplified setting, the top morphism $\nu : \Gamma, X, A \to
\Gamma, B$ must be entirely determined by a "term" $\Gamma, x : X, a : A
\vdash \nu : B\langle x, a \rangle$, for the outer square to commute.
Then, we see that the diagonal filler is exactly an elimination
principle: since it too commutes with weakening, it must be determined
by a "term" $\Gamma, v : \coprod_X A \vdash B(v)$!

However, note that this elimination principle does **not** allow us to
eliminate an arbitrary object from $\cE$, which corresponds
type-theoretically having _no_ $\cE$-large elimination. This large
elimination is captured by [[very strong comprehension coproducts]],
which are extremely rare.

opaque ∐-strong-elim : βˆ€ {Ξ“ Ξ”} {x : E.Ob[ Ξ“ ]} {a : D.Ob[ Ξ“ Q.β¨Ύ x ]} {b : D.Ob[ Ξ” ]} β†’ (Οƒ : Hom (Ξ“ P.β¨Ύ ∐ x a) Ξ”) (Ξ½ : Hom (Ξ“ Q.β¨Ύ x P.β¨Ύ a) (Ξ” P.β¨Ύ b)) β†’ Οƒ ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ P.Ο€αΆœ ∘ Ξ½ β†’ Hom (Ξ“ P.β¨Ύ ∐ x a) (Ξ” P.β¨Ύ b) ∐-strong-elim {x = x} {a = a} {b = b} Οƒ Ξ½ p = strong x a b p .centre .fst
The upper-left triangle of the diagram gives us our $\beta$ law;
eliminating out of a substitution extended with an introduction form
gives us the original substitution.

opaque unfolding ∐-strong-elim ∐-strong-Ξ² : βˆ€ {Ξ“ Ξ”} {x : E.Ob[ Ξ“ ]} {a : D.Ob[ Ξ“ Q.β¨Ύ x ]} {b : D.Ob[ Ξ” ]} β†’ {Οƒ : Hom (Ξ“ P.β¨Ύ ∐ x a) Ξ”} {Ξ½ : Hom (Ξ“ Q.β¨Ύ x P.β¨Ύ a) (Ξ” P.β¨Ύ b)} β†’ (p : Οƒ ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ P.Ο€αΆœ ∘ Ξ½) β†’ ∐-strong-elim Οƒ Ξ½ p ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ Ξ½ ∐-strong-Ξ² p = strong _ p .centre .snd .fst
The lower-right triangle describes how substitution interacts with
eliminators; if we forget the thing we just eliminated into, then
we recover the substitution from $\Gamma, \coprod X A \to \Delta$.

<a id="strong-comprehension-coproducts.∐-strong-sub"></a><a id="6937" href="Cat.Displayed.Comprehension.Coproduct.Strong.html#6937" data-type="(Pβ‚‚ : Comprehension D)
(coprods : has-comprehension-coproducts D-fib E-fib Q) (strong : strong-comprehension-coproducts Pβ‚‚ coprods) (p : B₁ .Precategory._∘_ Οƒ ((D Comprehension.β¨ΎΛ’ D-fib) Pβ‚‚ (Comprehension.Ο€αΆœ E E-fib Q) (coprods .has-comprehension-coproducts.⟨,⟩ x a)) ≑ B₁ .Precategory._∘_ (Comprehension.Ο€αΆœ D D-fib Pβ‚‚) Ξ½) β†’ B₁ .Precategory._∘_ (Comprehension.Ο€αΆœ D D-fib Pβ‚‚) (strong-comprehension-coproducts.∐-strong-elim Pβ‚‚ coprods strong Οƒ Ξ½ p) ≑ σ” class=β€œFunction”>∐-strong-sub : βˆ€ {Ξ“ Ξ”} {x : E.Ob[ Ξ“ ]} {a : D.Ob[ Ξ“ Q.β¨Ύ x ]} {b : D.Ob[ Ξ” ]} β†’ {Οƒ : Hom (Ξ“ P.β¨Ύ ∐ x a) Ξ”} {Ξ½ : Hom (Ξ“ Q.β¨Ύ x P.β¨Ύ a) (Ξ” P.β¨Ύ b)} β†’ (p : Οƒ ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ P.Ο€αΆœ ∘ Ξ½) β†’ P.Ο€αΆœ ∘ ∐-strong-elim Οƒ Ξ½ p ≑ Οƒ ∐-strong-sub p = strong _ p .centre .snd .snd
Finally, uniqueness gives us an $\eta$; any other substitution that
walks like the eliminator and quacks like the eliminator is the
eliminator.

<a id="strong-comprehension-coproducts.∐-strong-Ξ·"></a><a id="7396" href="Cat.Displayed.Comprehension.Coproduct.Strong.html#7396" data-type="(Pβ‚‚ : Comprehension D)
(coprods : has-comprehension-coproducts D-fib E-fib Q) (strong : strong-comprehension-coproducts Pβ‚‚ coprods) (p : B₁ .Precategory._∘_ Οƒ ((D Comprehension.β¨ΎΛ’ D-fib) Pβ‚‚ (Comprehension.Ο€αΆœ E E-fib Q) (coprods .has-comprehension-coproducts.⟨,⟩ x a)) ≑ B₁ .Precategory._∘_ (Comprehension.Ο€αΆœ D D-fib Pβ‚‚) Ξ½) (other : B₁ .Precategory.Hom ((D Comprehension.β¨Ύ D-fib) Pβ‚‚ Γ₁ (coprods .has-comprehension-coproducts.∐ x a)) ((D Comprehension.β¨Ύ D-fib) Pβ‚‚ Δ₁ b)) β†’ B₁ .Precategory._∘_ other ((D Comprehension.β¨ΎΛ’ D-fib) Pβ‚‚ (Comprehension.Ο€αΆœ E E-fib Q) (coprods .has-comprehension-coproducts.⟨,⟩ x a)) ≑ Ξ½ β†’ B₁ .Precategory._∘_ (Comprehension.Ο€αΆœ D D-fib Pβ‚‚) other ≑ Οƒ β†’ other ≑ strong-comprehension-coproducts.∐-strong-elim Pβ‚‚ coprods strong Οƒ Ξ½ p” class=β€œFunction”>∐-strong-Ξ· : βˆ€ {Ξ“ Ξ”} {x : E.Ob[ Ξ“ ]} {a : D.Ob[ Ξ“ Q.β¨Ύ x ]} {b : D.Ob[ Ξ” ]} β†’ {Οƒ : Hom (Ξ“ P.β¨Ύ ∐ x a) Ξ”} {Ξ½ : Hom (Ξ“ Q.β¨Ύ x P.β¨Ύ a) (Ξ” P.β¨Ύ b)} β†’ (p : Οƒ ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ P.Ο€αΆœ ∘ Ξ½) β†’ (other : Hom (Ξ“ P.β¨Ύ ∐ x a) (Ξ” P.β¨Ύ b)) β†’ other ∘ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) ≑ Ξ½ β†’ P.Ο€αΆœ ∘ other ≑ Οƒ β†’ other ≑ ∐-strong-elim Οƒ Ξ½ p ∐-strong-Ξ· p other Ξ² sub = ap fst (sym $ strong _ p .paths (other , Ξ² , sub))
Now, for some useful lemmas. If we eliminate by simply packaging up
the data into a pair, then we've done nothing. Categorically, this
means the unique filler of the following diagram is the identity
morphism.

~~~{.quiver}
\begin{tikzcd}
  {\Gamma,_{\cE}X,_{\cD}A} && {\Gamma,_{\cD}\coprod X A} \\
  \\
  {\Gamma,_{\cD}\coprod X A} && \Gamma
  \arrow["{\pi_{\cE},\langle X, A\rangle}"', from=1-1, to=3-1]
  \arrow["{\pi_{\cD}}", from=1-3, to=3-3]
  \arrow["{\pi_{\cD}}"', from=3-1, to=3-3]
  \arrow["{\pi_{\cE},\langle X, A\rangle}", from=1-1, to=1-3]
  \arrow["id", from=3-1, to=1-3]
\end{tikzcd}
~~~

<a id="strong-comprehension-coproducts.∐-strong-id"></a><a id="8460" href="Cat.Displayed.Comprehension.Coproduct.Strong.html#8460" data-type="(Pβ‚‚ : Comprehension D)
(coprods : has-comprehension-coproducts D-fib E-fib Q) (strong : strong-comprehension-coproducts Pβ‚‚ coprods) β†’ strong-comprehension-coproducts.∐-strong-elim Pβ‚‚ coprods strong (Comprehension.Ο€αΆœ D D-fib Pβ‚‚) ((D Comprehension.β¨ΎΛ’ D-fib) Pβ‚‚ (Comprehension.Ο€αΆœ E E-fib Q) (coprods .has-comprehension-coproducts.⟨,⟩ x a)) refl ≑ B₁ .Precategory.id” class=β€œFunction”>∐-strong-id : βˆ€ {Ξ“} {x : E.Ob[ Ξ“ ]} {a : D.Ob[ Ξ“ Q.β¨Ύ x ]} β†’ ∐-strong-elim P.Ο€αΆœ (Q.Ο€αΆœ P.β¨ΎΛ’ ⟨ x , a ⟩) refl ≑ id ∐-strong-id = sym (∐-strong-Ξ· refl id (idl ) (idr ))