Yoneda, Yoneda, Yoneda

James Leslie - Yoneda, Yoneda, Yoneda
Posted on April 23, 2018 by James Leslie

The Yoneda Lemma is one of the few β€˜theorems’ one learns in a first course on category theory and it is an invaluable tool.

Suppose we have a locally small category π’œ \mathcal{A}, then for any two objects A,B A, B there is a set of maps from A A to B B, denoted π’œ(A,B) \mathcal{A}(A,B). We can make this into a functor by forgetting about the domain. We define the following functor:

HB:π’œopβ†’π’πžπ­ H_B:\mathcal{A}^{op} \rightarrow \mathbf{Set},

such thatΒ A↦HB(A)=π’œ(A,B) A \mapsto H_B(A) = \mathcal{A}(A, B) andΒ (f:Aβ†’C)↦(HA(f):HA(C)β†’HA(A))(f:A \rightarrow C) \mapsto (H_A(f):H_A(C) \rightarrow H_A(A)). Given any map g:Cβ†’A g:C \rightarrow A, (HA(f))(g)=g∘f:Aβ†’A (H_A(f))(g) = g \circ f:A \rightarrow A. We can go further however, by removing our choice of AA. We define a functor

Hβ‹…:π’œβ†’[π’œop,π’πžπ­]H_\cdot:\mathcal{A} \rightarrow [\mathcal{A}^\text{op}, \mathbf{Set}],

where A↦HA A \mapsto H_A and (f:Aβ†’B)↦(Hf:HAβ†’HB) (f:A \rightarrow B) \mapsto (H_f:H_A \rightarrow H_B), where Hf H_f is a natural transformation. For any Cβˆˆπ’œ C \in \mathcal{A}, the C C component of Hf H_f is a function (Hf)C:HA(C)β†’HB(C) (H_f)_C:H_A(C) \rightarrow H_B(C) such that for any map g:Cβ†’A g:C \rightarrow A, ((Hf)C)(g)=f∘g:Cβ†’B ((H_f)_C)(g) = f \circ g:C \rightarrow B.

The functor Hβ‹… H_\cdot is known as the Yoneda embedding. It comes hand in hand with the Yoneda Lemma.

Yoneda lemma

Let π’œ\mathcal{A} be a locally small category. ThenΒ 

[π’œop,π’πžπ­](HA,X)β‰…X(A)[\mathcal{A}^\text{op}, \mathbf{Set}](H_A, X) \cong X(A),

naturally in Aβˆˆπ’œA \in \mathcal{A} and X∈[π’œop,π’πžπ­] X \inΒ  [\mathcal{A}^\text{op}, \mathbf{Set}].

There are many discussions on the importance of Yoneda, however we shall skip over them and instead look at the Yoneda embedding. This functor can only really be called an embedding if it is both full and faithful. This is a trivial result of the Yoneda lemma, however it is not necessary to invoke the lemma and it can be proven without it.

Yoneda embedding is full and faithful

Let A,Aβ€²βˆˆπ’œ A, A' \in \mathcal{A}, and let Ξ±:HAβ†’HAβ€² \alpha:H_A \rightarrow H_{A'} be a natural transformation. We need to find a map f:Aβ†’Aβ€² f:A \rightarrow A' such that Ξ±=Hf \alpha = H_f. Looking at the A A component of Ξ± \alpha gives us a function

Ξ±A:HA(A)β†’HAβ€²(A)\alpha_A:H_A(A) \rightarrow H_{A'}(A).

We apply this to the identity map on A A to get a map Ξ±A(1A):Aβ†’Aβ€² \alpha_A(1_A):A \rightarrow A'. I claim that this is the required map. For notation, we shall call it f f. It is the case that Hf=Ξ± H_f = \alpha if and only if each component is equal, that is (Hf)B=Ξ±B (H_f)_B = \alpha_B for all objects Bβˆˆπ’œ B \in \mathcal{A}. Choosing an arbitrary Bβˆˆπ’œ B \in \mathcal{A}, as bothΒ Β (Hf)B (H_f)_B and Ξ±B \alpha_B are functions, they are equal if and only if they take the same values on the same inputs. Recall the domains and codomains of the functions:

(Hf)B,Ξ±B:HA(B)β†’HAβ€²(B)(H_f)_B, \alpha_B: H_A(B) \rightarrow H_{A'}(B).

Take an arbitrary map g:Bβ†’A g:B \rightarrow A. Then ((Hf)B)(g)=f∘g=Ξ±A(1A)∘g ((H_f)_B)(g) = f \circ g = \alpha_A(1_A) \circ g. We need to show that this is Ξ±B(g) \alpha_B(g). This follows from the naturality of Ξ± \alpha. Indeed, for naturality gives us the following commutative square:

These functions take the following on 1A 1_A:

This says that Ξ±B(g)=Ξ±A(1A)∘g \alpha_B(g) = \alpha_A(1_A) \circ g. This means Ξ±B \alpha_B and (Hf)B (H_f)_B are equal as functions, which means that Hf=Ξ± H_f = \alpha. which by our reasoning above shows that Ξ±=Hf \alpha = H_f, hence Hβ‹… H_\cdot is full.

For faithfulness, again fix A,Aβ€²βˆˆπ’œ A, A' \in \mathcal{A} and consider two natural transformations Hf,Hg:HAβ†’HAβ€² H_f, H_g: H_A \rightarrow H_A'. Supposing Hf=Hg H_f = H_g, we need to show that f=g f=g. As Hf=Hg H_f = H_g, (Hf)A=(Hg)A) (H_f)_A = (H_g)_A). These are both functions, so we apply them to 1A 1_A giving us f∘1A=g∘1A f \circ 1_A = g \circ 1_A, therefore f=g f = g, proving faithfulness.

Despite not explicitly using the Yoneda lemma, everything we have done is used in the proof of it. There is one more result that helps capture the idea behind the proof for Yoneda.

Yoneda embedding is injective on isomorphism classes

Suppose for two objects A,Bβˆˆπ’œ A, B \in \mathcal{A} that HAβ‰…HB H_A \cong H_{B}. This means that we have two natural isomorphisms:

α:HA→HB,β:HB→HA\alpha:H_A \rightarrow H_B, \qquad \beta:H_B \rightarrow H_A

which are inverses to each other. By reasoning from above, we a map Ξ±A(1A):Aβ†’B \alpha_A(1_A):A \rightarrow B and Ξ²B(1B):Bβ†’A \beta_B(1_B):B \rightarrow A. For notation, we shall call Ξ±A(1A)=f \alpha_A(1_A) = f and Ξ²B(1B)=g \beta_B(1_B) = g. Again from above, we see that Ξ±B(g)=Ξ±A(1A)∘g \alpha_B(g) = \alpha_A(1_A) \circ g. Substituting for g g gives that Ξ±B(Ξ²B(1B))=Ξ±A(1A)∘βB(1B) \alpha_B(\beta_B(1_B)) =Β \alpha_A(1_A) \circ \beta_B(1_B). As Ξ± \alpha and Ξ² \beta are inverses, their components are mutual inverses. This means Ξ±B(Ξ²B(1B))=1B \alpha_B(\beta_B(1_B)) = 1_B, so Ξ±A(1A)∘βB(1B)=1B \alpha_A(1_A) \circ \beta_B(1_B) = 1_B. A similar argument shows that Ξ²B(1B)∘αA(1A)=1A \beta_B(1_B) \circ \alpha_A(1_A) = 1_A, hence Ξ±A(1A) \alpha_A(1_A) and Ξ²B(1B) \beta_B(1_B) are isomorphisms. Therefore, Aβ‰…B A \cong B.

The results from this post are from Chapter 4 of Tom Leinster’s Basic Category Theory textbook, which can be found here.