A Brief Introduction to Categories, Part 4: The Yoneda Lemma

This post is part of a series on category theory, see Overview of Blog Posts for all blog posts.

Introduction

Using the notion of natural transformations introduced previously, we are able to state and prove the (in)famous and all-important Yoneda lemma, which is not only applied throughout category theory, but can yield satisfying conceptual proofs in many distinct areas. This result single-handedly justifies the “behavioristic” or “relative” viewpoint internal to category theory that lies in not bothering with concrete qualities of the objects one is interested in and studying them via their relations to other objects, for it implies in a certain technical sense that an object is uniquely determined by how it relates to other objects. This allows us to think of objects in terms of functors.

Functor Categories

Let \mathcal{C} and \mathcal{D} be categories, then we can consider the class of functors \mathcal C \to \mathcal D. For two such functors, we can consider natural transformations between them, which we can compose in an associative way. For any functor, there’s the identity natural transformation. So this turns the collection of functors \mathcal C \to \mathcal D into a category, right?
Not quite, at least with our definitions. The subtle problem is that there is no reason to expect that the natural transformations between two functors form a set, there might be “too many”. To remedy this deficiency, we shall amend the definition of a category. Henceforth, what is defined in definition C1.1 shall be called a “locally small category” and a not necessarily locally small or “large” category has the same definition, except that the morphisms between two objects are allowed to be proper classes. With this amendment, we can make the following definition:

Definition C4.1 Let \mathcal C and \mathcal D be categories. Then the functor category, denoted by [\mathcal C,\mathcal D] has as its objects all functors F: \mathcal C \to \mathcal D and as morphisms natural transformations, with composition of natural transformations defined pointwise.

Exercise C4.2 If \mathcal C is a small category (the objects form a set and it is locally small) and \mathcal D is a locally small category, then the functor category [\mathcal C,\mathcal D] is locally small.

Example C4.3 As we have already seen, the functor category [G,\mathbf{Set}] for a group G considered as a one-object category is the category of G-sets with equivariant maps as morphisms. (cf. example C2.4 and example C3.3)

Example C4.4 Similarly, for a field k and a group G, the functor category [G,k\mathrm{-Vect}] is the category of representations of G over k. (cf. example C2.5 and example C3.4)

The Yoneda Lemma

We now come to the promised infamous lemma:

Theorem C4.5 (Yoneda lemma) Let \mathcal C be a locally small category, let x be an object in \mathcal C and let F: \mathcal C \to \mathbf{Set} be a functor, then the map \varphi^{x,F}:\mathrm{Hom}_{[\mathcal C,\mathbf{Set}]}(\mathrm{Hom}_{\mathcal C}(x,-),F) \to F(x), \eta \mapsto \eta_{x}(\mathrm{id}_x) is a bijection that is natural in x and in F.

Proof construct an inverse map \theta_{x,F} as follows: let c \in F(x), then set \theta^{x,F}(c) to be the following natural transformation: for any object y \in \mathcal C and any morphism f:x \to y, let \theta^{x,F}(c)_y(f)=F(f)(c), we need to check that this is indeed a natural transformation from \mathrm{Hom}_{\mathcal C}(x,-) to F. Let z be a third object and let g:y \to z be a morphism in \mathcal C. Then we need to verify that the following diagram commutes: Yoneda

To show this, let f \in \mathrm{Hom}_{\mathcal C}(x,y), then \theta^{x,F}(c)_z(g \circ f)=F(g \circ f)(c)=F(g)(F(f)(c))=F(g)(\theta^{x,F}(c)_y(f)) showing that the diagram commutes. Hence \theta^{x,F} is a natural transformation.

We now need to show that \theta^{x,F} is the inverse of \varphi^{x,F}. Let \eta: \mathrm{Hom}_{\mathcal C}(x,-) \Rightarrow F be a natural transformation, then we need to show that \theta^{x,F}(\varphi^{x,F}(\eta))=\eta, which we can check this component-wise. Let y \in \mathcal C be an object and let f:x \to y be a morphism, then we have \theta^{x,F}(\varphi^{x,F}(\eta))_y(f)=\theta^{x,F}(\eta_x(\mathrm{id}_x))_y(f)=F(f)(\eta_x(\mathrm{id}_x)) by naturality of \eta this equals \eta_y(f), see the diagram below, applied to the identity on x:

yoneda2

This proves one direction, for the other direction, we have for c \in F(x), \varphi^{x,F}(\theta^{x,F}(c))=\theta^{x,F}(c)_x(\mathrm{id}_x)=F(\mathrm{id}_x)(c)=c. This shows that \varphi and \theta are mutually inverse bijections. Naturality in x and F are easy computations.

There is also a contravariant version of the Yoneda lemma:

Corollary C4.6 Let \mathcal C be a locally small category and let F:\mathcal C^{op} \to \mathbf{Set} be a functor, i.e. a contravariant functor on C, then for any object x \in \mathcal C, the map \mathrm{Hom}_{[\mathcal{C}^{op},\mathbf{Set}]}(\mathrm{Hom}_{\mathcal C}(-,x),F) \to F(x), \eta \mapsto \eta_x(\mathrm{id}_x) is a natural bijection.

Proof Apply the Yoneda lemma to the opposite category.

The most important case is when F is another Hom-functor:

Corollary C4.7 Let \mathcal C be a locally small category and let x,y \in \mathcal C be objects. Then there is a natural isomorphism \mathrm{Hom}_{[\mathcal{C}^{op},\mathbf{Set}]}(\mathrm{Hom}_{\mathcal C}(-,x),\mathrm{Hom}_{\mathcal C}(-,y)) \cong \mathrm{Hom}_{\mathcal C}(x,y) given by \eta \mapsto \eta_x(\mathrm{id}_x).

Corollary C4.8 Let \mathcal C be a locally small category. Then the functor Y_{\mathcal C}: \mathcal C \to [\mathcal C^{op},\mathbf{Set}], called the Yoneda embedding, given by Y(x)=\mathrm{Hom}_{\mathcal{C}}(-,x) is fully faithful.

Corollary C4.9 Let \mathcal C be a locally small category, then if for two objects x and y, the functors \mathrm{Hom}_{\mathcal C}(-,x) and \mathrm{Hom}_{\mathcal C}(-,y) are naturally isomorphic, then x and y are isomorphic up to a unique isomorphism inducing a given natural isomorphism between the functors.

Proof By corollary C4.8, the Yoneda embedding is fully faithful, hence it reflects being isomorphic by lemma C3.11. As the Yoneda embedding is faithful, we get uniqueness.

Corollary C4.10 Let \mathcal C be a locally small category. If for two objects x and y, the functors \mathrm{Hom}_{\mathcal C}(x,-) and \mathrm{Hom}_{\mathcal C}(y,-) are naturally isomorphic, then x and y are isomorphic up to a unique isomorphism inducing a given natural isomorphism between the functors.

Proof Apply corollary C4.9 to the opposite category and note that two objects are isomorphic if and ony if they are isomorphic in the opposite category.

Remark Using the Yoneda lemma, one can identify a locally small category \mathcal C with the subcategory of the functor category [\mathcal C^{op},\mathbf{Set}], containg as objects all Hom-functors and as morphisms natural transformations between them.

Let us ponder for a moment what a remarkable thing we have shown: The last two corollaries tell us that in order to study an object, it is sufficient to study all morphisms from that object or all morphisms into that object. To put it succinctly, the Yoneda lemma tells us that an object is determined by its relation to other objects. Studying the functor \mathrm{Hom}_{\mathcal C}(x,-) or the functor \mathrm{Hom}_{\mathcal C}(-,x) can be easier than studying an object itself, especially if the objects satisfy so-called universal properties, which are basically convenient descriptions of the functors from or to an object.

Example C4.11 Let \mathbf{CRing} be the category of commutative rings, then if R is a commutative ring and I is an ideal, one has an isomorphism natural in T: \mathrm{Hom}_{\mathbf{CRing}}(R/I,T) \cong \{f \in \mathrm{Hom}_{\mathbf{CRing}}(R,T) \mid f_{\mid I}=0\}, given by pulling back along the projection R \to R/I. In this sense, the projection \pi:R \to R/I is the universal morphism that restricts to 0 on I: every other such morphism factorizes over it. This is the content of the homomorphism theorem. From a categorical perspective, the homomorphism theorem is the proper definition of a quotient modulo an ideal, whereas the construction with equivalence classes is mere coincidence. In a similar manner, for a multiplicatively closed subset S \subset R, the localization S^{-1}R together with the canonical morphism s:R \to S^{-1}R is the universal solution to the problem of finding a ring T and a ring homomorphism f:R \to T such that f maps all elements of S to units. Explicitly, one has a natural isomorphism \mathrm{Hom}_{\mathbf{CRing}}(S^{-1}R,T) \cong \{f \in \mathrm{Hom}_{\mathbf{CRing}}(R,T) \mid f(S) \subset T^\times\}.
If we look into the case that we have both an ideal I and a multiplicatively closed subset S in R, then we can ask for a universal morphism that sends both I to 0 and maps S to units. Here we can see the Yoneda lemma in action, for we have natural isomorphisms \mathrm{Hom}_{\mathbf{CRing}}(S^{-1}R/S^{-1}I,T) \cong \{f \in \mathrm{Hom}_{\mathbf{CRing}}(S^{-1}R,T) \mid f_{S^{-1}I} = 0 \} \cong \{f \in \mathrm{Hom}_{\mathbf{CRing}}(R,T) \mid f(S) \subset T^\times, f_{I}=0\} \cong \{f \in \mathrm{Hom}_{\mathbf{CRing}}(R/I,T) \mid f(\overline{S}) \subset T^\times\} \cong \mathrm{Hom}_{\mathbf{CRing}}(\overline{S}^{-1}R/I,T)
which implies that \overline{S}^{-1}R/I \cong S^{-1}R/S^{-1}I by the Yoneda lemma. This is a conceptually very satisfying proof, as we didn’t have to fiddle with equivalence classes or fractions, but we only used the abstract defining properties of localizations and quotients.

Exercise Use the Yoneda lemma to prove that if R is a commutative ring and I and J are two ideals such that I \subset J, then R/J \cong (R/I) / (R/J).

Exercise If S and T are two multiplicatively closed subsets of a commutative ring R and S \cdot T is the multiplicatively closed subset generated by S and T, then show that S^{-1}T^{-1}R \cong (S\cdot T)^{-1}R using the Yoneda lemma.

This concludes the post on the Yoneda lemma, which we shall see in many applications to come.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s