Lesson 03 · Syntax
Wiring Diagrams & Hierarchical Open Systems
Read and nest wiring diagrams as morphisms of an operad of open systems (Spivak).
Pictures that are mathematics
Wiring diagrams are not decoration. In Spivak’s framework they are the morphisms of an operad: an outer interface, inner boxes with their own interfaces, and wires that identify ports. Nesting a diagram inside a box is operadic composition.
Interactive wiring diagram
Open system · wiring diagram
Outer ports are the interface of X. Filling boxes is operadic composition: B itself is a diagram of B₁ and B₂.
From flat glue to hierarchical nesting
Many boxes, one spaghetti of wires — hard to reuse.
Wiring diagrams vs informal architecture sketches
Informal sketch
- Boxes mean “components” loosely
- Wires untyped
- Nesting is a PowerPoint layer
- Reuse by copy-paste
Wiring operad
- Boxes are open systems with ports
- Wires are typed equalities/flows
- Nesting is composition in T
- Reuse by substitution
Ports are typed names
A port is a named, typed locus on a boundary — voltage terminal, HTTP channel, SQL relation sort, agent mailbox. Wires assert equalities (or directed flows) between ports. Illegal wires (type mismatch, wrong direction) are rejected at the syntax layer, before any semantics is chosen.
Draw a legal nesting
- 01Draw the outer boundary and label its ports.
- 02Place inner boxes; label each box’s ports.
- 03Wire internal ports to each other or to the outer boundary.
- 04Confirm every wire respects types and directions.
- 05Treat the filled outer box as a single operation ready to nest inside a larger diagram.
Check yourself
Retrieval practice — feedback explains why.
Explain it back
Sketch a wiring diagram for a system you own: outer box, inner boxes, ports, and wires. Where does hierarchy currently live only in docs?
Sources · claim ledger
David Spivak showed that hierarchical wiring diagrams form morphisms of an operad T, providing a graphical language for databases, recursion, and plug-and-play circuits.
Spivak, The operad of wiring diagrams (arXiv:1305.0297) · verified 2026-07-28
An open system exposes a typed boundary (ports/interfaces); composition glues boundaries rather than treating systems as closed black boxes.
Spivak, operad of wiring diagrams — plug-and-play devices · verified 2026-07-28
Applied category theory (Fong & Spivak, Seven Sketches in Compositionality) develops compositionality via monoidal categories, wiring diagrams, and graphical calculi for open systems.
Fong & Spivak, Seven Sketches in Compositionality (arXiv:1803.05316) · verified 2026-07-28