< theory > A category K is a collection of objects, obj(K), and a collection of morphisms (or " arrows "), mor(K) such that
1. Each morphism f has a "typing" on a pair of objects A, B written f:A->B. This is read 'f is a morphism from A to B'. A is the "source" or " domain " of f and B is its "target" or " co-domain ".
2. There is a partial function on morphisms called composition and denoted by an infix ring symbol, o. We may form the "composite" g o f : A -> C if we have g:B->C and f:A->B.
3. This composition is associative: h o (g o f) = (h o g) o f.
4. Each object A has an identity morphism id_A:A->A associated with it. This is the identity under composition, shown by the equations id_B o f = f = f o id_A.
In general, the morphisms between two objects need not form a set (to avoid problems with Russell's paradox ). An example of a category is the collection of sets where the objects are sets and the morphisms are functions.
Sometimes the composition ring is omitted. The use of capitals for objects and lower case letters for morphisms is widespread but not universal. Variables which refer to categories themselves are usually written in a script font.