The Yoneda Lemma
The Yoneda lemma has been being complainted as “hard to understand” for a long time. Indeed it is not very easy, so I was trying to come up with a way to understand it more intuitively.
Everyone knows the analogy by Ravi Vakil:
You work at a particle accelerator. You want to understand some particle. All you can do are throw other particles at it and see what happens. If you understand how your mystery particle responds to all possible test particles at all possible test energies, then you know everything there is to know about your mystery particle.
But how to see that in actions?
Throw a particle at it…or we can throw more at once?
Start with the simplest probe with a one-point set $A = {\ast}$. A probe ${\ast} \to X$ just selects an element of $X$, so $X$ is bijective to the set of all maps from $A$ to $X$.
But…what stops us from throwing 2 at the same time?
Our first instinct might be probing with $A = {a, b}$. But if there is no restrictions on where can $a$ and $b$ map to, it would be a lot of redundancy in the set of all maps from $A$ to $X$: because in this case, for a finite $X$, the set of all maps has size $2^X$. The extra element in the probing set is doing duplicated work.
So, the easiest solution of this is to force $a$ and $b$ map to different elements — which means we want some kind of relation between the things that we use to probe, and the probes need to respect the relation.
That’s exactly what bring us to the idea of using category theory, isn’t it?
If we can probe with 2 elements, we can also probe with any sets; if we can probe with any set, we can also probe with many many sets at once. We can go even further: why stop at probing a set at a time? We can probe all of them at the same time!
That should give us the idea to have the following setup: We probe the category $\mathbf{Set}$ with another category $\mathbf{C}$, with a functor $F$ as a probe. Now, pick a set $F(c)$ that is probed by an object $c$, we should be able to recover $F(c)$ by two things: the probe, and the relations/structure (i.e. either $Hom(c, -)$ or $Hom(-, c)$).
With these two data, we can ask: how many different ways you can project the structure concerning $c$ into F?
The homomorphisms between cyclic groups.
Just like functors respect the structure of categories, natural transformations respect the structure of functors. $Nat(Hom(c,-), F)$ is exactly what we want.
Think about a group homomorphism (which respect the structure of groups) $\phi: \mathbb{Z} \to G$, once you commit to $\phi(1) = g$ everything else follows.
Now $Hom(c, -)$. It is the relation-free, freely-generated case just like $\mathbb{Z}$. The “generator” of $Hom(c, -)$ is the most natural one: $\mathbf{C}(c, c)$. So deciding $u = \alpha_c(\text{id}_c) \in F(c)$ locks in $\alpha_X(f) = F(f)(u)$ for all $f$, and any $u$ is a legal choice. One decision, no strings attached, the entire transformation.
And that’s exactly how you think about proving Yoneda lemma too.