Yoneda Lemma by Ben, using a Leinster book Michael Kelly O’Connor November 5, 2015
Contents 1 Representable Functors
1
2 Yoneda Lemma
2
3 Example
3
4 Category Theory in ML
3
1
Representable Functors
Definition 1.1. Let A be some category and A be an object of A. Then: • The functor H A : A → Set is defined to be H A = A(A, −). • The functor HA : Aop → Set is defined to be HA = A(−, A). Lou notes: some authors say "contravariant functor from A to B", some say "(covariant) functor from Aop to B", some say "contravariant functor from Aop to B"! Jay opines that the modern practice of declaring the objects of Aop to be the same as A is insane. Note that any arrow g : A → A0 in A gives a natural transformation from HA to HA0 by precomposition. Definition 1.2. Let F : A → Set be a functor. Then F is representable iff it’s naturally isomorphic to some H A . Similarly, if G : Aop → Set, it is representable if it’s naturally isomorphic to some HA .
1
2
Yoneda Lemma
Consider the functor category [Aop , Set]. The map H• is the Yoneda embedding. It’s a functor from A to op [A , Set]. The representable objects are a subset of the objects in [Aop , Set]. The Yoneda lemma relates arbitrary objects in [Aop , Set] to representable ones. Theorem 2.1. Yoneda lemma: For any A, X, the set of arrows [Aop , Set](HA , X) is naturally isomorphic to X(A). Proof. Fix A and X. For any α ∈ Nat(HA , X), we will define a α ˆ ∈ X(A), and given any x ∈ X(A), we will define a x ˜ ∈ Nat(HA , X). Then we must show that they are inverses and that they’re natural transformations. Note that there are two components to the naturality, since either A or X could vary. Given a natural transformation α ∈ Nat(HA , X), look at its component at A, αA : HA (A) → X(A). Since HA (A) = A(A, A), we can define α ˆ = αA (idA ). Given an x ∈ X(A) (just a member of a set), we would like to define a natural transformation x ˜ from HA to X. To define its component on B, we must find a morphism in Set (i.e., an ordinary function) from A(B, A) to X(B). So let f ∈ A(B, A). Then X(f ) : X(A) → X(B). So we may define x ˜B (f ) = X(f )(x) (note we have the same definition for any component). To prove that the definition of x ˜ is correct, we have to show that the transformation is natural. This amounts to showing that the following square is commutative: HA (B)
HA (g)
x ˜B
HA (C) x ˜C
X(g)
X(B) X(C) Let f ∈ HA (B), so that f : B → A. Then going around the top part of the commutative square gives X(f ◦ g)(x), while going around the bottom part gives X(g)(X(f )(x)). These two are equal by the definition of a functor. ˆ˜ = x To show that they’re inverses, consider x ˜A (idA ). This is X(idA )(x), which is 1X(A) (x), which is x. ˜ˆ . Unfortunately, I zoned out for that as well We also have to consider α as the naturality proof, although I believe Ben explicitly did one of the two naturality conditions.
2
3
Example
An example of a representable functor is F : FinVectR → Set, which is defined by taking the underlying set of the dual of a vector space. It is represented by R.
4
Category Theory in ML
Ray suggests looking at a book called "Computational Category Theory", which implements some amount of category in some variant of ML.
3