An exhibit · November 2026
A small heating controller, written in the notations that suit its parts: SQL for the data, a state machine for the behaviour, refinement types for the decoder, TLA+ and SMT for the proofs, Nix for the toolchain. The links between them are generated and type-checked. Then it was broken on purpose, one notation at a time, to see whether something else noticed.
00Gulliver
And the same scene, with the ropes named:
At the start of Gulliver's Travels Gulliver wakes on the beach at Lilliput and can't move. He is held by a great many slender threads, each of which he could break, and in fact he does break the ones on his left arm. No single thread holds him. What holds him is how many there are, and that they run to different stakes.
That is how this exhibit is built. No check catches every break (section 05). But each notation is tied to something written independently of it, so every break pulls against at least one rope. Here the giant is a coding agent and the code it writes. The ropes belong to the person who owns the system, and the slack between them is the agent's to use. Tie until every way the giant can still move is one you would accept.
The scene carries a warning too. The Lilliputians tied Gulliver so that he could do nothing at all, which is safe and useless. A decoder that rejects every row is exactly that kind of rope (section 07). So some ropes pull the other way: the machine must heat when it should, as well as not heat when it shouldn't. The dashed rope is the host. What the machine guarantees is proved. That the host tells it the truth is checked on the days that were run, and proved of none (section 04).
Swift also gave Lilliput a war over which end of an egg to crack. The many-notations idea declines to fight it. Each part keeps the notation it reads most clearly in, and the notations have to agree only on the types where they join.
01Try it
This is the real machine. The page fetches zone.json, the artifact the proofs are about, and runs it on the Glassbox runtime compiled to JavaScript. Every reading passes through the proved decoder and setpoint function first. You play the database: the window switch and the two settings are the zone's row. A simulated room sends a reading every second.
The room
window-changed.
The window switch then changes the row without sending window-changed. The machine still hears every reading, and every reading says where the window is.
The machine
What the machine was last told
| waiting for the first step |
Events, newest first
The second item is the point of the demo. The machine does nothing wrong there; it does exactly what it was proved to do. The host broke its side of the agreement, and "never heating with the window open" depends on both sides (section 04). With the careless host off, the switch is the event: every change to the window arrives as window-changed, so this page meets the host's obligation by construction. A host that reads a database somebody else writes to has no such guarantee, which is why the exhibit's own host is checked on recorded runs.
02The system
It heats when a reading falls below the low setpoint (target minus hysteresis), stops at the target, stops when the window opens, and stays in Fault until someone resets it. It is small on purpose, so that every state can be checked.
stateDiagram-v2 direction LR [*] --> Off Off --> Idle: power on Idle --> Heating: reading < low setpoint, window closed Heating --> Idle: reading ≥ target, or window opened Idle --> Off: power off Heating --> Off: power off Idle --> Fault: sensor lost Heating --> Fault: sensor lost Fault --> Idle: reset
Its claims are written by hand, apart from the machine, so that they are an independent statement of what it should do:
\* M1 heating is entered only on a step that says the window is closed \* M2 told the window has changed and is open, it is not heating afterwards \* I2 Fault is left only by reset \* R1 idle, window closed, reading below the low setpoint: it heats \* R2 heating, reading at or above the target: it stops \* H1 the reading that starts the heating does not also stop it \* I1 never heating while the window is open (derived, section 04)
Some say what must never happen and some say what must happen. Safety claims alone are satisfied by a machine that never moves, which was the first thing review found (section 07).
03The notations
| Part | Notation, and how it is tied to the others |
|---|---|
| The data | SQL. schema/zone.sql is the source of truth. A typed table (rowtype-yoga) is generated from it, and so are the refinement specs and the ranges the proofs use. |
| The behaviour | A Glassbox state machine, machines/zone.json. The host runs it as data, and no PureScript names its states. Glassbox generates its vocabulary as PureScript rows and its rules as TLA+ and SMT. |
| The decoder | Refinement types, checked by liquid-purescript. The spec is generated from the SQL CHECK constraints, column by column, by name. The decoder is proved to accept exactly the rows the schema allows, and to hand them on unchanged. |
| The proofs | TLA+ and SMT. TLC model-checks the generated machine, and z3 proves the same properties for every integer. A conformance table holds the interpreter to both. |
| The toolchain | Nix. flake.nix pins every tool and Postgres, and the same runs reproduced on two machines. |
schema/zone.sqlauthored
CREATE TABLE zone ( id INTEGER PRIMARY KEY, name TEXT NOT NULL UNIQUE, target_temp INTEGER NOT NULL CHECK (target_temp BETWEEN 50 AND 300), hysteresis INTEGER NOT NULL CHECK (hysteresis BETWEEN 1 AND 30), window_open BOOLEAN NOT NULL );
Temperatures are integers in tenths of a degree, so the target runs from 5.0 to 30.0 °C. Those are the limits the demo's decoder enforces.
machines/zone.jsonauthoredthe facts and one rule shown
"facts": [
{ "id": "reading", "kind": "quantity" },
{ "id": "target_temp", "kind": "quantity" },
{ "id": "low_setpoint", "kind": "quantity" },
{ "id": "window_open", "kind": "truth" } ],
{ "from": "idle", "on": "reading", "cases": [
{ "when": { "all": [
{ "not": { "fact": "window_open" } },
{ "op": "lt", "left": { "fact": "reading" }, "right": { "fact": "low_setpoint" } }
] }, "to": "heating" },
{ "stay": true } ]}
core/src/Generated/ZoneRow.lpsgenerated from the SQL
-- each CHECK constraint becomes a refinement on the field of the same name type Zone = { id :: Int , target_temp :: { v : Int | (50 <= v && v <= 300) } , hysteresis :: { v : Int | (1 <= v && v <= 30) } , window_open :: Boolean } -- a refined field is an invariant: proved wherever ZoneAccepted is built data ZoneDecoded = ZoneRejected | ZoneAccepted Zone -- complete (accepts exactly what the schema allows) and faithful (by name) decodeZone :: { row : ZoneColumns } -> { decoded : ZoneDecoded | (zoneAccepted decoded == (50 <= row.target_temp && … && row.hysteresis <= 30)) && (not (zoneAccepted decoded) || (zoneDecodedId decoded == row.id && …)) }
model/ZoneMachine.tlagenerated from the JSONone line shown
[] state = "idle" /\ event = "reading" ->
IF (~(facts["window_open"]) /\ (facts["reading"] < facts["low_setpoint"]))
THEN "heating" ELSE state
flowchart LR SQL["zone.sql
(authored)"] -->|notothenia| T["typed table
(PureScript)"] SQL -->|notothenia| L["refinements
(.lps)"] SQL -->|notothenia| R["ranges
(TLA+ / SMT)"] M["zone.json
(authored)"] -->|Glassbox| V["vocabulary
(PureScript)"] M -->|Glassbox| MT["machine
(TLA+ / SMT)"] E["claims and
environment
(hand-written)"] --> C{{"TLC · z3"}} R --> C MT --> C L --> P{{"lps + z3"}} T --> H["host"] V --> H M -->|interpreted| H
Some joints are held by the compiler where you might expect a test. A host that supplies the wrong kind of value for a fact, such as true-or-false where the machine declares a number, does not compile, and the error names the fact. Nor does a host that has lost a column the machine reads. Everything generated is regenerated by a freshness check, which refuses any file that differs.
04The window
"Never heating with the window open" sounds like a property of the machine. It isn't, and the model checker says so. Hand the machine arbitrary facts, and on a reading it can be told, out of nowhere, that the window is now open. It is obliged to look at the window only when told the window changed, so it stays heating. The claim has to be split.
Proved of the machine told anything at all, by TLC and by z3, with no assumption about the host.
window-changed event.Proved of nothing. Checked on every recorded run of the host, by a monitor that reads the row itself.
z3 derives "never heating with the window open" from M1, M2 and H-frame alone, without reading the machine's rules. Remove any one of the three and the derivation fails, so all three are needed. The claim that can honestly be made is this one:
The machine never heats with the window open provided the host tells it of every change to the window with a window-changed event before any other event, and tells it the row as it is. Both provisos are checked of the runs that were run and proved of none.
The two provisos fail in different ways when somebody writes to the row and no event follows. A host that reports what it reads breaks H-frame: on the next reading the machine hears the window is open and is not obliged to act. A host that caches the window and refreshes it only on window-changed keeps H-frame perfectly and breaks H-faithful. Both end up heating with the window open, and only the monitor sees the second, because it asks the row and not the machine. The Careless host switch in section 01 is the first of these.
The run below is the window guard deleted from the idle-to-heating rule: one edit to zone.json, with the generated files regenerated. M1 fails in both tools.
TLC, over the machine told anything
Error: Action property M1 is violated. /\ state = "off" /\ facts = [reading |-> 0, target_temp |-> 0, low_setpoint |-> 0, window_open |-> FALSE] /\ state = "idle" (power-on) /\ state = "heating" (reading) /\ facts = [reading |-> 0, target_temp |-> 0, low_setpoint |-> 1, window_open |-> TRUE]
z3, for every integer
of the machine, whatever it is told: I2 ✓ PROVED M1 ✗ REFUTED M2 ✓ PROVED R1 ✓ PROVED R2 ✓ PROVED | state idle, event reading, next heating, reading 0, low 1, window true of the machine in a host that meets its obligations: H1 ✓ PROVED I1-initial ✓ PROVED I1 ✓ PROVED (derived from M1 and M2 as stated)
Before the edit every line is PROVED, and TLC finds no error in 962 distinct states.
05The record
Each row is one deliberate break in one place. The whole row, which checks catch it and which don't, was predicted and committed before the break ran. Every cell below came out as predicted.
| # | Break | tlc | z3 | conform | facts | lps | fresh |
|---|---|---|---|---|---|---|---|
| The machine | |||||||
| B1 | window guard dropped from idle → heating | M1 | M1 | ||||
| B2 | heating guard made too strict | R1 | R1 | ||||
| B3 | never stops at the target | R2 | R2 | ||||
| B4 | power-off leaves Fault | I2 | I2 | ||||
| B10 | heating ignores the window opening | M2, I1 | M2 | ||||
| B12 | a new case: window open and reading above 100.0 → heating | M1 | M1 | ||||
| The tools between the notations | |||||||
| B5 | interpreter: ≥ evaluated as > | ✓ | |||||
| B6t | TLA+ generator: ≥ as > | R2 | ✓ | ||||
| B6s | SMT generator: ≥ as > | R2 | ✓ | ||||
| B11 | M2, as stated for the solver, weakened to "true" | I1 | |||||
| The data and the code that reads it | |||||||
| B7a | setpoint code: target + hysteresis | ✓ | ✓ | ||||
| B7b | the same, with its spec changed to match | ✓ | |||||
| B8a | schema: target allowed from 0 | ✓ | |||||
| B8b | schema: hysteresis allowed from −0.5 | H1 | H1 | ✓ | |||
| B9 | decoder: id and hysteresis crossed | ✓ | ✓ | ||||
Green: caught, and predicted to be caught, with the property that failed. Blank: not caught, and predicted not to be. B11 shows the derivation in section 04 really uses M2: weaken it and the solver can no longer derive I1.
And the host, on recorded days against a real Postgres. Four questions are asked of each run: did the monitor see heating with the row's window open, was every step the generated machine's step, did the window change only on window-changed, and was each step taken from where the last one left the machine.
| # | Break in the host | monitor | steps | frame | chain |
|---|---|---|---|---|---|
| HB1 | the row's window written, and no event follows | ✓ | ✓ | ||
| HB2 | sends reading where it should send window-changed | ✓ | ✓ | ||
| HB3 | throws away the state each step returns | ✓ | |||
| HB4 | interpreter: ≥ as >, on a day with 21.0 against a 21.0 target | ✓ | |||
| HB5 | caches the window, refreshing it only on window-changed | ✓ |
The other suites, also all as predicted: renames across the joints (4 of 4, each caught by the compiler or the boot check, naming what moved; one is a host supplying true-or-false as the reading), refinements (7 of 7), and hand edits to generated files (6 of 6, each refused by name).
No check catches everything, and that is the design. A break in the machine is caught by the model checker and the solver. A break in a tool between notations is caught by the conformance table. A break in the code that reads the data is caught by the proof or the end-to-end fact check. A break in the host is caught by the questions asked of its runs. Each part is checked against something written independently of it.
06How it was built
The exhibit was built by two Claude sessions on two machines over two days, under one rule: every break's outcome is predicted and committed before it runs, and each side tries to break what the other built. A prediction that comes out wrong is recorded, not edited. The first full table had one. B3, deleting the stop-at-target rule, made the solver report an error instead of refuting the claim. The cause was in Glassbox, which inferred the type of a fact from the rules that read it. Delete the only rule that read target_temp and the fact lost its type, and the generated SMT function lost an argument. The machine format now has every fact declare its kind, and on the next run B3 came out as predicted, with its prediction unedited since before the first run.
Three of the first version's checks were retired along the way: a hand-written TLA+ model, a second copy of the controller written as a function, and a trace replay. They went one at a time, with the full table rerun after each and a record of which new check now catches what the old one did. Each was a second statement of the behaviour, and so one more thing that could disagree with the artifact. Now there is one statement, zone.json, and everything else is checked against it.
07What review found
_ is named v by the compiler, and v is also the usual name for a spec's result, so zero _ = 0 was proved to return its argument. Fixed, with trap cases that the old code wrongly passed.Most share a shape: a check that ruled out the bad case and said nothing about the good one, or a check whose justification was a comment rather than another check. It turned up in a decoder, in a set of safety claims, in the assumptions and in the tools. The rule that came out of it: every check states both directions, or names the direction it leaves out. In Gulliver's terms, each was a rope that stopped him doing harm and never asked whether he could still work.
The rule applies over time too. A result counts only while the check that produced it still runs. Twice a claim outlived its check. Once, a broken test harness hid behind an earlier "7 of 7". Once, a trace replay would have gone on replaying stale traces after the step that refreshed them was retired. Both were caught before they misled anyone, and the harness now refuses to start on anything but the committed tree.
08Limits
Zone without the decoder. Inside the verified core that is reported; in the host, only the end-to-end fact check sees it.