Category Theory for the Working non-Mathematician 2

Last time I talked about the very basics of Category Theory, objects and morphisms and what exactly a Category consisted of. If nothing else sticks just remember that categories consist things (objects) and ways to go between things (morphisms) where you always have the ability to go from something to itself by doing nothing and you can go from thing to thing to thing via arrows composed together having a common middle object. The next step is to figure out how to go between two different categories. At the moment our view of the world is like a human stuck on the earth. There are places on earth and there are ways that we can go from place to place (routes) and we can compose our traveling methods to get from one place to another and then to another. So a category is much like a planet. However humans are curious. We look up at the stars and we want to venture to other planets. We are also very fragile creatures and we can’t just go to to any planet all willy nilly, we have to go there in a very specific way so that we don’t die. Not only that but the planet we go to has to have similar features to earth, so that again we don’t die. I know how earth looks and so the best way to survive is to correspond this new planet to the one I already know. This very restrictive way of going from one planet to another is similar to the nature of going from one category to another.

Let’s think about what it would mean to go from a category C to a category D. We start out in C, and there is some set of objects. Well D also has objects so the most logical thing to do is to have something in D correspond to something in C. The mathy way to write this is that for any object X in C, there is an object F(X) in D. Simple, elegant, no restrictions. Now, there are also morphisms (ways to go between objects) living in the category C and D. Any morphism in C goes between two objects in C and I’ve already said that the objects in C MUST be associated to some objects in D. The most logical thing to do once again would be to associate a given morphism from X to Y in C to a morphism between F(X) and F(Y) over in the category D. This part is a bit trickier because I want the morphism in C to be associated to the morphism in D in a way that makes sense. If I have a way to go from California to New York and then I go to Earth 2.0 discover California 2.0 and New York 2.0 then I’m going to want the way to go between the originals to correspond to the way to go between the new ones rather than some completely different route.

How is this going to work? First of all we need better notation. We are going to start calling our space travel from Earth to Earth 2.0, a functor. A functor $F:C\rightarrow D$ is a map from the category C to the category D that does the following. For any object X in C, there is an object F(X) in D. For any morphism between objects X,Y in C, $f:X\rightarrow Y$ there is a corresponding morphism $F(f):F(X)\rightarrow F(Y)$ which obey some rules to be explained later. For now just see how this functor is taking objects to CORRESPONDING objects in D, and paths between objects to paths between CORRESPONDING objects in D. What other rules do I need? Well if you will recall from the previous article, a category is not just objects and morphisms. It had some special rules about these things. Remember that for any object X in a category C there has to be at least this one special morphism; the identity morphism $id_X : X\rightarrow X$ which was like taking the path from X to X by not moving. In the current analogy, I can go from California to California by doing nothing at all. Since C and D are both categories, they both have these special “do nothing” paths and so logically it would be best if we took the one from C and sent it to the one in D. So our first condition for the functor F is that $F(id_X) = id_{F(X)}$. This is merely saying that F takes in the identity morphism from X to X, and sends it to the identity morphism from F(X) to F(X), which is the object in D that corresponded to X in C via the functor.

The last condition we need involves the other property that was forced upon a category in the previous post. In any category we had to be able to put two morphisms together, i.e. compose two morphisms $f:X\rightarrow Y$ and $g:Y\rightarrow Z$ to make one longer morphism $g\circ f : X\rightarrow Z$. So let’s see how this works with our functor going from one category to another. First, this requires 3 objects in C. Call them X,Y, Z. If we go from X to Y via the morphism f we can use the functor to make a corresponding path from F(X) to F(Y) via F(f) and if we go from Y to Z via g we can make a corresponding path from F(Y) to F(Z) via F(g).

Over in the land of C we were able to put f and g together to make $g\circ f:X\rightarrow Z$ so what we really want is to be able to put the corresponding morphisms F(f) and F(g) together in a way that makes sense. Since $g\circ f:X\rightarrow Z$ is itself just a morphism in C we know that $F:C\rightarrow D$ can transfer it over to a corresponding morphism in D. The functor F takes a morphism between two objects to a morphism between the two corresponding objects. So F is going to take $g\circ f$ to a functor between F(X) and F(Z). We can then write that $F(g\circ f ): F(X) \rightarrow F(Y)$. But now think about what F does to f and g separately. We have $F(f):F(X)\rightarrow F(Y)$ and $F(g):F(Y)\rightarrow F(Z)$. These are two morphisms with a common middle object, F(Y), in the category D, so of course we are allowed to stick them together to get $F(g) \circ F(f) : F(X) \rightarrow F(Z)$. We now have two morphisms living in D that go from F(X) to F(Z). Would it make sense that they are secretly the same? Yes my dear Watson it would.

Consider the states (objects) California, Texas, and New York on Earth with a route to go from California to Texas then to New York. We can use our spaceship (functor) to go over to Earth 2.0 that has corresponding states and routes. Specifically we make corresponding states, California 2.0, Texas 2.0, and New York 2.0 with corresponding routes. You and I are very different people though. You prefer a bunch of information at once and hate wasting precious time so you write down the entire damn route in a little notebook. From California to Texas then to New York. You fly over to Earth 2.0 and then you draw the corresponding entire route on Earth 2.0. However I am a simple minded peasant and need bits and pieces at a time. So first I draw the route from California to Texas and fly (using my spaceship called functor) on over to Earth 2.0, then draw it there between the California 2.0 and Texas 2.0. Then I take another trip and functor over the route between Texas and New York. The first trip ended at Texas 2.0 and the second one began at Texas 2.0, so I decide I can just glue these two routes together in my notebook. Well what difference does it make if we do it my way or your way? If there is to be any sense in the universe these two routes will be the same.

That is my long winded explanation that a functor needs to “preserve” composition. We had composition in the category C and then functored it over to D in the only logical way to do it. First composing two morphisms, then sending the resulting morphism over through the functor is exactly the same as first sending each morphism through the functor and then composing them afterwards. The next step is to go very meta which I will probably not do for another month or so. This may seem very meta already, but it isn’t.

First we talked about objects and ways to go between objects. Then we talked about a way to go between two categories, which consist of objects and ways to go between objects. When it comes down to it though, categories are themselves still sort of object like (thus far) and so going from one to another isn’t too much trouble after a lot of practice. After we achieve space travel going from one planet to another won’t be that complicated. The point is that in real life it’s typically easy to go from point A to point B. But what if I have two ways to go from A to B and because going from A to B is so easy, I want to know what it means to go between the two paths? Going from a path to a path turns out to be a lot more difficult than going from a thing to a thing.