Categories, Objects, and Arrows
A category is objects, arrows between them, a rule for composing arrows, and an identity arrow on every object, subject to associativity and the unit laws. The axioms mention no elements: arrows need not be functions, and an object is known only through the arrows into and out of it.
╌╌╌╌
Most of mathematics is organized around what things are: a group is a set with a multiplication, a topological space is a set with a collection of open subsets, a vector space is a set with addition and scaling. Category theory reorganizes the subject around what things do — how they map to one another. An object in a category is opaque; the only thing you may ask about it is which arrows go into it and which come out. Almost every construction in these notes is phrased in that language, which requires learning to work with objects you cannot look inside.
The definition is short. A category is a directed graph — objects as nodes, arrows as edges — carrying two extra pieces of data: a way to compose a matching pair of arrows end to end, and a distinguished identity arrow on each object. Three axioms constrain them.
The axioms
We write or to mean , and frequently abbreviate to .1 The object is the domain (or source) of and its codomain (or target); every arrow in every category has one definite domain and one definite codomain. The collection is the hom-set from to , also written — the name recalls homomorphism, from one of the earliest examples.
Two features of the definition matter before any example.
- Composition is partial. You may compose after only when the codomain of equals the domain of . The types must line up: gives , but and a map with do not compose at all.
Collection,
notset.
For a small category the objects form a set, but for or the objects are too numerous. We use the informal word collection (properly, class) and defer the distinction to the lesson on size.
The single most important consequence of the axioms is that any string of composable arrows has exactly one composite. Given
associativity makes every bracketing of equal, so it is safe to drop the parentheses. The case is not degenerate: the unique composite of the empty string at is . An identity is a zero-fold composite in the same sense that is the product of no numbers.
Arrows are not functions
In the arrows are functions, which makes it easy to read the axioms as a restatement of facts about functions. That reading fails: the definition never mentions elements. An object need not have any; an arrow need not send points to points. The axioms describe a bookkeeping of composition, nothing more.
Three small categories make the point.
- The empty category has no objects and no arrows. It vacuously satisfies every axiom.
- The terminal category has one object and only its identity arrow.
- The arrow category has two objects and a single non-identity
arrow between them, . Composition is forced; there is nothing
to choose. It is not obvious what an
element
of would be, and there is no sense in which is afunction.
More structure appears once the category has special shape. A category with one object, all of whose arrows compose associatively with a two-sided unit, is exactly a monoid: the arrows are its elements, composition is the operation, is the identity. If in addition every arrow is invertible, it is a group. A category in which there is at most one arrow between any two objects is exactly a preordered set: write to mean an arrow exists; reflexivity is , transitivity is composition.2 These are not analogies. A group is a category of a special shape, and a theorem about categories is automatically a theorem about groups and about ordered sets at once. These special shapes are catalogued in the zoo of categories.
Commutative diagrams
Because the only data is arrows and their composites, most statements in category theory are equations between composite arrows, and these are drawn rather than written. A diagram is a graph of objects and arrows in the category. It commutes when any two directed paths sharing a start and an end compose to the same arrow.
The triangle drawn earlier is the smallest commuting diagram: it says is the
composite of and , which is true by definition, so a triangle with a labelled
diagonal always commutes. A larger diagram carries real information. Saying the square commutes
is a compact way to assert an equation that would otherwise take a
line of symbols, and much of a categorical proof is a diagram chase: filling in
arrows so that the outer paths of a diagram are forced to agree.
Associativity and the unit laws, geometrically
The two axioms have clean pictures. Associativity is the statement that in a chain of three arrows, the two ways of inserting brackets land on the same composite.
The unit laws say that composing with an identity changes nothing. Every object carries a loop , and pre- or post-composing an arrow with the appropriate identity returns the same arrow.
An identity arrow is uniquely determined by its object: if and both act as two-sided units on , then by applying each unit law once. The same one-line argument recurs throughout the subject: an object defined by a universal property is unique.
Isomorphism
With composition and identities in hand, the categorical notion of sameness
is
available, and it is the arrows, not the elements, that define it.
Uniqueness of the inverse is the identity argument again: if and both invert , then .3 The isomorphisms in are exactly the bijections, but this is a small theorem, not a triviality — it amounts to the fact that a function has a two-sided inverse precisely when it is injective and surjective. In the isomorphisms are the group isomorphisms; in they are the homeomorphisms, and here a warning surfaces: a continuous bijection need not be an isomorphism. The map from onto the unit circle is a continuous bijection whose inverse is not continuous, so it is not an arrow-with-inverse in .4 Being a bijection on underlying sets is a fact about elements; being an isomorphism is a fact about arrows, and the two come apart.
| Category | Objects | Arrows | Isomorphisms |
|---|---|---|---|
| sets | functions | bijections | |
| groups | homomorphisms | group isomorphisms | |
| spaces | continuous maps | homeomorphisms | |
| a monoid | one object | elements of | invertible elements |
| a poset | elements of | relations | equalities |
In the poset row, forces , hence by antisymmetry; a poset has no nontrivial isomorphisms.
The universal-property preview
Forbidding a look inside objects forces every construction to be described by its maps, and descriptions by maps have a rigidity that internal descriptions lack. Consider the terminal category's single object, or, in , a one-element set. A one-element set has the property that from every set there is exactly one function . That property mentions no elements of ; it is entirely about arrows into . And it pins down: any two sets with this property are uniquely isomorphic.
This shape — for every object there exists a unique arrow such that some diagram commutes — is a universal property. Products, quotients, free groups, function spaces, and limits are all defined this way, and each is thereby determined up to unique isomorphism. The proof that a terminal object is unique up to unique isomorphism is worked in full in the lesson on universal properties. Once objects are anonymous, the only way to specify one is to say how everything maps to it, and that specification, when it succeeds, admits no ambiguity.
Building new categories from old
Two constructions appear immediately and recur constantly.
- The opposite category. Every category has a dual or opposite with the same objects and : every arrow is reversed, identities are unchanged, and composition runs backwards. Applying the construction twice returns .
- The product category. Given and , the product has pairs as objects and pairs as arrows, composed componentwise.
The opposite category underlies duality, the principle that every
definition, theorem, and proof has a mirror image obtained by reversing all arrows.
The dual of terminal
is initial
(exactly one arrow out of the object); the
dual of a monomorphism is an epimorphism; the dual of a product is a coproduct. A
single proof, read forwards and backwards, yields two theorems. Duality and these
constructions return in
the lesson on constructions on categories,
and the special arrows dual to isomorphism in
the lesson on special morphisms.
Consequences of the axioms
A graph, a partial associative composition, and units are all the definition requires. From that alone the notions of isomorphism, terminal object, duality, and universal property are already available, and they apply verbatim to sets, groups, spaces, monoids, and orders. Three constructions build on the axioms and nothing else: functors compare whole categories, natural transformations compare functors, and the Yoneda lemma recovers an object from the arrows into it.
Footnotes
- Leinster, Basic Category Theory, §1.1, Definition 1.1.1 and Remarks 1.1.2 — the data and axioms of a category, the notation, domain and codomain, and the uniqueness of the composite of a string of arrows (including the empty string as an identity). ↩
- Leinster, §1.1, Examples 1.1.8 — a one-object category as a monoid, a one-object category with all arrows invertible as a group, and a category with at most one arrow between objects as a preordered set. ↩
- Barr & Wells, Category Theory for Computing Science, §2.7.2–2.7.3 — inverse arrows and the proof that an inverse, when it exists, is unique. ↩
- Leinster, §1.1, Definition 1.1.4 and Examples 1.1.5–1.1.7 — isomorphisms defined by a two-sided inverse; the isomorphisms in , , , and the continuous bijection that is not a homeomorphism. ↩
╌╌ END ╌╌