Solution (source code)

= Solution

Let $\mathcal C$ be a <locally small category>, let $h_A=\mathcal C(-,A)$ be a <representable presheaf>, and let $X:\mathcal C^{\mathrm{op}}\to\mathbf{Set}$. The <Yoneda lemma> gives a <bijection>, natural in $A$ and $X$,
$$
\boxed{\operatorname{Nat}(h_A,X)\cong X(A),\qquad
\alpha\longmapsto\alpha_A(1_A).}
$$
For $x\in X(A)$, define a <natural transformation> $\alpha^x:h_A\to X$ by
$$
\alpha^x_B(f)=X(f)(x)\qquad(f:B\to A).
$$
For $v:C\to B$, the <functor> composition law gives $X(v)\alpha^x_B(f)=X(fv)(x)=\alpha^x_C(fv)$, proving <naturality>. Conversely, naturality of any $\alpha:h_A\to X$ along $f:B\to A$ gives
$$
\alpha_B(f)=X(f)\alpha_A(1_A).
$$
Thus $\alpha$ is determined by its displayed element, and $\alpha^x_A(1_A)=x$ proves that the constructions are inverse.

A <natural transformation> $\theta:X\to Y$ sends the element to $\theta_A(x)$, which corresponds to $\theta\alpha^x$. A <morphism> $u:A'\to A$ induces $h_u:h_{A'}\to h_A$; precomposition by $h_u$ sends the element to $X(u)(x)$. This proves naturality in both variables and completes the <Yoneda lemma> proof.