After a long hiatus (sorry about that!), I would like to resume the series on Stone duality. You may recall I started this series by saying that my own point of view on mathematics is strongly informed by category theory, followed by a little rant about the emotional reactions that category theory seems to excite in many people, and that I wouldn’t be “blathering” about categories unless a strong organic need was felt for it. Well, it’s come to that point: to continue talking sensibly about Stone duality, I really feel some basic concepts of category theory are now in order. So: before we pick up the main thread again, I’ll be talking about categories up to the point of the central concept of adjoint pairs, generalizing what we’ve discussed before in the context of truth-valued matrix algebra.

I’ll start by firmly denouncing a common belief: that category theory is some arcane, super-abstract subject. I just don’t believe that’s a healthy way of looking at it. To me, categories are no more and no less abstract than groups, rings, fields, etc. — they are just algebraic structures of a certain type (and a not too complicated type at that). That said, they are particularly ubiquitous and useful structures, which can be studied either as small structures (for example, posets provide examples of categories, and so do groups), or to organize the study of general types of structure in the large (for example, the class of posets and poset morphisms forms a category). Just think of them that way: they are certain sorts of algebraic structures which crop up just about everywhere, and it is very useful to learn something about them.

Usually, the first examples one is shown are large categories, typically of the following sort. One considers the class of mathematical structures of a given type: it could be the class of groups, or of posets, or of Boolean algebras, etc. The elements of a general such class are given the neutral name “objects”. Then, we are also interested in how the objects A, B, C, \ldots are related to each other, typically through transformations f: A \to B which “preserve” the given type of structure. In the case of sets, transformations are just functions; in the case of groups, the transformations are group homomorphisms (which preserve group multiplication, inversion, and identities); in the case of vector spaces, they are linear transformations (preserving vector addition and scalar multiplication); in the case of topological spaces, they are continuous maps (preserving a suitable notion of convergence). In general, the transformations are given the neutral name “homomorphisms”, or more often just “morphisms” or “maps”.

In all of these cases, two morphisms f: A \to B, g: B \to C compose to give a new morphism g \circ f: A \to C (for example the composite of two group homomorphisms is a group homomorphism), and do so in an associative way (h \circ (g \circ f) = (h \circ g) \circ f), and also there is an identity morphism 1_A: A \to A for each object A which behaves as identities should (f \circ 1_A = f = 1_B \circ f for any morphism f: A \to B). A collection of objects, morphisms between them, together with an associative law of composition and identities, is called a category.

A key insight of category theory is that in general, important structural properties of objects A, B, C, \ldots can be described purely in terms of general patterns or diagrams of morphisms and their composites. By means of such general patterns, the same concept (like the concept of a product of two objects, or of a quotient object, or of a dual) takes on the same form in many different kinds of category, for many different kinds of structure (whether algebraic, or topological, or analytic, or some mixture thereof) — and this in large part gives category theory the power to unify and simplify the study of general mathematical structure. It came as quite a revelation to me personally that (to take one example) the general idea of a “quotient object” (quotient group, quotient space, etc.) is not based merely on vague family resemblances between different kinds of structure, but can be made absolutely precise and across the board, in a simple way. That sort of explanatory power and conceptual unification is what got me hooked!

In a nutshell, then, category theory is the study of commonly arising structures via general patterns or diagrams of morphisms, and the general application of such study to help simplify and organize large portions of mathematics. Let’s get down to brass tacks.

Definition: A category C consists of the following data:

  • A class O of objects;
  • A class M of morphisms;
  • A function \mbox{dom}: M \to O which assigns to each morphism its domain, and a function \mbox{cod}: M \to O which assigns to each morphism its codomain. If f \in M, we write f: A \to B to indicate that \mbox{dom}(f) = A and \mbox{cod}(f) = B.
  • A function \mbox{Id}: O \to M, taking an object A to a morphism 1_A: A \to A, called the identity on A.

Finally, let C_2 denote the class of composable pairs of morphisms, i.e., pairs (f, g) \in M \times M such that \mbox{cod}(f) = \mbox{dom}(g). The final datum:

  • A function \mbox{comp}: C_2 \to M, taking a composable pair (f: A \to B, g: B \to C) to a morphism g \circ f: A \to C, called the composite of f and g.

These data satisfy a number of axioms, some of which have already been given implicitly (e.g., \mbox{dom}(g \circ f) = \mbox{dom}(f) and \mbox{cod}(g \circ f) = \mbox{cod}(g)). The ones which haven’t are

  1. Associativity: h \circ (g \circ f) = (h \circ g) \circ f for each composable triple (f: A \to B, g: B \to C, h: C \to D).
  2. Identity axiom: Given f: A \to B, f \circ 1_A = f = 1_B \circ f.

Sometimes we write C_0 for the class of objects, C_1 for the class of morphisms, and for n > 1, C_n for the class of composable n-tuples of morphisms. \Box

Nothing in this definition says that objects of a category are “sets with extra structure” (or that morphisms preserve such structure); we are just thinking of objects as general “things” and depict them as nodes, and morphisms as arrows or directed edges between nodes, with a given law for composing them. The idea then is all about formal patterns of arrows and their compositions (cf. “commutative diagrams”). Vishal’s post on the notion of category had some picture displays of the categorical axioms, like associativity, which underline this point of view.

In the same vein, categories are used to talk about not just large classes of structures; in a number of important cases, the structures themselves can be viewed as categories. For example:

  1. A preorder can be defined as a category for which there is at most one morphism f: A \to B for any two objects A, B. Given there is at most one morphism from one object to another, there is no particular need to give it a name like f; normally we just write a \leq b to say there is a morphism from a to b. Morphism composition then boils down to the transitivity law, and the data of identity morphisms expresses the reflexivity law. In particular, posets (preorders which satisfy the antisymmetry law) are examples of categories.
  2. A monoid is usually defined as a set M equipped with an associative binary operation (a, b) \mapsto a \cdot b and with a (two-sided) identity element e for that operation. Alternatively, a monoid can be construed as a category with exactly one object. Here’s how it works: given a monoid (M, \cdot, e), define a category where the class O consists of a single object (which I’ll give a neutral name like \bullet; it doesn’t have to be any “thing” in particular; it’s just a “something”, it doesn’t matter what), and where the class of morphisms is defined to be the set M. Since there is only one object, we are forced to define \mbox{dom}(a) = \bullet and \mbox{cod}(a) = \bullet for all a \in M. In that case all pairs of morphisms are composable, and composition is defined to be the operation in M: a \circ b := a \cdot b. The identity morphism on \bullet is defined to be e. We can turn the process around: given a category with exactly one object, the class of morphisms M can be construed as a monoid in the usual sense.
  3. A groupoid is a category in which every morphism is an isomorphism (by definition, an isomorphism is an invertible morphism, that is, a morphism f: A \to B for which there exists a morphism g: B \to A such that g \circ f = 1_A and f \circ g = 1_B). For example, the category of finite sets and bijections between them is a groupoid. The category of topological spaces and homeomorphisms between them is a groupoid. A group is a monoid in which every element is invertible; hence a group is essentially the same thing as a groupoid with exactly one object.

Remark: The notion of isomorphism is important in category theory: we think of an isomorphism f: A \to B as a way in which objects A, B are the “same”. For example, if two spaces are homeomorphic, then they are indistinguishable as far as topology is concerned (any topological property satisfied by one is shared by the other). In general there may be many ways or isomorphisms to exhibit such “sameness”, but typically in category theory, if two objects satisfy the same structural property (called a universal property; see below), then there is just one isomorphism between them which respects that property. Those are sometimes called “canonical” or “god-given” isomorphisms; they are 100% natural, no artificial ingredients! \Box

Earlier I said that category theory studies mathematical structure in terms of general patterns or diagrams of morphisms. Let me give a simple example: the general notion of “cartesian product”. Suppose X_1, X_2 are two objects in a category. A cartesian product of X_1 and X_2 is an object X together with two morphisms \pi_1:  X \to X_1, \pi_2: X \to X_2 (called the projection maps), satisfying the following universal property: given any object Y equipped with a map f_i: Y \to X_i for i = 1, 2, there exists a unique map f: Y \to X such that f_i = \pi_i \circ f for i = 1, 2. (Readers not familiar with this categorical notion should verify the universal property for the cartesian product of two sets, in the category of sets and functions.)

I said “a” cartesian product, but any two cartesian products are the same in the sense of being isomorphic. For suppose both (X, \pi_1, \pi_2) and (X', \pi_1', \pi_2') are cartesian products of X_1, X_2. By the universal property of the first product, there exists a unique morphism f: X' \to X such that \pi_i' = \pi_i \circ f for i = 1, 2. By the universal property of the second product, there exists a unique morphism g: X \to X' such that \pi_i = \pi_i' \circ g. These maps f and g are inverse to one another. Why? By the universal property, there is a unique map \phi: X \to X (namely, \phi = 1_X) such that \pi_i = \pi_i \circ \phi for i = 1, 2. But \phi = f \circ g also satisfies these equations: \pi_i = \pi_i \circ (f \circ g) (using associativity). So 1_X = f \circ g by the uniqueness clause of the universal property; similarly, 1_{X'} = g \circ f. Hence f: X \to X' is an isomorphism.

This sort of argument using a universal property is called a universality argument. It is closely related to what we dubbed the “Yoneda principle” when we studied posets.

So: between any two products X, X' of X_1 and X_2, there is a unique isomorphism f: X' \to X respecting the product structure; we say that any two products are canonically isomorphic. Very often one also has chosen products (a specific choice of product for each ordered pair (X_1, X_2)), as in set theory when we construe the product of two sets as a set of ordered pairs \{(x_1, x_2): x_1 \in X_1, x_2 \in X_2\}. We use X_1 \times X_2 to denote (the object part of) a chosen cartesian product of (X_1, X_2).

Exercise: Use universality to exhibit a canonical isomorphism \sigma: X_1 \times X_2 \to X_2 \times X_1. This is called a symmetry isomorphism for the cartesian product.

Many category theorists (including myself) are fond of the following notation for expressing the universal property of products:

\displaystyle \frac{f_1: Y \to X_1 \qquad f_2: Y \to X_2}{f = \langle f_1, f_2 \rangle: Y \to X_1 \times X_2}

where the dividing line indicates a bijection between pairs of maps (f_1, f_2) and single maps f into the product, effected by composing f with the pair of projection maps. We have actually seen this before: when the category is a poset, the cartesian product is called the meet:

\displaystyle \frac{a \leq x \qquad a \leq y}{a \leq x \wedge y}

In fact, a lot of arguments we developed for dealing with meets in posets extend to more general cartesian products in categories, with little change (except that instead of equalities, there will typically be canonical isomorphisms). For example, we can speak of a cartesian product of any indexed collection of objects \{X_i\}_{i \in I}: an object \prod_{i \in I} X_i equipped with projection maps \pi_i: \prod_{i \in I} X_i \to X_i, satisfying the universal property that for every I-tuple of maps f_i: Y \to X_i, there exists a unique map f: Y \to \prod_{i \in I} X_i such that f_i = \pi_i \circ f. Here we have a bijection between I-tuples of maps and single maps:

\displaystyle \frac{(f_i: Y \to X_i)_{i \in I}}{f = \langle f_i \rangle_{i \in I}: Y \to \prod_{i \in I} X_i}

By universality, such products are unique up to unique isomorphism. In particular, (X_1 \times X_2) \times X_3 is a choice of product of the collection \{X_1, X_2, X_3\}, as seen by contemplating the bijection between triples of maps and single maps

\displaystyle \frac{\frac{f_1: Y \to X_1 \qquad f_2: Y \to X_2}{\langle f_1, f_2 \rangle: Y \to X_1 \times X_2} \qquad \frac{f_3: Y \to X_3}{f_3: Y \to X_3}}{f: Y \to (X_1 \times X_2) \times X_3}

and similarly X_1 \times (X_2 \times X_3) is another choice of product. Therefore, by universality, there is a canonical associativity isomorphism

\alpha: (X_1 \times X_2) \times X_3 \to X_1 \times (X_2 \times X_3).

Remark: It might be thought that in all practical cases, the notion of cartesian product (in terms of good old-fashioned sets of tuples) is clear enough; why complicate matters with categories? One answer is that it isn’t always clear from purely set-theoretic considerations what the right product structure is, and in such cases the categorical description gives a clear guide to what we really need. For example, when I was first learning topology, the box topology on the set-theoretic product \prod_{i \in I} X_i seemed to me to be a perfectly natural choice of topology; I didn’t understand the general preference for what is called the “product topology”. (The open sets in the box topology are unions of products \prod_{i \in I} U_i of open sets in the factors X_i. The open sets in the product topology are unions of such products where U_i = X_i for all but finitely many i \in I.)

In retrospect, the answer is obvious: the product topology on \prod_{i \in I} X_i is the smallest topology making all the projection maps \pi_i continuous. This means that a function f: Y \to \prod_{i \in I} X_i is continuous if and only if each f_i = \pi_i \circ f: Y \to X_i is continuous: precisely the universal property we need. Similarly, in seeking to understand products or other constructions of more abstruse mathematical structures (schemes for instance), the categorical description is de rigeur in making sure we get it right. \Box

For just about any mathematical structure we can consider a category of such structures, and this applies to the notion of category itself. That is, we can consider a category of categories! (Sounds almost religious to me: category of categories, holy of holies, light of lights…)

  • Remark: Like “set of sets”, the idea of category of categories taken to a naive extreme leads to paradoxes or other foundational difficulties, but there are techniques for dealing with these issues, which I don’t particularly want to discuss right now. If anyone is uncomfortable around these issues, a stopgap measure is to consider rather the category of small categories (a category has a class of objects and morphisms; a small category is where these classes are sets), within some suitable framework like the set theory of Gödel-Bernays-von Neumann.

If categories are objects, the morphisms between them may be taken to be structure-preserving maps between categories, called “functors”.

Definition: If C and D are categories, a functor F: C \to D consists of a function F_0: C_0 \to D_0 (between objects) and a function F_1: C_1 \to D_1 (between morphisms), such that

  • F_0(\mbox{dom}_C(f)) = \mbox{dom}_D(F_1(f)) and F_0(\mbox{cod}_C(f)) = \mbox{cod}_D(F_1(f)), for each morphism f \in C_1 (i.e., F preserves domains and codomains of morphisms);
  • F_1(1_A) = 1_{F_0(A)} for each object A \in C_0, and F_1(g \circ f) = F_1(g) \circ F_1(f) for each composable pair (f, g) \in C_2 (i.e., F preserves identity morphisms and composition of morphisms).

Normally we are not so fussy in writing F_1(f) or F_0(A); we write F(f) and F(A) for morphisms f and objects A alike. Sometimes we drop the parentheses as well. \Box

If X, Y are groups or monoids regarded as one-object categories, then a functor between them amounts to a group or monoid homomorphism. If X, Y are posets regarded as categories, then a functor between them amounts to a poset map. So no new surprises in these cases.

Exercise: Define a product C \times D of two categories C, D, and verify that the definition satisfies the universal property of products in the “category of categories”.

Exercise: If a category C has chosen products, show how a functor C \times C \to C may be defined which takes a pair of objects (c, d) to its product c \times d. (You need to define the morphism part F_1 of this functor; this will involve the universal property of products.)