Yoneda’s Lemma
Okay, time to roll up our sleeves and get into one of the bits that makes category theory so immensely tweaky: Yoneda’s Lemma.
First, let’s lay out a bit of notation. Given a category and an object
we’ll use
to denote the covariant functor represented by
and
to denote the contravariant one. That is,
and
.
Now given a covariant functor , we’re interested in the set of natural transformations
. Note that not all of these are natural isomorphisms. Indeed,
may not be representable at all. Still, there can be natural transformations going in one direction.
The Yoneda Lemma is this: there is a bijection between and
.
Seriously.
And the proof is actually pretty clear too. One direction leaps out when you think of it a bit. A natural transformation has components
, sending morphisms of
to elements of certain sets. Now, given any category and any object, what morphism do we know to exist for certain? The identity on
! So take
and stick it into
and we get an element
. The really amazing bit is that this element completely determines the natural transformation!
So let’s start with a category , an object
, a functor
, and an element
. From this data we’re going to build the unique natural transformation
so that
. We must specify functions
so that for every arrow
in
we satisfy the naturality condition. For now, let’s focus on the naturality squares for morphisms
, and we’ll show that the other ones follow. This square is:
where the horizontal arrows are and
, respectively. Now this square must commute no matter what we start with in the upper-left corner, but let’s see what happens when we start with
. Around the upper right this gets sent to
, and then down to
. Around the lower left we first send
to
, which then gets sent to
. So, in order for these chosen naturality squares to commute for this specific starting value we must define
so that
.
Now I say that these definitions serve to make all the naturality squares commute. Let be any arrow in
and write out the square:
Now, starting with we send it right to
, and then down to
. On the other side we send
down to
, and then right to
. And thus the square commutes.
So, for every natural transformation we have an element
, for every element
we have a natural transformation
, and these two functions are clearly inverses of each other.
Almost identically, there’s a contravariant Yoneda Lemma, saying that for every contravariant functor
. You can verify that you’ve understood the proof I’ve given above by adapting it to the proof of the contravariant version.
There’s a lot here, and although it’s very elegant it may not be clear why it’s so interesting. I’ll come back tomorrow to try explaining what the Yoneda Lemma means.
Annoying technology
WordPress’ native anti-spam measure Akismethas gone on the blink. Every comment I try posting to other WordPress sites is getting eaten. In particular, if the Angry Physicist reads this I hope he’ll try finding my recent attempt at commenting in his spam queue.
Anyhow, I’ll be doing some testing here to see if I can even comment on my own weblog. I do know that a few days ago one of my own posts’ trackbacks to an earlier post of mine got flagged, but I’d made numerous comments on other WordPress sites since then. Still, maybe Dr. Kaczynski had the right idea about technology.
[UPDATE]: Fifty tries of commenting last night and marking them as “not spam” and still nothing. WordPress uses this spam catcher which is allowed to capriciously decide that my IP address is a spammer with no notice, recourse for me, or accountability on their part. Akismet is broken and needs to be fixed.