nLab Yoneda lemma




The Yoneda lemma says that the set of morphisms from a representable presheaf y(c)y(c) into an arbitrary presheaf XX is in natural bijection with the set X(c)X(c) assigned by XX 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 functors, universal constructions, and universal elements.

Statement and proof



(functor underlying the Yoneda embedding)

For 𝒞\mathcal{C} a locally small category we write

[C op,Set]Func(C op,Set) [C^{op}, Set] \coloneqq Func(C^{op}, Set)

for the functor category out of the opposite category of 𝒞\mathcal{C} into Set.

This is also called the category of presheaves on 𝒞\mathcal{C}. Other notation used for it includes Set C opSet^{C^{op}} or Hom(C op,Set))Hom(C^{op},Set)).

There is a functor

C y [C op,Set] c Hom 𝒞(,c) \array{ C &\overset{y}{\longrightarrow}& [C^op,Set] \\ c &\mapsto& Hom_{\mathcal{C}}(-,c) }

(called the Yoneda embedding for reasons explained below) from 𝒞\mathcal{C} to its category of presheaves, which sends each object to the hom-functor into that object, also called the presheaf represented by cc.


(Yoneda embedding is adjunct of hom-functor)

The Yoneda embedding functor y:𝒞[𝒞 op,Set]y \;\colon\; \mathcal{C} \to [\mathcal{C}^{op}, Set] from Def. is equivalently the adjunct of the hom-functor

Hom 𝒞:𝒞 op×𝒞Set Hom_{\mathcal{C}} \;\colon\; \mathcal{C}^{op} \times \mathcal{C} \longrightarrow Set

under the product category/functor category 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.


(Yoneda lemma)

Let 𝒞\mathcal{C} be a locally small category, with category of presheaves denoted [𝒞 op,Set][\mathcal{C}^{op},Set], according to Def. .

For X[𝒞 op,Set]X \in [\mathcal{C}^{op}, Set] any presheaf, there is a canonical isomorphism

Hom [C op,Set](y(c),X)X(c) Hom_{[C^op,Set]}(y(c),X) \;\simeq\; X(c)

between the hom-set of presheaf homomorphisms from the representable presheaf y(c)y(c) to XX, and the value of XX at cc.

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 natural transformation η:C(,c)X\eta: C(-, c) \to X (hence a homomorphism of presheaves):

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 ξX(c)\xi \in X(c) to the natural transformation η ξ\eta^\xi with components

η d ξ:=X()(ξ):C(d,c)X(d). \eta^\xi_d := X(-)(\xi) : C(d,c) \to X(d) \,.

In homotopy type theory

Discussion in homotopy type theory.

Note: the HoTT book calls a internal category in HoTT a “precategory” and a univalent category a “category”, but here we shall refer to the standard terminology of “category” and “univalent category” respectively.

By Lemma 9.5.3 in the HoTT book (see product category), we have an induced functor y:ASet A op\mathbf{y} : A \to \mathit{Set}^{A^{op}} which we call the yoneda embedding.

Theorem 9.5.4 (The Yoneda Lemma) For any category AA, any a:Aa:A, and any functor F:Set A opF: \mathit{Set}^{A^{op}}, we have an isomorphism

hom Set A op(ya,F)Fa(9.5.5)hom_{\mathit{Set}^{A^{op}}}(\mathbf{y}a,F) \cong F a \qquad \qquad(9.5.5)

Moreover this is natural in both aa and FF.

Proof. Given a natural transformation α:yaF\alpha : \mathbf{y}a \to F, we can consider the component α a:ya(a)Fa\alpha_a : \mathbf{y}a(a) \to F a. Since ya(a)hom A(a,a)\mathbf{y} a(a)\equiv hom_A(a,a), we have 1 a:ya(a)1_a:\mathbf{y}a(a), so that α a(1 a):Fa\alpha_a(1_a):F a. This gives a function αα a(1 a)\alpha \mapsto \alpha_a(1_a) from left to right in (9.5.5).

In the other direction, given x:Fax: F a, we define α:yaF\alpha : \mathbf{y} a \to F by

α a(f)F a,a(f)(x)\alpha_{a'}(f) \equiv F_{a,a'}(f)(x)

Naturality is easy to check, so this gives a function from right to left in (9.5.5).

To show that these are inverses, first suppose given x:Fax: F a. Then with α\alpha defined as above, we have α:yaF\alpha : \mathbf{y}a \to F and define xx as above, then for any f:hom A(a,a)f:hom_A(a',a) we have

α a(f) =α a(ya a,a(f)(1 a)) =(α aya a,a(f))(1 a) =(F a,a(f)α a)(1 a) =F a,a(f (α a(1 a)) =F a,a(f)(x). \begin{aligned} \alpha_{a'}(f) &= \alpha_{a'}(\mathbf{y} a_{a,a'}(f)(1_a))\\ &= (\alpha_{a'} \circ \mathbf{y}a_{a,a'}(f))(1_a)\\ &= (F_{a,a'}(f) \circ \alpha_a)(1_a)\\ &= F_{a,a'}(f_(\alpha_a(1_a))\\ &= F_{a,a'}(f)(x). \end{aligned}

Thus, both composites are equal to identities. The proof of naturality follows from this. \square

Corollary 9.5.6 The Yoneda embedding y:ASet A op\mathbf{y} : A \to \mathit{Set}^{A^{op}} is fully faithful.

Proof. By the Yoneda lemma, we have

hom Set A op(ya,yb)yb(a)hom A(a,b)hom_{\mathit{Set}^{A^{op}}}(\mathbf{y}a,\mathbf{y}b) \cong \mathbf{y} b(a) \equiv hom_A(a,b)

It is easy to check that this isomorphism is in fact the action of y\mathbf{y} on hom-sets. \square


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 \colon 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 \colon 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,g:y(d)X)(d,gX(d))(d, g : y(d) \to X) \simeq (d, g \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) \colon 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).

On the other hand, there have been examples of locally finite categories where naturality is not necessary. For example, (Lovász, Theorem 3.6 (iv)) states precisely that finite relational structures AA and BB are isomorphic if, and only if, Hom(C,A)Hom(C,B)Hom(C,A) \cong Hom(C,B) for every finite relational structure CC. Later (Pultr, Theorem 2.2) generalised the result to finitely well-powered, locally finite categories with (extremal epi, mono) factorization system.

The Yoneda lemma in semicategories

An interesting phenomenon arises in the case of semicategories i.e. “categories” (possibly) lacking identity morphisms:

the Yoneda lemma fails in general, since its validity in a semicategory 𝒢\mathcal{G} implies that 𝒢\mathcal{G} is in fact already a category because the Yoneda lemma permits to embed 𝒢\mathcal{G} into PrSh(𝒢)PrSh(\mathcal{G}) and the latter is always a category, the embedding then implying that 𝒢\mathcal{G} is itself a category!

But for regular semicategories \mathcal{R} there is a unity of opposites in the category of all semipresheaves on \mathcal{R} between the so called regular presheaves that are colimits of representables and presheaves satisfying the Yoneda lemma, whence the Yoneda lemma holds dialectically for regular presheaves!

For some of the details see at regular semicategory and the references therein.



For general references see any text on category theory, as listed in the references there.

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.

Review and exposition:

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).

A treatment of the Yoneda lemma for categories internal to an (∞,1)-topos is in

  • Louis Martini, Yoneda’s lemma for internal higher categories, (arXiv:2103.17141)

Early Lovász-Type results include

  • László Lovász, Operations with structures, Acta Mathematica Academiae Scientiarum Hungarica 18.3-4 (1967): 321-328.
  • Aleš Pultr. Isomorphism types of objects in categories determined by numbers of morphisms, Acta Scientiarum Mathematicarum, 35:155–160, 1973.

Last revised on April 11, 2024 at 09:27:51. See the history of this page for a list of all contributions to it.