Category Theory
Zulip Server
Archive

You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.


Stream: learning: questions

Topic: Intuition for Yoneda


view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 10:39):

I thought it might be worth asking here - what are people's preferred intuitions for the yoneda lemma? I've seen some expositions on stackexchange, nlab and blogs (like The Yoneda Perspective ), but none of them have felt completely "satisfying" to me...

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:09):

Think of a presheaf as a family of sets with (contravariant) transport functions indexed by some category C C . Then y(X) y(X) is exactly such a family generated by one element at X X , i.e. a free presheaf. Now what do we expect from morphisms out of something freely generated? To be equivalent to elements at the corresponding set! That's the yoneda lemma

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 11:12):

Ah yes this feels familiar - essentially you’re viewing the yoneda embedding as coming from a left kan extension of [Disc(Ob(C)), Set] along the inclusion Disc(Ob(C)) -> C^op?

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:12):

This POV makes it easy to see that the Yoneda lemma first readily extends to a free/forgetful adjunction

yX:SetC^yX(S)(A)Hom(A,X)×Sy_X : \mathrm{Set} → \hat{C}\\ y_X(S)(A) ≔ \mathrm{Hom}(A, X) × S

left adjoint of

evX:C^Set\mathrm{ev}_X : \hat{C} → \mathrm{Set}

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 11:13):

How should I interpret the “x S” part of the adjunction?

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:17):

which you can generalize in the following multi-sorted way: given f:CD f : C → D

f:D^C^f(P)Pff^* : \hat{D} → \hat{C}\\ f^*(P) ≔ P f

it has the following left adjoint

f(P)(X)YHom(X,f(Y))×P(Y)f_*(P)(X) ≔ ∫^Y \mathrm{Hom}(X, f(Y)) × P(Y)

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:17):

you can really see here how the left adjoint freely adds in all the possible ways you could've transported elements of P, but quotiented by how they were originally transported

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 11:18):

Ah, this seems like the formula for a pointwise left kan extension!

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:18):

yes! instantiating with C=1 C = 1 gives you Yoneda :)

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 11:19):

Mhm mhm - I’ve seen this before, and it definitely is neat that yoneda can be expressed through kan extensions! I guess I’m also interested in a more “elementary” intuition, too :)

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:26):

Here, I'm trying to explain the intuition behind all these fancy constructions, which is simply that representables are simply freely generated presheaves

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:27):

this is imo the Yoneda POV, and helps explain many theorems like the co-Yoneda lemma too

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:28):

co-yoneda is the presheaf version of the easy lemma that every algebraic structure is presented

view this post on Zulip Josselin Poiret (Jul 29 2025 at 11:30):

One more way to think about this is that the Yoneda lemma is the directed J rule

view this post on Zulip Adrian Clough (Jul 29 2025 at 11:45):

Another way in which you can make precise that a representable presheaf is generated by a single element is a follows: The category of right fibrations (with discrete fibres) RFib/C\mathrm{RFib}_{/C} is equivalent to the category of presheaves on CC. Moreover, the inclusion RFib/CCat/C\mathbf{RFib}_{/C} \hookrightarrow \mathbf{Cat}_{/C} admits a left adjoint which takes any object {c}C\{c\} \to C to C/cCC_{/c} \to C (which corresponds to the presheaf represented by cc). Let XCX \to C be a right fibration corresponding to a presheaf FF, then you have F(c)XcCat/C(c,X)RFib/C(C/c,X)Psh(C(,c),F)F(c) \simeq X_c \simeq \mathbf{Cat}_{/C}(c, X) \simeq \mathbf{RFib}_{/C}(C_{/c}, X) \simeq \mathbf{Psh}(C(-,c), F).

view this post on Zulip John Baez (Jul 29 2025 at 11:50):

At a very raw intuitive level I think of the presheaf category on a category as analogous to the free vector space on a set, with colimits taking the place of linear combinations, and the Yoneda embedding as analogous to the map sending elements of the set to the corresponding basis vectors. This can be elaborated, e.g. profunctors are like matrices, etc. I think of this whole body of math as the "rediscovery of linear algebra, one level up". It's very worth pondering why linear algebra was useful in the first place, and why this reincarnation is useful.

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 11:56):

John Baez said:

At a very raw intuitive level I think of the presheaf category on a category as analogous to the free vector space on a set, with colimits taking the place of linear combinations, and the Yoneda embedding as analogous to the map sending elements of the set to the corresponding basis vectors. This can be elaborated, e.g. profunctors are like matrices, etc. I think of this whole body of math as the "rediscovery of linear algebra, one level up". It's very worth pondering why linear algebra was useful in the first place, and why this reincarnation is useful.

Ooh this sounds intriguing - is there a reference you can point to that goes into this perspective in more detail?

view this post on Zulip John Baez (Jul 29 2025 at 12:01):

I think this is stuff "everyone knows" yet most are reluctant to mention. This is why I need to write a textbook... sigh.

The key fact to bear in mind is that the category of presheaves on a category C\mathsf{C} is the free cocompletion of C,\mathsf{C}, just as the vector space with basis SS is the free vector space on SS. Once you know that, a lot of stuff involving presheaves, profunctors, the Yoneda embedding, etc. reveal themselves as analogues of things you already know.

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 12:22):

Linear algebra has remained one of my favourite areas of math, even after all this time, so it’s awesome to hear that it even becomes useful in describing category theory :D

view this post on Zulip Josselin Poiret (Jul 29 2025 at 12:29):

John Baez said:

Once you know that, a lot of stuff involving presheaves, profunctors, the Yoneda embedding, etc. reveal themselves as analogues of things you already know.

What is the analogue of the Yoneda lemma in this case?

view this post on Zulip Peva Blanchard (Jul 29 2025 at 12:36):

Emily Riehl made a nice video about the Yoneda lemma in the category of matrices. (Sorry, I just remember that it was very nice, but I don't remember the actual content ^^')

view this post on Zulip John Baez (Jul 29 2025 at 12:38):

Josselin Poiret said:

John Baez said:

Once you know that, a lot of stuff involving presheaves, profunctors, the Yoneda embedding, etc. reveal themselves as analogues of things you already know.

What is the analogue of the Yoneda lemma in this case?

I always get confused when people talk about the Yoneda lemma as if it were a single result since I think of it as several related results (maybe because I never took a course on category theory). But the full and faithful yet not essentially surjective map from a category to its category of presheaves is mimicked by the one-to-one but not onto map from a set to the free vector space on that set.

(By the way, 'free commutative monoid' is a better analogue than 'free vector space', but most of us start by studying R\mathbb{R}-modules, not the more fundamental N\mathbb{N}-modules.)

view this post on Zulip Josselin Poiret (Jul 29 2025 at 12:39):

What is generally understood to be the Yoneda lemma is the isomorphism Hom(y(X),P)P(X) \mathrm{Hom}(y(X), P) ≃ P(X)

view this post on Zulip Josselin Poiret (Jul 29 2025 at 12:40):

the fact that the yoneda map is in fact an embedding is just a corollary of that result imo

view this post on Zulip John Baez (Jul 29 2025 at 12:43):

The analogue of the Yoneda isomorphism

Hom(y(X),P)P(X)\mathrm{Hom}(y(X), P) ≃ P(X)

is the equation

y(i),v=vi \langle y(i), v \rangle = v_i

Here

Inner products are like homsets, especially in quantum physics! Adjoint operators between inner product spaces are like adjoint functors.

(I don't usually write the ith basis vector as y(i)y(i); I usually write it as eie_i, but that could be mistaken for the ith component of some vector called ee, which would be very bad right now.)

view this post on Zulip Peva Blanchard (Jul 29 2025 at 12:47):

Another point of view, that I learned in this forum here, is as follows. Take for instance the category CC with two objects V,EV,E and two arrows s,t:VEs, t : V \to E.

A presheaf F:CopSetF : C^{op} \to \text{Set} is defined by

I find useful to think of CC as the kinds of "shapes", and FF as a kind of gluing of instances of those shapes.

One can check that

Given two presheaves (i.e. graphs) F,GF, G, a natural transformation FGF \Rightarrow G can be seen as morphism of graph (it maps vertices to vertices, edges to edges, while respecting the source and target maps).

Now, a natural transformation y(V)Fy(V) \Rightarrow F is a morphism from the graph with a single vertex to the graph FF. Hence, there are as many such natural transformations as there are vertices in the graph:

Nat(y(V),F)FVNat(y(V), F) \simeq FV

And similarly for edges.

view this post on Zulip Alex Kreitzberg (Jul 29 2025 at 18:56):

I think the number of footholds folks use to get an understanding speaks to how deep Yoneda is.

The nLab page [[Yoneda Lemma]] lists three corollaries with three corresponding intuitions. As a beginner, I notice the examples folks give of "what the Yoneda lemma is" are heavily skewed in favor of "corollary 1" (that the Yoneda embedding is an embedding). Imo this is hard for a beginner to appreciate because, as a beginner, I don't fully understand the presheaf category, because I don't fully understand free cocompletions, because I don't fully understand colimits. (I'm overselling my confusion a touch)

Despite its superficial complexity, I'm partial to "corollary 3" as the first one to learn, because it gives more context for universal properties.

Here's a simple example that really impressed me:

"a generalized element of a pair, is a pair of generalized elements", corresponds to the potential natural isomorphism

C(X,A×B)C(X,A)×C(X,B)C(X, A\times B) \cong C(X, A) \times C(X, B)

The Yoneda lemma tells you what your category needs to have to implement this isomorphism, by spelling out the way in which A×BA\times B is a universal object of a certain category. The projection functions of the pair end up being a "universal element", or what I think of as a universal interface.

That is you can specify the arrows going into some object with a set valued functor, and the Yoneda lemma can then tell you what resulting object gets defined (if possible). Or in other words, you can specify what the generalized elements of an object is, and the Yoneda lemma then tells you what you need to define the object.

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 19:40):

Alex Kreitzberg said:

I think the number of footholds folks use to get an understanding speaks to how deep Yoneda is.

The nLab page [[Yoneda Lemma]] lists three corollaries with three corresponding intuitions. As a beginner, I notice the examples folks give of "what the Yoneda lemma is" are heavily skewed in favor of "corollary 1" (that the Yoneda embedding is an embedding). Imo this is hard for a beginner to appreciate because, as a beginner, I don't fully understand the presheaf category, because I don't fully understand free cocompletions, because I don't fully understand colimits. (I'm overselling my confusion a touch)

Despite its superficial complexity, I'm partial to "corollary 3" as the first one to learn, because it gives more context for universal properties.

Here's a simple example that really impressed me:

"a generalized element of a pair, is a pair of generalized elements", corresponds to the potential natural isomorphism

C(X,A×B)C(X,A)×C(X,B)C(X, A\times B) \cong C(X, A) \times C(X, B)

The Yoneda lemma tells you what your category needs to have to implement this isomorphism, by spelling out the way in which A×BA\times B is a universal object of a certain category. The projection functions of the pair end up being a "universal element", or what I think of as a universal interface.

That is you can specify the arrows going into some object with a set valued functor, and the Yoneda lemma can then tell you what resulting object gets defined (if possible). Or in other words, you can specify what the generalized elements of an object is, and the Yoneda lemma then tells you what you need to define the object.

I'm inclined to agree - I feel like "corollary 1" does get over-emphasised in a way that's unhelpful, and I often prefer to approach yoneda through the language of representability. How do you feel about the way Schreiber puts it in "Philosophical" meaning of the Yoneda Lemma, in terms of "generalised objects" of C?

view this post on Zulip Alex Kreitzberg (Jul 29 2025 at 19:55):

If you're willing to accept a handful of weird videos on your youtube algorithm, Schreiber actually expands on that point of view in this video (I don't endorse the channel broadly):

https://youtu.be/1KUhLHlgG2Q?si=HbgTYhjtcY9TEQ48

With which he made these associated notes:

https://ncatlab.org/schreiber/show/Per%C3%AC+Panthe%C5%8Dr%C3%ADas

I think it's a very nice point of view that I'm assuming I'll understand better and better as I get more comfortable with presheaves, sheaves and the yoneda embedding (It's corollary 1 from the yoneda page again :" corollary I says that the interpretation of presheaves on C as generalized objects probeable by objects c of C is consistent: the probes of X by c are indeed the maps of generalized objects from c into X" ).

I have some intuition for it, but I'm not comfortable enough with it to give my own explicit description, I was going to revisit it after I was much more comfortable with presheaves.

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 20:01):

Alex Kreitzberg said:

If you're willing to accept a handful of weird videos on your youtube algorithm, Schreiber actually expands on that point of view in this video (I don't endorse the channel broadly):

https://youtu.be/1KUhLHlgG2Q?si=HbgTYhjtcY9TEQ48

With which he made these associated notes:

https://ncatlab.org/schreiber/show/Per%C3%AC+Panthe%C5%8Dr%C3%ADas

I think it's a very nice point of view that I'm assuming I'll understand better and better as I get more comfortable with presheaves, sheaves and the yoneda embedding (It's corollary 1 from the yoneda page again :" corollary I says that the interpretation of presheaves on C as generalized objects probeable by objects c of C is consistent: the probes of X by c are indeed the maps of generalized objects from c into X" ).

I have some intuition for it, but I'm not comfortable enough with it to give my own explicit description, I was going to revisit it after I was much more comfortable with presheaves.

Ah I think I've seen bits and pieces of that - was surprised to see, uh, the large amount of philosophizing going on... I'll take another look!

view this post on Zulip Alex Kreitzberg (Jul 29 2025 at 20:19):

I guess you did remind me of how I reworded it.

We're trying to interpret F:CopSetF : C^{\text{op}} \rightarrow \text{Set} as generalized elements from CC. That is, for cCc \in C, we want to write cFc \rightarrow F without getting into trouble.

We don't get into trouble because

FcNat(y(c),F)=cF" F c \cong Nat( y(c), F ) =`` c \rightarrow F "

Where we can pretend the natural transformations are morally cFc \rightarrow F, because CC is embedded in the presheaf category.

That is we're generalizing arrows like cdc \rightarrow d into the natural transformations y(c)y(d)y(c) \Rightarrow y(d) but then we just write them as vanilla arrows going into FF to emphasize it's just a bigger category.

But, I'm not at all sure this take is bug free, I'm open to feedback from pros on it.

view this post on Zulip Peva Blanchard (Jul 29 2025 at 20:34):

I'm not a pro, but considering the category C=Vs,tEC = V \xrightarrow{s,t} E, you obtain a relatively low-brow version of this. A presheaf FF on CC is just a graph (see e.g. my previous comment)

Using your notation, a generalized element VFV \to F (resp. EFE \to F) is a vertex (resp. edge) of FF.

The embedding of VV (resp. EE) into the presheaf category PSh(C)PSh(C), i.e. the category of graphs, is the graph y(V)y(V) with a single vertex (resp. the graph y(E)y(E) with a single edge and the two corresponding vertices).

The set FVFV (resp. FEFE) of vertices (resp. edges) of the graph FF is in bijection with the set of graph morphisms from y(V)y(V) (resp. y(E)y(E)) to FF. This is an instance of the Yoneda lemma.

view this post on Zulip Ruby Khondaker (she/her) (Jul 29 2025 at 20:44):

One thing I would be interested in is whether this perspective also makes the proof of yoneda transparent, as opposed to just the statement?

view this post on Zulip fosco (Jul 30 2025 at 08:02):

Apologies if I haven't seen this idea expanded elsewhere, but:

A category is a space, the category of presheaves on it is the space of regular functions defined on that space, or predicates that can be asserted about the space; the representable at AC0A\in\cal C_0 is a point, that is to say the functions that predicates "my input can reach the object AA with an arrow" and hom(X,A)\hom(X,A) contains all the proofs of this statement; yoneda lemma is the statement that

  1. To know a function F it is enough to know its value on points, i.e. the set of arrows from a point to F [Nat(yA,F)FANat(yA,F)\cong FA]

From which it follows

  1. If two points "coincide" then their associated objects coincide as well [sending AA to yAyA is fully faithful]
  2. Every function F can be reconstructed from points [sending AA to yAyA is a dense functor]

In this light, yoneda lemma is a fact of differential geometry: a functor F:CopSetF : {\cal C}^{op}\to \bf Set is just a bundle over C\cal C, and in order to know how the fibers of that bundle are glued together...

In more formal terms, every presheaf has a category of elements attached, and every [[discrete fibration]] is the category of elements of some presheaf (to the effect that the categories of presheaves and discrete fibrations are equivalent); so natural transformations yAFyA \to F correspond to functors C/AElts(F){\cal C}/A \to Elts(F) such that the diagram

C/AElts(F)C=C\begin{array}{ccc} {\cal C}/A &\to & Elts(F) \\ \downarrow && \downarrow \\ {\cal C} &=& \cal C \end{array}

with the projections to the category C\cal C commutes. Now a functor like this must be...

view this post on Zulip Josselin Poiret (Jul 30 2025 at 08:04):

The perspective of y(X) y(X) being freely generated by a single element (or vertex as @Peva Blanchard puts it) at X X makes the proof extremely transparent, it's one advantage of that idea.

One way to say the above is that for all f:Hom(A,X) f : \mathrm{Hom}(A, X) , f=Hom(f,X)(idX) f = \mathrm{Hom}(f, X)(\mathrm{id}_X) , i.e. all elements are just given by the action of a map on the generating element idX \mathrm{id}_X .

That means necessarily that for any natural transformation α:y(X)P α : y(X) → P , since this diagram commutes, you can chase idX \mathrm{id}_X around to determine the image of any element in terms of that of idX \mathrm{id}_X .

Hom(X,X)αXP(X)Hom(f,X)P(f)Hom(A,X)αAP(A)\begin{CD} \mathrm{Hom}(X,X) @>α_X>> P(X)\\ @V\mathrm{Hom}(f, X)VV @VVP(f)V\\ \mathrm{Hom}(A, X) @>>α_A> P(A) \end{CD}