# “Philosophical” meaning of the Yoneda Lemma

The Yoneda Lemma is a simple result of category theory, and its proof is very straightforward.

Yet I feel like I do not truly understand what it is about; I have seen a few comments here mentioning how it has deeper implications into how to think about representable functors.

What are some examples of this? How should one think of the Yoneda Lemma?

-

One way to look at it is this:

for $C$ a category, one wants to look at presheaves on $C$ as being "generalized objects modeled on $C$" in the sense that these are objects that have a sensible rule for how to map objects of $C$ into them. You can "probe" them by test objects in $C$.

For that interpretation to be consistent, it must be true that some $X$ in $C$ regarded as just an object of $C$ or regarded as a generalized object is the same thing. Otherwise it is inconsistent to say that presheaves on $C$ are generalized objects on $C$.

The Yoneda lemma ensures precisely that this is the case.

I wrote up a more detailed expository version of this story at motvation for sheaves, cohomology and higher stacks.

-
More specifically, the category of presheaves on C is the free cocomplete category on C. This fact is probably about as fundamental as Yoneda's lemma. So the Yoneda lemma is a kind of categorification of the fact that the map from a set to the free commutative monoid on that set is an injection. –  Reid Barton Oct 29 '09 at 2:08
Good point. By the way, a gentle introduction by John Baez on what "free cocompletion" means is here: ncatlab.org/nlab/show/free+cocompletion –  Urs Schreiber Oct 29 '09 at 2:14
So, for example (if I understand what you're getting at), sometimes you want to add "Pro-objects" and "Ind-objects" to your favorite category C which lacks limits over (co-)filtered systems, and you can do this by identifying C with its image under the Yoneda embedding (which implicitly uses Yoneda's Lemma). –  John Goodrick Feb 13 '10 at 20:50
@Hans, the precise statement that you are looking for is simply the Yoneda lemma. Those words are meant to highlight its "philosophical meaning", as requested. Those "objects modeled on C" are precisely presheaves on C. Their "set of probes" by some X in C is the value of the presheaf on X. Plenty of further technical details are linked to at ncatlab.org/nlab/show/… –  Urs Schreiber Feb 16 '12 at 10:29
@HansStricker: The nLab article on "Space and Quantity" (ncatlab.org/nlab/show/space+and+quantity) is my favorite exposition of these ideas. The "Details" section talks a little about the role of the Yoneda lemma. –  Vectornaut Feb 10 at 21:45
show 1 more comment

In his Algebraic Geometry class a few years back, Ravi Vakil explained Yoneda's lemma like this: You work at a particle accelerator. You want to understand some particle. All you can do are throw other particles at it and see what happens. If you understand how your mystery particle responds to all possible test particles at all possible test energies, then you know everything there is to know about your mystery particle.

-
To me, this is a beautiful explanation of particle physics in the familiar terms of Yoneda's lemma! –  Thanos D. Papaïoannou Oct 29 '09 at 9:31
It is, indeed, to some extent also good explanation of some string theoretic thinking is suggesting: that whatever space is, you find out by testing it by throwing worldsheets of strings into it. One can make this Yoneda-way of thinking about string theory sigma-models pretty precise in cases. One rarely sees string theorists talk this way, of course. One exception is Eric Sharpe, who promoted that point of view here: golem.ph.utexas.edu/string/archives/000677.html –  Urs Schreiber Oct 29 '09 at 9:53
One does not need to get into any fancy string theory to see this idea. Fundamental groups and homotopy groups are already a manifestation of this idea! Indeed I think Manin once suggested that we can view Gromov-Witten invariants as an algebro-geometric analogue of fundamental group... –  Kevin Lin Oct 29 '09 at 14:20
A lower-level manifestation of the same idea: a locally integrable function on an open domain is determined by the knowledge of the values of the integrals against test functions. –  Gian Maria Dall'Ara Nov 1 '09 at 15:51
@Agusti: There are, of course, two Yoneda lemmas. One says you can recover A from hom(A,-) and the other says you can recover it from hom(-,A). The latter is covariant in A, so makes a better statement. But, yes, from the hom(A,-) perspective, I'd say "you can know your particle by looking at its emissions". –  Theo Johnson-Freyd Feb 14 '10 at 18:16
show 2 more comments

Lazily, I'll just point to some notes on this question: What's the Yoneda Lemma all about?

-
Could you explain the last statement on page 8? (Any functor C^op \mapsto Set can be built out of representables Hom(-,A) in very roughly the same way that any number is built as a product of primes). Should I make it a separate question? –  Max M Nov 2 '09 at 1:34
This refers to the "co-Yoneda lemma", which says that every presheaf is a colimit of representable presheaves: ncatlab.org/nlab/show/co-Yoneda+lemma –  Urs Schreiber Nov 17 '09 at 17:04
Max M, sorry, I only just saw your question. Urs is right: I was referring to the fact that every presheaf is a colimit, in a canonical way, of representable presheaves. I'd call it that the 'Density formula'. Another reference is Theorem 5.1.16 of these notes: maths.gla.ac.uk/~tl/msci . Don't take the analogy with prime factorization too seriously. –  Tom Leinster Nov 18 '09 at 1:26
@Tom: Do you know some applications of Yoneda lemma to combinatorics? –  Yannic Apr 19 '12 at 7:16
Not off the top of my head. The only thing I can think of is that Joyal's theory of species is a categorical approach to enumerative combinatorics, and is almost certain to involve the Yoneda lemma in its development. –  Tom Leinster Apr 19 '12 at 13:45
show 2 more comments

If you have basic experience with abstract algebra, the ideas in the Yoneda lemma should be quite familiar and even intuitive; the apparent difficulty is only in recognizing them in this new presentation.

You can think of "category" as meaning the same thing as "algebraic theory in a multisorted language with only unary functions" (the objects of the category being the sorts of the language, the morphisms being the definable functions, and the equalities between (composites of) morphisms being the laws of the theory). From this perspective, a functor from C to Set is simply a model of the theory corresponding to C, and natural transformations of such functors are homomorphisms of models. The Yoneda lemma then is about free models: specifically, it says that for every sort s, the "term model" of terms with a single variable, of sort s (equivalently, definable functions with domain s) is the free model on a single generator of sort s. [It may be unfamiliar when expressed as "Nat(Hom(s, -), M) ~= M(s), naturally in M", but that is indeed all this categorical expression is saying]

The so-called co-Yoneda lemma mentioned in the other comments also has a nice interpretation from this perspective, amounting to the demonstration that every model can be specified by generators and relations.

(I wouldn't say this is The One Right Way to think about the Yoneda lemma, because it's useful to view it from many different perspectives, but this is certainly One Right Way to think about the Yoneda lemma.)

-
Neat! And under this analogy, representable functors (with representing object s) are just models that are freely generated by a single element (of sort s). To me, at least, this clears things up a lot. –  John Goodrick Feb 13 '10 at 20:55

A good and frequent use of the Yoneda lemma is internalization: If e.g. I have monoid valued representable contravariant functor Hom(-,A):C-->Set, then the representing object A must be a monoid object in C. This is because the structure morphism Hom(-,A)xHom(-,A)=Hom(-,AxA)-->Hom(-,A) is a natural transformation and thus, by Yoneda comes from a morphism AxA-->A inside C, same for the other structure morphisms and the commuting diagrams.

The same goes through for other algebraic (or limit) structures and also for covariant Hom-functors which, if they are algebra-valued are represented by an coalgebra-object. An excellent example for the latter is the fact that affine algebraic groups are represented by Hopf algebras.

-

Barr and Wells (Toposes, Triples, and Theories, 84) talks about arrows as a general kind of elements. In Set, arrows from {*}→A are the usual elements of A, and arrows from bigger sets X→A are the X-elements of A, or elements of A parameterised in X. Of course the latter makes sense in any category, so we can use this language the state the Yoneda lemma as:

The Hom(-,A)-elements of F are just the usual elements of FA.

I find this to be, at least, a useful mnemonic, but also justifies the intuition that an object "is" its collection of probes.

-
Nice interpretation! –  Martin Brandenburg Feb 18 '11 at 19:05

Another way to think about the Yoneda lemma is in terms of universal things. Consider, for instance, the existence of classifying spaces for bundles. The statement is that for any suitable group G, there is a space BG such that for any nice enough space X, homotopy classes of maps X → BG are in natural bijection with isomorphism classes of G-structured bundles over X. In categorical terms, that means there is a natural isomorphism between the functors

X ↦ {G-structured bundles over X}

and

X ↦ [X,BG]

The Yoneda lemma implies that this natural isomorphism is uniquely determined by a specific G-structured bundle over BG. That is, the existence of a "classifying space" BG with the above property implies the existence of a universal bundle EG → BG such that every bundle over any space X is the pullback of the universal one along a map X → BG, unique up to homotopy.

The search for representing objects, and hence for universal data, lies at the heart of a lot of modern algebraic topology, algebraic geometry, and even category theory.

-
Why do you say "G-structured bundle" instead of G-principal bundle? –  Urs Schreiber Oct 29 '09 at 7:39
It could be a vector bundle with transition functions in G. –  Mike Shulman Oct 30 '09 at 0:42

If you don't mind thinking of category theory in terms of functional programming there is an interpretation here. Fix a type A and a functor F. If you have a machine that can give you back an object of type FB every time you give it a function of type A->B, can you reverse engineer fully what the machine is doing? Essentially the machine must contain an element of FA and you can recover that FA from how it responds to your functions. This is very similar to Theo's physical perspective.

-

You might also want to think about the Yoneda Lemma as a statement about functors.

A locally small category $\mathcal{C}$ is embedded by the $\mathrm{hom}$ functor in the category $\mathrm{Hom}(\mathcal{C}^{\mathrm{op}},\mathrm{set})$. This is called the Yoneda embedding. Thus, the $\mathrm{hom}$ functor is fully faithful (this itself is a corollary of the Yoneda lemma), but is not an equivalence of categories, because it isn't essentially surjective. In other words, not every functor $F$ from $\mathcal{C}^{\mathrm{op}}$ to $\mathrm{set}$ is representable- for example, the empty functor which maps each object in $\mathcal{C}$ to the empty set, is never representable. The problem is that the Yoneda embedding does not commute with colimits. But the Yoneda lemma tells you that every functor $F\in \mathrm{Hom}(\mathcal{C}^{\mathrm{op}},\mathrm{set})$ becomes representable when extended appropriately. In other words, every functor $F$ from $\mathcal{C}^{\mathrm{op}}$ to $\mathrm{set}$ extends to a functor from $\left(\mathrm{Hom}(\mathcal{C}^{\mathrm{op}},\mathrm{set})\right)^{\mathrm{op}}$ to $\mathrm{set}$ (this is a special case of the Yoneda extension) which does commute with colimits, and is representable.

So one philosophical interpretation'' of the Yoneda lemma is the following:

Every functor $F$ from $\mathcal{C}^{\mathrm{op}}$ to $\mathrm{set}$ can be extended to a representable functor from $\left(\mathrm{Hom}(\mathcal{C}^{\mathrm{op}},\mathrm{set})\right)^{\mathrm{op}}$ to $\mathrm{set}$.

One reference for this point of view is these notes by Akhil Mathew.

-
Not only is it not essentially surjective in general, it's never essentially surjective, because the functor $C^{op} \to Set$ that is constantly empty cannot be isomorphic to a representable. (I must confess: I don't understand what you are trying to say in your answer.) –  Todd Trimble Feb 11 at 20:26
Thank you for your comment. I've used it to clarify and expand this answer- does it make more sense now? –  Daniel Moskovich Feb 12 at 8:39

Here is an example on representable functors. Yoneda's lemma gives down-to-earth, morpshim oriented interpretation of representable functors, and vice versa.

I will explain this with an example.

In a category $\mathscr{C}$, the product of $A$ and $B$ is the pair of object $A\times B$ in $\mathscr{C}$ and a fixed natural isomorphism $$\sigma \colon \mathrm{Hom}(-,A\times B)\to \mathrm{Hom}(-,A)\times \mathrm{Hom}(-,B).$$

This definition of products only uses terminology of functors. By applying Yoneda's lemma, we arrive at a morphism oriented definiton of products. Yoneda's lemma says that there is a bijection $$\Psi \colon \mathrm{Hom}\left( \mathrm{Hom}(-,A\times B),\mathrm{Hom}(-,A)\times \mathrm{Hom}(-,B)\right) \to \mathrm{Hom}(A\times B,A)\times \mathrm{Hom}(A\times B,B).$$ In particular, we apply this to $\sigma$ and denote $$\Psi(\sigma)=\sigma(A\times B)(\mathrm{id}_{A\times B})=(\pi^{A}\colon A\times B\to A,\pi^{B}\colon A\times B\to B).$$ Next, by applying the inverse of $\Psi$, we compute $$\sigma(X)=\Psi^{-1}\left( \Psi(\sigma)\right)(X):\mathrm{Hom}(X,A\times B)\to \mathrm{Hom}(X,A)\times \mathrm{Hom}(X,B)$$ $$f\colon X\to A\times B\mapsto (\pi^{A}\circ f,\pi^{B}\circ f).$$ Since $\sigma$ is a natural isomorphism, $\sigma(X)$ is a bijection. This bijectivity is the usual definition of product based on morphisms (universality):

For any pair of morphisms $f^{A}\colon X\to A$ and $f^{B}\colon X\to B$, there exists a unique morphism $f\colon X\to A\times B$ with $\pi^{A}\circ f=f^{A}$ and $\pi^{B}\circ f=f^{B}$.

I think the Philosophy behind Yoneda's lemma is that, it connects the world of functors (and natural transformations) $\mathfrak{Set}^{\mathscr{C}^{\mathrm{op}}}$ and the world of morphisms $\mathscr{C}$.

-