= Category
{title2=$\mathcal C$}
{wiki=Category_(mathematics)}
A category specifies <objects of a category>, <categorical morphisms> between them, and <composition in a category>. An arrow $f:A\to B$ can be followed by $g:B\to C$, giving $g\circ f:A\to C$. Every object $A$ has an <identity morphism> $1_A:A\to A$, and the rules satisfy
$$
h\circ(g\circ f)=(h\circ g)\circ f,\qquad f\circ1_A=f=1_B\circ f.
$$
<Associativity> means that grouping a chain differently does not change its composite. It does not assert <commutativity>, and the sources and targets must match before a composite is defined.
In the <Category of sets>, arrows are <functions>. Take two <functions> on the <real numbers>, $f(x)=x+1$ and $g(x)=2x$. Then $(g\circ f)(x)=2x+2$, whereas $(f\circ g)(x)=2x+1$. At $x=3$, the two orders give \b[8 and 7], respectively. Both orders are defined here because these maps share their source and target; for arbitrary arrows the reverse composite need not exist.
\Image[/categorical-composition-examples.png]
{title=Function composition remembers order, while a naturality square gives equal results along both routes}
A <partially ordered set> supplies a different example: its elements are the <objects of a category>, with exactly one arrow $a\to b$ when $a\leq b$, and none otherwise. <Transitivity> gives <composition in a category>, and <reflexivity> gives <identity morphisms>. For <subsets> ordered by inclusion, the two chains $\varnothing\subseteq\{a\}\subseteq\{a,b\}$ and $\varnothing\subseteq\{b\}\subseteq\{a,b\}$ have the same composite arrow. Thus arrows need not be maps of elements: they can record a relation.
Back to article page