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-> y
Hom(o, x) -p'-> Hom(o, y)
| |
ηx ηy
| |
v v
G[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 ∈ C
o2x = 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))
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 Hom(o,−), note that we can always
pre-compose any element of Hom(o,o) to every Hom(o,p). More-over,
if we know the value of ido, then we have the equation that ido∘a=a.
since ido is the identity. Moreover, ido is the only identity arrow
we possess across all Hom(o,−): We can only access the identity arrow
inside Hom(o,o). For all other Hom(o,p) where p=o, we do
not have the identity arrow ido or idp. So we have a sort of partial monoid ,
where we have a unique identity element ido, 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 Hom(o,−).
For every arrow a:p→q, we have the action
Hom(o,p)aHom(o,q).
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 Hom(o,−) 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 f(ex)=f(e)f(x). 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.