The Yoneda lemma, according to Ravil Vakil in Foundations of Algebraic Geometry, is an "important exercise you should do once in your life." This fundamental result is often said to be difficult to conceptualize. In this post, we present a variant of the usual proof and explain in a plain manner the idea behind the lemma.
Presheaves
In category theory, a presheaf is a mild generalization of the usual geometric notion of a presheaf. Instead of attaching data to each open set of a topological space, we attach data to each object in a category. More precisely, let C be a small category. A presheaf on C is a functor F:Cop→Set. We denote the category of presheaves on C, with morphisms being natural transformations of functors, by PSh(C).
It is instructive to examine the prototypical case, where C=Open(X) for some topological space X. Here, the objects of C are the open sets of X and the morphisms are given by the inclusions of open sets. We can view Open(X) as a subcategory of Top by corresponding each inclusion V⊆U to its associated embedding ιV,U:V→U. In this setting, a presheaf F on X attaches to each open subset U⊆X a set of sectionsF(U); furthermore, for each inclusion ιV,U, there is a corresponding restriction map resU,V which takes a section in F(U) and restricts it to obtain a section in F(V). Any presheaf or sheaf on a topological space can be interpreted as arising from the sheaf of continuous sections to a larger space sitting above X, known as the étale space, Et(F). Here, sections in F(U) correspond to subspaces of Et(F) which lie over U, and resV,U(s) is just the set-theoretic restriction, which may also be written as the pullback ιV,U∗s.
In the general case, we can think of HomC(V,U) as comprising all of the ways in which the structure of V can "fit inside" the structure of U, and the set of sections F(U) can be thought as representing all the ways the data of U fits inside of F, much like in the étale space point-of-view; this is the viewpoint suggested on the nLab article on presheaves. Given a morphism f∈Hom(V,U), the analog of the restriction map is the morphism F(f):F(U)→F(V). In this article, we will call this map the pullback by f and denote it by f∗ when the presheaf F is understood.
Representable Presheaves
Let F∈PSh(C) be a presheaf and U∈F be an object. Given a section s∈F(U), we may ask what the minimal subpresheaf of F containing s is. To construct this, we intuitively must "throw away" or "cut out" all sections of F which don't fit inside s.
Example. Let X be a topological space and F be a presheaf on X. Given an open set U⊆X and a section s∈F(U) we may construct the subpresheaf FU,s given by
FU,s(V)={{s∣V}∅if V⊆Uif V⊆U.
This subpresheaf consists of all the restrictions of s, and nothing more.
In general, for every morphism f∈Hom(V,U), we must include the pullback f∗s as a section of the minimal subpresheaf. To formalize this notion, consider the Hom-functor Hom(−,U), which may be interpreted as the presheaf of morphisms toU. By definition, the sections of this presheaf on V∈C are given by Hom(−,U)(V)=Hom(V,U), and the pullback by a morphism f∈Hom(V,W) is given by
f∗=defHom(−,U)(f):Hom(W,U)→Hom(V,U);f∗s=defs∘f.
Definition. Let C be a category and let U∈C be an object. Define a presheaf on C with a distinguished section on U to be a pair (G,s), where G∈PSh(C) is a presheaf and s∈G(U). These form a category PSh∙(C,U) where a morphism between objects (G,s) and (H,t) is defined to be a morphism of presheaves G⇒H which maps s↦t.
Proposition. The presheaf Hom(−,U) with distinguished section idU is the initial object of PSh∙(C,U).
Proof. Let F be a presheaf with a distinguished section s∈F(U). Then there exists a morphism ϕ:Hom(−,U)⇒F given by f↦f∗s=[F(f)](s). In other words, ϕ maps a section f∈Hom(V,U) to the pullback of the distinguished section s, which is a once again section over V (but in F). To check that this defines a morphism of presheaves, consider a morphism g:V→W in C. Then the diagram
commutes, since for all f∈Hom(W,U) we have g∗(f∗s)=(f∘g)∗s=(g∗f)∗s. Moreover, the identity idU is mapped to the distinguished section s, since idU∗s=s. Hence, ϕ defines a morphism (Hom(−,U),idU)→(F,s).
Conversely, to show uniqueness, suppose that ψ:(Hom(−,U),idU)→(F,s) is a morphism of presheaves distinguished on U. Then ψV(f) is automatically determined for all sections f∈Hom(V,U), since ψV(f)=ψV(f∗idU)=f∗(ψU(idU))=f∗s.
■
We call the initial object Hom(−,U) of PSh∙(C,U) the presheaf represented by U and denote it by HU. In a sense, this is the "least specific" presheaf on C which contains a section over U. The map taking an object to the presheaf it represents is known as the Yoneda embedding, which we denote by よ.
Proposition. The mapping よ:C→PSh(C) defines a functor by mapping f∈Hom(V,U) to the underlying morphism よ(f) of the unique morphism (HV,idV)→(HU,f) in PSh∙(C,V).
Proof. Let W→gV→fU be a sequence of morphisms. Then
idW⟼よ(g)W(g=g∗idV)⟼よ(f)V(g∗f=f∘g).
By uniqueness, it follows that よ(f∘g)=よ(f)∘よ(g) (this can also be proved directly, of course).
■
Yoneda's Lemma
We now state and prove Yoneda's lemma.
Theorem (Yoneda's lemma). Let C be a category. If F is a presheaf on C and U∈C is an object, then there is an isomorphism of sets
evU,F:HomPSh(C)(HU,F)∼F(U);ϕ⟼ϕU(idU).
Moreover, this a natural isomorphism of functors Cop×PSh(C)→Set.
Proof. For any section s∈F(U), there exists a unique morphism ϕ:HU→F such that ϕU(idU)=s, since (HU,idU) is the initial object of PSh∙(C,U). It follows that the evaluation map evU,F is a bijection.
For fixed F, the map U↦F(U) defines a functor taking f↦f∗, which follows by the definition of a presheaf. Likewise, for fixed U, the assignment F↦F(U) defines a functor taking a presheaf morphism to its component at U, which follows by the definition of the presheaf category. It follows that the map (U,F)↦F(U) defines a bifunctor Bpairing from the product category.
On the other hand, the Yoneda embedding U↦HU is a functor, and Hom(−,−) is a bifunctor, so it follows that (U,F)↦HomPSh(C)(HU,F) also defines a bifunctor Byoneda from the product category.
It remains to show that the two bifunctors are naturally isomorphic. For this, it suffices to check that they are natural on each factor. So, let f∈Hom(V,U). Then for all presheaf morphisms ϕ∈HomPSh(C)(HU,F), we have
Therefore, the bifunctor isomorphism is natural in the first factor. For the second factor, consider a presheaf morphism ψ:F⇒G. Then for all presheaf morphisms ϕ∈HomPSh(C)(HU,F), we have
Therefore, the bifunctor isomorphism is also natural in the second factor. It follows that the evaluation bifunctor ev is natural, which concludes the argument.
■
Intuitively, the Yoneda lemma states that a morphism from a presheaf represented by U to a general presheaf is completely determined by how it maps the identity section on U. The naturality condition can be rephrased as such:
In order to "shift back" the source of the evaluation from being at the identity idU to another section f, we can either first evaluate at idU as usual and then pullback to obtain ϕV(f), or precompose ϕ with the Yoneda embedding of f and then evaluate idV.
In order to "shift forward" the destination of the evaluation from being in F to another presheaf G, we can evaluate idU as usual and then apply a component of the morphism F⇒G, or compose ϕ with the morphism F⇒G and then evaluate at idU.
The Yoneda Embedding
The Yoneda lemma implies that there is an isomorphism
evU,V:HomPSh(C)(HU,HV)∼Hom(U,V)
which implies that the Yoneda embedding functor is fully faithful. In particular, an isomorphism of representable presheaves in PSh(C) must be induced by an isomorphism of the underlying objects in C. In other words, to understand an object in a category, it suffices to understand the presheaf of morphisms to that object.