I had never before realised the immense usefulness of the Yoneda lemma. In the past few sections of Mac Lane’s and Moerdijk’s “Sheaves in Geometry and Logic”, it’s been used both as a proof tool and as a heuristic for finding the right definition of a functor (in this case, the exponential functor in a presheaf category).

Here is a direct proof that does not require the machinery used by CWM. Seeing that there is “only one thing you can do” at any point of the proof, this proof is surely not new (indeed, I suspect it’s the same proof Prakash Panangaden gave in his category theory lectures at McGill in summer 2012).

The Lemma

Lemma (Yoneda). Let \(F : \mathbf{C} \to \mathbf{Sets}\) be a functor from a locally small category \(\mathbf{C}\). Then for all objects \(C\) of \(\mathbf{C}\),

$$ \gdef{\Nat}{\mathrm{Nat}} \gdef{\Hom}{\mathrm{Hom}} \gdef{\naturalto}{\Rightarrow} \Nat(\Hom(C, -), F) \simeq FC, $$

and this bijection is natural in \(C\) and \(F\).

Proof. We claim that the map

$$ \begin{aligned} \phi : \Nat(\Hom(C, -), F) &\to FC\\ \eta &\mapsto \eta_C 1_C \end{aligned} $$

is the bijection we want. So see why, observe that each natural transformation \(\eta : \Hom(C, -) \naturalto FC\) is uniquely determined by the of \(1_C : C \to C\). Indeed, let \(f : C \to D\) be arbitrary. Then by naturality of \(\eta\), we must have \(\eta_D f = F(f)(\eta_C 1_C)\):

commuting diagram

Accordingly, every element \(c \in FC\) gives rise to the natural transformation determined by \(\rho_C(1_C) = c\). So \(\phi\) is surjective. Conversely, if for two natural transformations \(\eta\), \(\rho\), \(\eta 1_C = \rho 1_C\), then for all \(f : C \to D\),

$$ \eta_D f = F(f)(\eta_C 1_C) = F(f)(\rho_C 1_C) = \rho_D f $$

So \(\eta = \rho\) by extensionality. So \(\phi\) is injective. So \(\phi\) is a bijection.

We now show naturality in \(F\). Let \(\gamma : F \naturalto G\) be a natural transformation. But this is immediate by the equality \((\gamma_C \circ \eta_C) = (\gamma \circ \eta)_C\):

commuting diagram

Next, we show naturality in \(C\). Suppose \(f : C \to D\). Then, by naturality of \(\eta\) (see the first diagram), we have \(\eta_D f = F(f)(\eta_C 1_C)\), so

$$ \begin{aligned} &\phi_D(\eta_D \circ\Hom(f,D))\\ &=(\eta_D \circ\Hom(f,D))(1_D)\\ &=\eta_Df\\ &=F(f)(\eta_C1_C). \end{aligned} $$

This means that the following diagram describing the naturality of \(\phi\) in \(C\) commutes (remark the cancellation of contravariance):

commuting diagram

So we conclude that \(\phi\) is also natural in \(C\). Q.E.D.

Questions

As I type this up, a few questions come to mind.

  1. What happens when \(F\) is representable, that is, when it is naturally isomorphic to \(\Hom(C, -)\) for some object \(C\) of \(\mathbf{C}\)? There’s no obvious reason (to me) why representability implies that every natural transformation \(\Hom(C, -) \naturalto F\) has to be an isomorphism. Is there a way to characterise these isomorphisms by means of the Yoneda lemma?

  2. I remember having found with a friend some cool applications of the Yoneda lemma to posets a few summers ago. Unfortunately, they were done on a whiteboard and I’ve been unable to rediscover them. So: what are some cool applications of the Yoneda lemma to posets?