Agent reading guide
To ground this example in the cited theory, focus your reading on:
- Contracts as relations: a contract on a box \(X\) is a subset \(R \subseteq X_{in}\times X_{out}\), i.e. a predicate on input/output pairs.
- Contracts form an algebra: a functorial mechanism that takes a wiring diagram and “pushes” internal contracts to a composite external contract.
- Composition = existential elimination: internal wires disappear from the external view, so the composite predicate quantifies over them.
In the Formalism tab we write the generic rule and then instantiate it for wall+roof.
What you are seeing
This wiring diagram is the syntax (how subsystems connect). The contracts are the semantics (what must be true).
Wire colours indicate roles or the current check result, not exact types. The signatures distinguish nonnegative real values from Boolean values; a green wire means the selected toy predicate holds, not that a physical handoff is approved.
In operad language: a wiring diagram is a multi-input “arrangement” of inner boxes into an outer box, and an algebra evaluates that arrangement. In our case, the evaluation produces a predicate (a set of allowed I/O pairs).
Roof safety contract \(C_R\)
Safety requirement: the roof must (i) pass code checks, and (ii) have capacity ≥ safety factor × design load. It also computes the reaction \(r\) that the wall must carry.
Wall safety contract \(C_W\)
Safety requirement: the wall must (i) pass code checks, and (ii) support the roof reaction load \(r\) with margin.
Combiner contract \(C_{\wedge}\)
This box is just the “system verdict”: it turns two booleans into one. (You can treat this as “reporting” the outcome, or as a tiny behavioural model.)
System-level meaning
When you connect roof → wall, the intermediate wire \(r\) becomes “internal”. So the system-level contract talks only about external inputs and outputs: it existentially quantifies over internal values.
That’s exactly the “contracts algebra” idea: a wiring diagram plus component contracts determines a composite contract.
1) Contracts as an algebra over wiring diagrams
A static contract on a box \(X\) is a relation \(R \subseteq X_{in}\times X_{out}\), i.e. a predicate \(P_X(x_{in},x_{out})\). A wiring diagram tells you how inner boxes are connected inside an outer box.
This generic formula belongs to a wiring category that can express feedback; it is not a definition of the narrower acyclic, one-attachment-per-port syntax used in the current resource essay. The example below uses an acyclic connection and computes the existential elimination explicitly. Here “contract” means a static allowed relation, not a separately established assume–guarantee calculus.
2) Instantiating the rule for the wall+roof wiring diagram
Let the outer system (the “shell”) have external inputs \((S, Cap_R, Code_R, Cap_W, Code_W)\) and external output \((ok_S)\). The internal wires are \(r\), \(ok_R\), \(ok_W\).
This is the promised “diagram → predicate” mapping: the wiring determines which internal variables are existentially eliminated.
3) Composing contracts with behaviour
To demonstrate composition with system behaviour, we use a simple deterministic behaviour model: the roof sets \(r := S\); the “ok” booleans compute from the inequalities and code flags; and the system ok is an AND.
Inputs (external wires)
As you change inputs, the diagram overlays update: reaction \(r\), booleans \(ok_R, ok_W, ok_S\), and wire colors.
Outputs + contract checks
Composite predicate (live)
This is the “contracts algebra output”: the wiring diagram plus component contracts yields a single checkable condition.