The Yoneda Lemma

You are what you relate to: representable functors and presheaves

The Yoneda Lemma

"You are what you relate to." The Yoneda Lemma says an object is completely pinned down by its arrows to and from everything else.

You Are What You Relate To

Click each object to reveal how the mystery object maps to it. Once every hom-set is showing, there is only one thing it can be.

Fingerprint: 0/3 hom-sets revealed
?Mystery ObjectAclick to revealBclick to revealCclick to reveal
Go deeper:You Are What You Relate To

"You are what you relate to." The Yoneda Lemma says that an object is completely determined by the collection of all morphisms into (or out of) it. It is the single most important result in category theory, and once you understand it, you see it everywhere.

Can you identify a mystery object just by knowing how it maps to other objects? Click each object below to reveal the hom-set Hom(?, X). Once all hom-sets are revealed, the mystery object's identity is uniquely determined — this is the essence of the Yoneda philosophy.

Key insight: An object is completely determined by its hom-sets — that is, by how it relates to every other object. Two objects with identical "relationship fingerprints" must be isomorphic. This is the philosophical core of the Yoneda Lemma.

Yoneda Embedding

Press Run Embedding to send each object to its presheaf, then click a presheaf to inspect it. No arrow information gets lost.

Category CfgABCyYonedaEmbedding
Go deeper:Yoneda Embedding

The Yoneda embedding y : C → [Cᵒᵖ, Set] sends each object A to its representable presheaf Hom(−, A). This embedding is full and faithful, meaning it perfectly preserves all morphism information.

Key insight: The Yoneda embedding is full (every natural transformation between representable presheaves comes from a morphism) and faithful (different morphisms give different natural transformations). This means every category embeds into a functor category.

Yoneda Lemma: Step by Step

Step forward and back through the proof. Watch one value, the image of the identity, determine everything else.

Step 1 of 5

Setup

We have a functor F and the representable functor Hom(A, -). We want to show that natural transformations Nat(Hom(A,-), F) correspond bijectively to elements of F(A).

Hom(A, −)Functor FHom(1,1){id₁}Hom(1,2){f}Hom(1,3){g∘f}F(1){a, b}F(2){x, y, z}F(3){p}alpha_1alpha_2alpha_3
Nat(Hom(A, −), F) ≅ F(A)
naturally in A and F
Go deeper:Yoneda Lemma: Step by Step

The Yoneda Lemma states: Nat(Hom(A,−), F) ≅ F(A), naturally in both A and F. Walk through the proof in both directions using the concrete example below.

Key insight: A natural transformation out of a representable functor is completely determined by a single value — its action on the identity morphism. Naturality forces all other components. The element alpha_A(id_A) ∈ F(A) is the "DNA" that uniquely encodes the entire natural transformation.

Presheaf Visualizer

Click an object to see its set, then show the restriction maps and notice they run backwards along the arrows.

Fibers (sets assigned to each object)P(A) = {a1, a2, a3}a1a2a3P(B) = {b1, b2}b1b2P(C) = {c1}c1Base Category CABCfgg∘f

Functoriality Check

P(g∘f)(c1) = a1
P(f) ∘ P(g)(c1) = P(f)(b1) = a1 Consistent!
P(g∘f) = P(f) ∘ P(g) — contravariant composition reverses order
Go deeper:Presheaf Visualizer

A presheaf on a category C is a functor P : Cᵒᵖ → Set. It assigns a set (a "fiber") to each object, and a restriction map to each morphism — going in the opposite direction. Think of it as a "fiber bundle" over the category.

Key insight: A presheaf is a "generalized object" that records a family of sets indexed by the category, with restriction maps going backwards (contravariant). The representable presheaves Hom(−, A) are the "basic building blocks" from which all presheaves are built.

Key Takeaways

  • An object is determined by all its arrows to and from other objects.
  • The Yoneda embedding loses no information about a category.
  • Nat(Hom(A,−), F) ≅ F(A): one element fixes the whole transformation.
  • Presheaves assign sets to objects, with maps running backwards.

Spot a mistake or have an idea?

Search