ยง Yoneda from string concatenation
I'm trying to build intuition for Yoneda (again) this time from the perspective
of strings and concatenation. The idea is that the identity function behaves
like the empty string, and "free arrow composition" behaves like string
concatenation. So can we understand yoneda from this model?
- First, let's think of
Hom(X, X)
. What are the elements here? Well, for one, we need the identity arrow idX
in Hom(X, X)
. Maybe we have other elements called a, b, c
in Hom(X, X)
. So our picture of Hom(X, X)
looks like this:
- what does it mean to have an element
a
in Hom(X, X)
? It means that there's an arrow from X
to X
in the category. But this also means that we have a map from Hom(X, X)
to Hom(X, X)
, given by composing with a
! That is, we have a map - . a :: Hom(X, X) -> Hom(X, X)
.
- If we have such a map of "composition with a", then we need to know where this map
-.a
maps all the elements of Hom(X, X).
Thinking about this, we see that we need to add new elements to Hom(X, X)
, which are the composition of the current elements ( idX
, a
, b
, c
) with a
. This gives us the elements idX.a = a, a.a = aa, b.a = ba, c.a = ca
.
- Similarly, we need to know where these new elements
aa
, ba
, ca
map to, but let's hold off on that for now, for that simply demands an extrapolation of imagination. Let's imagine having another object Y
and an arrow g: X -> Y
. This will give us a new hom-set Hom(X, Y) = Hom(X, X) . g
- In
Hom(X, Y)
we will have as elements all the arrows from X
to Y
. Let's say there's some arrow h: X -> Y
. Then, we will find this arrow h
in Hom(X, Y)
as the image of idX
under -.h
. So really, for any arrow, we can find what element it maps to as long as know (a) idX
and (b) -.h
.
Now that we understand the "internal" structure, let's imagine we're representing
this collection of objects and arrows by some other collection of objects
and arrows. So we have a functor F
that takes these sets to other sets,
and takes these objects to other objects.