Yoneda Lemma
Last Update:May 18, 2024 am
Yoneda lemma is a philosophical theorem in category theory. Dan piponi called it “the most difficult ordinary thing in mathematics”, while Emily Riehl said it “can be said to be the most important result in category theory”. On nLab, it is considered “basic, but deep and central”. In this article, we try to describe and prove Yoneda lemma in a clear, motivational and graphic way. At the same time, we introduce its important corollaries: Yoneda embedding and representable functor.
Presheaf Category
Given two categories $\mathsf{C}_1,\mathsf{C}_2$, we can define a functor category $\mathrm{Fct}(\mathsf{C}_1,\mathsf{C}_2)$. The objects of it consist of functors from $\mathsf{C}_1$ to $\mathsf{C}_2$ and the morphisms are natural tranformations among these functors. The functor category $\mathrm{Fct}(\mathsf{C}_1,\mathsf{C}_2)$ can also be denoted by $[\mathsf{C}_1,\mathsf{C}_2]$. Let $F,G\in[\mathsf{C}_1,\mathsf{C}_2]$. We can denote the set of morphisms between $F,G$ as
Given a category $\mathsf{C}$, the presheaf category on $\mathsf{C}$ is
An objects in the presheaf category is called a presheaf. It is actually a functor from $\mathsf{C}^{\mathrm{op}}$ to $\mathsf{Set}$.
$\mathrm{Hom}$ Functor
$\mathrm{Hom}_{\mathsf{C}}(-,-)$ Functor
Let $\mathsf{C}$ be a category. The bifunctor to the set category $\mathsf{Set}$
is defined as follows: the mapping of the objects is
the mapping of the morphisms is
It can be represented by the following diagram
$\mathrm{Hom}_{\mathsf{C}}(X,-)$ Functor
For the functor , fixing the first component to $X\in \mathrm{Ob}(\mathsf{C})$, we obtain the functor $\mathrm{Hom}_{\mathsf{C}}(X,-)$
Its object mapping is
and its morphism mapping is
which can be represented by the following diagram:
The mapping $g_*$ is often called the pushforward.
$\mathrm{Hom}_{\mathsf{C}}(-,Y)$ Functor
For the functor , fixing the second component to $Y\in \mathrm{Ob}(\mathsf{C})$, we obtain the functor $\mathrm{Hom}_{\mathsf{C}}(-,Y)$
Its object mapping is
and its morphism mapping is
which can be represented by the following diagram:
The mapping $f^*$ is often called the pullback.
$\mathrm{Hom}_{\mathsf{C}}(\cdot\,,-)$ Functor
It can be seen that the functor is a presheaf on $\mathsf{C}$, i.e., . Moreover, for every object $Y$ in $\mathsf{C}$, we obtain a corresponding presheaf $\mathrm{Hom}_{\mathsf{C}}(-,Y) \in [\mathsf{C}^{\mathrm{op}},\mathsf{Set}]$. In fact, this mapping can be extended to a functor from $\mathsf{C}$ to the category of presheaves $[\mathsf{C}^{\mathrm{op}},\mathsf{Set}]$, denoted as
Its object mapping is
and its morphism mapping is
which can be represented by the following diagram:
In the above, is the natural transformation from to $\mathrm{Hom}_{\mathsf{C}}(-,Y_2)$, defined as
The naturality of is ensured by the following commutative diagram:
Yoneda Lemma
Yoneda Lemma: the Proof of Isomorphism
Proposition
Let $\mathsf{C}$ be a category, $Y$ an object in $\mathsf{C}$, and the presheaf on $\mathsf{C}$. Further, let $F\in \mathsf{C}^\wedge$ be another presheaf on $\mathsf{C}$. On one hand, is the set of natural transformations between the presheaves $\mathrm{Hom}_{\mathsf{C}}(-,Y)$ and $F$. On the other hand, $F(Y)$ is the value of the presheaf $F$ at $Y$, which is also a set. The Yoneda lemma states that there exists a bijection between these two sets, i.e.,
Proof
If $\phi\in\mathrm{Nat}(\mathrm{Hom}_{\mathsf{C}}(-,Y),F)$, we can take any morphism $f: X \rightarrow Y$ in $\mathsf{C}$, and use the naturality of $\phi$ to obtain the following commutative diagram:
From the commutative diagram, we can derive the following relation:
Note that the choice of $X$ and $f$ is arbitrary, so we know that $\phi$ is uniquely determined by the value $\phi_Y(\mathrm{id}_Y)$. Therefore, we can define a mapping
and
We can verify that $\mathcal{B}$ is well-defined. In fact, for any morphism
in $\mathsf{C}$, we have the following commutative diagram:
So $\mathcal{B}(u)$ is indeed a natural transformation from to $F$. For any $\phi\in\mathrm{Nat}(\mathrm{Hom}_{\mathsf{C}}(-,Y),F)$, we have
and from the previous conclusion, we know that $\mathcal{B}(\mathcal{A}(\phi))=\phi$. Hence, .
For any $u\in F(Y)$, we have
so $\mathcal{A}\circ\mathcal{B}=\mathrm{id}_{F(Y)}$.
In summary, we have proved that
is a bijection.
Yoneda Lemma: the Proof of Natural Isomorphism
The Yoneda lemma not only establishes the isomorphism
given by the mapping $\mathcal{A}$, but it further asserts that this isomorphism is natural in both $Y$ and $F$. Specifically, we can define a bifunctor
whose object mapping is
and its morphism mapping is
which can be represented by the following diagram:
where $s$ is defined as
In the same way, we can define the binary evaluation functor
which can be represented by the following diagram:
where
Since
we have the commutative diagram:
Therefore, the mapping $\mathcal{A}$ is a natural isomorphism from the functor $\mathrm{Nat}(\mathrm{Hom}_{\mathsf{C}}(\cdot,-),-)$ to the functor $\mathrm{ev}^\wedge$.
Yoneda Embedding
Yoneda’s lemma yields a useful corollary.
Corollary. is a fully faithful functor.
Proof. By taking and in Yoneda’s lemma, we obtain
which implies
At this point, the mapping $\mathcal{B}$ can be transformed into
or equivalently
This is precisely the morphism mapping of the functor
Because is a bijection, is a fully faithful functor. $\square$
Note that the object mapping of is injective, meaning the functor embeds $\mathsf{C}$ as a full subcategory into the presheaf category $[\mathsf{C}^{\mathrm{op}},\mathsf{Set}]$. This embedding is known as the Yoneda embedding. From the properties of a fully faithful functor, it follows that
In terms of categorical isomorphism, we can equate $Y$ with $\mathrm{Hom}_{\mathsf{C}}(-,Y)$. An object in a category essentially equals the sum of all arrows pointing to that object. Under the concept of category isomorphism, the focus is on the arrows an object sends and receives from other objects, treating the object itself as a black box. The arrows between objects in the category then represent transformations between sets of arrows pointing to these objects. Specifically, if $f$ is an arrow from object $A$ to object $B$, then any arrow pointing to $A$ can be transformed through $f$ into an arrow pointing to $B$. Conversely, if there is a way to naturally transform all arrows pointing to $A$ into those pointing to $B$, such a transformation is necessarily achieved by connecting an arrow between $A$ and $B$.
Representable Functor
A presheaf $F:\mathsf{C}^{\mathrm{op}}\to\mathsf{Set}$ on the category $\mathsf{C}$ is called a representable functor if there exists an object $Z$ in $\mathsf{C}$ such that $\mathrm{Hom}_{\mathsf{C}}(-,Z)$ is naturally isomorphic to $F$. The pair $(Z,\phi)$, where $A$ is naturally isomorphic to
is called a representation of $F$.
According to Yoneda’s Lemma, $\phi$ is uniquely determined by an element $c:=\phi_Z(\mathrm{id}_Z)\in F(Z)$. For this reason, $(Z,c)$ is referred to as a representative element of $F$, where $Z$ is called the representing object or universal object, and $c$ is called the universal element.
Regarding representable functors, we have the following proposition.
Proposition. If a functor $F$ is representable, then its representation is unique up to isomorphism.
More specifically, consider the functor
corresponding to the comma category , where is a category with exactly one object and one morphism, and maps the only object in to . We can restate the above proposition as follows.
Proposition. If is a representation of the representable functor $F$, then $(Z,\phi)$ is a terminal object in . In other words, for any $(Y,\psi)\in\mathrm{Hom}_{\mathsf{C}}(\cdot,-)/j_Z$, there exists a unique morphism $g:Y\to Z$, such that the following diagram commutes in $\mathsf{C}^\wedge$.
Proof. Indeed, since $\phi$ is an isomorphism, the commutation of the diagram is equivalent to
Furthermore, because the functor $\mathrm{Hom}_{\mathsf{C}}(\cdot\,,-)$ is fully faithful,
is bijective. Therefore, there exists a unique $g:Y\to Z$ such that
thus making the diagram commute. $\square$
Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless declaring additionally.