
Inmathematics, acategory (sometimes called anabstract category to distinguish it from aconcrete category) is a collection of "objects" that are linked by "arrows". A category has two basic properties: the ability to compose the arrowsassociatively and the existence of an identity arrow for each object. A simple example is thecategory of sets, whose objects aresets and whose arrows arefunctions.
Category theory is a branch of mathematics that seeks to generalize all of mathematics in terms of categories, independent of what their objects and arrows represent. Virtually every branch of modern mathematics can be described in terms of categories, and doing so often reveals deep insights and similarities between seemingly different areas of mathematics. As such, category theory provides an alternative foundation for mathematics toset theory and other proposed axiomatic foundations. In general, the objects and arrows may be abstract entities of any kind, and the notion of category provides a fundamental and abstract way to describe mathematical entities and their relationships.
In addition to formalizing mathematics, category theory is also used to formalize many other systems in computer science, such as thesemantics of programming languages.
Two categories are the same if they have the same collection of objects, the same collection of arrows, and the same associative method of composing any pair of arrows. Twodifferent categories may also be considered "equivalent" for purposes of category theory, even if they do not have precisely the same structure.
Well-known categories are denoted by a short capitalized word or abbreviation in bold or italics: examples includeSet, the category ofsets andset functions;Ring, the category ofrings andring homomorphisms; andTop, the category oftopological spaces andcontinuous maps. All of the preceding categories have theidentity map as identity arrows andcomposition as the associative operation on arrows.
The classic and still much used text on category theory isCategories for the Working Mathematician bySaunders Mac Lane. Other references are given in theReferences below. The basic definitions in this article are contained within the first few chapters of any of these books.
Anymonoid can be understood as a special sort of category (with a single object whose self-morphisms are represented by the elements of the monoid), and so can anypreorder.
| Total | Associative | Identity | Divisible | Commutative | |
|---|---|---|---|---|---|
| Partial magma | Unneeded | Unneeded | Unneeded | Unneeded | Unneeded |
| Semigroupoid | Unneeded | Required | Unneeded | Unneeded | Unneeded |
| Small category | Unneeded | Required | Required | Unneeded | Unneeded |
| Groupoid | Unneeded | Required | Required | Required | Unneeded |
| Magma | Required | Unneeded | Unneeded | Unneeded | Unneeded |
| Quasigroup | Required | Unneeded | Unneeded | Required | Unneeded |
| Unital magma | Required | Unneeded | Required | Unneeded | Unneeded |
| Loop | Required | Unneeded | Required | Required | Unneeded |
| Semigroup | Required | Required | Unneeded | Unneeded | Unneeded |
| Monoid | Required | Required | Required | Unneeded | Unneeded |
| Group | Required | Required | Required | Required | Unneeded |
| Abelian group | Required | Required | Required | Required | Required |
There are many equivalent definitions of a category.[1] One commonly used definition is as follows. Acategory consists of
such that the following axioms hold:
We write, and we say " is a morphism from to". We write (or when there may be confusion about to which category refers) to denote thehom-class of all morphisms from to.[2]
Some authors write the composite of morphisms in "diagrammatic order", writing (sometimes with ⨟[3]) or instead of.
From these axioms, one can prove that there is exactly one identity morphism for every object. Often the map assigning each object its identity morphism is treated as an extra part of the structure of a category, namely a class function.
Some authors use a slight variant of the definition in which each object is identified with the corresponding identity morphism. This stems from the idea that the fundamental data of categories are morphisms and not objects. In fact, categories can be defined without reference to objects at all using a partial binary operation with additional properties.
A categoryC is calledsmall if both ob(C) and mor(C) are actuallysets and notproper classes, andlarge otherwise. Alocally small category is a category such that for all objectsa andb, the hom-class hom(a,b) is a set, called ahomset. Many important categories in mathematics (such as the category of sets), although not small, are at least locally small. Since, in small categories, the objects form a set, a small category can be viewed as analgebraic structure similar to amonoid but without requiringclosure properties. Large categories on the other hand can be used to create "structures" of algebraic structures.
Theclass of all sets (as objects) together with allfunctions between them (as morphisms), where the composition of morphisms is the usualfunction composition, forms a large category,Set. It is the most basic and the most commonly used category in mathematics. The categoryRel consists of allsets (as objects) withbinary relations between them (as morphisms). Abstracting fromrelations instead of functions yieldsallegories, a special class of categories.
Any class can be viewed as a category whose only morphisms are the identity morphisms. Such categories are calleddiscrete. For any givensetI, thediscrete category on I is the small category that has the elements ofI as objects and only the identity morphisms as morphisms. Discrete categories are the simplest kind of category.
Anypreordered set (P, ≤) forms a small category, where the objects are the members ofP, the morphisms are arrows pointing fromx toy whenx ≤y. Furthermore, if≤ isantisymmetric, there can be at most one morphism between any two objects. The existence of identity morphisms and the composability of the morphisms are guaranteed by thereflexivity and thetransitivity of the preorder. By the same argument, anypartially ordered set and anyequivalence relation can be seen as a small category. Anyordinal number can be seen as a category when viewed as anordered set.
Anymonoid (anyalgebraic structure with a singleassociativebinary operation and anidentity element) forms a small category with a single objectx. (Here,x is any fixed set.) The morphisms fromx tox are precisely the elements of the monoid, the identity morphism ofx is the identity of the monoid, and the categorical composition of morphisms is given by the monoid operation. Several definitions and theorems about monoids may be generalized for categories.
Similarly anygroup can be seen as a category with a single object in which every morphism isinvertible, that is, for every morphismf there is a morphismg that is bothleft and right inverse tof under composition. A morphism that is invertible in this sense is called anisomorphism.
Agroupoid is a category in which every morphism is an isomorphism. Groupoids are generalizations of groups,group actions andequivalence relations. Actually, in the view of category the only difference between groupoid and group is that a groupoid may have more than one object but the group must have only one. Consider a topological spaceX and fix a base point ofX, then is thefundamental group of the topological spaceX and the base point, and as a set it has the structure of group; if then let the base point runs over all points ofX, and take the union of all, then the set we get has only the structure of groupoid (which is called as thefundamental groupoid ofX): two loops (under equivalence relation of homotopy) may not have the same base point so they cannot multiply with each other. In the language of category, this means here two morphisms may not have the same source object (or target object, because in this case for any morphism the source object and the target object are same: the base point) so they can not compose with each other.

Anydirected graphgenerates a small category: the objects are thevertices of the graph, and the morphisms are the paths in the graph (augmented withloops as needed) where composition of morphisms is concatenation of paths. Such a category is called thefree category generated by the graph.
The class of all preordered sets with order-preserving functions (i.e., monotone-increasing functions) as morphisms forms a category,Ord. It is aconcrete category, i.e. a category obtained by adding some type of structure ontoSet, and requiring that morphisms are functions that respect this added structure.
The class of all groups withgroup homomorphisms asmorphisms andfunction composition as the composition operation forms a large category,Grp. LikeOrd,Grp is a concrete category. The categoryAb, consisting of allabelian groups and their group homomorphisms, is afull subcategory ofGrp, and the prototype of anabelian category.
The class of allgraphs forms another concrete category, where morphisms are graph homomorphisms (i.e., mappings between graphs which send vertices to vertices and edges to edges in a way that preserves all adjacency and incidence relations).
Other examples of concrete categories are given by the following table.
| Category | Objects | Morphisms |
|---|---|---|
| Set | sets | functions |
| Ord | preordered sets | monotone-increasing functions |
| Mon | monoids | monoid homomorphisms |
| Grp | groups | group homomorphisms |
| Grph | graphs | graph homomorphisms |
| Ring | rings | ring homomorphisms |
| Field | fields | field homomorphisms |
| R-Mod | R-modules, whereR is a ring | R-module homomorphisms |
| VectK | vector spaces over thefieldK | K-linear maps |
| Met | metric spaces | short maps |
| Meas | measure spaces | measurable functions |
| Stoch | measure spaces | Markov kernels |
| Top | topological spaces | continuous functions |
| Manp | smooth manifolds | p-timescontinuously differentiable maps |
Fiber bundles withbundle maps between them form a concrete category.
The categoryCat consists of all small categories, withfunctors between them as morphisms.
Any categoryC can itself be considered as a new category in a different way: the objects are the same as those in the original category but the arrows are those of the original category reversed. This is called thedual oropposite category and is denotedCop.
IfC andD are categories, one can form theproduct categoryC ×D: the objects are pairs consisting of one object fromC and one fromD, and the morphisms are also pairs, consisting of one morphism inC and one inD. Such pairs can be composedcomponentwise.
Amorphismf :a →b is called
Every retraction is an epimorphism. Every section is a monomorphism. The following three statements are equivalent:
Relations among morphisms (such asfg =h) can most conveniently be represented withcommutative diagrams, where the objects are represented as points and the morphisms as arrows.