category theory

Yoneda lemma

# Contents

## Idea

The Yoneda lemma says that the set of morphisms from a representable presheaf ${h}_{c}$ into an arbitrary presheaf $F$ is in natural bijection with the set $F\left(c\right)$ assigned by $F$ to the representing object $c$.

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.

In brief, the principle is that the identity morphism ${\mathrm{id}}_{x}:x\to x$ is the universal generalized element of $x$. This simple principle is surprisingly pervasive throughout category theory.

## Preliminaries

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

$Y:C\to \left[{C}^{\mathrm{op}},\mathrm{Set}\right]$Y : C \to [C^op,Set]

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

$C\left(-,-\right):{C}^{\mathrm{op}}×C\to \mathrm{Set}$C(-,-) : C^op \times C \to Set

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

in the closed symmetric monoidal category of categories.

Hence $Y$ sends any object $c\in C$ to the presheaf which assigns to any other object $d$ of $c$ the set of morphisms from $d$ into $c$:

$Y\left(c\right):{C}^{\mathrm{op}}\stackrel{C\left(-,c\right)}{\to }\mathrm{Set}\phantom{\rule{thinmathspace}{0ex}}.$Y(c) : C^{op} \stackrel{C(-,c)}{\to} Set \,.

### Remarks

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 $C$ as test spaces, presheaves on $C$ are generalized spaces modeled on $C$ which are characterized by the way one can map objects of $C$ into them.

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

## The Yoneda Lemma

Let $C$ be a locally small category, $\left[{C}^{\mathrm{op}},\mathrm{Set}\right]$ the category of presheaves on $C$. Let $c\in C$ be an object.

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

Formally:

###### Proposition

There is a canonical isomorphism

$\left[{C}^{\mathrm{op}},\mathrm{Set}\right]\left(C\left(-,c\right),X\right)\simeq X\left(c\right)$[C^op,Set](C(-,c),X) \simeq X(c)

natural in $c$.

Here $\left[{C}^{\mathrm{op}},\mathrm{Set}\right]$ denotes the functor category, also denoted ${\mathrm{Set}}^{{C}^{\mathrm{op}}}$ and $C\left(-,c\right)$ 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 $c$ as ${h}_{c}$. In that case the above is often written

$\mathrm{Hom}\left({h}_{c},X\right)\simeq X\left(c\right)$Hom(h_c, X) \simeq X(c)

or

$\mathrm{Nat}\left({h}_{c},X\right)\simeq X\left(c\right)$Nat(h_c, X) \simeq X(c)

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

### Proof

The crucial point is that the naturality condition on any natural transformation $\eta :C\left(-,c\right)⇒X$ is sufficient to ensure that $\eta$ is already entirely fixed by the value ${\eta }_{c}\left({\mathrm{Id}}_{c}\right)\in X\left(c\right)$ of its component ${\eta }_{c}:C\left(c,c\right)\to X\left(c\right)$ on the identity morphism ${\mathrm{Id}}_{c}$. And every such value extends to a natural transformation $\eta$.

More in detail, the bijection is established by the map

$\left[{C}^{\mathrm{op}},\mathrm{Set}\right]\left(C\left(-,c\right),X\right)\stackrel{{\mid }_{c}}{\to }\mathrm{Set}\left(C\left(c,c\right),X\left(c\right)\right)\stackrel{{\mathrm{ev}}_{{\mathrm{Id}}_{c}}}{\to }X\left(c\right)$[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 $c\in C$ and the second step is evaluation at ${\mathrm{Id}}_{c}\in C\left(c,c\right)$.

The inverse of this map takes $f\in X\left(c\right)$ to the natural transformation ${\eta }^{f}$ with components

${\eta }_{d}^{f}:=X\left(-\right)\left(f\right):C\left(d,c\right)\to X\left(d\right)\phantom{\rule{thinmathspace}{0ex}}.$\eta^f_d := X(-)(f) : C(d,c) \to X(d) \,.

### Remarks

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

## Corollaries

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\to \left[{C}^{\mathrm{op}},\mathrm{Set}\right]$ really is an embedding in that it is a full and faithful functor, because for $c,d\in C$ it naturally induces the isomorphism of Hom-sets.

$\left[{C}^{\mathrm{op}},\mathrm{Set}\right]\left(C\left(-,c\right),C\left(-,d\right)\right)\simeq \left(C\left(-,d\right)\right)\left(c\right)=C\left(c,d\right)$[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\left(c\right)\simeq Y\left(d\right)$ must come from an isomorphism of the representing objects $c\simeq d$:

$Y\left(c\right)\simeq Y\left(d\right)\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}⇔\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}c\simeq d$Y(c) \simeq Y(d) \;\; \Leftrightarrow \;\; c \simeq d

### corollary III: universality of representing objects

A presheaf $X:{C}^{\mathrm{op}}\to \mathrm{Set}$ is representable precisely if the comma category $\left(Y,{\mathrm{const}}_{X}\right)$ has a terminal object. If a terminal object is $\left(d,f:Y\left(d\right)\to X\right)\simeq \left(d,f\in X\left(d\right)\right)$ then $X\simeq Y\left(d\right)$.

This follows from unwrapping the definition of morphisms in the comma category $\left(Y,{\mathrm{const}}_{X}\right)$ and applying the Yoneda lemma to find

$\left(Y,{\mathrm{const}}_{X}\right)\left(\left(c,f\in X\left(c\right)\right),\left(d,g\in X\left(d\right)\right)\right)\simeq \left\{u\in C\left(c,d\right):X\left(u\right)\left(g\right)=f\right\}\phantom{\rule{thinmathspace}{0ex}}.$(Y,const_X)((c,f \in X(c)), (d, g \in X(d))) \simeq \{ u \in C(c,d) : X(u)(g) = f \} \,.

Hence $\left(Y,{\mathrm{const}}_{X}\right)\left(\left(c,f\in X\left(c\right),\left(d,g\in X\left(d\right)\right)\right)\simeq \mathrm{pt}$ says precisely that $X\left(-\right)\left(f\right):C\left(c,d\right)\to X\left(c\right)$ is a bijection.

### Interpretation

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

• corollary I says that the interpretation of presheaves in $C$ as generalized objects probeable by objects of $c$ is consistent: the probes of $X$ by $c$ are indeed the maps of generalized objects from $c$ into $X$;

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

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

## Generalizations

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

## References

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)

Revised on November 4, 2012 19:05:10 by Stephan Alexander Spahn (79.227.185.30)