Yoneda’s Lemma says that an object is determined by how every other object maps into it. Let C be a locally small category, let A∈C, and let F:C→Set be a functor. This is the covariant version; the contravariant form uses F:Cop→Set.
The lemma gives a natural isomorphism:
Nat(HomC(A,−),F)≅F(A).
The Map
Given a natural transformation η:HomC(A,−)⇒F, send it to Evaluating at idA picks out the element of F(A) represented by η.
Φ(η)=ηA(idA)∈F(A).
This defines a function
Φ:Nat(HomC(A,−),F)→F(A).
Now go the other way. Given x∈F(A), define a natural transformation
Ψ(x):HomC(A,−)⇒F by specifying its component at each object B:
Ψ(x)B(f)=F(f)(x)for f:A→B.
Naturality
We need to check that Ψ(x) is natural. For a morphism g:B→C, the naturality square asks for
F(g)(Ψ(x)B(f))=Ψ(x)C(g∘f).
Using the definition of Ψ(x) and functoriality of F,
F(g)(Ψ(x)B(f))=F(g)(F(f)(x))=F(g∘f)(x)=Ψ(x)C(g∘f).
So Ψ(x) is indeed a natural transformation.
The Inverses
First, start with x∈F(A). Then
Φ(Ψ(x))=Ψ(x)A(idA)=F(idA)(x)=x.
So Φ∘Ψ=idF(A).
Now start with a natural transformation η. Let
x=Φ(η)=ηA(idA).
For any f:A→B, naturality of η for the morphism f gives
F(f)(ηA(idA))=ηB(f∘idA)=ηB(f).
But the left side is exactly Ψ(x)B(f), so
Ψ(Φ(η))B(f)=ηB(f)
for every object B and every morphism f:A→B. Hence Ψ∘Φ is the identity.
Therefore
Nat(HomC(A,−),F)≅F(A).
This is Yoneda’s Lemma.