We can try to gain intuition for Yoneda by considering a finite category where we view arrows as directed paths.
The "interpretation" of a path is taken by going from edges to labels and then
concatenating all edge labels. We "interpret" the label id_x as "" (the
empty string), and we "interpret" all other arrows a as some unique string
associated to each arrow. Composition of arrows becomes concatenation of
strings. This obeys all the axioms of a category. We are basically of a
category as a free monoid.
Let's being our consideration of the covariant functor Hom(O, -): C → Set.
Note that the objects of this category are sets of arrows Hom(O, P).
To every arrow a: P → Q we associate the set function
a': Hom(O, P) → Hom(O, Q). a'(op) = pq . op.
Now, to apply Yoneda, we need another covariant functor G: S → Set. We now
need to show that the set of natural transformations η: F → G are in bijection
with the set G[O] ∈ Set.
We do this by the following consideration. Recall that for the natural transformation, we have the commuting diagram:
x -p-> yHom(o, x) -p'-> Hom(o, y)| |ηx ηy| |v vG[x] -G[p] --> G[y]∀ x y ∈ C, o2x ∈ Hom(o, x), p ∈ Hom(x, y), G[p](ηx(o2x)) = ηy(p'(o2x))Which on using the definition of p' becomes:
∀ x y ∈ C, o2x ∈ Hom(o, x), p ∈ Hom(x, y), G[p](ηx(o2x)) = ηy(o2x . p')Now pick the magic x = o and o2x = o2o = id_o. This gives:
x = o, y ∈ Co2x = id_o∀ y ∈ C, p ∈ Hom(o, y), G[p](ηo(id_o)) = ηy(id_o . p') G[p](ηo(id_o)) = ηy(p') [By identity arrow] [assume we fix ηo(id_o) ∈ G[o] ] ηy(p') = G[p](ηo(id_o)) [ηy is now forced. everything on the RHS is known]Hence, we learn how to map every other arrow ηy(p). If we know how to map
the arrows, we can map the objects in the hom-sets as images of the arrows,
since we know what ηo[id_o] maps to. Concretely:
§ Images ηo(q) for q ∈ Hom(o, o) after ηo(id_o) is fixed:
We have the relation id_o . q = q. So we get that the arrow q': Hom(o, o) → Hom(o, o)
takes id_o to q. By the structure of the natural transformation, we have that:
∀ x y ∈ C, o2x ∈ Hom(o, x), p ∈ Hom(x, y), G[p](ηx(o2x)) = ηy(p'(o2x))- Pick
x = y = o,o2x = id_o,p = q. This gives:
G[q](ηo(id_o)) = ηo(q'(id_o)) G[q](ηo(id_o)) = ηo(q' . id_o) G[q](ηo(id_o)) = ηo(q') ηo(q') = G[q](ηo(id_o))Hence, we've deduced ηo(q'), so we know what element q gets mapped to.
The same process works with any arrow!
§ A shift in perspective: Yoneda as partial monoid.
Since we're considering the sets , note that we can always pre-compose any element of to every . More-over, if we know the value of , then we have the equation that . since is the identity. Moreover, is the only identity arrow we possess across all : We can only access the identity arrow inside . For all other where , we do not have the identity arrow or . So we have a sort of partial monoid , where we have a unique identity element , and arrows that compose partially based on domain/codomain conditions.
From this perspective, we can read the commutative diagram laws as a sort of "Cayley's theorem". We have as elements the elements of the set . For every arrow , we have the action .
From this perspective, it is trivial to see that:
- Every monoid can be embedded into its action space (Cayley's theorem).
- This mapping of yoneda from to arbitrary sets is like a "forgetful" functor from a monoid into a semigroup.
- If our monoid is "well represented" by a semigroup, then once we know what the identity maps to, we can discover all of the other elements by using the relation . The only "arbitrariness" introduced by forgetting the monoid structure is the loss of the unique identity. NOTE : This is handwavy, since the data given by a natural transformation is somehow "different", in a way that I'm not sure how to make precise.