# nLab locally cartesian closed category

category theory

## Applications

#### Monoidal categories

monoidal categories

## With traces

• trace

• traced monoidal category?

# Contents

## Definition

A locally cartesian closed category is a category $C$ whose slice categories $C/x$ are all cartesian closed.

If a locally cartesian closed category $C$ has a terminal object, then $C$ is itself cartesian closed and in fact has all finite limits (because, cartesian products in $C/x$ are pullbacks in $C$); often this requirement is included in the definition.

Equivalently, a locally cartesian category $C$ is a category with pullbacks (and a terminal object, if required) such that each base change functor ${f}^{*}:C/y\to C/x$ has a right adjoint ${\Pi }_{f}$, called the dependent product. (This equivalence is discussed in detail below.)

In particular, such pullbacks preserve all colimits. Therefore, if a locally cartesian closed category has finite colimits, it is automatically a coherent category and in fact a Heyting category.

## Properties

### Cartesian closure in terms of base change and dependent product

We show how the dependent product and the internal hom in the slice categories may be used to express each other.

#### In category theory

###### Proposition

Let $𝒞$ be a category with pullbacks that has all dependent products ${\prod }_{•}$, equivalently that every morphism $f:E\to X$ in $𝒞$ induces an adjoint triple

${𝒞}_{/E}\stackrel{\stackrel{\sum _{f}}{\to }}{\stackrel{\stackrel{{f}^{*}}{←}}{\underset{\prod _{f}}{\to }}}{𝒞}_{/X}\phantom{\rule{thinmathspace}{0ex}}.$\mathcal{C}_{/E} \stackrel{\overset{\sum_f}{\to}}{\stackrel{\overset{f^*}{\leftarrow}}{\underset{\prod_f}{\to}}} \mathcal{C}_{/X} \,.

Then the internal hom in a slice ${𝒞}_{/X}$ exists and is given by

$\left[⟨E\stackrel{f}{\to }X⟩\phantom{\rule{thickmathspace}{0ex}},\phantom{\rule{thickmathspace}{0ex}}-{\right]}_{{𝒞}_{/X}}\simeq \prod _{f}\circ {f}^{*}\phantom{\rule{thinmathspace}{0ex}}.$[\langle E \stackrel{f}{\to} X\rangle \; ,\; -]_{\mathcal{C}_{/X}} \simeq \prod_f \circ f^* \,.
###### Proof

By the discusson at overcategory-Limits and colimits the product in the slice ${𝒞}_{/X}$ of two objects $⟨{E}_{1}\stackrel{{f}_{1}}{\to }X⟩$ and $⟨{E}_{1}\stackrel{{f}_{2}}{\to }X⟩$ is given by the pullback ${f}_{1}^{*}{E}_{2}={f}_{2}^{*}{E}_{1}$ in $𝒞$, regarded again as a morphism over $X$. More formally this means that the product with $⟨E\stackrel{f}{\to }X⟩$ is given by the composite

$\left(-\right){×}_{{𝒞}_{/X}}⟨E\stackrel{f}{\to }X⟩\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}:\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}{𝒞}_{/X}\stackrel{{f}^{*}}{\to }{𝒞}_{/E}\stackrel{\sum _{f}}{\to }{𝒞}_{/X}$(-) \times_{\mathcal{C}_{/X}} \langle E \stackrel{f}{\to} X\rangle \;\;\;:\;\;\; \mathcal{C}_{/X} \stackrel{f^*}{\to} \mathcal{C}_{/E} \stackrel{\sum_f}{\to} \mathcal{C}_{/X}

of the pullback along $f$ with the dependent sum along $f$. By the above adjoint triple both these morphisms have right adjoints and so the composite of the right adjoints is the right adjoint of the composite, hence is the internal hom:

${𝒞}_{/X}\stackrel{\prod _{f}}{←}{𝒞}_{/E}\stackrel{{f}^{*}}{←}{𝒞}_{/X}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}:\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\left[⟨E\stackrel{f}{\to }X⟩,-{\right]}_{{𝒞}_{/X}}\phantom{\rule{thinmathspace}{0ex}}.$\mathcal{C}_{/X} \stackrel{\prod_f}{\leftarrow} \mathcal{C}_{/E} \stackrel{f^* }{\leftarrow} \mathcal{C}_{/X} \;\;\;:\;\;\; [\langle E\stackrel{f}{\to} X \rangle, -]_{\mathcal{C}_{/X}} \,.
###### Proposition

If for a category $𝒞$ every slice category is a cartesian closed category, then for every morphism $f:X\to Y$ in $𝒞$ the dependent product ${\prod }_{f}$ exists and is given on an object $E\stackrel{p}{\to }X$ by the pullback

$\begin{array}{ccc}\prod _{f}⟨E\stackrel{p}{\to }X⟩& \to & \left[⟨X\stackrel{f}{\to }Y⟩,⟨E\stackrel{p}{\to }X\stackrel{f}{\to }Y⟩{\right]}_{{𝒞}_{/Y}}\\ ↓& & ↓\\ Y& \stackrel{\overline{\mathrm{id}}}{\to }& \left[⟨X\stackrel{f}{\to }Y⟩,⟨X\stackrel{f}{\to }Y⟩{\right]}_{{𝒞}_{/Y}}\end{array}$\array{ \prod_f \langle E \stackrel{p}{\to} X\rangle &\to& [\langle X \stackrel{f}{\to}Y\rangle, \langle E \stackrel{p}{\to}X \stackrel{f}{\to} Y\rangle]_{\mathcal{C}_{/Y}} \\ \downarrow && \downarrow \\ Y &\stackrel{\bar id}{\to}& [\langle X \stackrel{f}{\to}Y \rangle,\langle X \stackrel{f}{\to}Y \rangle]_{\mathcal{C}_{/Y}} }

in ${𝒞}_{/Y}$, where the bottom morphism is the adjunct of

$Y{×}_{{𝒞}_{/Y}}⟨X\stackrel{f}{\to }Y⟩\simeq ⟨X\stackrel{f}{\to }Y⟩\stackrel{\mathrm{id}}{\to }⟨X\stackrel{f}{\to }Y⟩\phantom{\rule{thinmathspace}{0ex}}.$Y \times_{\mathcal{C}_{/Y}} \langle X \stackrel{f}{\to} Y\rangle \simeq \langle X \stackrel{f}{\to}Y\rangle \stackrel{id}{\to} \langle X \stackrel{f}{\to}Y\rangle \,.
###### Proof

It is sufficient to check the $\left({f}^{*}⊣{\prod }_{f}\right)$-adjunction hom set-natural isomorphism

${𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,\prod _{f}⟨E\stackrel{p}{\to }X⟩\right)\simeq {𝒞}_{/X}\left({f}^{*}⟨F\stackrel{}{\to }Y⟩,⟨E\stackrel{p}{\to }X⟩\right)\phantom{\rule{thinmathspace}{0ex}},$\mathcal{C}_{/Y}( \langle F \stackrel{}{\to} Y\rangle , \prod_f \langle E \stackrel{p}{\to} X\rangle) \simeq \mathcal{C}_{/X}(f^* \langle F \stackrel{}{\to} Y\rangle, \langle E \stackrel{p}{\to} X\rangle) \,,

natural in $⟨F\stackrel{}{\to }Y⟩$.

Since the hom functor ${𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,-\right)$ preserves limits and hence pullbacks, the expression on the left is exhibited as the pullback

$\begin{array}{ccc}{𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,\prod _{f}⟨E\stackrel{p}{\to }X⟩& \to & {𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,\left[⟨X\stackrel{f}{\to }Y⟩,⟨E\stackrel{p}{\to }X\stackrel{f}{\to }Y⟩{\right]}_{{𝒞}_{/Y}}\right)\\ ↓& & ↓\\ *& \stackrel{}{\to }& {𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,\left[⟨X\stackrel{f}{\to }Y⟩,⟨X\stackrel{f}{\to }Y⟩{\right]}_{{𝒞}_{/Y}}\right)\end{array}$\array{ \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle, \prod_f \langle E \stackrel{p}{\to} X\rangle &\to& \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle, [\langle X \stackrel{f}{\to}Y \rangle,\langle E \stackrel{p}{\to}X \stackrel{f}{\to} Y\rangle]_{\mathcal{C}_{/Y}}) \\ \downarrow && \downarrow \\ * &\stackrel{}{\to}& \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle,[\langle X \stackrel{f}{\to}Y \rangle,\langle X \stackrel{f}{\to}Y \rangle]_{\mathcal{C}_{/Y}}) }

in Set. Using the $\left(\left(-\right){×}_{{𝒞}_{/Y}}⟨X\stackrel{f}{\to }Y⟩⊣\left[⟨X\stackrel{f}{\to }Y⟩,-{\right]}_{{𝒞}_{/Y}}\right)$-adjunction this is equivalently

$\begin{array}{ccc}{𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩,\prod _{f}⟨E\stackrel{p}{\to }X⟩& \to & {𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩{×}_{{𝒞}_{/Y}}⟨X\stackrel{f}{\to }Y⟩,⟨E\stackrel{p}{\to }X\stackrel{f}{\to }Y⟩\right)\\ ↓& & ↓\\ *& \stackrel{}{\to }& {𝒞}_{/Y}\left(⟨F\stackrel{}{\to }Y⟩{×}_{{𝒞}_{/Y}}⟨X\stackrel{f}{\to }Y⟩,⟨X\stackrel{f}{\to }Y⟩\right)\end{array}\phantom{\rule{thinmathspace}{0ex}}.$\array{ \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle, \prod_f \langle E \stackrel{p}{\to} X\rangle &\to& \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle \times_{\mathcal{C}_{/Y}} \langle X \stackrel{f}{\to}Y \rangle, \langle E \stackrel{p}{\to}X \stackrel{f}{\to} Y\rangle) \\ \downarrow && \downarrow \\ * &\stackrel{}{\to}& \mathcal{C}_{/Y}(\langle F \stackrel{}{\to} Y\rangle \times_{\mathcal{C}_{/Y} }\langle X \stackrel{f}{\to}Y \rangle , \langle X \stackrel{f}{\to}Y \rangle) } \,.

This pullback now manifestly computes ${𝒞}_{/X}\left({f}^{*}⟨F\to Y⟩,⟨E\stackrel{p}{\to }X⟩\right)$.

###### Proposition

If $C$ is locally cartesian closed (i.e., if every slice $C/X$ is cartesian closed), then every slice $C/X$ is also locally cartesian closed.

###### Proof

The slice of a slice is a slice, i.e., for every $f:X\to Y$ there is an equivalence

$\left(C/Y\right)/\left(f:X\to Y\right)\simeq C/X$(C/Y)/(f \colon X \to Y) \simeq C/X

whence the statement immediately follows.

###### Proposition

If $C$ is locally cartesian closed (and has a terminal object), then the pullback functor $X×-:C\to C/X$ preserves both finite products and exponentials up to isomorphism.

###### Proof

Clearly $X×-:C\to C/x$, being right adjoint to the forgetful functor ${\sum }_{X}:C/X\to C$, preserves limits, hence it preserves finite products in particular.

Let $\varphi :A\to X$ be any morphism. From the pullback diagram

$\begin{array}{ccc}A×Z& \stackrel{\varphi ×1}{\to }& X×Z\\ {}_{{\pi }_{A}}↓& & {↓}_{{\pi }_{X}}\\ A& \underset{\varphi }{\to }& X\end{array}$\array{ A \times Z & \stackrel{\phi \times 1}{\to} & X \times Z \\ _\mathllap{\pi_A} \downarrow & & \downarrow _\mathrlap{\pi_X} \\ A & \underset{\phi}{\to} & X }

we conclude $A{×}_{X}\left(X×Z\right)\cong A×Z$, seen as an object over $X$ via $\varphi \circ {\pi }_{A}:A×Z\to X$. Thus arrows in the slice $C/X$ of the form

$A{×}_{X}\left(X×Z\right)\to X×Y$A \times_X (X \times Z) \to X \times Y

are in natural bijection with arrows in $C$ of the form

$A×Z\stackrel{⟨\varphi \circ {\pi }_{A},g⟩}{\to }X×Y$A \times Z \stackrel{\langle \phi \circ \pi_A, g\rangle}{\to} X \times Y

which in turn are in natural bijection with arrows in the slice $C/X$ of the form

$A\stackrel{⟨\varphi ,\stackrel{˜}{g}⟩}{\to }X×{Y}^{Z}$A \stackrel{\langle \phi, \tilde{g} \rangle}{\to} X \times Y^Z

(where $\stackrel{˜}{g}:A\to {Y}^{Z}$ is obtained by currying $g:A×Z\to Y$ in $C$). This proves that $X×-:C\to C/x$ preserves exponentials.

###### Corollary

For any $f:X\to Y$ in $C$, the base change ${f}^{*}:C/Y\to C/X$ preserves exponentials. In other words, the dependent sum functor ${\sum }_{f}$ and the dependent product functor ${\prod }_{f}$ satisfy Frobenius reciprocity.

###### Proof

This is by combining proposition 3 and proposition 4, and recalling that the pullback functor

$C/Y\to \left(C/Y\right)/\left(f:X\to Y\right)\simeq C/X$C/Y \to (C/Y)/(f \colon X \to Y) \simeq C/X

is identified with the pullback functor ${f}^{*}:C/Y\to C/X$.

This state of affairs may be summarized in terms of the notion of hyperdoctrine:

###### Proposition

If $C$ is a category with finite limits, then it is locally cartesian closed precisely if regarded as an $C$-indexed category (by forming slice categories) it is a hyperdoctrine.

For a proof of the statement in this form, see for instance (Freyd).

#### In type theory

We formulate some of the above considerations in the syntax of dependent type theory.

###### Proposition

Let

$\begin{array}{ccccc}X& & & & A\\ & {}_{\varphi }↘& & {↙}_{c}\\ & & B\end{array}$\array{ X &&&& A \\ & {}_{\mathllap{\phi}}\searrow && \swarrow_{\mathrlap{c}} \\ && B }

be two display maps. Then the category theoretic identification

$\left[X,A{\right]}_{B}=\prod _{\varphi }{\varphi }^{*}⟨A\stackrel{c}{\to }X⟩$[X,A]_{B} = \prod_\phi \phi^* \langle A \stackrel{c}{\to} X\rangle

from prop. 1 is the categorical semantics of the dependent type theory syntax

$b:B⊢X\left(b\right)\to A\left(b\right):\mathrm{Type}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}{=}_{\mathrm{def}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}b:B⊢\prod _{x:X\left(b\right)}A\left(\varphi \left(x\right)\right)\phantom{\rule{thinmathspace}{0ex}}.$b : B \vdash X(b) \to A(b) : Type \;\;\; =_{def} \;\;\; b : B \vdash \prod_{x : X(b)} A(\phi(x)) \,.
###### Remark

While equivalent under the relation between type theory and category theory, the latter expression almost verbatim expresses the evident idea that:

(collection of internal homs parameterized over $B$) = ( collection of sections of the pullback of $A$ to $X$ )

###### Proof

By definition, the display map on the right is expressed as the dependent type

$b:B⊢A\left(b\right):\mathrm{Type}\phantom{\rule{thinmathspace}{0ex}},$b : B \vdash A(b) : Type \,,

the pullback ${f}^{*}⟨A\to B⟩$ is expressed by substitution

$x:X⊢A\left(\varphi \left(x\right)\right):\mathrm{Type}$x : X \vdash A(\phi(x)) : Type

and next the dependent product ${\prod }_{\varphi }{\varphi }^{*}⟨A\to B⟩$ by

$b:B⊢\prod _{x:X\left(b\right)}A\left(\varphi \left(x\right)\right):\mathrm{Type}\phantom{\rule{thinmathspace}{0ex}}.$b : B \vdash \prod_{x : X(b)} A(\phi(x)) : Type \,.

Now on the right $\varphi \left(x\right){=}_{\mathrm{def}}b$, formally because $\varphi$ is equivalently the projection ${\mathrm{pr}}_{1}$ out of $X$ expressed as the direct sum

$\frac{\left(b,x\right):\sum _{b:B}X\left(b\right)}{{\mathrm{pr}}_{1}\left(b,x\right){=}_{\mathrm{def}}b{=}_{\mathrm{def}}\varphi \left(x\right):B}\phantom{\rule{thinmathspace}{0ex}}.$\frac{(b,x) : \sum_{b : B} X(b)} { pr_1(b,x) =_{def} b =_{def} \phi(x) : B} \,.

Inserting this in the above expression makes it definitionally equal to

$b:B⊢\prod _{x:X\left(b\right)}A\left(b\right):\mathrm{Type}\phantom{\rule{thinmathspace}{0ex}}.$b : B \vdash \prod_{x : X(b)} A(b) : Type \,.

This in now a dependent product over a type that does not actually depend on the context $B$, and hence by definition this is the dependent function type

$b:B⊢X\left(b\right)\to A\left(b\right):\mathrm{Type}\phantom{\rule{thinmathspace}{0ex}}.$b : B \vdash X(b) \to A(b) : Type \,.

which expresses the internal hom in the slice over $B$.

### Internal logic

The internal logic of locally cartesian closed categories is an extensional form of dependent type theory. In particular, the dependent product ${\Pi }_{f}$ represents an extensional dependent product type in the internal logic.

### Almost local cartesian closure

There are categories which are cartesian closed and not locally cartesian closed, but in which for some $f$ the base change functor ${f}^{*}:C/y\to C/x$ has a right adjoint. This includes $\mathrm{Cat}$, $\mathrm{Gpd}$, and the category of crossed complexes; in the latter two cases, it is necessary and sufficient for $f$ to be a fibration, while in $\mathrm{Cat}$ it is sufficient for $f$ to be a fibration or an opfibration.

## Examples

###### Proposition

Every sheaf topos is locally cartesian closed.

###### Proof

By Giraud's theorem, in a sheaf topos pullbacks preserve colimits. With the adjoint functor theorem this implies that for every morphism $f:X\to Y$, the pullback functor ${f}^{*}:{𝒞}_{/Y}\to {𝒞}_{/X}$ has a right adjoint ${\prod }_{f}$. By prop. 1 this yields the local cartesian closure.

## References

A standard textbook account is around corollary A1.5.3 in

The relation between local cartesian closure and base change/hyperdoctrine structure is sometimes attributed to

• Peter Freyd, Aspects of topoi, Bull. Australian Math. Soc. 7 (1972), 1-76.

A discussion of dependent type theory as the internal language of locally cartesian closed categories is in

• R. A. G. Seely, Locally cartesian closed categories and type theory, Math. Proc. Camb. Phil. Soc. (1984) 95 (pdf)

Related literature includes

• Marta Bunge, and Susan Niefield, Exponentiability and single universes J. Pure Appl. Algebra 148 (2000) 217–250.

• François Conduché, Au sujet de l’existence d’adjoints à droite aux foncteurs “image réciproque” dans la catégorie des catégories (French) C. R. Acad. Sci. Paris Sér. A-B 275 (1972), A891–A894.

• J. Howie, Pullback functors and crossed complexes , Cahiers Topologie Géom. Différentielle, 20 (1979) 281–296.

Revised on November 22, 2012 21:13:07 by Todd Trimble (67.81.93.16)