Lesson 01 · Foundations
What Compositionality Demands
State the compositionality problem and distinguish compositional interfaces from ad-hoc glue.
The problem in one sentence
You can understand every component and still misunderstand the whole — unless the meaning of the whole is determined by the meanings of the parts and the law by which they are joined. That requirement is compositionality.
Closed boxes vs open systems
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₂.
Open systems and boundaries
A closed system has no exposed interface: you can only replace it wholesale. An open system publishes a typed boundary — ports, wires, message shapes, resource accounts — so neighbors can plug in. Composition glues boundaries. Without an explicit boundary, engineers invent implicit ones; those are where emergent failure lives.
How compositionality is earned
Name the whole
State the system whose meaning you care about.
Failure modes when composition is informal
| Mode | Symptom | Repair |
|---|---|---|
| Implicit interface | Works only if teams share unwritten lore | Promote lore to typed ports |
| Hidden channel | Globals/caches couple boxes invisibly | Surface channels as wires |
| Arity blindness | Binary glue forced onto multi-party joins | Use n-ary operations / wiring ops |
| Semantic fork | Same diagram, conflicting meanings | Fix one algebra; version others explicitly |
Diagnose a non-compositional join
- 01List the parts you claim to compose and the whole you claim to get.
- 02Write the interface of each part: what enters, what leaves, what is invariant.
- 03Write the glue: which ports connect, which types must match, which resources are shared.
- 04Ask: if I replace one part by another with the same interface, does the whole’s meaning update only through that interface?
- 05If the answer needs “tribal knowledge” beyond the interface, the design is not compositional yet.
Check yourself
Retrieval practice — feedback explains why.
Explain it back
Name a system you know that failed because two parts were correct alone but wrong when joined. What interface was missing?
Sources · claim ledger
Compositionality requires that the meaning of a composite system is determined by the meanings of its parts and the way they are composed — formalized when semantics is an algebra over a composition operad.
Spivak wiring diagrams + standard categorical usage · 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