# Category Theory Day One

16 Feb 2020

My office-mate asked me to give a “second lecture” in category theory in Eminar, the Tufts graduate student seminar. I gave a first lecture last semester, but I thought it might be nice to have something to point people who missed it to, in order to stick to my assignment and begin at the Yoneda lemma. So, here is yet another rendition of the first hour of a category theory class.

The treatment is brisk. To the interested reader,
I would highly recommend Emily Riehl’s *Category Theory in Context*,
which is the main inspiration here and
has the advantage of being available on the author’s website.
I also recommend Saunders Mac Lane’s
*Category Theory for the Working Mathematician*
and Francis Borceux’s *Handbook of Categorical Algebra.*

## Categories

A *category* is a collection of *objects,* say , , and
*arrows* between them, say .
Given a pair of arrows as below

we require the existence of their *composition,* .
Composition is associative, and for each object , there is a
(unique) arrow which acts as an identity for composition
of arrows.

Many familiar mathematical objects assemble into categories.
To wit, there is the *category of sets,* where objects are sets
and arrows are functions of sets, and the *category of topological spaces,*
where objects are topological spaces and arrows are continuous maps.
However, the notion of a category is flexible: not all categories
have “sets with additional structure” as objects.
For instance, a *preorder* is the same data as a category
where there is at most one arrow between any two objects.
Here an arrow should be interpreted as saying .

Note that I use the term *collection* advisedly: Russell’s paradox
says that there can be no set of all sets, so the category of
sets has more than a set’s worth of objects! However,
between any two sets, there is only a set’s worth of distinct functions.
That is, if and are sets, there is a *set*

Categories where this is the case for all objects are called *locally small.*
If additionally there is only a set’s worth of arrows in the entire category
(and thus only a set’s worth of objects!), the category is called *small.*

## Functors

If and are categories, a *functor*
is an assignment

I.e. for each object of , there is an object in , and for each arrow in , there is an arrow . Additionally, is required to satisfy

for all in , and must respect composition in the sense that

Such functors are sometimes called *covariant.*

Every category has an *opposite category*
, which is obtained from
formally reversing the direction of all the arrows.
Thus if has arrows

then has arrows

Any statement about objects and arrows in has a *dual*
statement about objects and arrows in , which is obtained
by reversing the direction of all the arrows.
If the proof of the original statement is categorical,
dualizing the proof yields a proof of the dual statement for .

The definition of a functor admits dualization in or in .
The import is essentially the same as long as only one dualization is
performed: the result is a *contravariant functor* :

Functors abound in mathematics. Many are so simple that we hardly think about them: for instance the “forgetful” functor from the category of groups and homomorphisms to sets that sends a group to its set of elements, and a group homomorphism to its action on underlying sets.

If is a locally small category and is an object, there are two particularly important functors . Write and for the set of arrows in with domain and codomain , respectively. If is an arrow in , there are functions

defined as and , respectively. The assignments

define covariant and contravariant functors
and

, respectively.

### Natural Transformations

Just as we have defined functors between categories,
it is useful to consider *functor categories,*
whose elements are functors . To do this, we need
a notion of a morphism between functors. It turns out
that the right notion is a *natural transformation.*
If are functors, a natural transformation
is a collection of maps
, one for each object of
such that for every arrow , the following
diagram commutes

Any directed path in a diagram of objects and arrows within
a category like the above yields an arrow from the initial
“vertex” of the path to the terminal one by reading off the
labelled arrows. A diagram *commutes* if any two directed
paths with the same endpoints yield equal arrows.
Thus, to say that the above diagram commutes asserts the
equality

The standard example of a natural transformation is the following.
Let be a field, and consider the category of -vector spaces
and linear transformations. There is a contravariant functor
that sends a vector space to its *dual* , namely the vector
space of linear transformations .
A linear map is sent to a map
which is defined as follows.
If is an element of ,
is the linear map

Thus there is a *covariant* functor sending a vector space
to its “double dual” .
There is a natural transformation from the identity functor
to the double dual functor.
At a given vector space , the map sends a vector
to the linear map defined by “evaluation at ,”
namely

Naturality of asserts that for a linear map, the following diagram commutes

To show this, consider a vector . The element is the linear map

so its action on is

demonstrating naturality.

The map is an isomorphism when is finite dimensional.
Thus we say that when restricted to the *subcategory*
of finite dimensional vector spaces, is a *natural isomorphism.*

### The Yoneda Lemma

Perhaps the fundamental result in category theory is the following:

Theorem.(The Yoneda Lemma)

Let be a locally small category and a functor. For each object of , there is a bijection

implemented by sending a natural transformation to the element . This bijection is natural in and .

The proof is straightforward, once one figures out what needs proving. The utility of the Yoneda lemma is likely far from obvious when one first meets it, but it turns out to be a major tool in category theory.