A Zoo of Categories
The axioms admit two very different kinds of model: large categories of structured sets and their structure-preserving maps (Set, Mon, Grp, Top, Vect), and small categories that are themselves single algebraic objects — a monoid as a one-object category, a poset as a thin category. The awkward cases Rel and Pfn have sets as objects but relations and partial functions as arrows, and a typed programming language presents its types and programs as a category.
╌╌╌╌
The axioms of a category are deliberately spare, and they admit models of two quite different flavors. In the first, the category is enormous and each object is a whole mathematical structure: , , . In the second, the category is small and is itself a single mathematical structure: a monoid is a one-object category, a poset is a category with at most one arrow between any two objects. Category theory studies both at once, and most of its results say something about each.
Categories of structured sets
Objects are sets furnished with extra structure, arrows are the functions that respect that structure, and composition and identities are inherited from functions.1 Checking the axioms is routine each time — the composite of two structure-preserving maps preserves structure, and the identity function trivially does.
| Category | Objects | Arrows |
|---|---|---|
| sets | all functions | |
| monoids | monoid morphisms | |
| groups | group homomorphisms | |
| abelian groups | group homomorphisms | |
| rings | ring homomorphisms | |
| vector spaces over | linear maps | |
| topological spaces | continuous maps | |
| posets | monotone maps |
Three of these need comment.
- . A monoid is a set with an associative binary
operation and a two-sided unit; a morphism satisfies
and . Simmons
calls the study of monoids
the study of composition in the miniature
: a monoid is what remains of a category when only one object is allowed. - and . A preorder is a reflexive transitive relation; a partial order is additionally antisymmetric. Arrows in both categories are the monotone maps, . For posets the hom-sets and coincide, which makes a full subcategory of .
- . Objects carry a topology rather than an algebraic operation, and the arrows are continuous maps. It behaves less tamely than the algebraic examples: a continuous bijection need not be an isomorphism.
The pattern structured sets plus structure-preserving functions
covers most
categories met in a first pass through algebra and topology, but it is not the
definition of a category, and the next two families break it in different ways.
Awkward relatives of Set
Both of the following categories have plain sets as objects, yet their arrows are not functions in the ordinary sense. They matter in computing, where partiality and nondeterminism are everyday phenomena.
- Partial functions, . An arrow is a total function defined on some subset . To compose with domains of definition and , restrict to and set for . For a third arrow , associativity holds because both bracketings of are defined on exactly and agree there.2
- Relations, . An arrow is a relation . The composite of and relates to exactly when some has and . The identity on is the diagonal .3
A function is a special relation and a special partial function, so sits inside both. Each enlargement keeps the objects and changes only what counts as an arrow — a reminder that a category is determined at least as much by its arrows as by its objects.
Small categories as single structures
In the second family the whole category is itself a single manageable algebraic object.
A monoid as a one-object category
Let be a monoid. Build a category with a single object , one arrow for each element of , composition given by the monoid operation, and the unit element. Associativity and the unit laws of the category are precisely the monoid axioms.4 Conversely, any one-object category yields a monoid: its arrows under composition. The two notions are the same data presented twice.
If every arrow of the one-object category is invertible, the monoid is a group. More generally, a category in which every arrow is an isomorphism is called a groupoid; a group is a one-object groupoid.
A poset as a thin category
Let be a preordered set. Build a category with the elements of as objects and exactly one arrow when , none otherwise. Reflexivity supplies the identities, transitivity supplies composition, and the axioms hold automatically because between any two objects there is at most one arrow — every diagram in such a category commutes.5 Categories with this property are called thin. Antisymmetry corresponds to the condition that isomorphic objects are equal.
The two miniature readings constrain a category in opposite ways, and every category mixes them:
| Degenerate case | Constraint | What survives |
|---|---|---|
| monoid | one object | composition structure |
| preorder | at most one arrow per hom-set | comparison structure |
| discrete category | only identity arrows | a bare class of objects |
A discrete category is the extreme in both directions at once: no arrows except the mandatory identities, so it is nothing more than its collection of objects.
Finite categories drawn in full
A category can also be given by an explicit finite table of objects and arrows. The categories , , and were introduced with the axioms; one step up in size are the shapes that index the constructions of later lessons.
When a finite category is specified by a drawing, composition must be defined for every composable pair and the axioms checked; usually the drawing leaves no choice. These small categories are the index shapes over which limits are taken: the parallel pair indexes equalizers, the discrete two-object category indexes binary products.
A programming language as a category
A typed functional programming language presents a category, the point of contact between category theory and computing science.6 Take a language with:
- primitive data types, plus derived types built by constructors;
- operations between types, including a do-nothing operation on each type ;
- a composition constructor taking and to a program ;
- a unit type such that each constant of type is an operation .
Impose the evident equations (, associativity of ). The resulting category has the types of as objects and the operations — programs — as arrows, with . Here is a model of the language, not its syntax: two source programs that the equations force to be equal, such as and , become the same arrow.
For example, take a language with types , , and , with constants and , operations , , and , subject to .
The composite program computes the successor character, and the arrows and are equal in because of the imposed equation. Typing is the source/target structure of the category, not an annotation layered on top. The correspondence between typed lambda calculi and cartesian closed categories develops this identification in full.
Free categories and free monoids
One more source of examples, midway between the structured-set world and the small-category world. Every directed graph generates a free category: the objects are the nodes of , the arrows are the finite paths, with composition given by concatenating paths and identities given by the empty paths. Associativity is the associativity of concatenation.7
Two special cases:
- The graph with one node and no edges generates the category .
- The graph with one node and one loop generates the one-object category whose arrows are the finite strings over a one-letter alphabet, i.e. the free monoid on one generator, isomorphic to .
The free monoid on an arbitrary set is the Kleene closure : all
finite lists of elements of under concatenation, with the empty list as unit.
The word free
carries a precise universal meaning, given by the
free–forgetful adjunctions;
here it names a construction that turns any graph into a category and any set into a
monoid.
Summary of the examples
The table records the two flavors and where each example lives.
| Example | Kind | Objects | Arrows | Special feature |
|---|---|---|---|---|
| , , , | large | structures | structure maps | the classical template |
| , | large | sets | partial functions, relations | arrows are not functions |
| monoid | small | one | elements of | composition in miniature |
| preorder / poset | small | elements of | instances of | comparison in miniature; thin |
| discrete category | small | any class | identities only | no structure at all |
| for a language | small | types | programs | equations quotient the syntax |
| for a graph | small | nodes | paths | freely generated |
Two disciplines carry forward. First, never assume an object has elements or an
arrow is a function; half the examples above violate each assumption. Second, the
same categorical statement specializes across the zoo — a statement about
categories is simultaneously a statement about sets, monoids, orders, spaces, and
programming languages. Functors, the maps
between categories, turn constructions like underlying set,
free monoid,
and
path category
into mathematical objects in their own right.
Footnotes
- Simmons, An Introduction to Category Theory, §1.2 — categories of structured sets; the monoid and preset/poset examples worked in detail, and as a full subcategory of . ↩
- Simmons, §1.2, Example 1.2.3 — the category of sets and partial functions, with composition by restriction to the composable part. ↩
- Barr & Wells, Category Theory for Computing Science, §2.1.13–2.1.14 — the categories and , with the diagonal relation as identity. ↩
- Barr & Wells, §2.3.1–2.3.12 — preordered sets, semigroups, monoids, the Kleene closure, and the constructions and presenting an ordered set and a monoid as categories. ↩
- Leinster, Basic Category Theory, §1.1, Examples 1.1.8(b)–(e) — discrete categories, groups and monoids as one-object categories, and preorders as categories with at most one arrow between objects. ↩
- Barr & Wells, §2.2 — functional programming languages as categories: the assumptions A-1 to A-3, the category , and the NAT/BOOLEAN/CHAR example with the program next. ↩
- Barr & Wells, §2.6.16–2.6.17 — the free category (path category) generated by a graph, and the one-loop graph generating the free monoid on one generator. ↩
╌╌ END ╌╌