# Yoneda lemma

In mathematics, specifically in category theory, the Yoneda lemma 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 particular kind of category with just one object and only isomorphisms). It allows the embedding of any 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}$ 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){\mbox{, or}}}$
${\displaystyle h^{A}(f)(g)=f\circ g}$.

Let ${\displaystyle F}$ be an arbitrary functor from ${\displaystyle {\mathcal {C}}}$ to ${\displaystyle \mathbf {Set} }$. Then Yoneda's lemma says that:

For each object ${\displaystyle A}$ of ${\displaystyle {\mathcal {C}}}$, the natural transformations 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 \mathbf {Set} ^{\mathcal {C}}\times {\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})}$;[lower-alpha 1] and given an element ${\displaystyle u}$ of ${\displaystyle F(A)}$, the corresponding natural transformation is given by ${\displaystyle \Phi (f)=F(f)(u)}$.

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.[lower-alpha 2]

The mnemonic "falling into something" can be helpful in remembering that ${\displaystyle h_{A}}$ is the contravariant 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 X}$ into ${\displaystyle A}$.

### Proof

The proof of Yoneda's lemma is indicated by 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^{-}}$ 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^{-}}$ as a covariant functor:

${\displaystyle h^{-}\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^{-}}$ 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_{-}}$ gives rise to a covariant functor from ${\displaystyle {\mathcal {C}}}$ to the category of contravariant functors to ${\displaystyle \mathbf {Set} }$:

${\displaystyle h_{-}\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_{-}}$. This is called the Yoneda embedding.

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

### 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, pre-sheaves, and on closer inspection, prove to be 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.

${\displaystyle \mathrm {Nat} (F,G)=\int _{c\in \mathbf {C} }\mathrm {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. [2]

${\displaystyle K\cong \int ^{c\in \mathbf {C} }Kc\times \mathbf {C} (-,c),\qquad K\cong \int _{c\in \mathbf {C} }Kc^{\mathbf {C} (c,-)},}$
${\displaystyle H\cong \int ^{c\in \mathbf {C} }Hc\times \mathbf {C} (c,-),\qquad H\cong \int _{c\in \mathbf {C} }Hc^{\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.[3]

## 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. "Yoneda embedding". nLab. Retrieved 6 July 2019.
2. Loregian, Fosco (2015). "This is the (co)end, my only (co)friend". arXiv:1501.02503 [math.CT].
3. Kinoshita, Yoshiki (23 April 1996). "Prof. Nobuo Yoneda passed away". Retrieved 21 December 2013.