# Yoneda lemma

In mathematics, the Yoneda lemma is arguably the most important result in category theory.[1] It is an abstract result on functors of the type morphisms into a fixed object. It is a vast generalisation of Cayley's theorem from group theory (viewing a group as a miniature category with just one object and only isomorphisms). It allows the embedding of any locally small category into a category of functors (contravariant set-valued functors) defined on that category. It also clarifies how the embedded category, of representable functors and their natural transformations, relates to the other objects in the larger functor category. It is an important tool that underlies several modern developments in algebraic geometry and representation theory. It is named after Nobuo Yoneda.

## Generalities

The Yoneda lemma suggests that instead of studying the locally small category ${\displaystyle {\mathcal {C}}}$ , one should study the category of all functors of ${\displaystyle {\mathcal {C}}}$  into ${\displaystyle \mathbf {Set} }$  (the category of sets with functions as morphisms). ${\displaystyle \mathbf {Set} }$  is a category we think we understand well, and a functor of ${\displaystyle {\mathcal {C}}}$  into ${\displaystyle \mathbf {Set} }$  can be seen as a "representation" of ${\displaystyle {\mathcal {C}}}$  in terms of known structures. The original category ${\displaystyle {\mathcal {C}}}$  is contained in this functor category, but new objects appear in the functor category, which were absent and "hidden" in ${\displaystyle {\mathcal {C}}}$ . Treating these new objects just like the old ones often unifies and simplifies the theory.

This approach is akin to (and in fact generalizes) the common method of studying a ring by investigating the modules over that ring. The ring takes the place of the category ${\displaystyle {\mathcal {C}}}$ , and the category of modules over the ring is a category of functors defined on ${\displaystyle {\mathcal {C}}}$ .

## Formal statement

Yoneda's lemma concerns functors from a fixed category ${\displaystyle {\mathcal {C}}}$  to the category of sets, ${\displaystyle \mathbf {Set} }$ . If ${\displaystyle {\mathcal {C}}}$  is a locally small category (i.e. the hom-sets are actual sets and not proper classes), then each object ${\displaystyle A}$  of ${\displaystyle {\mathcal {C}}}$  gives rise to a natural functor to ${\displaystyle \mathbf {Set} }$  called a hom-functor. This functor is denoted:

${\displaystyle h_{A}=\mathrm {Hom} (A,-)}$ .

The (covariant) hom-functor ${\displaystyle h_{A}}$  sends ${\displaystyle X}$  to the set of morphisms ${\displaystyle \mathrm {Hom} (A,X)}$  and sends a morphism ${\displaystyle f\colon X\to Y}$  (where ${\displaystyle X}$  and ${\displaystyle Y}$  are objects in ${\displaystyle {\mathcal {C}}}$ ) to the morphism ${\displaystyle f\circ -}$  (composition with ${\displaystyle f}$  on the left) that sends a morphism ${\displaystyle g}$  in ${\displaystyle \mathrm {Hom} (A,X)}$  to the morphism ${\displaystyle f\circ g}$  in ${\displaystyle \mathrm {Hom} (A,Y)}$ . That is,

${\displaystyle h_{A}(f)=\mathrm {Hom} (A,f),{\text{ or}}}$
${\displaystyle h_{A}(f)(g)=f\circ g}$

Yoneda's lemma says that:

Lemma (Yoneda) — Let ${\displaystyle F}$  be a functor from a locally small category ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ . Then for each object ${\displaystyle A}$  of ${\displaystyle {\mathcal {C}}}$ , the natural transformations ${\displaystyle \mathrm {Nat} (h_{A},F)\equiv \mathrm {Hom} (\mathrm {Hom} (A,-),F)}$  from ${\displaystyle h_{A}}$  to ${\displaystyle F}$  are in one-to-one correspondence with the elements of ${\displaystyle F(A)}$ . That is,

${\displaystyle \mathrm {Nat} (h_{A},F)\cong F(A).}$

Moreover, this isomorphism is natural in ${\displaystyle A}$  and ${\displaystyle F}$  when both sides are regarded as functors from ${\displaystyle {\mathcal {C}}\times \mathbf {Set} ^{\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ .

Here the notation ${\displaystyle \mathbf {Set} ^{\mathcal {C}}}$  denotes the category of functors from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ .

Given a natural transformation ${\displaystyle \Phi }$  from ${\displaystyle h_{A}}$  to ${\displaystyle F}$ , the corresponding element of ${\displaystyle F(A)}$  is ${\displaystyle u=\Phi _{A}(\mathrm {id} _{A})}$ ;[a] and given an element ${\displaystyle u}$  of ${\displaystyle F(A)}$ , the corresponding natural transformation is given by ${\displaystyle \Phi _{X}(f)=F(f)(u)}$  which assigns to a morphism ${\displaystyle f\colon A\to X}$  a value of ${\displaystyle F(X)}$ .

### Contravariant version

There is a contravariant version of Yoneda's lemma, which concerns contravariant functors from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ . This version involves the contravariant hom-functor

${\displaystyle h^{A}=\mathrm {Hom} (-,A),}$

which sends ${\displaystyle X}$  to the hom-set ${\displaystyle \mathrm {Hom} (X,A)}$ . Given an arbitrary contravariant functor ${\displaystyle G}$  from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ , Yoneda's lemma asserts that

${\displaystyle \mathrm {Nat} (h^{A},G)\cong G(A).}$

### Naming conventions

The use of ${\displaystyle h_{A}}$  for the covariant hom-functor and ${\displaystyle h^{A}}$  for the contravariant hom-functor is not completely standard. Many texts and articles either use the opposite convention or completely unrelated symbols for these two functors. However, most modern algebraic geometry texts starting with Alexander Grothendieck's foundational EGA use the convention in this article.[b]

The mnemonic "falling into something" can be helpful in remembering that ${\displaystyle h_{A}}$  is the covariant hom-functor. When the letter ${\displaystyle A}$  is falling (i.e. a subscript), ${\displaystyle h_{A}}$  assigns to an object ${\displaystyle X}$  the morphisms from ${\displaystyle A}$  into ${\displaystyle X}$ .

### Proof

Since ${\displaystyle \Phi }$  is a natural transformation, we have the following commutative diagram:

This diagram shows that the natural transformation ${\displaystyle \Phi }$  is completely determined by ${\displaystyle \Phi _{A}(\mathrm {id} _{A})=u}$  since for each morphism ${\displaystyle f\colon A\to X}$  one has

${\displaystyle \Phi _{X}(f)=(Ff)u.}$

Moreover, any element ${\displaystyle u\in F(A)}$  defines a natural transformation in this way. The proof in the contravariant case is completely analogous.

### The Yoneda embedding

An important special case of Yoneda's lemma is when the functor ${\displaystyle F}$  from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$  is another hom-functor ${\displaystyle h_{B}}$ . In this case, the covariant version of Yoneda's lemma states that

${\displaystyle \mathrm {Nat} (h_{A},h_{B})\cong \mathrm {Hom} (B,A).}$

That is, natural transformations between hom-functors are in one-to-one correspondence with morphisms (in the reverse direction) between the associated objects. Given a morphism ${\displaystyle f\colon B\to A}$  the associated natural transformation is denoted ${\displaystyle \mathrm {Hom} (f,-)}$ .

Mapping each object ${\displaystyle A}$  in ${\displaystyle {\mathcal {C}}}$  to its associated hom-functor ${\displaystyle h_{A}=\mathrm {Hom} (A,-)}$  and each morphism ${\displaystyle f\colon B\to A}$  to the corresponding natural transformation ${\displaystyle \mathrm {Hom} (f,-)}$  determines a contravariant functor ${\displaystyle h_{\bullet }}$  from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} ^{\mathcal {C}}}$ , the functor category of all (covariant) functors from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$ . One can interpret ${\displaystyle h_{\bullet }}$  as a covariant functor:

${\displaystyle h_{\bullet }\colon {\mathcal {C}}^{\text{op}}\to \mathbf {Set} ^{\mathcal {C}}.}$

The meaning of Yoneda's lemma in this setting is that the functor ${\displaystyle h_{\bullet }}$  is fully faithful, and therefore gives an embedding of ${\displaystyle {\mathcal {C}}^{\mathrm {op} }}$  in the category of functors to ${\displaystyle \mathbf {Set} }$ . The collection of all functors ${\displaystyle \{h_{A}|A\in C\}}$  is a subcategory of ${\displaystyle \mathbf {Set} ^{\mathcal {C}}}$ . Therefore, Yoneda embedding implies that the category ${\displaystyle {\mathcal {C}}^{\mathrm {op} }}$  is isomorphic to the category ${\displaystyle \{h_{A}|A\in C\}}$ .

The contravariant version of Yoneda's lemma states that

${\displaystyle \mathrm {Nat} (h^{A},h^{B})\cong \mathrm {Hom} (A,B).}$

Therefore, ${\displaystyle h^{\bullet }}$  gives rise to a covariant functor from ${\displaystyle {\mathcal {C}}}$  to the category of contravariant functors to ${\displaystyle \mathbf {Set} }$ :

${\displaystyle h^{\bullet }\colon {\mathcal {C}}\to \mathbf {Set} ^{{\mathcal {C}}^{\mathrm {op} }}.}$

Yoneda's lemma then states that any locally small category ${\displaystyle {\mathcal {C}}}$  can be embedded in the category of contravariant functors from ${\displaystyle {\mathcal {C}}}$  to ${\displaystyle \mathbf {Set} }$  via ${\displaystyle h^{\bullet }}$ . This is called the Yoneda embedding.

The Yoneda embedding is sometimes denoted by よ, the Hiragana kana Yo.[2]

### Representable functor

The Yoneda embedding essentially states that for every (locally small) category, objects in that category can be represented by presheaves, in a full and faithful manner. That is,

${\displaystyle \mathrm {Nat} (h^{A},P)\cong P(A)}$

for a presheaf P. Many common categories are, in fact, categories of pre-sheaves, and on closer inspection, prove to be categories of sheaves, and as such examples are commonly topological in nature, they can be seen to be topoi in general. The Yoneda lemma provides a point of leverage by which the topological structure of a category can be studied and understood.

### In terms of (co)end calculus

Given two categories ${\displaystyle \mathbf {C} }$  and ${\displaystyle \mathbf {D} }$  with two functors ${\displaystyle F,G:\mathbf {C} \to \mathbf {D} }$ , natural transformations between them can be written as the following end.[3]

${\displaystyle \mathrm {Nat} (F,G)=\int _{c\in \mathbf {C} }\mathrm {Hom} _{\mathbf {D} }(Fc,Gc)}$

For any functors ${\displaystyle K\colon \mathbf {C} ^{op}\to \mathbf {Sets} }$  and ${\displaystyle H\colon \mathbf {C} \to \mathbf {Sets} }$  the following formulas are all formulations of the Yoneda lemma.[4]

${\displaystyle K\cong \int ^{c\in \mathbf {C} }Kc\times \mathrm {Hom} _{\mathbf {C} }(-,c),\qquad K\cong \int _{c\in \mathbf {C} }(Kc)^{\mathrm {Hom} _{\mathbf {C} }(c,-)},}$
${\displaystyle H\cong \int ^{c\in \mathbf {C} }Hc\times \mathrm {Hom} _{\mathbf {C} }(c,-),\qquad H\cong \int _{c\in \mathbf {C} }(Hc)^{\mathrm {Hom} _{\mathbf {C} }(-,c)}.}$

## Preadditive categories, rings and modules

A preadditive category is a category where the morphism sets form abelian groups and the composition of morphisms is bilinear; examples are categories of abelian groups or modules. In a preadditive category, there is both a "multiplication" and an "addition" of morphisms, which is why preadditive categories are viewed as generalizations of rings. Rings are preadditive categories with one object.

The Yoneda lemma remains true for preadditive categories if we choose as our extension the category of additive contravariant functors from the original category into the category of abelian groups; these are functors which are compatible with the addition of morphisms and should be thought of as forming a module category over the original category. The Yoneda lemma then yields the natural procedure to enlarge a preadditive category so that the enlarged version remains preadditive — in fact, the enlarged version is an abelian category, a much more powerful condition. In the case of a ring ${\displaystyle R}$ , the extended category is the category of all right modules over ${\displaystyle R}$ , and the statement of the Yoneda lemma reduces to the well-known isomorphism

${\displaystyle M\cong \mathrm {Hom} _{R}(R,M)}$    for all right modules ${\displaystyle M}$  over ${\displaystyle R}$ .

## Relationship to Cayley's theorem

As stated above, the Yoneda lemma may be considered as a vast generalization of Cayley's theorem from group theory. To see this, let ${\displaystyle {\mathcal {C}}}$  be a category with a single object ${\displaystyle *}$  such that every morphism is an isomorphism (i.e. a groupoid with one object). Then ${\displaystyle G=\mathrm {Hom} _{\mathcal {C}}(*,*)}$  forms a group under the operation of composition, and any group can be realized as a category in this way.

In this context, a covariant functor ${\displaystyle {\mathcal {C}}\to \mathbf {Set} }$  consists of a set ${\displaystyle X}$  and a group homomorphism ${\displaystyle G\to \mathrm {Perm} (X)}$ , where ${\displaystyle \mathrm {Perm} (X)}$  is the group of permutations of ${\displaystyle X}$ ; in other words, ${\displaystyle X}$  is a G-set. A natural transformation between such functors is the same thing as an equivariant map between ${\displaystyle G}$ -sets: a set function ${\displaystyle \alpha \colon X\to Y}$  with the property that ${\displaystyle \alpha (g\cdot x)=g\cdot \alpha (x)}$  for all ${\displaystyle g}$  in ${\displaystyle G}$  and ${\displaystyle x}$  in ${\displaystyle X}$ . (On the left side of this equation, the ${\displaystyle \cdot }$  denotes the action of ${\displaystyle G}$  on ${\displaystyle X}$ , and on the right side the action on ${\displaystyle Y}$ .)

Now the covariant hom-functor ${\displaystyle \mathrm {Hom} _{\mathcal {C}}(*,-)}$  corresponds to the action of ${\displaystyle G}$  on itself by left-multiplication (the contravariant version corresponds to right-multiplication). The Yoneda lemma with ${\displaystyle F=\mathrm {Hom} _{\mathcal {C}}(*,-)}$  states that

${\displaystyle \mathrm {Nat} (\mathrm {Hom} _{\mathcal {C}}(*,-),\mathrm {Hom} _{\mathcal {C}}(*,-))\cong \mathrm {Hom} _{\mathcal {C}}(*,*)}$ ,

that is, the equivariant maps from this ${\displaystyle G}$ -set to itself are in bijection with ${\displaystyle G}$ . But it is easy to see that (1) these maps form a group under composition, which is a subgroup of ${\displaystyle \mathrm {Perm} (G)}$ , and (2) the function which gives the bijection is a group homomorphism. (Going in the reverse direction, it associates to every ${\displaystyle g}$  in ${\displaystyle G}$  the equivariant map of right-multiplication by ${\displaystyle g}$ .) Thus ${\displaystyle G}$  is isomorphic to a subgroup of ${\displaystyle \mathrm {Perm} (G)}$ , which is the statement of Cayley's theorem.

## History

Yoshiki Kinoshita stated in 1996 that the term "Yoneda lemma" was coined by Saunders Mac Lane following an interview he had with Yoneda in the Gare du Nord station.[5][6]

## Notes

1. ^ Recall that ${\displaystyle \Phi _{A}:\mathrm {Hom} (A,A)\to F(A)}$  so the last expression is well-defined and sends a morphism from ${\displaystyle A}$  to ${\displaystyle A}$ , to an element in ${\displaystyle F(A)}$ .
2. ^ A notable exception to modern algebraic geometry texts following the conventions of this article is Commutative algebra with a view toward algebraic geometry / David Eisenbud (1995), which uses ${\displaystyle h_{A}}$  to mean the covariant hom-functor. However, the later book The geometry of schemes / David Eisenbud, Joe Harris (1998) reverses this and uses ${\displaystyle h_{A}}$  to mean the contravariant hom-functor.

## References

1. ^ Riehl, Emily (2017). Category Theory in Context (PDF). Dover. ISBN 978-0-486-82080-4.
2. ^ "Yoneda embedding". nLab. Retrieved 6 July 2019.
3. ^ Loregian (2015), Theorem 1.4.1.
4. ^ Loregian (2015), Proposition 2.2.1.
5. ^ Kinoshita, Yoshiki (23 April 1996). "Prof. Nobuo Yoneda passed away". Retrieved 21 December 2013.
6. ^ "le lemme de la Gare du Nord". neverendingbooks. 18 November 2016. Retrieved 2022-09-10.