Definition:Category

Definition
A category $\mathcal C$ consists of


 * A class of objects denoted $\mathcal C_0$ or $\operatorname{ob}\ \mathcal C$


 * A class of morphisms or arrows or maps denoted $\mathcal C_1$ or $\operatorname{mor}\ \mathcal C$ or or $\operatorname{Hom}\ \mathcal C$

satisfying the following properties:


 * To each arrow $f \in \mathcal C_1$ is associated a domain $X = \operatorname{dom} (f) \in \mathcal C_0$ and a codomain $Y = \operatorname{cod}(f) \in \mathcal C_0$, written $f:X \to Y$ or $X \stackrel{ f }{\longrightarrow} Y$


 * For every two arrows $f$ and $g$ such that $\operatorname{cod}(f)=\operatorname{dom}(g)$, the composition $g \circ f$ or $gf$ is a morphism of $\mathcal C$ with domain $\operatorname{dom}(f)$ and codomain $\operatorname{cod}(g)$


 * Composition is associative, that is, given $f : X \to Y$, $g: Y \to Z$, $h: Z \to W$, $f\circ(g\circ h)=(f\circ g)\circ h$.


 * For each $X \in \mathcal C_0$ there exists an identity arrow $\operatorname{id}_X$ such that for every $Y \in \mathcal C_0$ and $f : X\to Y$, $g: Y\to X$ we have $f\circ\operatorname{id}_X = f$, $\operatorname{id}_X \circ g = g$.

The collection of morphisms between two objects $X$ and $Y$ of $\mathcal C$ form a class $\operatorname{Hom}_{\mathcal C}(X, Y)$ or just $\operatorname{Hom}(X, Y)$, called the hom-class of morphisms $X \to Y$.

If for every $X,Y \in \mathcal C_0$, $\operatorname{Hom}(X,Y)$ is a set we say that $\mathcal C$ is locally small.

Note that while a class can be thought of as similar to a set, a major success of category theory is the unification of many properties of algebraic structures.

This means that if one formally the class of objects as a set, one comes to consider the "set of all sets", which is not well defined (is the set of all sets an element of itself? see Russell's Paradox).

One way to rigorously introduce the notion of a class is to use the Godel-Bernays axioms of set theory, which recognise classes at an axiomatic level, and are essentially equivalent to the standard Zermelo-Fraenkel axioms (that is, the same results can be proved from both).

Examples

 * The empty category with no objects and no arrows is trivially a category, often written $\mathbf 0$


 * The category with a single object $X$ with $\operatorname{id}_X$ the only morphism also satisfies the axioms, and is often denoted $\mathbf 1$