Category theory: abstracting mathematical construction (essay)
Definition. A category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathcal{C}} consists[note 1] of the following data:
- A class[note 2] Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathcal{C})} , called the "objects" of the category
- For any two objects Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X,Y \in \text{ob}(\mathcal{C})} , a set Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathcal{C}}(X,Y)} , called the "morphisms from Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X } to Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Y } ." We take Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : X \rightarrow Y} to be a statement which means the exact same thing as the statement .
- For any two morphisms Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : X \rightarrow Y} and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g : Y \rightarrow Z} , a function Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \circ : \text{mor}_{\mathcal{C}}(Y,Z) \times \text{mor}_{\mathcal{C}}(X,Y) \rightarrow \text{mor}_{\mathcal{C}}(X,Z), } which we call "composition." That is, we can compose Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g } to get an element Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g \circ f : X \rightarrow Z } ,
subject to the following conditions:
- For any object Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X \in \text{ob}(\mathcal{C}) } , there exists an "identity" morphism Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 1_X : X \rightarrow X } , satisfying for any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : Y \rightarrow X } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g \circ 1_X = g } for any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g : X \rightarrow Z } .
- Composition is associative: Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (f \circ g) \circ h = f \circ (g \circ h) } .
♦
One example of a category---the example, in fact---is Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } , the category of sets. The objects of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } are sets, the morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } are functions, and composition of morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } is composition of functions: Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (g \circ f)(x) : = g(f(x)). } The identity morphism of a set Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X} is the function Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X \rightarrow X } which does nothing.
Another example of a category is "the discrete category with 2 elements," which I shall call Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbb{I} } . The objects Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathbb{I}) } are a set consisting of 2 elements (for concreteness we could take Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathbb{I}) := \{ a,b \} } where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle a = \emptyset } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b = \{ \emptyset \} } ).[note 3] The morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbb{I} } are the identity elements, and nothing else. More formally, we haveFailed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(a,a) = \{ * \} } , Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(a,b) = \emptyset } , and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(b,b) = \{ * \} } .
Another example of a category is the category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Grp} } of groups. Here, the objects are groups, and the morphisms are group homomorphisms.
Another example of a category is the (naive) category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Top} } of topological spaces. Here, the objects are topological spaces, and the morphisms are continuous maps.
We could go on like this ad infinitum. There are a huge variety of mathematical objects that form categories. Rings, graphs, vector spaces, representations, algebraic varieties, the points of the sphere, the open subsets of the plane, the natural numbers, compact Hausdorff totally disconnected spaces, etc etc. There is even a category of categories themselves. In fact, every mathematical object forms a category,[note 4] though perhaps not in an interesting manner. Part of modern mathematical folklore is that you should always "categorify" whatever mathematical objects it is that you are working with, i.e. you should find a way to define everything in a category-theoretic way.
Note that the definition I gave of categories is set theoretic. Shea has reminded me that category theory can be taken as foundational (see here for Lawvere's attempt at that). I have barely studied Lawvere's ideas, but I am skeptical that it is useful as a foundation. One big reason why is that when it comes to actually proving things, set theory is much easier than category theory. It has been my experience that even the most routine, "obvious" things can become very difficult to prove when phrased categorically. I don't think this is just my own ineptitude; I think there is a deep reason why category theory is difficult, which I will explain later. It's not just me, either: When working mathematicians want to understand something category theoretic, they often do things that allow them to think about it in a set theoretic manner, e.g. they embed their category into the category of sets (see "Yoneda embedding").
Functors
I mentioned earlier that there is a category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Cat}} of categories. Clearly the objects of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Cat}} are ... categories, but what are the morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Cat}} ? They are called functors, and they are defined as follows.
Definition. A functor Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F : \mathcal{C} \rightarrow \mathcal{D}} is a function which sends any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X \in \text{ob}(\mathcal{C})} to an object Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F(X) \in \text{ob}(\mathcal{D})} , along with a function which sends any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varphi \in \text{mor}_{\mathcal{C}}( X ,Y)} to an object Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F(\varphi) \in \text{mor}_{\mathcal{D}}(F(X),F(Y))} . This assignment respects composition (meaning Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F(\varphi \circ \psi) = F(\varphi) \circ F(\psi)} for any morphisms Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varphi, \psi} ), and which respects identity (meaning Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F(\text{Id}_{X} ) = \text{Id}_{F(X)} } for any object ). ♦
If you want examples of functors, you can find many of them in a category theory textbook. I won't give the standard examples here. I will only give one example, which demonstrates the essence and purpose of functors.
Let's suppose that we are mathematicians who wish to do some set-theoretic "construction." For example, one construction we could do is we could take any set , and we could replace it with a set , where is a set which has exactly two copies of every element of . For example, if then we might have .
Now, let's suppose that we change in a "trivial" way. For example, instead of considering , what if we considered . Since and are basically the same, nothing important would change. Instead of getting
Now, why am I entitled to say that and are "basically the same," and that replacing with was trivial? Because all I did was I took the contents of , and I added a symbol ' to both of them! That's not interesting. More formally, I think that and are "the same" because I have in mind a function , which sends and , and this function is an isomorphism; it has an inverse function which sends and . Likewise, I think that and are "basically the same" because there is an isomorphism sending , , etc.
It is clear that and didn't play any special role in our construction; we could have done the exact same thing for any set . Thus, for an arbitrary set , let's call . Furthermore, let's call the latter isomorphism of the above paragraph . It's also clear (exercise!) that is any isomorphism of sets, then we get an isomorphism , which we shall call . Thus our construction defines a functor , where is that category whose objects are sets and whose morphisms are isomorphisms of sets.
Let's take a step back and observe what happened. We have a set-theoretic construction . This set-theoretic construction is robust against arbitrary choices, in the sense that if we were to relabel all the elements of (that is, if we changed to an isomorphic set ), then there is an obvious way to relabel all the elements of . This robustness means precisely that our construction defines a functor.
This, in my view, is the essence of functors.[note 5] Functors represent mathematical constructions, such that when you make an unimportant change to the input of the construction, it induces an unimportant change on the output of the construction.
As any mathematician (or computer programmer) knows, whenever you are constructing something (or programming something), there are tons of details which are "arbitrary," in the sense that they that could have been other than the way they are. We even faced this issue in the previous section, when I defined the category . To define the objects of , I needed a set with two elements, and I chose , but I could just as well have chosen , or , or , or anything else, and it wouldn't have made a big difference. (Likewise, when programming a computer, it doesn't matter if we begin our for-loops at 0 and end at n-1, or begin them at 1 and end them at n.)
Functors are a way of talking about constructions, without making any arbitrary choices. Functors gain their "independence" from arbitrary choices because to build one, you have to say how it would handle any possible arbitrary choices. (Here we also see why category theory is difficult: to define a functor, you have to say how you would handle any possible choice, which is much more difficult than just saying how you would do the construction in some specific case).
Universal properties
There is another way in which categories handle arbitrary choices...
The history of category theory
Eillenberg-Steenrod axioms [TODO]
Notes
- ↑ In the literature this is called a "locally small" category.
- ↑ A class is just another word for a set. In conventional mathematics, we aren't allowed to use the word "set" here, because for many categories it would give rise to a Russell's paradox. I think that Russell's paradox only arises in situations where we aren't being careful about our what math refers to in reality, but that discussion would take us too far afield.
- ↑ I don't like this approach to sets. I think sets should contain actual existents. But I won't fight that battle today.
- ↑ Indeed, suppose that some "thing" in mathematics is defined as , where is a set and is a structure (I won't define what a "structure" is; see Bourbaki for that. But think about it as an additional set. [TODO look up]). Then we get a category of "things" for free. The objects of are "thing"s, and a morphism is an isomorphism of sets, such that: the structure living over that you get when you transport by , is equal to , or in symbols
- ↑ Or at least, it is the essence of functors on groupoids.