48 One system for categories and types

Every category theory and every type theory is one system with:

\[ \boxed { \begin {aligned} &\text {identity decides}\to \text {contexts and filling (a category)}\\ &\quad \to \Sigma _f\dashv f^*\dashv \Pi _f\ \ (\text {all type formers, limits, Kan extensions})\\ &\quad \to \begin {cases} e^2=e:\ \text {truncations, modalities, subobjects, reflections}\\ \sigma ^2=1:\ \text {duality }C^{op},\ \dagger ,\ \text {linear negation},\ \text {Boolean} \end {cases}\\ &\quad \to \text {axes: structure }\{\sigma ,\delta ,\pi \},\ \text {identity level},\ \text {involution},\\ &\qquad \ \ \text {modality},\ \text {generation},\ V,\ \text {size} \end {aligned} } \]
I. The core

K1 (contexts and filling form a category). Contexts are lists of places, and a morphism of contexts fills the places of one with terms of the other. Filling composes by filling into a filling, associatively and with \(\mathrm {id}\) as unit (Y5). Every type theory has such a category of contexts, and every category is one in this sense [1655, 1656].

K2 (identity decides). Y8: \(\mathrm {Nat}(\mathrm {Hom}(A,-),F)\simeq F(A)\). For identity types this is J (Y1). Objects are determined by what maps into or out of them, and universal properties are representability.

K3 (type formers are adjoints to filling). For a map of contexts \(f\), filling \(f^*\) has adjoints on both sides:

\begin{equation} \Sigma _f\dashv f^*\dashv \Pi _f . \tag{1084}\end{equation}

Place map \(f\) \(\Sigma _f\) \(\Pi _f\)
weakening \(\pi \) \(\sum \), \(\exists \) \(\prod \), \(\forall \)
diagonal \(\delta \) \(\mathrm {Id}\), \(=\) \(=\Rightarrow -\)
duplicating a type \(+\), \(\vee \) \(\times \), \(\wedge \)
diagonal \(C\to C^J\) colimit limit
any functor \(F\), by precomposition left Kan extension right Kan extension

Equality is \(\Sigma _\delta \) [183, 1649], and limits and colimits are the adjoints of the diagonal into diagrams. Kan extensions contain all of these [1645]. \(A\to -\) is right adjoint to \(A\times -\) (currying).

K4 (generated and determined). A type given by generators is an initial algebra, with recursion and induction as its use rule (N7, N8). A type given by its uses is a final coalgebra, with corecursion and coinduction. They are left and right, as in K3.

K5 (the involution: duality). \(C\mapsto C^{op}\) reverses arrows and satisfies \((C^{op})^{op}=C\). Every notion has a dual by \(\sigma \):

Notion Dual
limit colimit
\(\Pi \) \(\Sigma \)
inductive coinductive
monad comonad
initial terminal

K6 (the idempotent: reflection). An idempotent monad \(T^2\simeq T\) is a reflection onto its fixed objects (L25). It covers:

Splitting idempotents is Cauchy completion.

II. The seven axes

X1 (structural maps). Which of \(\sigma \) (exchange), \(\delta \) (contraction) and \(\pi \) (weakening) act naturally on contexts:

Allowed Logic Categories
\(\sigma ,\delta ,\pi \) intuitionistic cartesian (closed)
\(\sigma ,\pi \) affine semicartesian symmetric monoidal
\(\sigma ,\delta \) relevant symmetric monoidal with diagonals
\(\sigma \) linear symmetric monoidal (closed)
none ordered (Lambek) monoidal biclosed

A symmetric monoidal category is cartesian exactly when every object carries natural \(\delta \) and \(\pi \) [1657]: the place maps are the structural rules [278, 1658].

X2 (level of identity).

Level Identity of elements Categories
\(-1\) any two proofs equal (propositions) preorders, hyperdoctrines
\(0\) identity is a proposition (sets) 1-categories, toposes
\(1\) identity is a set groupoids, 2-categories
\(\infty \) identities of identities, without end \(\infty \)-groupoids, \((\infty ,1)\)-categories

Iterated identity types make every type an \(\infty \)-groupoid [788, 1659, 1660]. Univalence makes identity of types equivalence: counts as in N0, lifted to every level [193]. For categories, isomorphic objects being identical is univalence (Rezk completeness) [1661].

X3 (involution).

Involution Theory
none intuitionistic; cartesian closed
\(\dagger \), with \(\dagger \dagger =1\) dagger categories; quantum processes [218]
\(A^{\perp \perp }=A\) classical linear logic; \(*\)-autonomous [1662, 1663]
\(\neg \neg =1\) on \(\Omega \) classical logic; Boolean toposes

Compact closure gives each \(A\) a dual with unit \(I\to A^*\otimes A\) and counit \(A\otimes A^*\to I\). Its snake equations are the triangle identities of Y9.

X4 (modalities). Idempotent monads and comonads (K6):

X5 (generation).

Generation Example
inductive \(\mathbb N\), lists, trees; initial algebras
coinductive streams; final coalgebras
higher inductive generators include identifications, e.g. \(S^1\) from a point and a loop

X6 (base of enrichment). Homs valued in a monoidal \(V\), with composition the sum over a matched middle [1666]:

\(V\) Categories
truth values preorders; relations (allegories [1667])
sets ordinary categories
\([0,\infty ]\) metric spaces [1668]
abelian groups additive and abelian categories
vector spaces linear categories
categories 2-categories

With biproducts, sum equals product: both adjoints of \(\delta \) coincide.

X7 (size). Universes are types of types: object classifiers. Impredicative quantification over a universe gives polymorphism (System F) [1669, 1670].

III. The dictionary

Logic Type theory Category theory
proposition type object
proof term morphism
\(\top \) / \(\bot \) \(1\) / \(0\) terminal / initial
\(\wedge \) / \(\vee \) \(\times \) / \(+\) product / coproduct
\(\Rightarrow \) \(\to \) exponential
\(\forall \) / \(\exists \) \(\Pi \) / \(\Sigma \) right / left adjoint of \(f^*\)
\(=\) \(\mathrm {Id}\) \(\Sigma _\delta \); path object
induction inductive type initial algebra
coinduction coinductive type final coalgebra
\(\Box \), \(\Diamond \) modal type idempotent (co)monad
\(\otimes \), \(\multimap \) linear type symmetric monoidal closed
truth values propositions subobject classifier \(\Omega \)
IV. Type theories and their categories

Type theory Category Axes
simply typed \(\lambda \) cartesian closed [1655] X1 full, X2 \(0\)
extensional Martin-Löf locally cartesian closed [1671, 1672] \(+\Sigma ,\Pi \)
higher-order logic elementary topos \(+\Omega \)
classical higher-order logic Boolean topos X3 \(\neg \neg =1\)
homotopy type theory \((\infty ,1)\)-topos [136, 748] X2 \(\infty \), univalence, HITs
cubical type theory cubical-set models [1673] univalence by computation
System F PL-categories [1670] X7 impredicative
linear logic \(*\)-autonomous [1663] X1 \(\sigma \), X3 \(\perp \perp \)
Lambek calculus monoidal biclosed [1658] X1 none
modal (S4) comonad X4
cohesive HoTT cohesive \(\infty \)-topos [1665] X4 cohesion
algebraic theories Lawvere theories [1258] rows of places
regular / coherent logic regular / coherent categories fragments of K3
quantum processes dagger compact [218] X3 \(\dagger \), compact
V. Kinds of category as values of the axes

Kind Value
monoid / ring / algebra one object, \(V=\) sets / abelian groups / vector spaces (B2, B4)
preorder; Heyting algebra X2 \(=-1\); with \(\Rightarrow \) (A2)
groupoid every arrow invertible
monoidal / symmetric X1 \(\{\}\) / \(\{\sigma \}\)
cartesian X1 \(\{\sigma ,\delta ,\pi \}\)
closed right adjoint to \(A\otimes -\)
dagger / compact X3 \(\dagger \) / duals with snake equations
additive / abelian X6 abelian groups, biproducts
allegory relations with \(\dagger \) and \(\le \) (B1)
topos finite limits, exponentials, \(\Omega \)
\(n\)-category, \(\infty \)-category X2 \(=n,\infty \)
fibration / indexed category judgments over contexts (K1)
VI. What the system says