# Category Theory/Categories

This is the Categories chapter of Category Theory.

## DefinitionEdit

A category ${\displaystyle {\mathcal {C}}}$  consists of four kinds of data subject to three axioms, as listed below:

### DataEdit

Objects
${\displaystyle {\mathcal {C}}}$  has objects denoted by ${\displaystyle A}$ , ${\displaystyle B}$ , ${\displaystyle C}$ ,…
Morphisms
For each ordered pair of objects ${\displaystyle A}$ , ${\displaystyle B}$  in ${\displaystyle {\mathcal {C}}}$ , there is a class of morphisms or arrows from ${\displaystyle A}$  to ${\displaystyle B}$ . The notation ${\displaystyle f:A\to B}$  means that ${\displaystyle f}$  is a morphism from ${\displaystyle A}$  to ${\displaystyle B}$ . The class of all morphisms from ${\displaystyle A}$  to ${\displaystyle B}$  is denoted by ${\displaystyle {\text{Hom}}_{\mathcal {C}}(A,B)}$  or sometimes simply ${\displaystyle {\mathcal {C}}(A,B)}$ .
Composition
For each ordered triple of objects ${\displaystyle A}$ , ${\displaystyle B}$ , ${\displaystyle C}$  in ${\displaystyle {\mathcal {C}}}$ , there is a law of composition: If ${\displaystyle f:A\to B}$  and ${\displaystyle g:B\to C}$ , then the composite of ${\displaystyle f}$  and ${\displaystyle g}$  is a morphism ${\displaystyle gf:A\to C}$
Identity
For each object ${\displaystyle A}$  there is a designated identity morphism on ${\displaystyle A}$ , notated as ${\displaystyle 1_{A}}$ , from ${\displaystyle A}$  to ${\displaystyle A}$ .

### AxiomsEdit

These data satisfy the following three axioms, of which the first is in the nature of a convention, while the remaining two are more substantial:

Unique typing
${\displaystyle {\text{Hom}}(A_{1},B_{1})}$  and ${\displaystyle {\text{Hom}}(A_{2},B_{2})}$  are disjoint unless ${\displaystyle A_{1}=A_{2}}$ , ${\displaystyle B_{1}=B_{2}}$ .
Associative Law
${\displaystyle h(gf)=(hg)f}$  if the composites are defined. Note that if one composite is defined, the other is necessarily defined.
Identity is a “neutral element”
For the identity morphism ${\displaystyle 1_{B}:B\to B}$  associated to each object ${\displaystyle B}$ , two equations must hold for each pair of objects ${\displaystyle A}$  and ${\displaystyle C}$  and each pair of arrows ${\displaystyle f:A\to B}$ , ${\displaystyle g:B\to C}$ :
• ${\displaystyle 1_{B}\,f=f}$
• ${\displaystyle g\,1_{B}=g}$

### Terminology and fine pointsEdit

• If ${\displaystyle f:A\to B}$  in a category, ${\displaystyle A}$  is called the domain or source of ${\displaystyle f}$ , and ${\displaystyle B}$  is called the codomain or target of ${\displaystyle f}$ .
• ${\displaystyle {\text{Hom}}(A,B)}$  is called a hom class or a hom set if it is indeed a set. In general a hom set may be empty, but for any object ${\displaystyle A}$ , ${\displaystyle {\text{Hom}}(A,A)}$  is not empty because it contains the identity morphism.
• The hom class ${\displaystyle {\text{Hom}}(A,B)}$  may be denoted by ${\displaystyle {\text{Hom}}_{\mathcal {C}}(A,B)}$  or ${\displaystyle {\mathcal {C}}(A,B)}$  if it is necessary to specify which category is referred to.
• An object in a category need not be a set; the object need not have anything called elements.
• Morphisms may also be called maps. This does not mean that every morphism in any category is a set function (see #Baby examples and #Preorders). Arrow is a less misleading name.
• The composite ${\displaystyle gf}$  may be written ${\displaystyle g\circ f}$ .
• It might be more natural to write the composite of ${\displaystyle f:A\to B}$  and ${\displaystyle g:B\to C}$  as ${\displaystyle fg}$  instead of ${\displaystyle gf}$  but the usage given here is by far the most common. This stems from the fact that if the arrows are set functions and ${\displaystyle x\in A}$ , then ${\displaystyle (gf)(x)=g(f(x))}$ . Thus ${\displaystyle gf}$  is best read as "do ${\displaystyle g}$  after ${\displaystyle f}$ ".

### Large and smallEdit

The definition says that a category 'has' objects and 'has' morphisms. This means that for any category ${\displaystyle {\mathcal {C}}}$  and ${\displaystyle X}$  is any mathematical object, the statement '${\displaystyle X}$  is an object of ${\displaystyle {\mathcal {C}}}$ ' is either true or false, and similarly for the statement '${\displaystyle X}$  is a morphism of ${\displaystyle {\mathcal {C}}}$ '. The objects (or arrows) of a category need not constitute a set. If they do, the category is said to be small. If they don't, the category is large.

The requirement that the collection of morphisms from ${\displaystyle A}$  to ${\displaystyle B}$  be a set makes a category locally small. In this book, all categories are locally small.

### DiscreteEdit

A category is discrete if every morphism is an identity.

### PreorderEdit

A category ${\displaystyle {\mathcal {P}}}$  is a preorder if for every pair of objects ${\displaystyle P,P'}$ , there exists at most one morphism ${\displaystyle f:P\to P'}$ .

## Examples of categoriesEdit

### Baby examplesEdit

These examples are trivial and maybe uninteresting. But do not underestimate the power of baby examples. For one thing, they are sometimes counterexamples to possible theorems.

0 (the empty category)
This category has no objects and no morphisms.
1
The category 1 has one object and one morphism, which must necessarily be the object's identity arrow.
1+1
This category has two objects and two morphisms: the identities on each object.
2
This category has two objects and three morphisms. The third morphism goes from one object to the other.
Remarks
• The objects of these baby categories are nodes in a graph (not sets) and the morphisms are arrows in the graph (not functions).
• For these baby categories we don't have to say what the composition operation does: it is always forced.
• It is impolite to say that categorists think that 1 + 1 is not equal to 2.

### The category of setsEdit

The category of sets, denoted by Set, is this category:

• The objects are all sets
• A morphism from a set ${\displaystyle A}$  to a set ${\displaystyle B}$  is a function with domain ${\displaystyle A}$  and codomain ${\displaystyle B}$ .
• The composition is the usual composition: If ${\displaystyle f:A\to B}$  and ${\displaystyle g:B\to C}$  then ${\displaystyle gf:A\to C}$  is defined by ${\displaystyle gf(x)=g(f(x))}$  for all ${\displaystyle x\in A}$ .
• The identity morphism ${\displaystyle 1_{A}}$  on a set ${\displaystyle A}$  is the identity function defined by ${\displaystyle 1_{A}(x)=x}$  for ${\displaystyle x\in A}$ .
Terminology and fine points
• In order to preserve the unique typing in a function definition, it is necessary to include its codomain. For example, ${\displaystyle 1_{A}:A\to A}$  is a different function from the inclusion function ${\displaystyle i:A\to B}$  to some set ${\displaystyle B}$  properly including ${\displaystyle A}$ .
• In most approaches to the foundations of math, the collection of all sets is not a set. This makes Set a large category. However, it is still locally small since the class of all functions between two sets, ${\displaystyle A}$  and ${\displaystyle B}$ , is a subclass of their Cartesian product ${\displaystyle A\times B}$  which is a set.

### Mathematical structures as categoriesEdit

#### PreordersEdit

A preorder ${\displaystyle \preccurlyeq }$  on a set ${\displaystyle A}$  is a reflexive and transitive relation on ${\displaystyle A}$ , which means that for all ${\displaystyle a\in A}$ , ${\displaystyle a\preccurlyeq a}$  and for all ${\displaystyle a}$ , ${\displaystyle b}$ , ${\displaystyle c}$  in ${\displaystyle A}$ , if ${\displaystyle a\preccurlyeq b}$  and ${\displaystyle b\preccurlyeq c}$ , then ${\displaystyle a\preccurlyeq c}$ .

A preorder "is" a category in the following sense: Given a preorder (${\displaystyle A}$ , ${\displaystyle \preccurlyeq }$ ) the category structure is this:

• The objects of the category are the elements of ${\displaystyle A}$ .
• There is exactly one morphism from ${\displaystyle a}$  to ${\displaystyle b}$  if and only if ${\displaystyle a\preccurlyeq b}$ .

The existence of identities is forced by reflexivity and the composition law is forced by transitivity. It follows that the category structure has the property that there is at most one morphism from any object ${\displaystyle a}$  to any object ${\displaystyle b}$ .

Conversely, suppose you have a category with set ${\displaystyle A}$  of objects, with the property that there is at most one morphism between any two objects. Define a relation ${\displaystyle \preccurlyeq }$  on ${\displaystyle A}$  by requiring that ${\displaystyle a\preccurlyeq b}$  if and only if there is a morphism from ${\displaystyle a}$  to ${\displaystyle b}$ . Then (${\displaystyle A}$ , ${\displaystyle \preccurlyeq }$ ) is a preorder.

The statements in the two preceding paragraphs describe an equivalence of categories between the category of small categories with at most one morphism between any two objects and all functors between such categories, and the category of preorders and order-preserving maps.

Remark: Given a preorder, the morphisms of the corresponding category exist by definition. There is exactly one morphism from ${\displaystyle a}$  to ${\displaystyle b}$  if and only if ${\displaystyle a\preccurlyeq b}$ . This is an axiomatic definition; in a model a morphism from ${\displaystyle a}$  to ${\displaystyle b}$  could be anything, for example the pair (${\displaystyle a}$ , ${\displaystyle b}$ ). In no sense is the morphism required to be a function.

#### GroupsEdit

Every group ${\displaystyle G}$  can be viewed as a category ${\displaystyle {\mathcal {G}}}$  as follows: ${\displaystyle {\mathcal {G}}}$  has one single object; call it ${\displaystyle e}$ . Therefore it has only one homset ${\displaystyle {\text{Hom}}_{\mathcal {G}}(e,e)}$ , which is defined to be the underlying set of the group ${\displaystyle G}$  (in other words, the arrows are the group elements.) We take as composition the group multiplication. It follows that the identity element of ${\displaystyle G}$  is ${\displaystyle 1_{e}}$ . Notice that in the category ${\displaystyle {\mathcal {G}}}$ , every morphism is an isomorphism (invertible under composition). Conversely, any one-object category in which all arrows are isomorphisms can be viewed as a group; the elements of the group are the arrows and the multiplication is the composition of the category. This describes an equivalence between the category of groups and homomorphisms and the category of small categories with a single object in which every morphism is an isomorphism.

This can be generalized in two ways.

A category ${\displaystyle {\mathcal {G}}}$  is called a groupoid if every morphism is an isomorphism. Thus a groupoid can be called "a group with many objects."

A monoid is a set with an associative binary operation that has an identity element. By the same technique as for groups, any monoid "is" a category with exactly one object and any category with exactly one object "is" a monoid.

#### MatricesEdit

This is a good example of a category whose objects are not sets and whose arrows are not functions. ${\displaystyle \mathbf {Matr} _{K}}$  is the category whose objects are the positive integers and whose arrows ${\displaystyle A:n\to m}$  are ${\displaystyle m\times n}$  matrices where composition is matrix multiplication, for any commutative ring ${\displaystyle K}$ . For any object ${\displaystyle n}$ , ${\displaystyle 1_{n}=I_{n}}$ , the ${\displaystyle n\times n}$  identity matrix.

### Categories of sets with structureEdit

finite sets and functions; denoted FinSet.
monoids and morphisms; denoted Mon.
groups and homomorphisms; denoted Grp.
abelian groups and homomorphisms; denoted Ab.
rings and unit-preserving homomorphisms; denoted Rng.
commutative rings and unit-preserving homomorphisms; denoted CRng.
left modules over a ring ${\displaystyle R}$  and linear maps; denoted ${\displaystyle R}$ -Mod.
right modules over a ring ${\displaystyle R}$  and linear maps; denoted Mod-${\displaystyle R}$ .
modules over a commutative ring ${\displaystyle K}$  and linear maps; denoted ${\displaystyle K}$ -Mod.
subsets of Euclidean space of 3 dimensions and Euclidean movements
subsets of Euclidean space of n dimensions and continuous functions
topological spaces and continuous functions; denoted Top.
topological spaces and homotopy classes of functions; denoted Toph.
Remarks

The law of composition is not specified explicitly in describing these categories. This is the custom when the objects have underlying set-structure, the morphisms are functions of the underlying sets (transporting the additional structure), and the law of composition is merely ordinary function-composition. Indeed, sometimes even the specification of the morphisms is suppressed if no confusion would arise—thus one speaks of the category of groups.

The examples of sets with structure suggest a conceptual framework. For example, the concept of group may be regarded as constituting a first-order abstraction or generalization from various concrete, familiar realizations such as the additive group of integers, the multiplicative group of nonzero rationals, groups of permutations, symmetry groups, groups of Euclidean motions, and so on. Then, again, the notion of a category constitutes a second-order abstraction, the concrete realizations of which consist of such first-order abstractions as the category of groups, the category of rings, the category of topological spaces, and so on.

## Properties of objects and morphismsEdit

### IsomorphismsEdit

A morphism ${\displaystyle f:A\to B}$  in a category is said to be an isomorphism if there is a morphism ${\displaystyle g:B\to A}$  in the category with ${\displaystyle gf=1_{A}}$ , ${\displaystyle fg=1_{B}}$ . It is easy to prove that ${\displaystyle g}$  is then uniquely determined by ${\displaystyle f}$ . The morphism ${\displaystyle g}$  is called the inverse of f, written ${\displaystyle g=f^{-1}}$ . It follows that ${\displaystyle f=g^{-1}}$ . If there is an isomorphism from ${\displaystyle A}$  to ${\displaystyle B}$ , we say ${\displaystyle A}$  is isomorphic to ${\displaystyle B}$ , and it is easy to prove that "isomorphism" is an equivalence relation on the objects of the category.

#### ExamplesEdit

• A function from ${\displaystyle A}$  to ${\displaystyle B}$  in the category of sets is an isomorphism if and only if it is bijective.
• A homomorphism of groups is an isomorphism if and only if it is bijective.
• The isomorphisms of the category of topological spaces and continuous maps are the homeomorphisms. In contrast to the preceding example, a bijective continuous map from one topological space to another need not be a homeomorphism because its inverse (as a set function) may not be continuous. An example is the identity map on the set of real numbers, with the domain having the discrete topology and the codomain having the usual topology.

### Monomorphisms and EpimorphismsEdit

A morphism ${\displaystyle f}$  in a category ${\displaystyle {\mathcal {C}}}$  is a monomorphism if, for any morphisms ${\displaystyle g}$  and ${\displaystyle h}$ , if ${\displaystyle fg}$  and ${\displaystyle fh}$  are defined and ${\displaystyle fg=fh}$  then ${\displaystyle g=h}$ .

A morphism ${\displaystyle f}$  in a category ${\displaystyle {\mathcal {C}}}$  is an epimorphism if, for any morphisms ${\displaystyle g}$  and ${\displaystyle h}$ , if ${\displaystyle gf}$  and ${\displaystyle hf}$  are defined and ${\displaystyle gf=hf}$  then ${\displaystyle g=h}$ .

### Initial and terminal objectsEdit

${\displaystyle T}$  is said to be a terminal (or final) object when ${\displaystyle X\to T}$  is a unique morphism for any ${\displaystyle X}$  in ${\displaystyle {\mathcal {C}}}$ . The law of composition ensures that if ${\displaystyle T}$  and ${\displaystyle T'}$  are terminal objects in ${\displaystyle {\mathcal {C}}}$ , they are isomorphic, i.e., ${\displaystyle T(')}$  is unique up to isomorphism. In the categories of sets, groups, and topological spaces, the terminal objects are singletons, trivial groups, and one-point spaces, respectively. "b" is the terminal object in 2 as depicted above.

## Constructions on categoriesEdit

### SubcategoriesEdit

A subcategory ${\displaystyle {\mathcal {S}}}$  of a category ${\displaystyle {\mathcal {C}}}$  is a category in which:

• The class of objects of ${\displaystyle {\mathcal {S}}}$  is contained in the class of objects of ${\displaystyle {\mathcal {C}}}$ .
• The class of arrows of ${\displaystyle {\mathcal {S}}}$  is contained in the class of arrows of ${\displaystyle {\mathcal {C}}}$ .
• For every arrow ${\displaystyle f}$  in ${\displaystyle {\mathcal {S}}}$ , the domain and codomain of ${\displaystyle f}$  are in ${\displaystyle {\mathcal {S}}}$ .
• For every object ${\displaystyle s}$  in ${\displaystyle {\mathcal {S}}}$ , the identity arrow ${\displaystyle 1_{s}}$  is in ${\displaystyle {\mathcal {S}}}$ .
• For every pair of arrows ${\displaystyle f,g}$  in ${\displaystyle {\mathcal {S}}}$ , the arrow ${\displaystyle g\circ f}$  is in ${\displaystyle {\mathcal {S}}}$  where it is defined.

### Opposite categoryEdit

Given a category ${\displaystyle {\mathcal {C}}}$ , the opposite (or dual) category ${\displaystyle {\mathcal {C}}^{\text{op}}}$  has the same objects as ${\displaystyle {\mathcal {C}}}$  and for every arrow ${\displaystyle f:a\to b}$  in ${\displaystyle {\mathcal {C}}}$ , the arrow ${\displaystyle f^{\text{op}}:b\to a}$  is in ${\displaystyle {\mathcal {C}}^{\text{op}}}$ . In other words, it has the same objects, and arrows are reversed.

### The product of two categoriesEdit

Given two categories ${\displaystyle {\mathcal {B}}}$  and ${\displaystyle {\mathcal {C}}}$ , the product category, denoted ${\displaystyle {\mathcal {B}}\times {\mathcal {C}}}$ , is given by the following data:

• The objects of ${\displaystyle {\mathcal {B}}\times {\mathcal {C}}}$  are ${\displaystyle (b,c)}$  where ${\displaystyle b}$  is an object of ${\displaystyle {\mathcal {B}}}$  and ${\displaystyle c}$  is an object of ${\displaystyle {\mathcal {C}}}$ .
• The arrows of ${\displaystyle {\mathcal {B}}\times {\mathcal {C}}}$  are ${\displaystyle (f,g)}$  where ${\displaystyle f}$  is an arrow of ${\displaystyle {\mathcal {B}}}$  and ${\displaystyle g}$  is an arrow of ${\displaystyle {\mathcal {C}}}$ .
• Composition is given by ${\displaystyle (f',g')\circ (f,g)=(f'\circ f,g'\circ g)}$ .
• The product ${\displaystyle {\mathcal {C}}\times \mathbf {2} }$  is called the cylinder category, denoted ${\displaystyle {\text{Cyl}}({\mathcal {C}})}$

### Arrow categoriesEdit

• A functor category ${\displaystyle {\mathcal {B}}^{\mathcal {C}}}$  is a category whose objects are functors ${\displaystyle T:{\mathcal {C}}\to {\mathcal {B}}}$  and arrows are natural transformations.
• A functor category ${\displaystyle {\mathcal {C}}^{\mathbf {2} }}$  is called an arrow category, denoted ${\displaystyle {\mathcal {C}}^{\rightarrow }}$ . Its objects are arrows ${\displaystyle f:a'\to b'}$  in ${\displaystyle {\mathcal {C}}}$  and its arrows are pairs of arrows ${\displaystyle (h,k):f\to f'}$  such that ${\displaystyle f'\circ h=k\circ f}$ .

### Comma categoriesEdit

• Given categories and functors ${\displaystyle T:{\mathcal {E}}\to {\mathcal {C}}}$  and ${\displaystyle S:{\mathcal {D}}\to {\mathcal {C}}}$ , the comma category ${\displaystyle (T\downarrow S)}$  has objects ${\displaystyle (e,d,f)}$  where ${\displaystyle e}$  is an object in ${\displaystyle {\mathcal {E}}}$ , ${\displaystyle d}$  is an object in ${\displaystyle {\mathcal {D}}}$ , and ${\displaystyle f:Te\to Sd}$  is an arrow in ${\displaystyle {\mathcal {C}}}$ . Its arrows are ${\displaystyle (k,h):(e,d,f)\to (e',d',f')}$  where ${\displaystyle k:e\to e'}$  is an arrow in ${\displaystyle {\mathcal {E}}}$  and ${\displaystyle h:d\to d'}$  is an arrow in ${\displaystyle {\mathcal {D}}}$  such that ${\displaystyle Sh\circ f=f'\circ Tf}$ . Composition is given by ${\displaystyle (k,h)\circ (k',h')=(k\circ k',h\circ h')}$ . The identity is ${\displaystyle 1_{(e,d,f)}=(1_{e},1_{d})}$ .

#### Special types of comma categoriesEdit

Using the definition of comma category above, assume that we have ${\displaystyle {\mathcal {D}}=\mathbf {1} }$ , ${\displaystyle {\mathcal {E}}={\mathcal {C}}}$ , and ${\displaystyle T=1_{\mathcal {C}}}$ . Let ${\displaystyle 1}$  denote the object in ${\displaystyle \mathbf {1} }$ . Then ${\displaystyle S1=A}$  for some object ${\displaystyle A}$  in ${\displaystyle {\mathcal {C}}}$ . In this case, we write the comma category as ${\displaystyle ({\mathcal {C}}\downarrow A)}$  and call it the slice category of ${\displaystyle A}$  (or the category of objects over ${\displaystyle A}$ ).

Now assume, instead, that we have ${\displaystyle {\mathcal {E}}=\mathbf {1} }$ , ${\displaystyle {\mathcal {D}}={\mathcal {C}}}$ , and ${\displaystyle S=1_{\mathcal {C}}}$ . Let ${\displaystyle 1}$  denote the object in ${\displaystyle \mathbf {1} }$ . Then ${\displaystyle T1=A}$  for some object ${\displaystyle A}$  in ${\displaystyle {\mathcal {C}}}$ . In this case, we write the comma category as ${\displaystyle (A\downarrow {\mathcal {C}})}$  and call it the coslice category of ${\displaystyle A}$  (or the category of objects under ${\displaystyle A}$ ).

Finally, if we have ${\displaystyle {\mathcal {E}}={\mathcal {D}}={\mathcal {C}}}$  and ${\displaystyle T=S=1_{\mathcal {C}}}$ , then the comma category ${\displaystyle (1_{\mathcal {C}}\downarrow 1_{\mathcal {C}})={\mathcal {C}}^{\rightarrow }}$ .