Density theorem (category theory)

In category theory, a branch of mathematics, the density theorem states that every presheaf of sets is a colimit of representable presheaves in a canonical way.

For example, by definition, a simplicial set is a presheaf on the simplex category Δ and a representable simplicial set is exactly of the form $$\Delta^n = \operatorname{Hom}(-, [n])$$ (called the standard n-simplex) so the theorem says: for each simplicial set X,
 * $$X \simeq \varinjlim \Delta^n$$

where the colim runs over an index category determined by X.

Statement
Let F be a presheaf on a category C; i.e., an object of the functor category $$\widehat{C} = \mathbf{Fct}(C^\text{op}, \mathbf{Set})$$. For an index category over which a colimit will run, let I be the category of elements of F: it is the category where It comes with the forgetful functor $$p: I \to C$$.
 * 1) an object is a pair $$(U, x)$$ consisting of an object U in C and an element $$x \in F(U)$$,
 * 2) a morphism $$(U, x) \to (V, y)$$ consists of a morphism $$u: U \to V$$ in C such that $$(Fu)(y) = x.$$

Then F is the colimit of the diagram (i.e., a functor)
 * $$I \overset{p}\to C \to \widehat{C}$$

where the second arrow is the Yoneda embedding: $$U \mapsto h_U = \operatorname{Hom}(-, U)$$.

Proof
Let f denote the above diagram. To show the colimit of f is F, we need to show: for every presheaf G on C, there is a natural bijection:


 * $$\operatorname{Hom}_{\widehat{C}} (F, G) \simeq \operatorname{Hom} (f, \Delta_G)$$

where $$\Delta_G$$ is the constant functor with value G and Hom on the right means the set of natural transformations. This is because the universal property of a colimit amounts to saying $$\varinjlim -$$ is the left adjoint to the diagonal functor $$\Delta_{-}.$$

For this end, let $$\alpha: f \to \Delta_G$$ be a natural transformation. It is a family of morphisms indexed by the objects in I:
 * $$\alpha_{U, x}: f(U, x) = h_U \to \Delta_G(U, x) = G$$

that satisfies the property: for each morphism $$(U, x) \to (V, y), u: U \to V$$ in I, $$\alpha_{V, y} \circ h_u = \alpha_{U, x}$$ (since $$f((U, x) \to (V, y)) = h_u.$$)

The Yoneda lemma says there is a natural bijection $$G(U) \simeq \operatorname{Hom}(h_U, G)$$. Under this bijection, $$\alpha_{U, x}$$ corresponds to a unique element $$g_{U, x} \in G(U)$$. We have:
 * $$(Gu)(g_{V, y}) = g_{U, x}$$

because, according to the Yoneda lemma, $$Gu: G(V) \to G(U)$$ corresponds to $$- \circ h_u: \operatorname{Hom}(h_V, G) \to \operatorname{Hom}(h_U, G).$$

Now, for each object U in C, let $$\theta_U: F(U) \to G(U)$$ be the function given by $$\theta_U(x) = g_{U, x}$$. This determines the natural transformation $$\theta: F \to G$$; indeed, for each morphism $$(U, x) \to (V, y), u: U \to V$$ in I, we have:
 * $$(G u \circ \theta_V)(y) = (Gu)(g_{V, y}) = g_{U, x} = (\theta_U \circ Fu)(y),$$

since $$(Fu)(y) = x$$. Clearly, the construction $$\alpha \mapsto \theta$$ is reversible. Hence, $$\alpha \mapsto \theta$$ is the requisite natural bijection.