Universal Properties III - Yoneda's Lemma

Euripides

Every man is like the company he is wont to keep.

One of the most consistent philosophies throughout all of category theory is "It's all about the arrows." This is built into the very core of the theory, in that you don't even really need objects to define a category: they are in one-to-one correspondence with the identity arrows!

At a metaphorical level, an arrow f:cc in a category C can be thought of some information that each of c and c "see" about the other. So for a fixed object c, the collection of all arrows from c is the total information about the category C available to the object c; or dually, the set of all arrows to a fixed object c is all information available in the category C about the object c. From this point of view, what more information could there be about a given object? Nothing. The category is all there is, and in the category the only data are the arrows.

But how does one formalize this idea?

The original inspiration: universal properties

First revisit our pantheon of objects with universal properties. Looking over these examples, a clear pattern emerges. In each case was have an object c in a category C that is characterized by a "universal property," which can be expressed in the form of a bijection

τd:HomC(c,d)F(d)

that is "natural in d", where F:CSet is some functor.[1] This naturality, often stated but not articulated, is the formal embodiment of the idea that the bijection τd is defined "in the same way" for every dC, or at least "in a compatible way." What that means precisely is that for every arrow f:d1d2 in C we have a commutative diagram

This is exactly the diagram for a natural transformation τ:HomC(c,)F. The fact that all of the component functions τd are set bijections implies that τ is actually a natural isomorphism.

Examples

For illustration, we recall some specific examples of universal properties.

Coequalizers of set maps

Suppose X and Y are sets. Their disjoint union XY is the set characterized by the universal property that set maps f:XYZ are in natural bijection with pairs of set maps g:XZ, h:YZ. To put this into the above context, let F:SetSet be the functor that assigns:

τZ:HomSet(XY,Z)F(Z)

In other words, there is a natural isomorphism τ:HomSet(XY,)F.

Quotients by normal subgroups

Let N be a normal subgroup of a group G. The quotient group G/N, together with its projection morphism π:GG/N defined by gg+N, satisfies a universal property. Let F:GrpSet be the functor that assigns to each group H the set of group morphisms f:GH such that Nker(f). Then there is a natural bijection

τH:HomGrp(G/N,H)F(H).

Under this bijection, each group morphism g:G/NH is sent to the group morphism gπ:GH.

In other words, there is a natural isomorphism τ:HomGrp(G/N,)F.

Direct sums of abelian groups

If A and B are abelian groups, their direct sum is the abelian group AB. As a set, it consists of all pairs of formal sums a+b with aA and bB. The operation is defined "component-wise": (a+b)+(a+b)=(a+a)+(b+b). (Although not common, one could reasonably argue that a different notation should be used for the formal sum symbol, such as ab.) One can verify that AB is an abelian group, and that it comes equipped with two injective group morphisms i1:AAB and i2:BAB. Moreover, there is a natural bijection between group morphisms from AB and pairs of groups morphisms AC, BC:

τC:HomAb(AB,C)F(C),

where F(C)={(g1,g2)g1HomAb(A,C),g2HomAb(B,C)}. Under this bijection, each group morphism f:ABC is sent to the pair of group morphisms fi1:AC, fi2:BC.

In other words, there is a natural isomorphism τ:HomAb(AB,)F.

Free R-modules

Let R be a ring and U:R-ModSet be the usual forgetful functor. The free module construction takes each set A and produces an R-module F(A). The function which sends each aA to the same element aF(A) regarded as a formal R-linear sum of elements of A is an arrow j:AU(F(A)). For any other R-module M, each function f:AU(M) can be extended uniquely to a module morphism h:F(A)M with f=U(h)j.

In the current context, let G:R-ModSet be the functor that assigns to each R-module M the collection of set maps f:AU(M); i.e., G(M)=HomSet(A,U(M)). Then there is a natural bijection

τN:HomR(F(A),M)G(M).

In other words, there is a natural isomorphism τ:HomR(F(A),)G.

The tensor product construction

Suppose R is a commutative ring and M and N are left R-modules. By taking the standard R-module structure (i.e., (R,R)-bimodule structure) on M and the canonical (R,Z)-bimodule structure on N, we can form the tensor product MRN. The result is an (R,Z)-bimodule, i.e., a left R-module. There is a natural bijection between R-module morphisms MSNP and certain set maps:

τP:HomR-Mod(MRN,P)F(P),

where F(P) is the collection of bilinear, R-balanced (R,Z)-set maps g:M×NP.

In other words, there is a natural isomorphism τ:Hom(R,T)(MSN,)F.

From objects to (hom) functors

We first notice that in every universal property, we are always characterizing morphisms from an object (or dually, to an object) in terms of a "natural" bijection with some other info. To make this functorial, consider the following:

Definition of hom functor

For each object c in a given category C, we can define a functor Hc:CSet as follows:

  • For each object dC, we let Hc(d)=HomC(c,d).
  • For each arrow f:dd, we let Hc(f):Hc(d)Hc(d) be the set map that takes each morphism g:cd to the morphism fg:cd.

It is also common to write HomC(c,) for Hc, but when doing so we will then also write f for Hc(f), rather than the awkward looking HomC(c,f). In either case, I usually verbally refer to this functor as the hom-out functor.

We should verify that Hc is indeed a functor.

First note that for each identity arrow 1d in C we have Hc(1d):Hc(d)Hc(d) is the set map that send each arrow g:cd to the arrow 1dg:cd; since C is a category, we certainly have 1dg=g and so Hc(1d) is the identity map on Hc(d).

Next, for a pair of composable arrows f1:d1d2 and f2:d2d3, we have

Hc(f2f1)=(f2f1)=f2(f1)=Hc(f2)Hc(f1).

More formally, for each object gHc(d1) (i.e., arrow g:cd1), we have

Hc(f2f1)(g)=(f2f1)g,

while

(Hc(f2)Hc(f1))(g)=f2(f1g).

By the associativity of composition in C these two are equal.

From the category C to a functor category

For each object cC we have defined a functor Hc:CSet, which is an object of the functor category SetC. Have we actually defined a functor H:CSetC? To answer that, we need to specify what H should do to arrows.

To that end, suppose f:cc is an arrow in C. Each arrow from Hc to Hc in SetC is a natural transformation τ:HcHc. This is the data of a family of arrows τd:Hc(d)Hc(d), one for each object dD, satisfying the usual naturality condition. So let's consider the sets Hc(d)=HomC(c,d) and Hc(d)=HomC(c,d).

Given an element gHc(d) (i.e., an arrow g:cd), it's not exactly clear how we can use the arrow f:cc to produce an arrow cd, i.e., an element of Hc(d)).

However, there is an obvious way to take an element gHc(d) (i.e., an arrow g:cd) and use the arrow f:cc to produce an arrow cd, namely by pre-composing with f:cc.

This defines a set map τd:Hc(d)Hc(d), which (we hope) defines a natural transformation τ:HcHc. However, this natural transformation is going "the wrong way." In the classical parlance, we would be describing a so-called contravariant functor from C to SetC. This language has generally (but not entirely) fallen out of favor and been replaced by the use of the opposite category construction.[2] In other words, we can use our construction above to define a (covariant) functor[3]

H:CopSetC.

Note that the category Cop has the same objects as the category C, and each arrow in Cop from an object c to an object c corresponds to an arrow f:cc in C. Because of this, and in an effort to avoid confusion, we often denote arrows in Cop by fop:cc, where the corresponding arrow in C is f:cc.

The hom-out functor

For a given category C, we have defined a functor H:CopSetC as follows:

  • For each object cCop (which is the same as an object cC), we have H(c)=Hc=HomC(c,).
  • For each arrow fop:cc in Cop (which corresponds to an arrow f:cc in C), the natural transformation H(fop):HcHc is defined by "pre-composition with f," i.e., for each dC the set map H(fop)d:Hc(d)Hc(d) is given by sending each arrow g:cd to the arrow gf:cd.

Note that the naturality of our supposedly natural transformation follows from the associativity of arrow composition. To see this, suppose g:d1d2 is an arrow in C and consider the diagram below:

Starting from the top-left, suppose hHc(d1), i.e., we have an arrow h:cd1. Going over and down yields the arrow g(hf):cd2, while going down and then over yields the arrow (gh)f:cd2. By associativity of arrow composition in C, these two arrows are equal.

Yoneda's Lemma

If we hadn't been inspired by the myriad constructions objects with universal properties, this wouldn't seem like a great way to understand objects in a given category C. Arbitrary functors F:CSet can presumably be very complicated and difficult to comprehend, and so the category SetC of all such functors is huge and mysterious, at least in comparison with the original category C. It would seem impossible that useful knowledge about an object cC could be gained from studying the corresponding functor HcSetC.

Following the general principle of "knowing an object by knowing the maps from it"[4], we should first examine what we can say about arrows from Hc to other objects FSetC. In other words, we should examine natural transformation HcF.

And here we at last come to it, the great lemma of category theory:

Yoneda's Lemma

Suppose c is an object of a category C and F:CSet is a functor. Then there is a (natural!) bijection between the set of natural transformation HcF and the set F(c), given by sending each natural transformation τ:HcF to the element τc(1c)F(c).

In other words, there are (natural!) bijections

yc,F:HomSetC(Hc,F)F(c).

We can upgrade this bijection to a full-on natural isomorphism between two functors, but for now let's examine the proof of this lemma.

First suppose τ:HcF is a natural transformation. This means that for every object dC we have a set map τd:Hc(d)F(d). In particular, by taking d=c we have a set map τc:Hc(c)F(c). The domain of this set map is HomC(c,c) which contains the unique identity arrow 1c:cc. The set map τc then assigns this arrow to some element τc(1c)F(c). This element is yc,F(τ).

To show yc,F is injective, we must show that τ is entirely determined by yc,F(τ), i.e., entirely determined by the single element τc(1c). To see this, suppose dC is any object, and consider the set map τd:Hc(d)F(d). Take any element in the domain of this set map, i.e., any arrow f:cd. By the naturality of τ, we have a commutative diagram:

Starting from the top-left with the element 1c, if we go across and then down we get the element F(f)(τc(1c)), i.e., the image under F(f) of the special element yc,F(τ). On the other hand, if we first go down the vertical arrow, the element 1c is sent to the element f1c, which is exactly the element fHc(d). This then maps across to τd(f). Commutativity has thus forced τd(f) to be the image under F(f) of the element yc,F(τ). The entire set map τd:Hc(d)F(d) is thus completely determined by yc,F(τ). We must have τd()=F()(yc,F(τ)). This proves that the set map y is injective.

To show yc,F is surjective, take any element xF(c) and for every dD let τd:Hc(d)F(d) be the set map given by τd(f)=F(f)(x). We claim this defines a natural transformation τ:HcF. To verify this, suppose g:d1d2 is an arrow in C and consider the (hopefully commutative!) diagram below:

Let's check this diagram is commutative. Take an element f in the top left, i.e., an arrow f:cd1. By our definition of τ, when we go across the top map we obtain the element F(f)(x), and when we then go down the right map we get the element F(g)(F(f)(x)), i.e., (F(g)F(f))(x). On the other hand, if we first go down the left map, we obtain the element gf, and if we then go across the bottom map we obtain the element F(gf)(x). Since F is a functor, we always have F(gf)=F(g)F(f), and hence (F(g)F(f))(x)=F(gf)(x). Our diagram is indeed commutative! Thus τ:HcF really is a natural transformation, and by construction yc,F(τ)=τc(1c)=F(1c)(x)=x.

We haven't lost anything

You might still worry that for two objects c,cC, there are way more arrows between their images Hc and Hc in the gigantic functor category SetC than there are between c and c in the original category C.[5] We could also be worried that certain arrows f1,f2:cc in C become identified when we consider their images in Hc(f1) and Hc(f2) in the functor category.[6] Fortunately, life is good. By taking F=Hc in Yoneda's Lemma, we immediately obtain the following corollary:

Corollary

For any pair of objects c,cC, each natural transformation τ:HcHc is of the form τ=H(fop) for a unique arrow f:cc in C.

Note that this corollary does indeed follow by taking F=Hc in Yoneda's Lemma, since we have a bijection from the set of natural transformations τ:HcHc to the set Hc(c)=HomC(c,c), given by sending each natural transformation τ to τc(1c), the latter of which is exactly an arrow f:cc. Moreover, as we saw above, the naturality condition of τ guarantees that every set map τd:Hc(d)Hc(d) is completely determined by f and is given exactly by f.

The Yoneda embedding

(UNDER CONSTRUCTION)


  1. To be fair, sometimes we have the "dual" situation, in which we have a natural bijection τd:HomC(d,c)F(d). For now we'll stick to one scenario. ↩︎

  2. See Opposite categories and contravariant functors. ↩︎

  3. We also could have defined a functor Hop:C(SetC)op, but this choice seems simpler. ↩︎

  4. Think about how meta this is. We're trying to prove the validity of this principle and we're using the principle itself to guide our exploration! ↩︎

  5. In other words, we might be worried the functor H is not full. ↩︎

  6. In other words, we might be worried the functor H is not faithful. ↩︎