Consider the functions $f : X \to Y$ and $g : Y \to Z$. According to the Wikipedia articles on Function Composition, the application of $f$ to an input $x$ can be written as $xf$ (as opposed to the usual $f(x)$), and function composites can be written as $fg$ (as opposed to the usual $g \circ f$). This is known as postfix notation or diagrammatic notation because the equation $(xf)g = x(fg)$ holds and the function composite can be read from the following diagram: $$ X \xrightarrow{f} Y \xrightarrow{g} Z \implies X \xrightarrow{fg} Z $$

I would like a journal reference that uses this notation, preferably briefly explaining its advantages.

What I've tried

The closest reference I have is "Z Notation", where relations $R \subseteq X \times Y$ and $S \subseteq Y \times Z$ can be composed in diagrammatic order using a "fat semicolon":

enter image description here

This use of semicolon coincides with the notation for function composition used (mostly by computer scientists) in Category theory.

Could I also have a journal reference that uses Z notation?

  • 1
    $\begingroup$ The notation with ";" is one possible choice. Or you could simply use juxtaposition, as in the diagram. There was a similar question math.stackexchange.com/questions/258344/… and you might find some answers helpful. A good case in favour of postfix composition is made here: iti.cs.tu-bs.de/TI-INFO/koslowj/RESEARCH/RPN $\endgroup$ – Marc Olschok Feb 27 '13 at 1:27
  • $\begingroup$ Alternatively, just make all your arrows go from the right to the left. I've seen this in a few sets of notes on category theory. $\endgroup$ – Joppy Jun 7 '17 at 22:41

Not sure if this is exactly what you're looking for, but this blog post has three references to Journal articles about reverse Polish notation (postfix notation).


David Spivak defines diagrammatic order in Category Theory for the Sciences:

However, there is another way to write this composition, called diagrammatic order. Instead of g compose f we write f;g: A->C, meaning 'do f, then do g'.

He does not mention any advantages.

In my un-journaled opinion: the advantage of diagrammatic order is that it reads left-to-right which is the natural ordering for English readers.

This is particularly useful in functional programming languages such as scala:

val queryExternalService : Route = 
  getRequest andThen forwardRequest andThen (_ map RouteResult.Complete)

The ordering is grammatically similar to how it would read: "get the request and then forward the request and then map the result to a Complete".


This paper of Abramsky and Jagadeensan (published in the Journal of Symbolic Logic) uses the semicolon $;$ for composition of morphisms in Game Semantics. This seems to be the prevailing notation for composition in that subject, and I could get you a whole lot more similar references, if you wanted.

In game semantics, we compose strategies by (very roughly) laying them side by side and playing their common component against each other (I could give a better account, but it wouldn't be relevant to your question). In that case, it just gets confusing if you swap the order and write $\tau\circ\sigma$ rather than $\sigma;\tau$. The fact that strategies don't obviously correspond to functions probably helps as well.

Indeed, there is a close relationship with the category of sets and relations that you mentioned, and certain categories of games admit a faithful functor into the category of sets and relations. If we have relations $R\subset X\times Y$ and $S\subset Y\times Z$, it is confusing to write $S\circ R\subset X\times Y$ for the composition, especially given the definition of relational composition, so the semicolon $;$ is often used for composition of relations. (See my recent paper, for instance - look at the first paragraph after Lemma 1).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.