A definition of a category can be obtained as an enrichment of a triple (A,B,c). Think of A as the set of objects of the category, B(a) as the set of morphisms with domain a, and c(a,b) as the codomain of morphism b with domain a. For a category, we must have:
What we have so far requires that the relation represented by the triple is reflexive and transitive. The following extra structure requires that the proofs of reflexity and transitivity preserve equality in a nice way, and form a category:
There is a natural operation
on triples,
which corresponds to construction of the reflexive and transitive
closure of a relation, and with an extra twist to construction of
the free category on a graph.
Now we can define composition and identity:
The axioms for a category given above are then satisfied. This is the free category generated by the graph.