# Fundamental Considerations of Categories

This chapter focuses mainly on limits and colimits in a given category $\mathcal{C}$. It also discusses other important and interesting categorical constructions, such as the simple notion of opposite categories and the Grothendieck construction, which gives something like the histogram of a set-valued functor. As usual, the work relies as often as possible on a grounding in databases.

This chapter is in some sense parallel to Chapter 3, Fundamental Considerations in Set. When attention is restricted to $\mathcal{C}=Set$, the discussion of limits and colimits in this chapter subsumes the earlier work (which focused on certain finite limits and colimits). Also, this chapter ends with a section called Arithmetic of Categories, Section 6.2.5, which is tightly parallel with Section 3.4.3. This shows that in terms of grade school arithmetic expressions like

$\mathcal{A}×\left(\mathcal{B}+\mathcal{C}\right){=}^{?}\left(\mathcal{C}×\mathcal{A}\right)+\left(\mathcal{B}×\mathcal{A}\right),$

the behavior of categories is predictable: the rules for categories are well aligned with those of sets, which are well aligned with those of natural numbers.

# 6.1   Limits and colimits

Limits and colimits are universal constructions, meaning they represent certain ideals of behavior in a category. When it comes to sets that map to A and B, the A × B grid is ideal—it projects on to both A and B as straightforwardly as possible. When it comes to sets that can interpret the elements of both A and B, the disjoint union AB is ideal—it includes both A and B without confusion or superfluity. These are limits and colimits in Set. Limits and colimits exist in other categories as well.

Limits in a preorder are meets; colimits in a preorder are joins. Limits and colimits also exist for database instances and monoid actions, allowing us to discuss, for example, the product or union of different finite state machines. Limits and colimits exist for topological spaces, giving rise to products and unions as well as to quotients.

Limits and colimits do not exist in every category. However, when $\mathcal{C}$ is complete with respect to limits (or colimits), these limits always seem to mean something valuable to human intuition. For example, when a subject had already been studied for a long time before category theory came to promenance, it often turned out that classically interesting constructions in the subject corresponded with limits and colimits in its categorification $\mathcal{C}$. For example, products, unions, and quotients by equivalence relations are classical ideas in set theory that are naturally captured by limits and colimits in Set.

## 6.1.1   Products and coproducts in a category

Section 3.1 discussed products and coproducts in the category Set of sets. Now we discuss the same notions in an arbitrary category. For both products and coproducts, we begin with examples and then write the general concept.

### 6.1.1.1   Products

The product of two sets is a grid, which projects down onto each of the two sets. This is a good intuition for products in general.

Example 6.1.1.2. Given two preorders, ${\mathcal{X}}_{1}≔\left({X}_{1},{⩽}_{1}\right)$ and ${\mathcal{X}}_{2}≔\left({X}_{2},{⩽}_{2}\right)$, we can take their product and get a new preorder ${\mathcal{X}}_{1}×{\mathcal{X}}_{2}$. Both ${\mathcal{X}}_{1}$ and ${\mathcal{X}}_{2}$ have underlying sets (namely, X1 and X2), so we might hope that the underlying set of ${\mathcal{X}}_{1}×{\mathcal{X}}_{2}$ is the set X1 × X2 of ordered pairs, and this turns out to be true. We have a notion of less-than on ${\mathcal{X}}_{1}$, and we have a notion of less-than on ${\mathcal{X}}_{2}$; we need to construct a notion of less-than on ${\mathcal{X}}_{1}×{\mathcal{X}}_{2}$. So, given two ordered pairs (x1, x2) and $\left({x}_{1}^{\prime },{x}_{2}^{\prime }\right)$, when should we say that $\left({x}_{1},{x}_{2}\right){⩽}_{1,2}\left({x}_{1}^{\prime },{x}_{2}^{\prime }\right)$ holds? A guess is that it holds iff both ${x}_{1}{⩽}_{1}{x}_{1}^{\prime }$ and ${x}_{2}{⩽}_{2}{x}_{2}^{\prime }$ hold, and this works:1

${\mathcal{X}}_{1}×{\mathcal{X}}_{2}≔\left({X}_{1}×{X}_{2},{⩽}_{1,2}\right).$

Note that the projection functions X1 × X2X1 and X1 × X2X2 induce morphisms of preorders. That is, if $\left({x}_{1},{x}_{2}\right){⩽}_{1,2}\left({x}_{1}^{\prime },{x}_{2}^{\prime }\right)$, then in particular, ${x}_{1}{⩽}_{1}{x}_{1}^{\prime }$ and ${x}_{2}{⩽}_{2}{x}_{2}^{\prime }$. So we have preorder morphisms

Exercise 6.1.1.3.

Suppose you have a partial order $\mathcal{S}=\left(S,{⩽}_{S}\right)$ on songs (you prefer some songs over others, but sometimes you cannot compare). And suppose you have a partial order $\mathcal{A}=\left(A,{⩽}_{A}\right)$ on pieces of art. You are about to be given two pairs (s, a) and (s′, a′), each including a song and an art piece. Does the product partial order $\mathcal{S}×\mathcal{A}$ provide a reasonable guess for your preferences on these pairs?

Exercise 6.1.1.4.

Consider the partial order ⩽ on ℕ given by standard less-than-or-equal-to, so 5 ⩽ 9, and let divides be the partial order from Example 4.4.3.2, where 6 divides 12. If we call the product order (X, ≤) ≔ (ℕ, ⩽) × (ℕ, divides), which of the following are true?

$\begin{array}{llll}\left(2,4\right)\le \left(3,4\right)\hfill & \left(2,4\right)\le \left(3,5\right)\hfill & \left(2,4\right)\le \left(8,0\right)\hfill & \left(2,4\right)\le \left(0,0\right)\hfill \end{array}$

Example 6.1.1.5. Given two graphs G1 = (V1, A1, src1, tgt1) and G2 = (V2, A2, src2, tgt2), we can take their product and get a new graph G1 × G2. The vertices are the grid of vertices V1 × V2, so each vertex in G1 × G2 is labeled by a pair of vertices, one from G1 and one from G2. When should an arrow connect (v1, v2) to $\left({v}_{1}^{\prime },{v}_{2}^{\prime }\right)$? Whenever we can find an arrow in G1 connecting v1 to ${v}_{1}^{\prime }$ and we can find an arrow in G2 connecting v2 to ${v}_{2}^{\prime }$. It turns out there is a simple formula for the set of arrows in G1 × G2, namely, A1 × A2.

Let’s write GG1 × G2 and say, G = (V, A, src, tgt). We said that V = V1 × V2 and A = A1 × A2. What should the source and target functions AV be? Given a function src1 : A1V1 and a function src2 : A2V2, the universal property for products in Set (Proposition 3.1.1.10 or, better, Example 3.1.1.15) provides a unique function

$src≔sr{c}_{1}×sr{c}_{2}:{A}_{1}×{A}_{2}\to {V}_{1}×{V}_{2}.$

Namely, the source of arrow (a1, a2) will be the vertex (src1(a1), src2(a2)). Similarly, we have a ready-made choice of target function tgt = tgt1 × tgt2. We have now defined the product graph,

$G={G}_{1}×{G}_{2}=\left({V}_{1}×{V}_{2},{A}_{1}×{A}_{2},sr{c}_{1}×sr{c}_{2},tg{t}_{1}×tg{t}_{2}\right).$

Here is a concrete example. Let I and J be drawn as follows:

The product I × J has, as expected, 3 * 4 = 12 vertices and 3 * 4 = 12 arrows:

Here is the most important thing to notice. Look at the Arrow table for I × J, and for each ordered pair, look only at the first entry in all three columns; you will see something that matches with the Arrow table for I. For example, in the I × J table, the first row’s first entries are f, v, w. Then do the same for the second entry in each column, and again you will see a match with the Arrow table for J. These matches are readily visible graph homomorphisms I × JI and I × JJ in Grph.

Exercise 6.1.1.6.

Let [1] denote the linear order graph of length 1,

and let P = Paths([1]) be its paths-graph, as in Example 5.1.2.25 (so P should have three arrows and two vertices). Draw the graph P × P.

Exercise 6.1.1.7.

Recall from Example 4.5.2.10 that a discrete dynamical system (DDS) is a set s together with a function f : ss. It is clear that if

is the loop schema, then a DDS is simply an instance (a functor) I : $\mathcal{L}\mathit{\text{oop}}$Set. We have not yet discussed DDS products, but perhaps you can guess how they should work. For example, consider these instances I, J : $\mathcal{L}\mathit{\text{oop}}$Set:

a. Make a guess and tabulate I × J. Then draw it.2

b. Recall the notion of natural transformations between functors (see Example 5.3.3.5), which in the case of functors $\mathcal{L}\mathit{\text{oop}}$Set are the morphisms of instances. Do you see clearly that there is a morphism of instances I × JI and I × JJ? Check that if you look only at the left-hand coordinates in your I × J, you see something compatible with I.

In each case what is most important to recognize is that there are projection maps I × JI and I × JJ, and that the construction of I × J seems as straightforward as possible, subject to having these projections.

Definition 6.1.1.8. Let $\mathcal{C}$ be a category, and let $X,Y\in \text{Ob}\left(\mathcal{C}\right)$ be objects. A span on X and Y consists of three constituents (Z, p, q), where $Z\in \text{Ob}\left(\mathcal{C}\right)$ is an object, and where p : ZX and q : ZY are morphisms in $\mathcal{C}$.

A product of X and Y is a span $X\stackrel{{\pi }_{1}}{←}X×Y\stackrel{{\pi }_{2}}{\to }Y$, such that for any other span $X\stackrel{p}{←}Z\stackrel{q}{\to }Y$ there exists a unique morphism tp,q : ZX × Y such that the following diagram commutes:3

We often denote the morphism tp,q by 〈p, q〉: ZX × Y .

Remark 6.1.1.9. Definition 6.1.1.8 endows the product of two objects with a universal property. It says that a product of two objects X and Y maps to those two objects and serves as a gateway for all that do the same. “None shall map to X and Y except through me!” This grandiose property is held by products in all the various categories discussed so far. It is what is meant by “X × Y maps to both X and Y and does so as straightforwardly as possible.” The grid of dots obtained as the product of two sets has such a property (see Example 3.1.1.11).

Example 6.1.1.10. Example 6.1.1.2 discussed products of preorders. This example discusses products in an individual preorder. That is, by Proposition 5.2.1.13, there is a functor PrOCat that realizes each individual preorder as a category. If ${P}=\left(P,\le \right)$ is a preorder, what are products in $\mathcal{P}$? Given two objects $a,b\in \text{Ob}\left(\mathcal{P}\right)$, we first consider {a, b} spans, i.e., azb. That is some z such that za and zb. The product is a span aa × bb, but such that every other spanning object z is less than or equal to a × b. In other words, a × b is as big as possible subject to the condition of being less than a and less than b. This is precisely their meet, ab (see Definition 4.4.2.1).

Example 6.1.1.11. Note that the product of two objects in a category $\mathcal{C}$ may not exist. Let’s return to preorders to see this phenomenon.

Consider the set ℝ2, and say that (x1, y1) ≤ (x2, y2) if there exists ≥ 1 such that x1 = x2 and y1 = y2; in other words, point p is less than point q if, in order to travel from q to the origin along a straight line, one must pass through p along the way.4 We have given a perfectly good partial order, but p ≔ (1, 0) and q ≔ (0, 1) do not have a product. Indeed, it would have to be a nonzero point that was on the same line through the origin as p and the same line through the origin as q, of which there are none.

Example 6.1.1.12. Note that there can be more than one product of two objects in a category $\mathcal{C}$ but that any two choices will be canonically isomorphic. Let’s return once more to preorders to see this phenomenon.

Consider the set ℝ2, and say that (x1, y1) ≤ (x2, y2) if ${x}_{1}^{2}+{y}_{1}^{2}\le {x}_{2}^{2}+{y}_{2}^{2}$, in other words, if the former is closer to the origin. For any point p = (x0, y0), let ${C}_{p}=\left\{\left(x,y\right)\in {ℝ}^{2}|{x}^{2}+{y}^{2}={x}_{0}^{2}+{y}_{0}^{2}\right)\right\}$, and call it the orbit circle of p.

For any two points p, q, there will be lots of points that serve as products p × q: any point a on the smaller of their two orbit circles will suffice. Given any two points a, a′ on this smaller circle, we have a unique isomorphism aa′ because aa′ and a′ ≤ a.

Exercise 6.1.1.13.

Consider the preorder $\mathcal{P}$ of cards in a deck, shown in Example 4.4.1.3; it is not the whole story of cards in a deck, but take it to be so. Consider this preorder $\mathcal{P}$ as a category (by way of the functor PrOCat).

a. For each of the following pairs, what is their product in $\mathcal{P}$ (if it exists)?

$\begin{array}{cc}\hfill ⌜\text{a diamond}⌝×⌜\text{a heart}⌝& \hfill ⌜\text{a queen}⌝×⌜\text{a black card}⌝\\ ⌜\text{a card}⌝×⌜\text{a red card}⌝\hfill & \hfill ⌜\text{a face card}⌝×⌜\text{a black card}⌝\end{array}$

b. How would these answers differ if $\mathcal{P}$ were completed to the “whole story” partial order classifying cards in a deck?

Exercise 6.1.1.14.

Let X be a set, and consider it as a discrete category. Given two objects x, y ∈ Ob(X), under what conditions will there exist a product x × y in X?

Exercise 6.1.1.15.

Let f : ℝ → ℝ be a function like one that you would see in grade school (e.g., f(x) = x+7). A typical thing to do is to graph f as a curve running through the plane ℝ2 ≔ ℝ×ℝ. For example, f is graphed as a straight line with slope 1 and y-intercept 7. In general, the graph of f is a curve that be understood as a function F : ℝ → ℝ2.

a. For an arbitrary function f : ℝ → ℝ with graph F : ℝ → ℝ2 and an arbitrary r ∈ ℝ, what are the (x, y) coordinates of F (r) ∈ ℝ2?

b. Obtain F : ℝ → ℝ2 using the universal property given in Definition 6.1.1.8.

Exercise 6.1.1.16.

Consider the preorder (ℕ, divides), discussed in Example 4.4.3.2, where, e.g., 5 ≤ 15, but 5 ≰ 6. Consider it as a category, using the functor PrOCat.

a. What is the product of 9 and 12 in this category?

b. Is there a standard name for products in this category?

Example 6.1.1.17. Products do not have to exist in an arbitrary category, but they do exist in Cat, the category of categories. That is, given two categories $\mathcal{C}$ and $\mathcal{D}$, there is a product category $\mathcal{C}×\mathcal{D}$. We have $\text{Ob}\left(\mathcal{C}×\mathcal{D}\right)=\text{Ob}\left(\mathcal{C}\right)×\text{Ob}\left(\mathcal{D}\right)$, and for any two objects (c, d) and (c′, d′), we have

${\text{Hom}}_{\mathcal{C}×\mathcal{D}}\left(\left(c,d\right),\left(c\prime ,d\prime \right)\right)={\text{Hom}}_{\mathcal{C}}\left(c,c\prime \right)×{\text{Hom}}_{\mathcal{C}}\left(d,d\prime \right).$

The composition formula is clear.

Let [1] ∈ Ob(Cat) denote the linear order category of length 1:

As a schema it has one arrow, but as a category it has three morphisms. So we expect [1]×[1] to have nine morphisms, and that is true. In fact, [1]×[1] looks like a commutative square:

We see only four morphisms here, but there are also four identities and one morphism (0, 0) → (1, 1) given by composition of either direction. It is a minor miracle that the categorical product somehow “knows” that this square should commute; however, this is not a mere preference but follows rigorously from the definitions we already gave of Cat and products.

### 6.1.1.18   Coproducts

The coproduct of two sets is their disjoint union, which includes nonoverlapping copies of each of the two sets. This is a good intuition for coproducts in general.

Example 6.1.1.19. Given two preorders, ${\mathcal{X}}_{1}≔\left({X}_{1},{\le }_{1}\right)$ and ${\mathcal{X}}_{2}≔\left({X}_{2},{\le }_{2}\right)$, we can take their coproduct and get a new preorder ${\mathcal{X}}_{1}\bigsqcup {\mathcal{X}}_{2}$. Both ${\mathcal{X}}_{1}$ and ${\mathcal{X}}_{2}$ have underlying sets (namely, X1 and X2), so we might hope that the underlying set of ${\mathcal{X}}_{1}×{\mathcal{X}}_{2}$ is the disjoint union X1X2, and that turns out to be true. We have a notion of less-than on ${\mathcal{X}}_{1}$ and a notion of less-than on ${\mathcal{X}}_{2}$.

Given an element xX1X2 and an element x′ ∈ X1X2, how can we use ≤1 and ≤2 to compare x1 and x2? The relation ≤1 only knows how to compare elements of X1, and the relation ≤2 only knows how to compare elements of X2. But x and x′ may come from different homes, e.g., xX1 and x′ ∈ X2, in which case neither ≤1 nor ≤2 gives any clue about which should be bigger.

So when should we say that x1⊔2 x′ holds? The obvious guess is to say that x is less than x′ iff both x and x′ are from the same home and the local ordering has xx′. To be precise, we say x1⊔2 x′ if and only if either one of the following conditions hold:

• xX1 and x′ ∈ X1 and x1 x′, or
• xX2 and x′ ∈ X2 and x2 x′.

With ≤1⊔2 so defined, one checks that it is not only a preorder but that it serves as a coproduct of ${\mathcal{X}}_{1}$ and ${\mathcal{X}}_{2}$,5

${\mathcal{X}}_{1}\bigsqcup {\mathcal{X}}_{2}≔\left({X}_{1}\bigsqcup {X}_{2},{\le }_{1\bigsqcup 2}\right).$

Note that the inclusion functions X1X1X2 and X2X1X2 induce morphisms of preorders. That is, if x, x′ ∈ X1 are elements such that x1 x′ in ${\mathcal{X}}_{1}$, then the same will hold in ${\mathcal{X}}_{1}\bigsqcup {\mathcal{X}}_{2}$, and similarly for ${\mathcal{X}}_{2}$. So we have preorder morphisms

Exercise 6.1.1.20.

Suppose you have a partial order $\mathcal{A}≔\left(A,{\le }_{A}\right)$ on apples (you prefer some apples to others, but sometimes you cannot compare). And suppose you have a partial order $\mathcal{O}≔\left(O,{\le }_{O}\right)$ on oranges. You are about to be given two pieces of fruit from a basket of apples and oranges. Is the coproduct partial order $\mathcal{A}\bigsqcup \mathcal{O}$ a reasonable guess for your preferences, or does it seem biased?

Example 6.1.1.21. Given two graphs G1 = (V1, A1, src1, tgt1) and G2 = (V2, A2, src2, tgt2), we can take their coproduct and get a new graph G1G2. The vertices will be the disjoint union of vertices V1V2, so each vertex in G1G2 is labeled either by a vertex in G1 or by one in G2 (if any labels are shared, then something must be done to differentiate them). When should an arrow connect v to v′? Whenever both are from the same component (i.e., either v, v′ ∈ V1 or v, v′ ∈ V2) and we can find an arrow connecting them in that component. It turns out there is a simple formula for the set of arrows in G1G2, namely, A1A2.

Let’s write GG1G2 and say, G = (V, A, src, tgt). We now know that V = V1V2 and A = A1A2. What should the source and target functions AV be? Given a function src1 : A1V1 and a function src2 : A2V2, the universal property for coproducts in Set can be used to specify a unique function

$src≔sr{c}_{1}\bigsqcup sr{c}_{2}:{A}_{1}\bigsqcup {A}_{2}\to {V}_{1}\bigsqcup {V}_{2}.$

Namely, for any arrow aA, we know either aA1 or aA2 (and not both), so the source of a will be the vertex src1(a) if aA1 and src2(a) if aA2. Similarly, we have a ready-made choice of target function tgt = tgt1tgt2. We have now defined the coproduct graph.

Here is an example. Let I and J be as in Example 5.3.3.5:

The coproduct IJ has, as expected, 3 + 5 = 8 vertices and 3 + 4 = 7 arrows:

Here is the most important thing to notice. Look at the Arrow tables and notice that there is a way to send each row in I to a row in IJ such that all the foreign keys match, and similarly for J. This also works for the vertex tables. These matches are readily visible graph homomorphisms IIJ and JIJ in Grph.

Exercise 6.1.1.22.

Recall from Example 4.5.2.10 that a discrete dynamical system (DDS) is a set s together with a function f : ss; if

is the loop schema, then a DDS is simply an instance (a functor) I : $\mathcal{L}\mathit{\text{oop}}$Set. We have not yet discussed DDS coproducts but perhaps you can guess how they should work. For example, consider these instances I, J : $\mathcal{L}\mathit{\text{oop}}$Set:

Make a guess and tabulate IJ. Then draw it.

In each case (preorders, graphs, DDSs), what is most important to recognize is that there are inclusion maps IIJ and JIJ, and that the construction of IJ seems as straightforward as possible, subject to having these inclusions.

Definition 6.1.1.23. Let $\mathcal{C}$ be a category, and let $X,Y\in \text{Ob}\left(\mathcal{C}\right)$ be objects. A cospan on X and Y consists of three constituents (Z, i, j), where $Z\in \text{Ob}\left(\mathcal{C}\right)$ is an object, and where i : XZ and j : YZ are morphisms in $\mathcal{C}$.

A coproduct of X and Y is a cospan $X\stackrel{{\iota }_{1}}{\to }X\bigsqcup Y\stackrel{{\iota }_{2}}{←}Y$, such that for any other cospan $X\stackrel{i}{\to }Z\stackrel{j}{←}Y$ there exists a unique morphism si,j : XYZ such that the following diagram commutes:6

The morphism si,j is often denoted .

Remark 6.1.1.24. Definition 6.1.1.8 endows the coproduct of two objects with a universal property. It says that a coproduct of two objects X and Y receives maps from those two objects, and serves as a gateway for all that do the same. “None shall receive maps from X and Y except through me!” This grandiose property is held by all the coproducts discussed so far. It is what is meant by “XY receives maps from both X and Y and does so as straightforwardly as possible.” The disjoint union of dots obtained as the coproduct of two sets has such a property (see Example 3.1.2.5).

Example 6.1.1.25. By Proposition 5.2.1.13, there is a functor PrOCat that realizes every preorder as a category. If $\mathcal{P}=\left(P,\le \right)$ is a preorder, what are coproducts in $\mathcal{P}$? Given two objects $a,b\in \text{Ob}\left(\mathcal{P}\right)$, we first consider {a, b} cospans, i.e., azb. A cospan of a and b is any z such that az and bz. The coproduct will be such a cospan aabb, but such that every other cospanning object z is greater than or equal to ab. In other words, ab is as small as possible subject to the condition of being bigger than a and bigger than b. This is precisely their join, ab (see Definition 4.4.2.1).

Just as for products, the coproduct of two objects in a category $\mathcal{C}$ may not exist, or it may not be unique. The nonuniqueness is much less “bad” because given two candidate coproducts, they will be canonically isomorphic. They may not be equal, but they are isomorphic. But coproducts might not exist at all in certain categories.

Example 6.1.1.26. Consider the set ℝ2 and partial order from Example 6.1.1.11, where (x1, y1) ≤ (x2, y2) if there exists ≥ 1 such that x1 = x2 and y1 = y2. Again the points p ≔ (1, 0) and q ≔ (0, 1) do not have a coproduct. Indeed, it would have to be a nonzero point that was on the same line through the origin as p and the same line through the origin as q, of which there are none.

Exercise 6.1.1.27.

Consider the preorder $\mathcal{P}$ of cards in a deck, shown in Example 4.4.1.3; it is not the whole story of cards in a deck, but take it to be so. Consider this preorder $\mathcal{P}$ as a category (by way of the functor PrOCat).

a. For each of the following pairs, what is their coproduct in $\mathcal{P}$ (if it exists)?

$\begin{array}{cc}⌜\text{a diamond}⌝\bigsqcup ⌜\text{a heart}⌝\hfill & \hfill ⌜\text{a queen}⌝\bigsqcup ⌜\text{a black card}⌝\\ ⌜\text{a card}⌝\bigsqcup ⌜\text{a red card}⌝\hfill & \hfill ⌜\text{a face card}⌝\bigsqcup ⌜\text{a black card}⌝\end{array}$

b. How would these answers differ if $\mathcal{P}$ were completed to the “whole story” partial order classifying cards in a deck?

Exercise 6.1.1.28.

Let X be a set, and consider it as a discrete category. Given two objects x, y ∈ Ob(X), under what conditions will there exist a coproduct xy?

Exercise 6.1.1.29.

Consider the preorder (ℕ, divides), discussed in Example 4.4.3.2, where, e.g., 5 ≤ 15, but 5 ≰ 6.

a. What is the coproduct of 9 and 12 in that category?

b. Is there a standard name for coproducts in that category?

## 6.1.2   Diagrams in a category

Diagrams have illustrated the text throughout the book. What is the mathematical foundation of these illustrations? The answer is functors.

Definition 6.1.2.1 (Diagrams). Let $\mathcal{C}$ and I be categories. An I-shaped diagram in $\mathcal{C}$ is simply a functor $d:I\to \mathcal{C}$. In this case I is called the indexing category for the diagram.7

Here are some rules for drawing diagrams as in Definition 6.1.2.1.

Rules of good practice 6.1.2.2. Suppose given an indexing category I and an I-shaped diagram $X:I\to \mathcal{C}$. One draws this as follows:

(i) For each object in qI, draw a dot labeled by X(q); if several objects in I point to the same object in $\mathcal{C}$, then several dots are labeled the same way.

(ii) For each morphism f : qq′ in I, draw an arrow between dots X(q) and X(q′), and label it X(f) in $\mathcal{C}$. Again, if several morphisms in I are sent to the same morphism in $\mathcal{C}$, then several arrows are labeled the same way.

(iii) One can abridge this process by not drawing every morphism in I, as long as every morphism in I is represented by a unique path in $\mathcal{C}$, i.e., as long as the drawing is sufficiently unambiguous as a depiction of $X:I\to \mathcal{C}$.

(iv) One may choose to draw a dash box around the finished diagram X to indicate that it is referencing an ambient category $\mathcal{C}$.

Example 6.1.2.3. Consider the commutative diagram in Set:

This is the drawing of a functor d : [1] × [1] → Set (see Example 6.1.1.17). With notation for the objects and morphisms of [1] × [1], as shown in diagram (6.1), we have d(0, 0) = d(0, 1) = d(1, 0) = ℕ and d(1, 1) = ℤ (for some reason) and d(id0, f): ℕ → ℕ given by nn + 1, and so on. The fact that d is a functor means it must respect composition formulas, which implies that diagram (6.2) commutes. We call [1] × [1] the commutative square indexing category. 8

Example 6.1.2.4. Recall from Section 2.2 that not all diagrams commute; one must specify that a given diagram commutes if one wishes to communicate this fact. But then, how is a noncommuting diagram to be understood as a functor?

Let G ∈ Ob(Grph) denote the following graph:

Recall the free category functor F : GrphCat (see Example 5.1.2.33). The free category F (G) ∈ Ob(Cat) on G looks almost like [1]×[1] in Example 6.1.2.3 except that since (0,0)[f, g] is a different path in G than is (0,0)[h, i], they become different morphisms in F(G). A functor F(G) → Set might be drawn the same way that (6.2) is, but it would be a diagram that would not be said to commute.

Exercise 6.1.2.5.

Consider [2], the linear order category of length 2.

a. Is [2] the appropriate indexing category for commutative triangles?

b. If not, what is? If so, what might lead someone to be skeptical, and why would the skeptic be wrong?

Example 6.1.2.6. Recall that an equalizer in Set is a diagram of sets that looks like this:

where g1f = g2f. What is the indexing category for such a diagram? It is the schema (6.3) with the PED E[f, g1] ≃ E[f, g2]. That is, in some sense one sees the indexing category, but the PED needs to be declared.

Exercise 6.1.2.7.

Let $\mathcal{C}$ be a category, $A\in \text{Ob}\left(\mathcal{C}\right)$ an object, and f : AA a morphism in $\mathcal{C}$. Consider the following two diagrams in $\mathcal{C}$:

a. Should these two diagrams have the same indexing category?

b. Write the indexing category for both.

c. If they have the same indexing category, what is causing or allowing the pictures to appear different?

d. If they do not have the same indexing category, what coincidence makes the two pictures have so much in common?

Definition 6.1.2.8. Let I ∈ Ob(Cat) be a category. The left cone on I, denoted I, is the category defined as follows. On objects we put Ob(I) = {LCI} ⊔ Ob(I), and we call the new object LCI the cone point of I. On morphisms we add a single new morphism sb : LCIb for every object b ∈ Ob(I); more precisely,

The composition formula is in some sense obvious. To compose two morphisms both in I, compose as dictated by I; if one has LCI as source, then there will be a unique choice of composite.

There is an obvious inclusion of categories,

$\begin{array}{cc}I\to {I}^{◅}.\hfill & \hfill \left(6.4\right)\end{array}$

Remark 6.1.2.9. Note that the specification of I given in Definition 6.1.2.8 works just as well if I is considered a schema and we are constructing a schema I: add the new object LCI and the new arrows sb : LCIb for each b ∈ Ob(I), and for every morphism f : bb′ in I, add a PED ${}_{L{C}_{I}}\left[{s}_{b\prime }\right]\simeq {}_{L{C}_{I}}\left[{s}_{b},f\right]$. We generally do not distinguish between categories and schemas, since they are equivalent, by Theorem 5.4.2.3.

Example 6.1.2.10. For a natural number n ∈ ℕ, define the n-leaf star schema, denoted Starn, to be the category (or schema; see Remark 6.1.2.9) n, where n is the discrete category on n objects. The following illustrate the categories Star0, Star1, Star2, and Star3:

Exercise 6.1.2.11.

Let ${\mathcal{C}}_{0}≔\underset{¯}{0}$ denote the empty category, and for any natural number n ∈ ℕ, let ${\mathcal{C}}_{n+1}={\left({\mathcal{C}}_{n}\right)}^{◅}$. Draw ${\mathcal{C}}_{4}$.

Exercise 6.1.2.12.

Let $\mathcal{C}$ be the graph-indexing schema as in (5.8). What is ${\mathcal{C}}^{◅}$, and how does it compare to the indexing category for equalizers, (6.3)?

Solution 6.1.2.12.

They are the same,

where the latter is understood to include the PED E[f, g1] = E[f, g2].

Definition 6.1.2.13. Let I ∈ Ob(Cat) be a category. The right cone on I, denoted I, is the category defined as follows. On objects we put Ob(I) = Ob(I) ⊔ {RCI}, and we call the new object RCI the cone point of I. On morphisms we add a single new morphism tb : bRCI for every object b ∈ Ob(I); more precisely,

The composition formula is in some sense obvious. To compose two morphisms both in I, compose as dictated by I; if one has RCI as target, then there will be a unique choice of composite.

There is an obvious inclusion of categories II.

Exercise 6.1.2.14.

Let $\mathcal{C}$ be the category (2), where 2 is the discrete category on two objects. Then $\mathcal{C}$ is somehow square-shaped, but what category is it exactly? Is $\mathcal{C}$ the commutative square indexing category [1] × [1] (see Example 6.1.2.3), is it the noncommutative square indexing category F (G) (see Example 6.1.2.4), or is it something else?

Exercise 6.1.2.15.

Let I = 2, let $\mathcal{C}$ be an arbitrary category, and let $D=\text{Fun}\left({I}^{◅},\mathcal{C}\right)$.

a. Using Rules 6.1.2.2, draw an object d ∈ Ob(D).

b. How might you draw a morphism f : dd′ in D?

Solution 6.1.2.15.

a. We have I = Star2, as in Example 6.1.2.10. We can draw an object $d:{I}^{◅}\to \mathcal{C}$ as a span,

${d}_{1}\stackrel{i}{←}{d}_{0}\stackrel{j}{\to }{d}_{2}.$

b. We could draw f : dd′ as

## 6.1.3   Limits and colimits in a category

Let $\mathcal{C}$ be a category, let I be an indexing category (which means that I is a category that we use as the indexing category for a diagram), and let $D:I\to \mathcal{C}$ be an I-shaped diagram (which means a functor). It is in relation to this setup that we can discuss the limit or colimit. In general, the limit of a diagram $D:I\to \mathcal{C}$ is a I shaped diagram, lim $D:{I}^{◅}\to \mathcal{C}$. In the case of products we have I = 2, and the limit looks like a span, the shape of I (see Exercise 6.1.2.15). For general I, D we may have many I-shaped diagrams; which of them is the limit of D? Answer: The one with the universal gateway property; see Remark 6.1.1.9.

### 6.1.3.1   Universal objects

Definition 6.1.3.2. Let $\mathcal{C}$ be a category. An object $a\in \text{Ob}\left(\mathcal{C}\right)$ is called initial if, for all objects $c\in \text{Ob}\left(\mathcal{C}\right)$, there exists a unique morphism ac, i.e., $|{\text{Hom}}_{\mathcal{C}}\left(a,c\right)|=1$. An object $z\in \text{Ob}\left(\mathcal{C}\right)$ is called terminal if, for all objects $c\in \text{Ob}\left(\mathcal{C}\right)$, there is exists a unique morphism cz, i.e., $|{\text{Hom}}_{\mathcal{C}}\left(c,z\right)|=1$.

Example 6.1.3.3. For any category I, the left cone I has a unique initial object, and the right cone I has a unique terminal object; in both cases it is the cone point. See Definitions 6.1.2.8 and 6.1.2.13.

Example 6.1.3.4. The initial object in Set is the set a for which there is always one way to map from a to anything else. Given c ∈ Ob(Set), there is exactly one function Ø → c, because there are no choices to be made, so the empty set Ø is the initial object in Set.

The terminal object in Set is the set z for which there is always one way to map to z from anything else. Given c ∈ Ob(Set), there is exactly one function c → {☺}, where {☺} is any set with one element, because there are no choices to be made: everything in c must be sent to the single element in {☺}. There are lots of terminal objects in Set, and they are all isomorphic to 1.

Example 6.1.3.5. The initial object in Grph is the graph a for which there is always one way to map from a to anything else. Given c ∈ Ob(Grph), there is exactly one graph homomorphism Ø → c, where Ø ∈ Ob(Grph) is the empty graph; so Ø is the initial object.

The terminal object in Grph is more interesting. It is

the graph with one vertex and one arrow. In fact, there are infinitely many terminal objects in Grph, but all of them are isomorphic to $\mathcal{L}\mathit{\text{oop}}$, meaning one can change the names of the vertex (s) and the arrow (f) and get another terminal object.

Exercise 6.1.3.6.

Let X be a set, let ℙ(X) be the set of subsets of X (see Definition 3.4.4.9). We can regard ℙ(X) as a preorder under inclusion of subsets (see, for example, Section 4.4.2). And we can regard preorders as categories using a functor PrOCat (see Proposition 5.2.1.13).

a. What is the initial object in ℙ(X)?

b. What is the terminal object in ℙ(X)?

Example 6.1.3.7. The initial object in the category Mon of monoids is the trivial monoid, 1. Indeed, for any monoid M, a morphism of monoids 1M is a functor between one-object categories and these are determined by where they send morphisms. Since 1 has only the identity morphism and functors must preserve identities, there is no choice involved in finding a monoid morphism 1M.

Similarly, the terminal object in Mon is also the trivial monoid, 1. For any monoid M, a morphism of monoids M1 sends everything to the identity; there is no choice.

Exercise 6.1.3.8.

a. What is the initial object in Grp, the category of groups?

b. What is the terminal object in Grp?

Example 6.1.3.9. Recall the preorder Prop of logical propositions from Section 5.2.4.1. The initial object is a proposition that implies all others. It turns out that “FALSE” is such a proposition. The proposition “FALSE” is like “1 ≠ 1”; in logical formalism it can be shown that if “FALSE” is true, then everything is true.

The terminal object in Prop is a proposition that is implied by all others. It turns out that “TRUE” is such a proposition. In logical formalism, everything implies that “TRUE” is true.

Example 6.1.3.10. The discrete category 2 has no initial object and no terminal object. The reason is that it has two objects 1, 2, but no maps from one to the other, so Hom2(1, 2) = Hom2(2, 1) = Ø.

Exercise 6.1.3.11.

Recall the divides preorder (see Example 4.4.3.2), where 5 divides 15.

a. Considering this preorder as a category, does it have an initial object?

b. Does it have a terminal object?

Exercise 6.1.3.12.

Let $\mathcal{M}$ = (List({a, b}), [ ], ++) denote the free monoid on the set {a, b} (see Definition 4.1.1.15) considered as a category via the functor MonCat (see Theorem 5.2.1.3).

a. Does $\mathcal{M}$ have an initial object?

b. Does $\mathcal{M}$ have a terminal object?

c. Which monoids $\mathcal{M}$, considered as one-object categories, have initial (resp. terminal) objects?

Exercise 6.1.3.13.

Let S be a set, and consider the indiscrete category KS ∈ Ob(Cat) on objects S (see Example 5.3.4.3).

a. For what S does KS have an initial object?

b. For what S does KS have a terminal object?

An object in a category is sometimes called universal if it is either initial or terminal, but we rarely use that term in practice, preferring to be specific about whether the object is initial or terminal. The word final is synonymous with the word terminal, but we will use the latter.

Universal properties refer to either initial or terminal objects in a specially-designed category. Colimits end up having an initial sort of universal property, and limits end up having a terminal sort of universal property. See Section 6.1.3.16.

Warning 6.1.3.14. A category $\mathcal{C}$ may have more than one initial object; similarly a category $\mathcal{C}$ may have more than one terminal object. As shown in Example 6.1.3.4, any set with one element, e.g., {*} or {☺} or {43}, is a terminal object in Set. Each of these terminal sets has the same number of elements, i.e., there exists an isomorphism between them, but they are not exactly the same set.

In fact, Proposition 6.1.3.15 shows that in any category $\mathcal{C}$, any two terminal objects in $\mathcal{C}$ are isomorphic (similarly, any two initial objects in $\mathcal{C}$ are isomorphic). While there are many isomorphisms in Set between {1, 2, 3} and {a, b, c}, there is only one isomorphism between {*} and {☺}. This is always the case for universal objects: there is a unique isomorphism between any two terminal (resp. initial) objects in any category.

As a result, we often speak of the initial object in $\mathcal{C}$ or the terminal object in $\mathcal{C}$, as though there were only one. “It is unique up to unique isomorphism” is put forward as the justification for using the rather than a. This is not too misleading, because just as a person today does not contain exactly the same atoms as that person yesterday, the difference is unimportant.

This book uses either the definite or the indefinite article, as is convenient, when speaking about initial or terminal objects. For example, Example 6.1.3.4 discussed the initial object in Set and the terminal object in Set. This usage is common throughout mathematical literature.

Proposition 6.1.3.15. Let $\mathcal{C}$ be a category, and let ${a}_{1},{a}_{2}\in \text{Ob}\left(\mathcal{C}\right)$ both be initial objects. Then there is a unique isomorphism $f:{a}_{1}\stackrel{\cong }{\to }{a}_{2}$. (Similarly, for any two terminal objects in $\mathcal{C}$, there is a unique isomorphism between them.)

Proof. Suppose a1 and a2 are initial. Since a1 is initial, there is a unique morphism f : a1a2; there is also a unique morphism a1a1, which must be ida1. Since a2 is initial, there is a unique morphism g : a2a1; there is also a unique morphism a2a2, which must be ida2. So gf = ida1 and fg = ida2, which means that f is the desired (unique) isomorphism.

The proof for terminal objects is appropriately dual.

### 6.1.3.16   Examples of limits

We are moving toward defining limits and colimits in full generality. We have assembled most of the pieces we will need: indexing categories, their left and right cones, and the notion of initial and terminal objects. Relying on the now familiar notion of products, we put these pieces in place and motivate one more construction, the slice category over a diagram.

Let $\mathcal{C}$ be a category, and let $X,Y\in \text{Ob}\left(\mathcal{C}\right)$ be objects. Definition 6.1.1.8 defines a product of X and Y to be a span $X\stackrel{{\pi }_{1}}{←}X×Y\stackrel{{\pi }_{2}}{\to }Y$ such that for every other span $X\stackrel{p}{←}Z\stackrel{q}{\to }Y$, there exists a unique morphism ZX × Y making the triangles commute. It turns out that we can enunciate this in the language of universal objects by saying that the span $X\stackrel{{\pi }_{1}}{←}X×Y\stackrel{{\pi }_{2}}{\to }Y$ is itself a terminal object in the category of {X, Y} spans. Phrasing the definition of products in this way is generalizable to defining arbitrary limits.

Construction 6.1.3.17 (Products). Let $\mathcal{C}$ be a category, and let X1, X2 be objects. We can consider this setup as a diagram $X:\underset{¯}{2}\to \mathcal{C}$, where X(1) = X1 and X(2) = X2. Consider the category 2 = Star2 (see Example 6.1.2.10), the inclusion i : 22 (see (6.4)), and the category of functors ${\text{Fun}\left(\underset{¯}{2}}^{◅},\mathcal{C}\right)$. The objects in ${\text{Fun}\left(\underset{¯}{2}}^{◅},\mathcal{C}\right)$ are spans in $\mathcal{C}$, and the morphisms are natural transformations between them (see Exercise 6.1.2.15).

Given a functor $S:{\underset{¯}{2}}^{◅}\to \mathcal{C}$, we can compose with i : 22 to get a functor $\underset{¯}{2}\to \mathcal{C}$. We want that to be X. That is, to get the product of X1 and X2, we are looking among those $S:{\underset{¯}{2}}^{◅}\to \mathcal{C}$ for which the following diagram commutes:

We are ready to define the category of {X1, X2} spans.

Define the category of X spans in $\mathcal{C}$, denoted ${\mathcal{C}}_{/X}$, to be the category whose objects and morphisms are as follows:

$\begin{array}{cc}\begin{array}{r}\hfill \text{Ob}\left({\mathcal{C}}_{\text{/}X}\right)=\left\{S:{\underset{¯}{2}}^{◅}\to \mathcal{C}|S○i=X\right\}\\ \hfill {\text{Hom}}_{{\mathcal{C}}_{/X}}\left(S,S\prime \right)=\left\{\alpha :S\to S\prime |\alpha ◇i={\text{id}}_{X}\right\}.\end{array}\hfill & \hfill \left(6.5\right)\end{array}$

The product of X1 and X2 was defined in Definition 6.1.1.8; we can now recast X1 × X2 as the terminal object in ${\mathcal{C}}_{/X}$.

An object in ${\mathcal{C}}_{/X}$ can be pictured as a diagram in $\mathcal{C}$ of the following form:

${X}_{1}\stackrel{p}{←}Z\stackrel{q}{\to }{X}_{2}$

In other words, the objects of ${\mathcal{C}}_{/X}$ are spans. A morphism in ${\mathcal{C}}_{/X}$ from object ${X}_{1}\stackrel{p}{←}Z\stackrel{q}{\to }{X}_{2}$ to object ${X}_{1}\stackrel{p\prime }{←}Z\prime \stackrel{q\prime }{\to }{X}_{2}$ consists of a morphism : ZZ′, such that p′ ○ = p and q′ ○ = q. So the set of such morphisms in ${\mathcal{C}}_{/X}$ are all the ’s that make both squares commute in the right-hand diagram:

Each object in ${\mathcal{C}}_{/X}$ is a span on X1 and X2, and each morphism in ${\mathcal{C}}_{/X}$ is a morphism of cone points in $\mathcal{C}$ making everything commute. The terminal object in ${\mathcal{C}}_{/X}$ is the product of X1 and X2 (see Definition 6.1.1.8).

It may be strange to have a category in which the objects are spans in another category. But once one admits this possibility, the notion of morphism between spans becomes totally sensible.

Example 6.1.3.18. Consider the following arbitrary six-object category $\mathcal{C}$, in which the three diagrams that can commute do so:

Let $X:\underset{¯}{2}\to \mathcal{C}$ be given by X(1) = X1 and X(2) = X2. Then the category of X spans might be drawn

### 6.1.3.19   Definition of limit

A product of two objects X, Y ∈ Ob() is a special case of a limit, namely, one in which the indexing category is 2. To handle arbitrary limits, we replace 2 with an arbitrary indexing category I, and use the following definition to generalize the category of spans, defined in (6.5).

Definition 6.1.3.20. Let $\mathcal{C}$ be a category, let I be a category. Let I be the left cone on I, and let i : II be the inclusion. Suppose that $X:I\to \mathcal{C}$ is an I-shaped diagram in $\mathcal{C}$. The slice category of $\mathcal{C}$ over X, denoted ${\mathcal{C}}_{/X}$, is the category whose objects and morphisms are as follows:

$\begin{array}{rrr}\hfill \text{Ob}\left({\mathcal{C}}_{\text{/}X}\right)& =& \left\{S:{I}^{◅}\to \mathcal{C}|S○i=X\right\};\hfill \\ \hfill {\text{Hom}}_{{\mathcal{C}}_{/X}}\left(S,S\prime \right)& =& \left\{\alpha :S\to S\prime |\alpha ○i={\text{id}}_{X}\right\}.\end{array}$

A limit of X, denoted limI X or lim X, is a terminal object in ${\mathcal{C}}_{/X}$.

Remark 6.1.3.21. Perhaps the following diagram will be helpful for understanding limits. Given a functor $X:I\to \mathcal{C}$, what is its limit? The solid-arrow part of the figure is the data we start with, i.e., the category $\mathcal{C}$, the indexing category I, and the diagram $X:I\to \mathcal{C}$, as well as the part we automatically add, the cone I with the inclusion $I\stackrel{i}{\to }{I}^{◅}$. The category ${\mathcal{C}}_{/X}$ is found in the dotted arrow part: its objects are the dotted arrows $S:{I}^{◅}\to \mathcal{C}$ that make the following triangle commute, and its morphisms are the natural transformations α : SS′x between them:

The limit of X is the initial object in this category.

Pullbacks The relevant indexing category for pullbacks is the cospan, I = 2, drawn as on the left:

A I-shaped diagram in $\mathcal{C}$ is a functor $X:I\to \mathcal{C}$, which might be drawn as on the right (e.g., ${X}_{0}\in \text{Ob}\left(\mathcal{C}\right)$).

An object S in the slice category ${\mathcal{C}}_{/X}$ is a commutative diagram S : I$\mathcal{C}$ over X, which looks like the left-hand box:

A morphism in ${\mathcal{C}}_{/X}$ is drawn as in the right-hand box. A terminal object in ${\mathcal{C}}_{/X}$ is precisely the gateway we want, i.e., the limit of X is the pullback ${X}_{0}{×}_{{X}_{2}}{X}_{1}$ (see Remark 6.1.1.9).

Remark 6.1.3.22. Let $\mathcal{C}$ be a category, and suppose given a functor $X:I\to \mathcal{C}$. Its limit is a certain functor lim $X:{I}^{◅}\to \mathcal{C}$. The category I looks basically the same as I, except it has an extra cone point LCI mapping to everything in I (see Definition 6.1.2.8). The functor lim X can be applied to this object in I to get an object in $\mathcal{C}$, and it is this object that people often refer to as the limit of X. We call it the limit set of X.

For example, if I = 2 then a functor $X:\underset{¯}{2}\to \mathcal{C}$ consists of two objects in $\mathcal{C}$, say X1 and X2. The left cone 2 is the span category, so the limit of X is a span, in particular it is the product span X1X1 × X2X2. But people often speak of the product as if it was just X1 × X2, the cone point of the span.

Exercise 6.1.3.23.

Let GrIn be the graph-indexing category (see (5.8)).

a. What is GrIn?

b. Let G : GrInSet be the graph from Example 4.3.1.2. Give an example of an object in Set/G.

Exercise 6.1.3.24.

Let $\mathcal{C}$ be a category, and let I = 0 be the empty category. There is a unique functor $X:\underset{¯}{0}\to \mathcal{C}$.

a. What is the slice category ${\mathcal{C}}_{/X}$?

b. What is a limit of X?

Solution 6.1.3.24.

a. The left cone of 0 is the terminal category 0 = 1, and since every diagram

commutes, we have an isomorphism $\text{Fun}\left(\underset{¯}{1},\mathcal{C}\right)\stackrel{\cong }{\to }{\mathcal{C}}_{/X}$. But by (??), we have an isomorphism $\mathcal{C}\stackrel{\cong }{\to }\text{Fun}\left(\underset{¯}{1},\mathcal{C}\right)$, so in fact ${\mathcal{C}}_{/X}\cong \mathcal{C}$.

b. A limit of X is defined to be a terminal object in ${\mathcal{C}}_{/X}$, which is a terminal object in $\mathcal{C}$, if it exists. In other words, terminal objects in a category give us a canonical example of limits. This was hinted at in Exercise 3.2.3.5.

Example 6.1.3.25. In the course of doing math, random-looking diagrams sometimes come up, for which one wants to take the limit. We have now constructed the limit for any shape diagram. For example, if we wanted to take the product of more than two, say, n, objects, we could use the diagram shape I = n. A functor X : nSet is n sets X1, X2, … , Xn, and their limit is a functor lim X : nSet,

which, of course, is the product, ${X}_{L{C}_{\underset{¯}{n}}}={X}_{1}×{X}_{2}×\cdots ×{X}_{n}$.

Example 6.1.3.26. We have now defined limits in any category, so we have defined limits in Cat. Let [1] denote the category depicted

$\stackrel{0}{•}\stackrel{e}{\to }\stackrel{1}{•}$

and let $\mathcal{C}$ be an arbitrary category. Naming two categories is the same thing as naming a functor X : 2Cat; consider the functor X(1) = [1], $X\left(2\right)=\mathcal{C}$. The limit of X is a product of categories (see Example 6.1.1.17); it is denoted $\left[1\right]×\mathcal{C}$. It turns out that $\left[1\right]×\mathcal{C}$ looks like a $\mathcal{C}$-shaped prism. It consists of two panes, front and back, say, each having the precise shape as $\mathcal{C}$ (same objects, same arrows, same composition) as well as morphisms from the front pane to the back pane making all front-to-back squares commute. For example, if $\mathcal{C}$ was the category generated by the left-hand schema , then $\mathcal{C}×\left[1\right]$ would be the category generated by the right-hand schema:

It turns out that a natural transformation α : FG between functors $F,G:\mathcal{C}\to \mathcal{D}$ is the same thing as a functor $\mathcal{C}×\left[1\right]\to \mathcal{D}$ such that the front pane is sent via F and the back pane is sent via G. The components are captured by the front-to-back morphisms, and the naturality is captured by the commutativity of the front-to-back squares in $\mathcal{C}×\left[1\right]$.

Exercise 6.1.3.27.

Recall that Section 3.4.6.5 described relative sets. In fact, Definition 3.4.6.6 basically defines a category of relative sets over any fixed set B. Let B : 1Set be the functor representing the object B ∈ Ob(Set).

a. What is the relationship between the slice category Set/B, as defined in Definition 6.1.3.20, and the category of relative sets over B?

b. What is the limit of the functor B : 1Set?

Theorem 6.1.3.28. Let I be a category and let F : ISet be a functor. Then its limit set limI F ∈ Ob(Set) exists and one can find its elements as follows. An element of the set limI F is given by choosing an element of xiF (i) for each object i ∈ Ob(I) such that, for each f : iione has F(f)(xi) = xi.

Proof. See [29].

Exercise 6.1.3.29.

Let I be the category given by the following schema:

Let X : ISet be given on objects by X(a) ≔ 2, X(b) ≔ 1, X(c) ≔ 3, X(d) = 2, and given (in sequence notation) on morphisms by X(f) = (1, 1), X(g) = (1, 1, 1), X(h) = (1, 2, 1). What is the limit limI X.

### 6.1.3.30   Definition of colimit

The definition of colimits is appropriately dual to the definition of limits. Instead of looking at left cones, we look at right cones; instead of being interested in terminal objects, we are interested in initial objects.

Definition 6.1.3.31. Let $\mathcal{C}$ be a category, let I be a category; let I be the right cone on I, and let i : II be the inclusion. Suppose that $X:I\to \mathcal{C}$ is an I-shaped diagram in $\mathcal{C}$. The coslice category of $\mathcal{C}$ over X, denoted ${\mathcal{C}}_{X/}$, is the category whose objects and morphisms are as follows:

$\begin{array}{lll}\hfill \text{Ob}\left({\mathcal{C}}_{X/}\right)& =& \left\{S:{I}^{⊳}\to \mathcal{C}|S○i=X\right\};\\ \hfill {\text{Hom}}_{{\mathcal{C}}_{X/}}\left(S,S\prime \right)& =& \left\{\alpha :S\to S\prime |\alpha \diamond i={\text{id}}_{X}\right\}.\end{array}$

A colimit of X, denoted colimI X or colim X, is an initial object in ${\mathcal{C}}_{X/}$.

Remark 6.1.3.32. Perhaps the following diagram will be helpful for understanding colimits. Given a functor $X:I\to \mathcal{C}$, what is its colimit? The solid-arrow part of the figure is the data we start with, i.e., the category $\mathcal{C}$, the indexing category I, and the diagram $X:I\to \mathcal{C}$, as well as the part we automatically add, the cone I with the inclusion $I\stackrel{i}{\to }{I}^{⊳}$. The category ${\mathcal{C}}_{X/}$ is found in the dotted arrow part: its objects are the dotted arrows $S:{I}^{⊳}\to \mathcal{C}$ that make the following triangle commute, and its morphisms are the natural transformations α : SS′ between them:

The colimit of X is the initial object in this category.

Pushouts The relevant indexing category for pushouts is the span, I = 2 drawn as on the left:

An I-shaped diagram in $\mathcal{C}$ is a functor $X:I\to \mathcal{C}$, which might be drawn as on the right (e.g., ${X}_{0}\in \text{Ob}\left(\mathcal{C}\right)$).

An object S in the coslice category ${\mathcal{C}}_{X/}$ is a commutative diagram $S:{I}^{⊳}\to \mathcal{C}$ over X, which looks like the left-hand box:

A morphism in ${\mathcal{C}}_{X/}$ is drawn as in right-hand box. An initial object in ${\mathcal{C}}_{X/}$ is precisely the gateway we want, i.e., the colimit of X is the pushout, ${X}_{1}{\bigsqcup }_{{X}_{0}}{X}_{2}$.

Exercise 6.1.3.33.

Let GrIn be the graph-indexing category (see (5.8)).

a. What is GrIn?

b. Let G : GrInSet be the graph from Example 4.3.1.2. Give an example of an object in SetG/.

Exercise 6.1.3.34.

Let $\mathcal{C}$ be a category, and let I = 0 be the empty category. There is a unique functor $X:\underset{¯}{0}\to \mathcal{C}$.

a. What is the coslice category ${\mathcal{C}}_{X/}$?

b. What is a colimit of X (assuming it exists)?

Solution 6.1.3.34.

a. The right cone of 0 is the terminal category 01, and since every diagram

commutes, we have an isomorphism $\text{Fun}\left(\underset{¯}{1},\mathcal{C}\right)\stackrel{\cong }{\to }{\mathcal{C}}_{X/}$. But by (??), we have an isomorphism $\mathcal{C}\stackrel{\cong }{\to }\text{Fun}\left(\underset{¯}{1},\mathcal{C}\right)$, so in fact $\mathcal{C}\cong {\mathcal{C}}_{X/}$.

b. A colimit of X is defined to be an initial object in ${\mathcal{C}}_{X/}$, which is an initial object in $\mathcal{C}$, if it exists. In other words, initial objects in a category give us a canonical example of colimits. This was hinted at in Exercise 3.3.3.4.

Theorem 6.1.3.35. Let I be a category and let F : ISet be a functor. Then its colimit set colimI F ∈ Ob(Set) exists and one can find its elements as follows. An element of the set colimI F is given by choosing any i ∈ Ob(I) and any element of xiF(i), and then considering two such elements equivalent if there exists f : iisuch that X(f)(xi) = xi.

Proof. See [29].

Exercise 6.1.3.36.

Let I be the category given by the following schema:

Let X : ISet be given on objects by X(a) ≔ 2, X(b) ≔ 2, X(c) ≔ 4, X(d) = 3, and given (in sequence notation) on morphisms by X(f) = (1, 2), X(g) = (1, 2, 1), X(h) = (1, 2, 4). What is the colimit colimI X.

Remark 6.1.3.37. Definition 6.1.3.31 defined what it means to be a colimit in any category; however, in any particular category, some colimits may not exist. It is like defining the quotient of any two natural numbers r, s ∈ ℕ by r ÷ s = q if and only if $q\ast s=r$. We have defined what it means to be a quotient, but that doesn’t mean the quotient of any two numbers exists, e.g. if r = 7 and s = 2.

The same goes for limits. A category $\mathcal{C}$ in which every diagram is guaranteed to have a limit is called complete. A category $\mathcal{C}$ in which every diagram is guaranteed to have a colimit is called cocomplete.

Example 6.1.3.38 (Cone as colimit). It turns out that Cat is cocomplete, meaning every diagram in $\mathcal{C}$ has a colimit. We give an example of a colimit in Cat.

Let $\mathcal{C}$ be a category, and recall from Example 6.1.3.26 the category $\mathcal{C}×\left[1\right]$. The inclusion of the front pane is a functor ${i}_{0}:\mathcal{C}\to \mathcal{C}×\left[1\right]$. (Similarly, the inclusion of the back pane is a functor ${i}_{1}:\mathcal{C}\to \mathcal{C}×\left[1\right]$.) Finally, let $t:\mathcal{C}\to \underset{¯}{1}$ be the unique functor to the terminal category (see Exercise 5.1.2.40). We now have a diagram in Cat of the form

The colimit (i.e., the pushout) of this diagram in Cat slurps down the entire front pane of $\mathcal{C}×\left[1\right]$ to a point, and the resulting category is isomorphic to ${\mathcal{C}}^{◅}$. The diagrams in (6.7) illustrate this phenomenon.

The category $\mathcal{C}$ is shown in the upper left-hand corner of (6.7). The left cone ${\mathcal{C}}^{◅}$ on $\mathcal{C}$ is obtained as a pushout in Cat. We first make a prism $\mathcal{C}×\left[1\right]$ and then identify the front pane with a point. (Similarly, the pushout of an analogous diagram for i1 would give ${\mathcal{C}}^{▻}$.)

Example 6.1.3.39. Consider the category Top of topological spaces. The (unfilled) circle is a topological space, which people often denote by S1 (for one-dimensional sphere). Topologically, it is equivalent to an oval, as shown in Figure 6.1. The filled-in circle, also called a two-dimensional disk, is denoted D2. The inclusion of the circle into the disk, as its boundary, is continuous, so we have a morphism in Top of the form i : S1D2. The terminal object in Top is the one-point space ●, so there is a unique morphism t : S1 → ●.

The pushout of the diagram ${D}^{2}\stackrel{i}{←}{S}^{1}\stackrel{t}{\to }•$ is isomorphic to the two-dimensional sphere (the exterior of a tennis ball), S2. The reason is that we have slurped the entire bounding circle of D2 to a point, which becomes, say, the south pole, and the interior area of D2 becomes the surface area of the sphere. Mathematically, the category of topological spaces has the right morphisms to ensure that this intuitive picture is correct.

Application 6.1.3.40. Consider the symmetric graph Gn consisting of a chain of n vertices,

Think of this as modeling a subway line. There are n-many graph homomorphisms G1Gn given by the various vertices. One can create transit maps using colimits. For example, the colimit of the left-hand diagram is the symmetric graph drawn at the right:

# 6.2   Other notions in Cat

This section discusses some additional notions about categories. Section 6.2.1 explains a kind of duality for categories, in which arrows are flipped. Reversing the order in a preorder is an example of this duality, as is the similarity between the definitions of limit and colimit. Section 6.2.2 discusses the Grothendieck construction, which in some sense makes a histogram for a set-valued functor, and shows that this idea is useful for transforming databases into the kind of format (RDF) used in scraping data off web pages. Some ways of creating new categories from old are explained in Sections 6.2.3 and 6.2.4. Finally, Section 6.2.5 shows that precisely the same arithmetic statements that held for sets (see Section 3.4.3) hold for categories.

## 6.2.1   Opposite categories

In the early days of category theory, and still today, people would sometimes discuss two different kinds of functors between categories: covariant functors and contravariant functors. Covariant functors are what this book calls functors. The reader may have come across the idea of contravariance when considering Exercise 5.2.3.2,9 which showed that a continuous mapping of topological spaces f : XY does not induce a morphism of orders on their open sets Open(X) → Open(Y); that is not required by the notion of continuity. Instead, a morphism of topological spaces f : XY induces a morphism of orders Open(Y) → Open(X), going backward. So we do not have a functor TopPrO in this way, but it is quite close. It used to be said that Open is a contravariant functor TopPrO.

As important and common as contravariance is, one finds that keeping track of which functors were covariant and which were contravariant is a big hassle. Luckily, there is a simple work-around, which simplifies everything: the notion of opposite categories.

Definition 6.2.1.1. Let $\mathcal{C}$ be a category. The opposite category of $\mathcal{C}$, denoted ${\mathcal{C}}^{\text{op}}$, has the same objects as $\mathcal{C}$, i.e., $\text{Ob}\left({\mathcal{C}}^{\text{op}}\right)=\text{Ob}\left(\mathcal{C}\right)$, and for any two objects c, c′, one defines

${\text{Hom}}_{{\mathcal{C}}^{\text{op}}}\left(c,c\prime \right)≔{\text{Hom}}_{\mathcal{C}}\left(c\prime ,c\right).$

Example 6.2.1.2. If n ∈ ℕ is a natural number and n the corresponding discrete category, then nop = n. Recall the span category I = 2 from Definition 6.1.1.8. Its opposite is the cospan category Iop = 2, from Definition 6.1.1.23.

Exercise 6.2.1.3.

Let $\mathcal{C}$ be the category from Example 6.1.3.18. Draw ${\mathcal{C}}^{\text{op}}$.

Proposition 6.2.1.4. Let $\mathcal{C}$ and $\mathcal{D}$ be categories. One has ${\left({\mathcal{C}}^{\text{op}}\right)}^{\text{op}}=\mathcal{C}$. Also one has a canonical isomorphism $\text{Fun}\left(\mathcal{C},\mathcal{D}\right)\cong \text{Fun}\left({\mathcal{C}}^{\text{op}},{\mathcal{D}}^{\text{op}}\right)$. This implies that a functor ${\mathcal{C}}^{\text{op}}\to \mathcal{D}$ can be identified with a functor $\mathcal{C}\to {\mathcal{D}}^{\text{op}}$.

Proof. This follows straightforwardly from the definitions.

Exercise 6.2.1.5.

If $\mathcal{C}$ is a category and $c\in \text{Ob}\left(\mathcal{C}\right)$ is an initial object, does this imply that c is a terminal object in ${\mathcal{C}}^{\text{op}}$?

Exercise 6.2.1.6.

In Exercises 5.2.3.2, 5.2.4.3, and 5.2.4.4 there were questions about whether a certain function $\text{Ob}\left(\mathcal{C}\right)\to \text{Ob}\left(\mathcal{D}\right)$ extended to a functor $\mathcal{C}\to \mathcal{D}$.

a. Does the function Open: Ob(Top) → Ob(PrO) extend to a functor Open: TopopPrO?

b. Does the function L : Ob(J) → Ob(Prop) extend to a functor L : JopProp?

c. Does the function R : Ob(J) → Ob(Set) extend to a functor R : JopSet?

Example 6.2.1.7 (Simplicial sets). Recall from Example 5.3.4.4 the category Δ of linear orders [n]. For example, [1] is the linear order 0 ⩽ 1, and [2] is the linear order 0 ⩽ 1 ⩽ 2. Both [1] and [2] are objects of Δ. There are 6 morphisms from [1] to [2], which could be denoted

${\text{Hom}}_{\Delta }\left(\left[1\right],\left[2\right]\right)=\left\{\left(0,0\right),\left(0,1\right),\left(0,2\right),\left(1,1\right),\left(1,2\right),\left(2,2\right)\right\}.$

The category Δop turns out to be quite useful in algebraic topology. It is the indexing category for a combinatorial approach to the homotopy theory of spaces. That is, we can represent something like the category of spaces and continuous maps using the functor category Fun(Δop, Set), which is called the category of simplicial sets.

This may seem very complicated compared to simplicial complexes (see Section 3.4.4.3). But simplicial sets have excellent formal properties that simplicial complexes do not. We do not go further with this here, but through the work of Dan Kan, André Joyal, Jacob Lurie, and many others, simplicial sets have allowed category theory to pierce deeply into the realm of topology, and vice versa.

## 6.2.2   Grothendieck construction

Let $\mathcal{C}$ be a database schema (or category), and let $J:\mathcal{C}\to Set$ be an instance. We have been drawing this in table form, but there is another standard way of laying out the data in J, called the resource descriptive framework, or RDF. Developed for the World Wide Web, RDF is a useful format when one does not have a schema in hand. For example, when scraping information off a website, one does not know which schema will be best. In these cases information is stored in RDF triples, which are of the form

$〈\text{Subject},\text{Predicate},\text{Object}〉.$

For example, one might see something like

This might be an RDF interpretation of the sentence “On January 14, 2013, Barack Obama told congress to raise the debt ceiling.”

Category-theoretically, it is quite simple to convert a database instance $J:\mathcal{C}\to Set$ into an RDF triple store. To do so, we use the Grothendieck construction, also known as the category of elements.

Definition 6.2.2.1. Let $\mathcal{C}$ be a category, and let $J:\mathcal{C}\to Set$ be a functor. The category of elements of J, denoted ${\int }_{\mathcal{C}}J$, is defined as follows:

There is a natural functor ${\pi }_{J}:{\int }_{\mathcal{C}}J\to \mathcal{C}$. It sends each object $\left(C,x\right)\in \text{Ob}\left({\int }_{\mathcal{C}}J\right)$ to the object $C\in \text{Ob}\left(\mathcal{C}\right)$. And it sends each morphism f : (C, x) → (C′, x′) to the morphism f : CC′. We call πJ the projection functor.

Example 6.2.2.2. Let A be a set, and consider it as a discrete category. We saw in Exercise 5.3.3.4 that a functor S : ASet is the same thing as an A-indexed set, as discussed in Section 3.4.6.9. We follow Definition 3.4.6.11 and, for each aA, write SaS(a).

What is the category of elements of a functor S : ASet? The objects of ∫A S are pairs (a, s), where aA and sS(a). Since A has nothing but identity morphisms, ∫A S has nothing but identity morphisms, i.e., it is the discrete category on a set. In fact, that set is the disjoint union

$\underset{A}{\int }S=\coprod _{a\in A}{S}_{a}.$

The functor πS: ∫A SA sends each element in Sa to the element aA.

One can see this as a kind of histogram. For example, let A = {BOS, NYC, LA, DC}, and let S : ASet assign

$\begin{array}{ccc}\hfill {S}_{\text{BOS}}& =& \left\{\text{Abby, Bob, Casandra}\right\},\hfill \\ \hfill {S}_{\text{NYC}}& =& \varnothing ,\hfill \\ \hfill {S}_{\text{LA}}& =& \left\{\text{John, Jim}\right\},\hfill \\ \hfill {S}_{\text{DC}}& =& \left\{\text{Abby, Carla}\right\}.\hfill \end{array}$

Then the category of elements of S would look like the (discrete) category at the top:

We also see that the category of elements construction has converted an A-indexed set into a relative set over A, as in Definition 3.4.6.6.

The preceding example does not show how the Grothendieck construction transforms a database instance into an RDF triple store. The reason is that the database schema was A, a discrete category that specifies no connections between data (it simply collects the data into bins). So let’s examine a more interesting database schema and instance. This is taken from Spivak [39].

Application 6.2.2.3. Consider the following schema, first encountered in Example 4.5.2.1:

And consider the instance $J:\mathcal{C}\to \mathbf{\text{Set}}$, which we first encountered in (4.12) and (4.14):

The category of elements of $J:\mathcal{C}\to \mathbf{\text{Set}}$ looks like this:

In Diagram (6.11) of ${\int }_{\mathcal{C}}J$, ten arrows were omitted for ease of readability, for example, arrow was omitted.

How do we see the category of elements ${\int }_{\mathcal{C}}J$ as an RDF triple store? For each arrow in ${\int }_{\mathcal{C}}J$, we take the triple consisting of the source vertex, the arrow name, and the target vertex. So the triple store would include triples such as 〈101 worksIn q10〉 and 〈q10 name Production〉. Note that if $\mathcal{C}$ were an olog, we could read off these triples (and concatenations of them) as English sentences. For example, the preceding two triples could be Englished as follows:

Employee 101 works in Department q10, which has as name Production.

Exercise 6.2.2.4.

Devise a schema $\mathcal{C}$ for which you can imagine an instance $I:\mathcal{C}\to \mathbf{\text{Set}}$ such that the category of elements ∫(I) is the triple store in (6.8).

Slogan 6.2.2.5.

The Grothendieck construction takes structured, tabulated data and flattens it by throwing it all into one big space. The projection functor is then tasked with remembering which box each datum originally came from.

Exercise 6.2.2.6.

Recall from Section 4.1.2.10 that a finite state machine is a free monoid (List(Σ), [ ], ++) acting on a set X. Recall also that we can consider a monoid as a category $\mathcal{M}$ with one object, and we can consider a monoid action as a set-valued functor F: $\mathcal{M}$Set (see Section 5.2.1.1). In the case of Figure 4.2 the monoid is List(a, b), which can be drawn as the schema

and the functor $F:\mathcal{M}\to \mathbf{\text{Set}}$ is recorded in an action table in Example 4.1.3.1. What is ${\int }_{\mathcal{M}}F$? How does it relate to Figure 4.2?

## 6.2.3   Full subcategory

Definition 6.2.3.1. Let $\mathcal{C}$ be a category, and let $X\subseteq \text{Ob}\left(\mathcal{C}\right)$ be a set of objects in $\mathcal{C}$. The full subcategory of $\mathcal{C}$ spanned by X is the category, denoted ${\mathcal{C}}_{\text{Ob}=X}$, with objects $\text{Ob}\left({\mathcal{C}}_{\text{Ob}=X}\right)≔X$ and with morphisms ${\text{HOM}}_{{\mathcal{C}}_{\text{Ob}=X}}\left(x,x\prime \right)≔{\text{HOM}}_{\mathcal{C}}\left(x,x\prime \right)$.

Example 6.2.3.2. The following are examples of full subcategories. For example, the category Fin of finite sets is the full subcategory of Set spanned by the finite sets.

• If X = {s ∈ Ob(Set) | s is finite}, then Fin = SetOb=X.
• If X = {P ∈ Ob(PrO) | P is a finite linear order)}, then FLin = PrOOb=X.
• If X = {[n] ∈ FLin | n ∈ ℕ} (see Example 5.3.4.4), then Δ = FLinOb=X.
• If X = {M ∈ Ob(Mon) | M is a group}, then Grp = MonOb=X.
• If , then Mon = CatOb=X.
• If X = {n ∈ Ob(Fin) | n ∈ ℕ}, then there is an equivalence of categories FinFinOb=X.
• If X = {(V, A, src, tgt) ∈ Ob(Grph) | A = ∅}, then SetGrphOb=X.
• If , then SetCatOb=X.

Remark 6.2.3.3. A subcategory $\mathcal{C}\subseteq \mathcal{D}$ is (up to isomorphism) just a functor $i:\mathcal{C}\to \mathcal{D}$ that happens to be injective on objects and arrows. The subcategory is full if and only if i is a full functor in the sense of Definition 5.3.4.8.

Example 6.2.3.4. Let $\mathcal{C}$ be a category, let $X\subseteq \text{Ob}\left(\mathcal{C}\right)$ be a set of objects, and let ${\mathcal{C}}_{\text{Ob}=X}$ denote the full subcategory of $\mathcal{C}$ spanned by X. We can realize this as a fiber product of categories. Indeed, recall that for any set, we can form the indiscrete category on that set (see Example 5.3.4.3). In fact, we have a functor Ind: SetCat. Thus the function $X\to \text{Ob}\left(\mathcal{C}\right)$ can be converted into a functor between indiscrete categories $\mathit{\text{Ind}}\left(X\right)\to \mathit{\text{Ind}}\left(\text{Ob}\left(\mathcal{C}\right)\right)$. There is also a unique functor $\mathcal{C}\to \mathit{\text{Ind}}\left(\text{Ob}\left(\mathcal{C}\right)\right)$ sending each object to itself. Then the full subcategory of $\mathcal{C}$ spanned by X is the fiber product of categories,

Exercise 6.2.3.5.

Recall the sets 0, 1, 2 ∈ Ob(Set) from Notation 2.1.2.21. Including all identities and all compositions, how many morphisms are there in the full subcategory SetOb={0,1,2}?

## 6.2.4   Comma categories

Category theory includes a highly developed and interoperable catalogue of materials (categories such as [n], GrIn, PrO, etc.) and production techniques for making new categories from old. One such was the full subcategory idea in the previous section—given any category and any subset of objects, one can form a new category to restrict attention to the subset. Another is the comma category construction.

Definition 6.2.4.1. Let $\mathcal{A}\stackrel{F}{\to }\mathcal{C}\stackrel{G}{←}\mathcal{B}$ be a cospan of categories. The comma category of $\mathcal{C}$ morphisms from F to G, denoted $\left(F{↓}_{\mathcal{C}}G\right)$ or simply (FG), is the category with objects

and for any two objects (a, b, f) and (a′, b′, f′) the set Hom(FG) ((a, b, f), (a′, b′, f′)) of morphisms (a, b, f) → (a′, b′, f′) is

In diagram form,

There is a canonical functor $\left(F↓G\right)\to \mathcal{A}$, called left projecton, sending (a, b, f) to a, and a canonical functor $\left(F↓G\right)\to \mathcal{B}$, called right projection, sending (a, b, f) to b.

A cospan $\mathcal{A}\stackrel{F}{\to }\mathcal{C}\stackrel{G}{←}\mathcal{B}$ is reversible, i.e., we can flip it to obtain $\mathcal{B}\stackrel{G}{\to }\mathcal{C}\stackrel{F}{←}\mathcal{A}$. However, note that (FG) is different than (i.e., almost never equivalent to) (GF).

Slogan 6.2.4.2.

When two categories $\mathcal{A}$, ℬ can be interpreted in a common setting $\mathcal{C}$, the comma category integrates them by recording how to move from $\mathcal{A}$ to $\mathcal{B}$ inside $\mathcal{C}$.

Example 6.2.4.3. Let $\mathcal{C}$ be a category and $I:\mathcal{C}\to \mathbf{\text{Set}}$ a functor. This example shows that the comma category construction captures the notion of taking the category of elements ${\int }_{\mathcal{C}}I$ (see Definition 6.2.2.1).

Consider the set 1, the category Disc(1), and the functor F : Disc(1) → Set sending the unique object to the set 1. We use the cospan $\mathit{\text{Disc}}\left(\underset{¯}{1}\right)\stackrel{F}{\to }\mathbf{\text{Set}}\stackrel{I}{←}\mathcal{C}$. There is an isomorphism of categories

${\int }_{\mathcal{C}}I\cong \left(F↓I\right).$

Indeed, an object in (FI) is a triple (a, b, f), where a ∈ Ob(Disc(1)), $b\in \text{Ob}\left(\mathcal{C}\right)$, and f : F(a) → I(b) is a morphism in Set. There is only one object in Disc(1), so this reduces to a pair (b, f), where $b\in \text{Ob}\left(\mathcal{C}\right)$ and f : {☺} → I(b). The set of functions {☺} → I(b) is isomorphic to I(b) (see Exercise 2.1.2.20). So we have reduced Ob(FI) to the set of pairs (b, x), where $b\in \text{Ob}\left(\mathcal{C}\right)$ and xI(b); this is $\text{Ob}\left({\int }_{\mathcal{C}}I\right)$. Because there is only one function 11, a morphism (b, x) → (b′, x′) in (FI) boils down to a morphism r : bb′ such that the diagram

commutes. But such diagrams are in one-to-one correspondence with the diagrams defining morphisms in ${\int }_{\mathcal{C}}I$.

Exercise 6.2.4.4.

Let $\mathcal{C}$ be a category, and let $c,c\prime \in \text{Ob}\left(\mathcal{C}\right)$ be objects represented by the functors $c,c\prime :\underset{¯}{1}\to \mathcal{C}$. Consider the cospan $\underset{¯}{1}\stackrel{c}{\to }\mathcal{C}\stackrel{c\prime }{←}\underset{¯}{1}$. What is the comma category (cc′)?

Exercise 6.2.4.5.

Let $\mathcal{C}$ and $\mathcal{D}$ be categories, and let $!:\mathcal{C}\to \underset{¯}{1}$ and $!:\mathcal{D}\to \underset{¯}{!}$ be the unique functors to the terminal category. What is the comma category for $\mathcal{C}\stackrel{!}{\to }\underset{¯}{1}\stackrel{!}{←}\mathcal{D}$?

Exercise 6.2.4.6.

Let $\mathcal{C}$ be a category.

a. If $c\in \mathcal{C}$ is an initial object, what is the comma category for the cospan $\underset{¯}{1}\stackrel{c}{\to }\mathcal{C}\stackrel{{\text{id}}_{\mathcal{C}}}{←}\mathcal{C}$?

b. If $d\in \mathcal{C}$ is a terminal object, what is the comma category for the cospan $\mathcal{C}\stackrel{{\text{id}}_{\mathcal{C}}}{\to }\mathcal{C}\stackrel{d}{←}\mathcal{C}$?

## 6.2.5   Arithmetic of categories

Section 3.4.3 summarized some of the properties of products, coproducts, and exponentials for sets, showing that they lined up precisely with familiar arithmetic properties of natural numbers. We can do the same for categories.

In the following proposition, we denote the coproduct of two categories $\mathcal{A}$ and $\mathcal{B}$ by the notation $\mathcal{A}+\mathcal{B}$ rather than $\mathcal{A}\bigsqcup \mathcal{B}$. We also denote the functor category $\text{Fun}\left(\mathcal{A},\mathcal{B}\right)$ by ${\mathcal{B}}^{\mathcal{A}}$. Finally, we use 0 and 1 to refer to the discrete category on 0 objects and on 1 object respectively.

Proposition 6.2.5.1. The following isomorphisms exist for any small categories .

• $\mathcal{A}+\underset{¯}{0}\cong \mathcal{A}$.
• $\mathcal{A}+\mathcal{B}\cong \mathcal{B}+\mathcal{A}$.
• $\left(\mathcal{A}+\mathcal{B}\right)+\mathcal{C}\cong \mathcal{A}+\left(\mathcal{B}+\mathcal{C}\right)$.
• $\mathcal{A}×\underset{¯}{0}\cong \underset{¯}{0}$.
• $\mathcal{A}×\underset{¯}{1}\cong \mathcal{A}$.
• $\mathcal{A}×\mathcal{B}\cong \mathcal{B}×\mathcal{A}$.
• $\left(\mathcal{A}×\mathcal{B}\right)×\mathcal{C}\cong \mathcal{A}×\left(\mathcal{B}×\mathcal{C}\right)$.
• $\mathcal{A}×\left(\mathcal{B}+\mathcal{C}\right)\cong \left(\mathcal{A}×\mathcal{B}\right)+\left(\mathcal{A}×\mathcal{C}\right)$.
• ${\mathcal{A}}^{\underset{¯}{0}}\cong \underset{¯}{1}$.
• ${\mathcal{A}}^{\underset{¯}{1}}\cong \mathcal{A}$.
• .
• ${\underset{¯}{1}}^{\mathcal{A}}\cong \underset{¯}{1}$.
• ${\mathcal{A}}^{\mathcal{B}+\mathcal{C}}\cong {\mathcal{A}}^{\mathcal{B}}×{\mathcal{A}}^{\mathcal{C}}$.
• ${\left({\mathcal{A}}^{\mathcal{B}}\right)}^{\mathcal{C}}\cong {\mathcal{A}}^{\mathcal{B}×\mathcal{C}}$.
• ${\left(\mathcal{A}×\mathcal{B}\right)}^{\mathcal{C}}\cong {\mathcal{A}}^{\mathcal{C}}×{\mathcal{B}}^{\mathcal{C}}$.

Proof. These are standard results; see Mac Lane [29].

__________________

1Given R1X1 × X1, R2X2 × X2, take R1 × R2 ⊆ (X1 × X2) × (X1 × X2).

2The result is not necessarily inspiring, but at least computing it is straightforward.

3The names X × Y and π1, π2 are not mathematically important; they are pedagogically useful.

4Note that (0, 0) is not related to anything else.

5Given R1X1 × X1, R2X2 × X2, take

$\begin{array}{ll}{R}_{1}\bigsqcup {R}_{2}\hfill & \subseteq \left({X}_{1}×{X}_{1}\right)\bigsqcup \left({X}_{2}×{X}_{2}\right)\hfill \\ \hfill & \subseteq \left({X}_{1}×{X}_{1}\right)\bigsqcup \left({X}_{2}×{X}_{2}\right)\bigsqcup \left({X}_{2}×{X}_{1}\right)\bigsqcup \left({X}_{2}×{X}_{2}\right)\hfill \\ \hfill & \cong \left({X}_{1}\bigsqcup {X}_{1}\right)×\left({X}_{1}\bigsqcup {X}_{2}\right).\hfill \end{array}$

6The names XY and ı1, ı2 are not mathematically important; they are pedagogically useful.

7The indexing category I is usually assumed to be small in the sense of Remark 5.1.1.2, meaning that its collection of objects is a set.

8What is here denoted F (G) might be called the noncommutative square indexing category.

9Similarly, see Exercise 5.2.4.4.