Solution (source code)

= Solution

Write $H_c=\mathcal C(-,c)$. The <category of elements> $\int P$ of a <categorical presheaf> $P$ has objects $(c,x)$ with $x\in P(c)$; a <morphism> $(c,x)\to(d,y)$ is $u:c\to d$ satisfying $P(u)y=x$. It is a <small category> because $\mathcal C$ is small and each $P(c)$ is a <set>. Consider the diagram sending $(c,x)$ to $H_c$ and $u$ to the <natural transformation> given by postcomposition with $u$.

There is a canonical cocone $\alpha_{c,x}:H_c\to P$ with
$$
(\alpha_{c,x})_a(v)=P(v)x\qquad(v:a\to c).
$$
Functoriality makes it a <natural transformation>, and the equation $P(u)y=x$ makes these transformations a cocone.

To prove its <universal property>, let $Q$ be any <categorical presheaf> with a compatible cocone $\beta_{c,x}:H_c\to Q$. Define
$$
t_c(x)=(\beta_{c,x})_c(1_c).
$$
For $u:c\to d$ and $y\in P(d)$, compatibility with the arrow $(c,P(u)y)\to(d,y)$ gives
$$
t_c(P(u)y)=(\beta_{d,y})_c(u)=Q(u)(\beta_{d,y})_d(1_d)=Q(u)t_d(y).
$$
Thus $t:P\to Q$ is natural. <Naturality> of each $\beta_{c,x}$ shows $t\alpha_{c,x}=\beta_{c,x}$. Conversely any transformation with these equations must have the displayed values $t_c(x)$, so it is unique. We have proved the <canonical colimit presentation of a presheaf>:
$$
\boxed{P\cong\operatorname{colim}_{(c,x)\in\int P}H_c.}
$$