title: Density theorem (category theory)
text: # 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
  
  * an object is a pair $(U,x)$ consisting of an object U in C and an element $x\in F(U)$,
  * a morphism $(U,x)\to (V,y)$ consists of a morphism $u:U\to V$ in C such that $(Fu)(y)=x.$
  
  It comes with the forgetful functor $p:I\to C$.
  
  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:
  
      $(Gu\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.
  
  