nLab
composition

Contents

Definition

Composition is the operation that takes morphisms f:xy and g:yz in a category and produces a morphism gf:xz, called the composite of f and g.

Higher arity

Strictly speaking, composition as defined above is binary composition. One can also define n-ary composites for any natural number n0: given n+1 objects x 0,,x n and n morphisms f i:x i1x i, we get the composite f nf 1:x 0x n. Since composition in a category is associative, a definition of n-ary composition from binary composition via any choice of bracketing will be equal to that resulting from any other choice of bracketing. The unary composite of f 1:x 0x 1 is simply f itself, and the nullary composite of x 0 is its identity morphism.

Conversely, a category can equivalently be defined as a directed graph equipped with an n-ary composition operation for every natural number n0, satisfying suitable associativity axioms. This definition may be called unbiased, as opposed to the usual definition which is “biased” towards 0 and 2.

Notation

Traditionally, the composite of f and g as above is written gf, following the notation introduced by the followers of Leibniz for composition of functions. This is often abbreviated as simply gf. Of course, this notation preserves the order of symbols in the elementwise definition of function composition: (gf)(x)=g(f(x)).

On the other hand, reading a diagram

xfygzx \stackrel{f}\to y \stackrel{g}\to z

the notation fg reads better. One way to make this anti-Leibniz convention clearer is to write f;g (which is based on the interpretation of programming commands as morphisms in theoretical computer science). Since this convention is motivated by the drawing of diagrams, it is also sometimes called diagrammatic order.

Therefore, the notations gf and fg are ambiguous, while gf and f;g are less so. It seems that the notation gf for gf is more common than fg for f;g, although the fg notation occurs in some important older papers.

Is f;g really more common than fg, as Charles Wells wrote here a moment ago? I've seen fg more often (even for this order) and f;g mostly in CS-oriented literature, but my experience is probably not as broad. —Toby

The change you made is probably good. Much of my work in category theory was done in connection with computer science, so my perception may be skewed. –Charles

OK, thanks! —Toby

Mike Shulman: I hope I didn’t mess up these statements when I merged the two pages.

Although diagrammatic order has advantages and partisans, especially among category theorists and computer scientists, the “classical” order of composition is firmly entrenched in much of mathematics. Many people who agree that diagrammatic order is “better” on its own merits nevertheless believe that trying to change the established “classical” order of composition creates more confusion than it removes.

In some older category theory papers, arrows were written pointing from right to left, so that the composition of arrows could be written in the “classical” style, while still preserving the diagrammatic intuition. Hom-sets were accordingly written C(b,a), where a is the source, and b is the target.

In enriched category theory

In enriched category theory, for V a monoidal category the composition operation on a V-enriched category C is for each triple (x,y,z) of objects of C a morphism

x,y,z:C(x,y)C(y,x)C(x,z)\circ_{x,y,z} : C(x,y) \otimes C(y,x) \to C(x,z)

in V.

This reduces to the above definition in the case that V= Set. The composition morphism x,y,z sends any two composable morphisms to their composite.

x,y,z:((xfy),(ygz))(xgfz).\circ_{x,y,z} : ((x \stackrel{f}{\to} y), (y \stackrel{g}{\to} z)) \;\; \mapsto \;\; (x \stackrel{g\circ f}{\to} z) \,.