Yoneda lemma



The Yoneda lemma says that the set of morphisms from a representable presheaf h ch_c into an arbitrary presheaf FF is in natural bijection with the set F(c)F(c) assigned by FF to the representing object cc.

The Yoneda lemma is an elementary but deep and central result in category theory and in particular in sheaf and topos theory. It is essential background behind the central concepts of representable functor, universal construction, and universal element.


Recall that for CC a locally small category and [C op,Set](=Set C op=Hom(C op,Set))[C^{op}, Set] (= Set^{C^{op}} = Hom(C^{op},Set)) the category of presheaves on CC, there naturally is a functor

Y:C[C op,Set] Y : C \to [C^op,Set]

– called the Yoneda embedding for reasons explained below – which sends CC to the category of presheaves over it: this is just the image of the Hom-functor

C(,):C op×CSet C(-,-) : C^op \times C \to Set

under the Hom-adjunction

Hom(C op×C,Set)Hom(C,[C op,Set]) Hom(C^{op} \times C, Set) \stackrel{\simeq}{\to} Hom(C, [C^{op}, Set])

in the closed symmetric monoidal category of categories.

Hence YY sends any object cCc \in C to the presheaf which assigns to any other object dd of CC the set of morphisms from dd into cc:

Y(c):C opC(,c)Set. Y(c) : C^{op} \stackrel{C(-,c)}{\to} Set \,.


One way to appreciate the meaning of this and of what the Yoneda lemma has to say about it is to regard this in the context of space and quantity: thinking of the objects of CC as test spaces, presheaves on CC are generalized spaces modeled on CC which are characterized by the way one can map objects of CC into them.

The Yoneda lemma states that the functor YY has good properties which make this interpretation consistent.

The Yoneda Lemma

Let CC be a locally small category, [C op,Set][C^{op}, Set] the category of presheaves on CC. Let cCc \in C be an object.

The Yoneda lemma asserts that the set of morphisms from the presheaf represented by cc into any other presheaf XX is in natural bijection with the set X(c)X(c) that this presheaf assigns to cc.



There is a canonical isomorphism

[C op,Set](C(,c),X)X(c) [C^op,Set](C(-,c),X) \simeq X(c)

natural in cc.

Here [C op,Set][C^{op}, Set] denotes the functor category, also denoted Set C opSet^{C^{op}} and C(,c)C(-,c) the representable presheaf. This is the standard notation used mostly in pure category theory and enriched category theory. In other parts of the literature it is customary to denote the presheaf represented by cc as h ch_c. In that case the above is often written

Hom(h c,X)X(c) Hom(h_c, X) \simeq X(c)


Nat(h c,X)X(c) Nat(h_c, X) \simeq X(c)

to emphasize that the morphisms of presheaves are natural transformations of the corresponding functors.


The proof is by chasing the element Id cC(c,c)Id_c \in C(c, c) around both legs of a naturality square for a transformation η:C(,c)X\eta: C(-, c) \to X:

C(c,c) η c X(c) Id c η c(Id c) =def ξ C(f,c) X(f) X(f) C(b,c) η b X(b) f η b(f) \array{ C(c, c) & \stackrel{\eta_c}{\to} & X(c) & & & & Id_c & \mapsto & \eta_c(Id_c) & \stackrel{def}{=} & \xi \\ _\mathllap{C(f, c)} \downarrow & & \downarrow _\mathrlap{X(f)} & & & & \downarrow & & \downarrow _\mathrlap{X(f)} & & \\ C(b, c) & \underset{\eta_b}{\to} & X(b) & & & & f & \mapsto & \eta_b(f) & & }

What this diagram shows is that the entire transformation η:C(,c)X\eta: C(-, c) \to X is completely determined from the single value ξη c(Id c)X(c)\xi \coloneqq \eta_c(Id_c) \in X(c), because for each object bb of CC, the component η b:C(b,c)X(b)\eta_b: C(b, c) \to X(b) must take an element fC(b,c)f \in C(b, c) (i.e., a morphism f:bcf: b \to c) to X(f)(ξ)X(f)(\xi), according to the commutativity of this diagram.

The crucial point is that the naturality condition on any natural transformation η:C(,c)X\eta : C(-,c) \Rightarrow X is sufficient to ensure that η\eta is already entirely fixed by the value η c(Id c)X(c)\eta_c(Id_c) \in X(c) of its component η c:C(c,c)X(c)\eta_c : C(c,c) \to X(c) on the identity morphism Id cId_c. And every such value extends to a natural transformation η\eta.

More in detail, the bijection is established by the map

[C op,Set](C(,c),X)| cSet(C(c,c),X(c))ev Id cX(c) [C^{op}, Set](C(-,c),X) \stackrel{|_{c}}{\to} Set(C(c,c), X(c)) \stackrel{ev_{Id_c}}{\to} X(c)

where the first step is taking the component of a natural transformation at cCc \in C and the second step is evaluation at Id cC(c,c)Id_c \in C(c,c).

The inverse of this map takes fX(c)f \in X(c) to the natural transformation η f\eta^f with components

η d f:=X()(f):C(d,c)X(d). \eta^f_d := X(-)(f) : C(d,c) \to X(d) \,.


In the light of the interpretation in terms of space and quantity mentioned above this says that for XX a generalized space modeled on CC, and for cc a test space, morphisms from cc to XX with cc regarded as a generalized space are just the morphisms from cc into XX.


The Yoneda lemma has the following direct consequences. As the Yoneda lemma itself, these are as easily established as they are useful and important.

corollary I: Yoneda embedding

The Yoneda lemma implies that the Yoneda embedding functor Y:C[C op,Set]Y : C \to [C^op,Set] really is an embedding in that it is a full and faithful functor, because for c,dCc,d \in C it naturally induces the isomorphism of Hom-sets.

[C op,Set](C(,c),C(,d))(C(,d))(c)=C(c,d) [C^{op},Set](C(-,c),C(-,d)) \simeq (C(-,d))(c) = C(c,d)

corollary II: uniqueness of representing objects

Since the Yoneda embedding is a full and faithful functor, an isomorphism of representable presheaves Y(c)Y(d)Y(c) \simeq Y(d) must come from an isomorphism of the representing objects cdc \simeq d:

Y(c)Y(d)cd Y(c) \simeq Y(d) \;\; \Leftrightarrow \;\; c \simeq d

corollary III: universality of representing objects

A presheaf X:C opSetX : C^{op} \to Set is representable precisely if the comma category (Y,const X)(Y,const_X) has a terminal object. If a terminal object is (d,f:Y(d)X)(d,fX(d))(d, f : Y(d) \to X) \simeq (d, f \in X(d)) then XY(d)X \simeq Y(d).

This follows from unwrapping the definition of morphisms in the comma category (Y,const X)(Y,const_X) and applying the Yoneda lemma to find

(Y,const X)((c,fX(c)),(d,gX(d))){uC(c,d):X(u)(g)=f}. (Y,const_X)((c,f \in X(c)), (d, g \in X(d))) \simeq \{ u \in C(c,d) : X(u)(g) = f \} \,.

Hence (Y,const X)((c,fX(c),(d,gX(d)))pt(Y,const_X)((c,f \in X(c), (d, g \in X(d))) \simeq pt says precisely that X()(f):C(c,d)X(c)X(-)(f) : C(c,d) \to X(c) is a bijection.


For emphasis, here is the interpretation of these three corollaries in words:

  • corollary I says that the interpretation of presheaves on CC as generalized objects probeable by objects cc of CC is consistent: the probes of XX by cc are indeed the maps of generalized objects from cc into XX;

  • corollary II says that probes by objects of CC are sufficient to distinguish objects of CC: two objects of CC are the same if they have the same probes by other objects of CC.

  • corollary III characterizes representable functors by a universal property and is hence the bridge between the notion of representable functor and universal constructions.


The Yoneda lemma tends to carry over to all important generalizations of the context of categories:

Necessity of naturality

The assumption of naturality is necessary for the Yoneda lemma to hold. A simple counter-example is given by a category with two objects AA and BB, in which Hom(A,A)=Hom(A,B)=Hom(B,B)= 0Hom(A,A) = Hom(A,B) = Hom(B,B) = \mathbb{Z}_{\geq 0}, the set of integers greater than or equal to 00, in which Hom(B,A)= 1Hom(B,A) = \mathbb{Z}_{\geq 1}, the set of integers greater than or equal to 11, and in which composition is addition. Here it is certainly the case that Hom(A,)Hom(A,-) is isomorphic to Hom(B,)Hom(B,-) for any choice of -, but AA and BB are not isomorphic (composition with any arrow BAB \rightarrow A is greater than or equal to 11, so cannot have an inverse, since 00 is the identity on AA and BB).

A finite counter-example is given by the category with two objects AA and BB, in which Hom(A,A)=Hom(A,B)=Hom(B,B)={0,1}Hom(A,A) = Hom(A,B) = Hom(B,B) = \{0, 1\}, in which Hom(B,A)={0,2}Hom(B,A) = \{0, 2\}, and composition is multiplication modulo 2. Here, again, it is certainly the case that Hom(A,)Hom(A,-) is isomorphic to Hom(B,)Hom(B,-) for any choice of -, but AA and BB are not isomorphic (composition with any arrow BAB \rightarrow A is 00, so cannot have an inverse, since 11 is the identity on AA and BB).



The term Yoneda lemma originated in an interview of Nobuo Yoneda by Saunders Mac Lane at Paris Gare du Nord:

In Categories for the Working Mathematician MacLane writes that this happened in 1954.

Reviews and expositions include

A discussion of the Yoneda lemma from the point of view of universal algebra is in

  • Vaughan Pratt, The Yoneda lemma without category theory: algebra and applications (pdf).

Last revised on October 13, 2016 at 11:50:52. See the history of this page for a list of all contributions to it.