โ† back to index

The Operad of Wiring Diagrams

David I. Spivak ยท 2013 ยท arxiv arXiv:1305.0297

Prereqs: basic comfort with typed functions. ๐Ÿž Fritz 2020 helps but isn't required.

A wiring diagram is a box with typed input and output ports. Composing boxes means plugging outputs into inputs โ€” the types must match. This is the syntax layer: how components connect, before you decide what they compute.

Boxes and ports

A box has typed input ports and typed output ports. It's an interface specification โ€” no implementation yet. Think of a function signature without the body.

composite wiring diagram Box A Box B type X type Y type Z type Y type Z types must match

Boxes compose by wiring outputs to inputs. The types constrain which wirings are legal โ€” you can't plug a "type Z" output into a "type X" input. The composite is itself a box, with its own input and output ports. This is operadic composition: boxes all the way down.

Scheme

Supplier assignment

Wiring a diagram means assigning a supplier to each input port. Every input must get its value from exactly one output port (or from an external input of the outer box). The assignment must respect types: a port of type T can only be wired to an output of type T.

Scheme

Composing boxes

The operad operation: given an outer box with inner boxes wired together, collapse the inner structure into a single box. The composite box has the outer box's interface. The internal wiring is hidden โ€” encapsulation.

Scheme

Operadic composition is associative

The key property: composing (A then B) then C gives the same wiring diagram as composing A then (B then C). The wiring diagram operad is a genuine wpoperad โ€” composition is associative and there's an identity (the box that passes all ports through unchanged).

Scheme

Notation reference

Paper Scheme Meaning
X = (X_in, X_out)(make-box name ins outs)Box with typed ports
ฯ†: Y_in โ†’ X_out โˆ Z_insupplier assignmentWiring function
W(X; Yโ‚,โ€ฆ,Yโ‚™)(compose-boxes ...)Wiring diagram with n inner boxes
id_X(lambda (x) x)Identity box (pass-through)
โˆ˜(pipe f g)Operadic composition
Neighbors

Other paper pages

Foundations (Wikipedia)

Translation notes

The examples on this page use lists and symbols to represent typed ports and wiring. Spivak's paper works with operads in the category of typed finite sets โ€” the supplier assignment is a genuine function between coproducts. For example: the wiring diagram above connects two boxes with string labels. In the paper, the same construction uses typed finite sets with a function ฯ† from inner input ports to the disjoint union of outer inputs and other boxes' outputs. The compositional structure is identical. The set-theoretic precision is not.

Every example is Simplified.

Ready for the real thing? arxiv Read the paper. Start at ยง2 for the operad definition, ยง3 for propagation of properties through wiring.

Framework connection: The Natural Framework pipeline is a wiring diagram in Spivak's operad โ€” the operad gives the syntax of how stages connect, while Markov categories give the semantics. (jkThe Natural Framework)