A category $C$ consists of the following data:
A set $Ob(C)$ called the objects.
For all objects $X,Y$, a set of arrows $C(X,Y)$. For an arrow $a$ in $C(X,Y)$, we write $a: X \rightarrow Y$, and say that $a$ is an arrow from $X$ to $Y$. We may think of the arrow as an abstract process or function. $X$ is the domain of $a$, and $Y$ is the codomain of $a$. Another name for arrow is morphism.
Given arrows $f: X \rightarrow Y$ and $g: Y \rightarrow Z$, the category provides a composition rule that defines a composite morphism $f \triangleright g: X \rightarrow Z$. Think of $f \triangleright g$ as the process which first “goes through” $f$ from $X$ to $Y$ and then goes through $g$ from $Y$ to $Z$. Note: the standard notations for $f \triangleright g$ are $f;g$ and $g \circ f$.
Subject to the following requirements:
Associativity. Suppose we are given a composable sequence of arrows $f,g,h$:
Then it must be that:
So parentheses don’t matter, which means that we can simply write $f \triangleright g \triangleright h$.
Identities. For each object $X$, there exists a designated identity arrow $Id_X: X \rightarrow X$, such that for all arrows $f: W \rightarrow X$ and $g: X \rightarrow Y$:
and