Yoneda’s Lemma says that an object is determined by how every other object maps into it. Let C\mathcal{C} be a locally small category, let ACA \in \mathcal{C}, and let F:CSetF : \mathcal{C} \to \mathbf{Set} be a functor. This is the covariant version; the contravariant form uses F:CopSetF : \mathcal{C}^{op} \to \mathbf{Set}.

The lemma gives a natural isomorphism:

Nat(HomC(A,),F)F(A).\operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \cong F(A).

The Map

Given a natural transformation η:HomC(A,)F\eta : \operatorname{Hom}_{\mathcal{C}}(A, -) \Rightarrow F, send it to Evaluating at idA\mathrm{id}_A picks out the element of F(A)F(A) represented by η\eta.

Φ(η)=ηA(idA)F(A).\Phi(\eta) = \eta_A(\mathrm{id}_A) \in F(A).

This defines a function

Φ:Nat(HomC(A,),F)F(A).\Phi : \operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \to F(A).

Now go the other way. Given xF(A)x \in F(A), define a natural transformation Ψ(x):HomC(A,)F\Psi(x) : \operatorname{Hom}_{\mathcal{C}}(A, -) \Rightarrow F by specifying its component at each object BB:

Ψ(x)B(f)=F(f)(x)for f:AB.\Psi(x)_B(f) = F(f)(x) \qquad \text{for } f : A \to B.

Naturality

We need to check that Ψ(x)\Psi(x) is natural. For a morphism g:BCg : B \to C, the naturality square asks for

F(g)(Ψ(x)B(f))=Ψ(x)C(gf).F(g)(\Psi(x)_B(f)) = \Psi(x)_C(g \circ f).

Using the definition of Ψ(x)\Psi(x) and functoriality of FF,

F(g)(Ψ(x)B(f))=F(g)(F(f)(x))=F(gf)(x)=Ψ(x)C(gf).F(g)(\Psi(x)_B(f)) = F(g)(F(f)(x)) = F(g \circ f)(x) = \Psi(x)_C(g \circ f).

So Ψ(x)\Psi(x) is indeed a natural transformation.

The Inverses

First, start with xF(A)x \in F(A). Then

Φ(Ψ(x))=Ψ(x)A(idA)=F(idA)(x)=x.\Phi(\Psi(x)) = \Psi(x)_A(\mathrm{id}_A) = F(\mathrm{id}_A)(x) = x.

So ΦΨ=idF(A)\Phi \circ \Psi = \mathrm{id}_{F(A)}.

Now start with a natural transformation η\eta. Let

x=Φ(η)=ηA(idA).x = \Phi(\eta) = \eta_A(\mathrm{id}_A).

For any f:ABf : A \to B, naturality of η\eta for the morphism ff gives

F(f)(ηA(idA))=ηB(fidA)=ηB(f).F(f)(\eta_A(\mathrm{id}_A)) = \eta_B(f \circ \mathrm{id}_A) = \eta_B(f).

But the left side is exactly Ψ(x)B(f)\Psi(x)_B(f), so

Ψ(Φ(η))B(f)=ηB(f)\Psi(\Phi(\eta))_B(f) = \eta_B(f)

for every object BB and every morphism f:ABf : A \to B. Hence ΨΦ\Psi \circ \Phi is the identity.

Therefore

Nat(HomC(A,),F)F(A).\operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \cong F(A).

This is Yoneda’s Lemma.