---
tag: 8P9PJG95H3
kind: statement
role: theorem
name: Density theorem
msc: [18A25, 18A30]
uses: [A2DE66937D, AND2WHZC8P, 4DKB6AQ8J7, BJS1CGTKQ5, S9EJKKRHW1, KCCHH87H6E, 1X0WKFQX8K]
about: [AND2WHZC8P, KCCHH87H6E]
sources:
  - url: https://en.wikipedia.org/wiki/Density_theorem_(category_theory)
same_as:
  wikidata: Q48996306
  wikipedia: Density theorem (category theory)
---

## Statement

Let $\mathcal{C}$ be a small [[category|A2DE66937D]], let $\widehat{\mathcal{C}} = [\mathcal{C}^{\mathrm{op}}, \mathbf{Set}]$ be the [[functor category|1X0WKFQX8K]] of [[presheaves|AND2WHZC8P]] on $\mathcal{C}$, and let $y \colon \mathcal{C} \to \widehat{\mathcal{C}}$ be the [[Yoneda embedding|4DKB6AQ8J7]].
Let $P$ be a presheaf on $\mathcal{C}$, and let $\int P$ be its [[category of elements|S9EJKKRHW1]], with objects the pairs $(c, x)$ such that $x \in P(c)$.
Let $\pi \colon \int P \to \mathcal{C}$ be the projection $(c, x) \mapsto c$.
Then $P$ is the [[colimit|BJS1CGTKQ5]] of the diagram $y \circ \pi \colon \int P \to \widehat{\mathcal{C}}$.
The colimit cocone has components $y(c) \to P$ given by the natural transformations that correspond to $x \in P(c)$ under the Yoneda lemma.

## Remarks

Proof idea: colimits in $\widehat{\mathcal{C}}$ are computed objectwise in $\mathbf{Set}$.
At an object $d$, the colimit of the sets $\Hom(d, c)$ over $(c, x) \in \int P$ is a quotient of the set of pairs $(g \colon d \to c, x \in P(c))$, and each pair is identified with $(\id_d, P(g)(x))$.
So the colimit at $d$ is $P(d)$, and the identifications are compatible with the maps of $P$.

Example: if $P = y(a)$ is itself [[representable|KCCHH87H6E]], then $\int P$ is the slice category over $a$, which has the terminal object $(a, \id_a)$, and the colimit is just $y(a)$.

In short: every presheaf is a colimit of representable presheaves.
Smallness of $\mathcal{C}$ makes $\int P$ small, so the colimit is a small colimit.

## Explanations

### L1 human

Representable presheaves are the building blocks of all presheaves.
Every presheaf can be glued together from copies of representable ones, one copy for each element, along the maps between those elements.
This is like saying that every set is the union of its one-point subsets, but in a setting with arrows.

### L2 human

The theorem is used to extend a functor $F \colon \mathcal{C} \to \mathcal{E}$ to all presheaves when $\mathcal{E}$ has colimits: send $P$ to the colimit of $F \circ \pi$.
This extension is the left Kan extension of $F$ along $y$, and it is left adjoint to the functor $E \mapsto \Hom_{\mathcal{E}}(F(-), E)$.
Geometric realisation of simplicial sets is built this way, from the standard simplices.
The theorem also shows that $\widehat{\mathcal{C}}$ is the free cocompletion of $\mathcal{C}$.
