As with all the other algebraic structures we’ve considered, we’re interested in the “structure-preserving maps” between categories. In this case, they’re called “functors”.
A functor from a category to a category consists of two functions, both also called . One sends objects of to objects of , and the other sends morphisms of to morphisms of . Of course, these are subject to a number of restrictions:
- If is a morphism from to in , then is a morphism from to in .
- For every object of , we have in — identities are sent to identities.
- Given morphisms and in , we have in — a functor preserves compositions.
It’s tempting at this point to think of a “category of categories”, but unfortunately this gets hung up on the same hook as the “set of sets”. A lot of the intuition goes through, however, and we do have a category of small categories (with only a set of objects and a set of morphisms) and functors between them.
Every category comes with an identity functor . This is an example of an “endofunctor” (in analogy with “endomorphism”).
Every category of algebraic structures we’ve considered — , , , , etc. — comes with a “forgetful” functor to the category of sets. Remember that a group (for example) is a set with extra structure on top of it, and a group homomorphism is a function that preserves the group structure. If we forget all that extra structure we’re just left with sets and functions again.
To be explicit, there is a functor that sends a group to its underlying set . It sends a homomorphism to itself, now considered as a function on the underlying sets. It should be apparent that this sends the identity homomorphism on the group to the identity function on the set , and that it preserves compositions. The same arguments go through for rings, monoids, -modules.
In fact, there are other forgetful functors that behave in much the same way. A ring is an abelian group with extra structure, so we can forget that structure to get a functor from to — the category of abelian groups. An abelian group, in turn, is a restricted kind of group. We can forget the restriction to get a functor from to .
Now for some more concrete examples. Remember that a monoid is a category with one object. So what’s a functor between such monoids? Consider monoids and as categories. Then there’s only one object in each, so the object function is clear. We’re left with a function on the morphisms sending the identity of to the identity of and preserving compositions — a monoid homomorphism!
What about functors between preorders, considered as categories? Now all the constraints are on the object function. Consider preorders and as categories. If there is an arrow from to in then there must be an arrow from to . That is, if then . Functors in this case are just order-preserving functions.
These two examples show how the language of categories and functors subsumes both of these disparate notions. Preorder relations translate into the existence of certain arrows, which functors must then preserve, while monoidal multiplications translate into compositions of arrows, which functors must then preserve. The categories of (preorders, order-preserving functions) and (monoids, monoid homomorphisms) both find a natural home with in the category of (small categories, functors).