41.04.02 · category-theory / yoneda-representability

The Yoneda Lemma, the Yoneda Embedding, and Density

shipped3 tiersLean: none

Anchor (Master): Riehl 2016 *Category Theory in Context* (Dover) §2.2-2.4 and §6.2 (density and the co-Yoneda lemma via the category of elements); Mac Lane 1998 *Categories for the Working Mathematician* 2e (Springer GTM 5) Ch. III §2 and Ch. X (ends and the coend form); Mac Lane-Moerdijk 1992 *Sheaves in Geometry and Logic* (Springer) Ch. I §5 (presheaves as the free cocompletion, the density theorem); Kelly 1982 *Basic Concepts of Enriched Category Theory* (Cambridge) Ch. 2-3 (the enriched and weighted-colimit Yoneda)

Intuition Beginner

You can identify a thing without ever looking inside it, just by recording how everything else relates to it. To know a person you have never met, collect, for every place in the world, the list of routes that reach them there. If two people generate the very same lists from everywhere, they are the same person. The lists are a complete portrait. The previous unit packaged exactly these lists as a functor: fix an object, and record, for each other object, the bundle of arrows pointing at it.

The Yoneda lemma is the precise statement that the portrait loses nothing. It says: a way of comparing the portrait of one object to any other measurement is the same as a single value of that measurement at the object. All the comparison data collapses to one piece of information, recovered at the seed.

Two consequences follow. First, an object is completely pinned down by its portrait: two objects with matching portraits are the same, and every relationship between two objects shows up as a relationship between their portraits and no extra ones sneak in. This is the slogan that an object is known by its maps. Second, every measurement you could make on objects, however complicated, is assembled out of these basic portraits glued together. The portraits are the building blocks, and everything else is built from them. That assembling-from-portraits statement is what the density idea captures.

Visual Beginner

Picture one fixed dot, the object you want to study, with its portrait: for every other dot, the bundle of arrows running into the fixed dot. Now imagine a second, possibly very different, measurement that also assigns a set to every dot. The Yoneda lemma compares the portrait to this measurement and says every such comparison is named by one point: the value of the measurement at the fixed dot, fed the identity loop.

question the portrait answers it by the Yoneda lemma says
how do you store an object? the bundle of arrows into it one identity loop regrows the rest
how do two objects relate? a comparison of their portraits exactly the arrows between them, no more
how do you build any measurement? glue portraits together every measurement is a blend of portraits

The picture shows the seed at work in two directions. Reading inward, the identity loop at the center names every comparison from the portrait. Reading outward, the same loops, one per object, let you reassemble any shaded measurement as a patchwork of portraits.

Worked example Beginner

Work in a tiny world with two objects, and . Besides the two do-nothing identity arrows, there is exactly one extra arrow, , going from to . Composition is forced: followed by the identity is .

Step 1. Build the portrait of , the rule recording arrows out of . From the arrows out are the identity on and , so at the portrait holds a two-element set, and at it holds the one-element set containing .

Step 2. Pick a measurement to compare against. Let the measurement assign to a three-element set and to a one-element set , with the arrow sending the value at over to the value at by sending every one of to .

Step 3. Count the comparisons by hand. A comparison must respect the arrows, and the Yoneda lemma promises the number of comparisons equals the number of values the measurement gives at , namely three. Each choice of one of as the image of the identity on extends to exactly one full comparison, because feeding into the comparison is then forced.

What this tells us: the comparisons did not need to be searched for one by one. There were three, matching the three values at , and each was named by where it sent the identity on . The portrait of is so rigid that a single choice at the seed determines everything.

Check your understanding Beginner

Formal definition Intermediate+

Let be a locally small category. For an object the covariant hom-functor sends to and to post-composition ; the contravariant hom-functor sends to and to pre-composition . A presheaf on is a functor ; the presheaves and their natural transformations form the functor category [Riehl 2016]. These hom-functors are the representable functors of 41.04.01.

Definition (the Yoneda functors). The covariant Yoneda functor is regarded as varying in ; the Yoneda embedding is the functor $$ \text{よ}\colon\mathcal{C}\longrightarrow[\mathcal{C}^{\mathrm{op}},\mathbf{Set}],\qquad c\mapsto\mathcal{C}(-,c), $$ sending an object to its contravariant hom-functor (its functor of points) and an arrow to the natural transformation with component , post-composition. The symbol よ is the Japanese kana yo; one also writes or with .

Definition (functor of points; representable presheaf). A presheaf naturally isomorphic to some is representable; is its representing object. The notation or denotes the set of natural transformations , the hom-set of the functor category. The notation introduced here — よ for the Yoneda embedding, for the presheaf category, and for the two hom-functors, for the category of elements, for a coend — is recorded in _meta/NOTATION.md.

For a presheaf on the category of elements has objects the pairs with and morphisms the arrows in with , as in 41.04.01; the projection forgets the element and is a discrete fibration.

Counterexamples to common slips Intermediate+

  • The Yoneda bijection is with the value, not with an automorphism group. is a bijection of sets for every , representable or not. Reading it only in the case recovers , the morphisms, but the lemma is unconditional and applies to any set-valued functor.

  • Full and faithful is not the same as injective on objects. The Yoneda embedding is full and faithful, so it is injective on isomorphism classes, but two non-isomorphic objects with no common arrows could in principle be sent to non-isomorphic presheaves while the functor remains non-injective on the nose; what is forced is , an isomorphism of hom-sets, hence iff .

  • Density is a colimit of representables, not a limit. Every presheaf is a colimit, not a limit, of representables, indexed by its own category of elements; reversing this to a limit fails already for a two-element coproduct of representables.

Key theorem with proof Intermediate+

The signature result is the Yoneda lemma, computing the natural transformations out of a representable functor as the values of the target, naturally in both arguments.

Theorem (Yoneda lemma). Let be locally small, an object, and a functor. The map $$ \Phi_{F,c}\colon\mathrm{Nat}\bigl(\mathcal{C}(c,-),F\bigr)\longrightarrow F(c),\qquad \alpha\longmapsto\alpha_c(\mathrm{id}_c), $$ is a bijection, natural in and in [Riehl 2016]. Dually, for a presheaf , $$ \mathrm{Nat}\bigl(\mathcal{C}(-,c),F\bigr)\cong F(c),\qquad \alpha\longmapsto\alpha_c(\mathrm{id}_c). $$

Proof. Construct an inverse . Given , define a transformation with components by for .

The family is natural. For the naturality square asks that . Both sides applied to give on the left by functoriality of , and on the right, since . The square commutes.

The two maps are mutually inverse. Computing uses . Conversely, take any and set . Naturality of at gives ; evaluating at and using yields . So , and is a bijection.

Naturality in : for , precomposition induces a map , and the square against commutes because matches by naturality of at . Naturality in : a natural transformation post-composes to , and , so commutes with . The contravariant statement is the covariant lemma applied in .

Bridge. The Yoneda lemma builds toward the full force of the functor-of-points viewpoint and appears again in 41.06.02, where it is the engine of the Kan-extension formulas, and in 04.02.01, where a scheme is recovered from its functor of points. The foundational reason a single value controls the whole transformation is that naturality forces , so every component is the seed pushed forward; this is exactly the mechanism by which the representability theorem of 41.04.01 reads the universal element off the identity, now upgraded from invertible to arbitrary . Taking in the contravariant form generalises that representability statement: it computes , which is exactly the statement that the embedding よ is full and faithful, proved in the next section. Putting these together, the bridge is from "morphisms between objects" to "natural transformations between their functors of points", and the lemma is what makes that passage lose nothing, so the entire apparatus of universal properties is shadow-boxing with this one bijection.

Exercises Intermediate+

Advanced results Master

Theorem (the Yoneda embedding is full and faithful). For a locally small the functor is full and faithful: for all the function , , is a bijection. This is the Yoneda lemma applied with the presheaf , whose value at is ; the inverse sends a natural transformation to . Consequently in if and only if in the presheaf category, the precise sense in which an object is known by its maps. The full subcategory of on the representables is therefore equivalent to , and よ exhibits as that subcategory.

Theorem (Cayley's theorem as the one-object case). Apply the embedding to , the one-object category of a monoid . A presheaf on is a right -set, and the embedding sends the unique object to as a right -set with acting on itself by right multiplication; fullness and faithfulness say as monoids, the endomorphisms of the regular representation. For a group this is Cayley's theorem: embeds into the symmetric group on its underlying set via the regular representation, since the -equivariant self-maps of are exactly left multiplications. The classical embedding of a group into a permutation group is thus the Yoneda embedding specialised to a one-object groupoid, and the Yoneda lemma is the categorical generalisation of the orbit-stabiliser bookkeeping that underlies the regular representation.

Theorem (density; every presheaf is a colimit of representables). Let be a presheaf with category of elements and projection . Then is the colimit of the composite , and the colimiting cocone has component at the natural transformation named by under the Yoneda lemma. Symbolically, $$ F;\cong;\mathrm{colim}\Bigl(\textstyle\int_{\mathcal{C}}F\xrightarrow{\ \pi\ }\mathcal{C}\xrightarrow{\ \text{よ}\ }[\mathcal{C}^{\mathrm{op}},\mathbf{Set}]\Bigr). $$ The category of representables is dense in : representable presheaves generate the whole category under colimits, and a presheaf is reconstructed canonically by gluing one representable per element of each of its values along the morphisms of .

Theorem (the co-Yoneda / ninja-Yoneda coend form). The density colimit is computed by a coend, the co-Yoneda lemma: for any presheaf , $$ F;\cong;\int^{c\in\mathcal{C}}F(c)\cdot\mathcal{C}(-,c), $$ where is the -indexed copower (coproduct of copies) of the representable , and the coend over identifies the two ways an arrow acts. Dually for a covariant via an end. These coend expressions are the manipulable form of density; the ends-and-coends calculus is developed in 41.06.01, where the Fubini and continuity rules make the formulas computational. The same coend underlies the convolution and Kan-extension formulas: a left Kan extension along よ is computed by substituting the coend, which is why presheaf categories are the natural home of such constructions.

Theorem (presheaves as the free cocompletion). For any category the presheaf category is the free cocompletion of : it is cocomplete, and for every cocomplete category restriction along よ gives an equivalence between colimit-preserving functors and arbitrary functors . Concretely any extends, uniquely up to isomorphism among colimit-preserving functors, to with , the left Kan extension along よ. The unit of this universal property is the density theorem: because makes the coend collapse to . This is the universal property that singles out presheaf categories among all cocomplete categories receiving .

Theorem (the 2-categorical Yoneda). The construction is itself functorial in at the level of the 2-category . For a 2-category and an object the representable 2-functor has the property that, for any 2-functor , the category of 2-natural transformations is equivalent to the category , the 2-Yoneda lemma. Specialising exhibits as a full sub-2-category of via , and the bicategorical refinement (pseudofunctors, pseudonatural transformations, modifications) is the form used to identify (op)fibrations with pseudofunctors through the Grothendieck construction, the indexed reading of the category of elements.

Synthesis. Putting these together, the Yoneda lemma is the single fact from which the rest of elementary category theory is deduced. The foundational reason an object is known by its maps is that , so the embedding into presheaves loses no information and reflects isomorphisms; this is exactly the upgrade of the representability theorem of 41.04.01 from invertible to arbitrary transformations. The same bijection, read in the one-object case, is dual to nothing more exotic than Cayley's theorem, and read in the limit-preserving direction shows よ preserves limits while the density theorem repairs the colimits it destroys by exhibiting every presheaf as a canonical colimit of representables. The central insight is that this density makes the free cocompletion of , so the coend is at once the reconstruction of and the recipe for extending any functor along よ, which generalises to the weighted-colimit and enriched settings without change. The bridge is that adjunctions in 41.03.01, Kan extensions in 41.06.02, and the functor of points in 04.02.01 are each a use of this one lemma, so the working slogan that all of category theory is shadow-boxing with Yoneda is the literal observation that universal properties are computed by evaluating natural transformations at an identity arrow.

Full proof set Master

Proposition 1 (the Yoneda map is a bijection, natural in both variables). For and an object , the map , , is a bijection, natural in and in .

Proof. Define for by . Naturality of : for and , . For the inverse identities, ; and for with , naturality of at gives , so . Naturality in along : , so the square with commutes. Naturality in along : precomposition sends to , and , the last by naturality of at , matching . Both naturality squares commute.

Proposition 2 (the embedding is full and faithful). The functor , , induces a bijection .

Proof. Apply Proposition 1 in the contravariant form to the presheaf , whose value at is . The Yoneda bijection sends a natural transformation to . The inverse sends to with for , which is exactly . So is the inverse of the Yoneda bijection, hence a bijection: よ is full and faithful. Reflection of isomorphisms follows, since a full and faithful functor inverting produces with , whence by faithfulness, and symmetrically.

Proposition 3 (density: every presheaf is the colimit of ). For a presheaf on , the cocone with component at exhibits as .

Proof. First the family is a cocone: for a morphism in , i.e. with , one needs . Both are transformations , and by the Yoneda bijection it suffices to compare their values at the identity: . So the family is a cocone. To see it is colimiting, test against an arbitrary presheaf and a cocone . By Yoneda each is an element , and the cocone condition says whenever . Define by ; the cocone condition is exactly naturality of , and holds by evaluating at . Uniqueness of is forced because any mediating transformation has . Hence .

Proposition 4 (free cocompletion: extension along よ). Let be cocomplete and a functor. The left Kan extension exists, preserves colimits, satisfies , and is the unique colimit-preserving functor with this property up to isomorphism.

Proof. Define , the colimit over the category of elements of , which exists since is cocomplete. On a representable, has a terminal object by the Yoneda lemma, so the colimit collapses and , giving . The functor preserves colimits: a colimit of presheaves is computed in as a corresponding colimit of categories of elements, and colimits commute with colimits in , so . For uniqueness, any colimit-preserving with satisfies, by Proposition 3, naturally in . So , and restriction along よ is an equivalence between colimit-preserving functors and functors .

Connections Master

  • Representable functors and universal elements 41.04.01. The prerequisite unit defines the representable functors , the universal element , and the representability theorem identifying a representation with a universal element and with an initial or terminal object of . The Yoneda lemma proved here is the unconditional version of that theorem's Proposition 1: it computes for every , so representability is exactly the special case where the resulting transformation is invertible, and the universal element named there is the Yoneda image of the identity.

  • Natural transformations and functor categories 41.01.02. The lemma is a statement about the hom-sets of the functor category built in 41.01.02; the density theorem and the free-cocompletion property are statements about its colimits. The full-and-faithfulness of よ shows that the equivalence-of-categories machinery of 41.01.02 embeds as the representables, so every categorical invariant of is computed inside its presheaves.

  • Limits, colimits, and universal cones 41.02.01. Exercise 7 shows よ preserves the limits constructed in 41.02.01, and the density theorem shows it does not preserve colimits, instead presenting the presheaf category as the formal colimit completion. The cone-functor reading of a limit from 41.02.01 is the representability statement that the Yoneda lemma here turns into a computation, and the coend form is a weighted colimit in the sense that unit develops.

  • Adjunctions via Yoneda 41.03.01. The co-produced unit 41.03.01 derives the uniqueness of adjoints directly from the Yoneda lemma: a right adjoint value represents , and the embedding's faithfulness forces it unique up to unique isomorphism. The free-cocompletion property proved here is the universal property making a left adjoint to restriction, so adjunctions and the Yoneda embedding are two readings of the same Kan-extension data.

  • Ends, coends, and Kan extensions 41.06.01, 41.06.02. The co-Yoneda coend previewed here is given its full calculus in the co-produced 41.06.01, where the end and coend over a profunctor and the Fubini rule make the formula computational. The free-cocompletion extension is the leading example of the pointwise Kan extension developed in the co-produced 41.06.02, whose general formula is the same coend with the representable replaced by an arbitrary weight.

Historical & philosophical context Master

The lemma is named for Nobuo Yoneda, who isolated the bijection in the course of work on the homology theory of modules and the functor [Yoneda 1954]; the statement was transmitted to Saunders Mac Lane in a conversation at the Gare du Nord in Paris in 1954 and entered the literature through Mac Lane's lectures and Categories for the Working Mathematician [Mac Lane 1998], where it appears in Chapter III together with the embedding and the remark that an object is determined up to isomorphism by the functor it represents. Riehl's Category Theory in Context (2016) organises the lemma, its naturality, the embedding, and the density theorem as the spine of its second chapter, the presentation followed here [Riehl 2016].

The density theorem and the reading of presheaves as the free cocompletion were systematised in topos theory: Mac Lane and Moerdijk's Sheaves in Geometry and Logic (1992) [Mac Lane-Moerdijk 1992] presents every presheaf as a colimit of representables in Chapter I and uses it to build the sheafification adjunction, while Kelly's Basic Concepts of Enriched Category Theory (1982) [Kelly 1982] gives the weighted-colimit and enriched form in which the coend is the defining computation. The one-object case recovers Cayley's 1854 embedding of a group into a permutation group, so the categorical lemma is the common generalisation of the regular representation in group theory, the Stone and Gelfand dualities recovering a space from its functions, and Grothendieck's functor-of-points reconstruction of a scheme from the maps into it.

Bibliography Master

@article{Yoneda1954yoneda,
  author  = {Yoneda, Nobuo},
  title   = {On the homology theory of modules},
  journal = {Journal of the Faculty of Science, University of Tokyo, Section I},
  volume  = {7},
  year    = {1954},
  pages   = {193--227}
}

@book{MacLane1998yoneda,
  author    = {Mac Lane, Saunders},
  title     = {Categories for the Working Mathematician},
  edition   = {2},
  publisher = {Springer},
  series    = {Graduate Texts in Mathematics 5},
  year      = {1998}
}

@book{Riehl2016yoneda,
  author    = {Riehl, Emily},
  title     = {Category Theory in Context},
  publisher = {Dover},
  year      = {2016}
}

@book{MacLaneMoerdijk1992,
  author    = {Mac Lane, Saunders and Moerdijk, Ieke},
  title     = {Sheaves in Geometry and Logic: A First Introduction to Topos Theory},
  publisher = {Springer},
  series    = {Universitext},
  year      = {1992}
}

@book{Kelly1982,
  author    = {Kelly, G. Max},
  title     = {Basic Concepts of Enriched Category Theory},
  publisher = {Cambridge University Press},
  series    = {London Mathematical Society Lecture Note Series 64},
  year      = {1982}
}

@incollection{Cayley1854,
  author    = {Cayley, Arthur},
  title     = {On the theory of groups, as depending on the symbolic equation $\theta^n = 1$},
  booktitle = {Philosophical Magazine},
  volume    = {7},
  year      = {1854},
  pages     = {40--47}
}