# The Yoneda Lemma

## Introduction

In this post I am going to explain my favorite theorem: The Yoneda lemma. If you do not know what category theory is, you should maybe read my previous post where I explain some of the basics.

The thing that fascinates me about the Yoneda lemma is that depending on the concrete category you are working with, it provides a theorem which is mostly nontrivial. Previously, these theorems were proven independently since it was unknown that they can be generalized with category theory. One way to think of the Yoneda lemma is through particle physics. In particle physics, it suffices to take a particle and shoot other particles at it. If one knows all reactions of a special particle with all possible particles, then one knows everything there is to know about the special particle. The Yoneda lemma formalizes this intuition. In a previous post I have generalized functions by defining generalized functions (distributions) by their action on other functions, so-called test functions. This was also an application of the Yoneda-embedding.

Depending on the concrete category it provides the following theorems:

- In a poset every element can be determined by the set of all elements it is greater than or equal to. In particular, every element is equivalent to a Dedekind cut. Or alternatively, every element of a partially ordered set can be included in some powerset.
- Cayley’s theorem: Every group is isomorphic to a subgroup of a permutation group.
- Erdös’ lemma: Every graph is isomorphic to a family of subsets of a set such that and are joined by an edge iff
- Every ring has a faithful module.

## Presheaves

First, we are going to generalize elements in sets. If we have a set containing some elements we may recognize that we can instead of looking at the elements look at the projections . Here, denotes a set which contains only one element. Instead of taking the elements directly we identify them by a “choosing function” which picks single elements. Thus, each projection corresponds to a single elements. To generalize elements in sets we can generalize this notion of “picking” by allowing other sets as the singleton set as the domain. Let us define this for general categories, not only for sets:

Let be a locally small category, an object in .
Then we define the contravariant Hom-functor of A by

where Set is the category of sets.

This is a contravariant functor as you may want to prove by checking the corresponding functor laws. Go grab a pen, it is really not that difficult and will help your understanding. I wait here for you.

Locally small means that the morphisms between each two objects form a set. If this is not the case we get problems pertaining the well-definedness.

I will occasionally write instead of .

A presheaf on a category is any functor . A presheaf is called representable if it is naturally isomorphic to the contravariant Hom-functor for some object .

## The Yoneda lemma

The Yoneda lemma tells us that we can get all presheaves from Hom-functors through natural transformations and how to do this. It explicitly enumerates all these natural transformations.

If you look into literature, what I am going to explain is often called the contravariant Lemma of Yoneda. I think it is easier to understand than the usual Yoneda, but you can get the other one by applying the contravariant Yoneda in the opposite category.

Since we can define a presheaf for each object in a category we can define an embedding . This is called the Yoneda embedding and is a (co-variant) functor

The Yoneda embedding embeds a category into a category of functors. The question the Yoneda lemma answers is how the elements behave in this new category. How do they interact with the other elements? What are the morphisms for some from the bigger category ?

**Lemma(Yoneda):**
Let be an arbitrary functor.
Then for all objects there is a bijection.
\begin{equation}
F(A)\simeq Mor(A^\circ, F)
\end{equation}

On the left side of the equation there is a set, say . On the right side of the equations, we have morphisms between two functors and , i.e., natural transformations .

To prove this, let us first take a natural transformation from the
right set . Let’s say .
This looks as follows:

I want to show that is completely determined by some object in . This would give us a bijection and we are done.

So, take some morphism for some arbitrary object in . Since is a natural transformation, we can draw the following commutative diagram by applying at the components and .

We do not know a lot about , but we know that it contains the identity . Thus we can trace the functions on the element and get the following:

I take the symbol for . The equation on the lower right follows from commutativity. One hand is given by going through the upper right corner, the other hand is given by going through the lower left corner.

Note that we started with any and wanted to find some object in which completely determines . But hey, we are done. is such an object. It determines completely since if we know , we know for each , since this is exactly and thus only depends on . Thus, the proof is complete.

## Conclusion

Even if you do not share my enthusiasm for my favorite theorem I hope you found this post helpful. The important thing to remember is that things are fully determined by their interactions with everything else. Even if you did not follow each of the steps in the proof I hope that I could convince you that the Yoneda lemma is a very powerful tool. And even if you did not understand anything at all, which I doubt, since then you would not be reading to the bottom of the page, I may have convinced you that there are areas of math that have nothing to do with boring computations and numbers.