An exhibit · November 2026

Many notations,
one type system.

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.

5notations, joined by generated and type-checked links
37deliberate breaks across five suites, the catchers of each predicted and committed before it ran
37caught exactly as predicted, in the final runs
9gaps found by adversarial review that the breaks had missed, one of them in the verifier

00Gulliver

A giant held by a lot of small ropes.

Engraving: Gulliver lies on his back on the beach, his long hair pegged to the ground, while tiny Lilliputian archers climb onto his chest.
“I likewise felt several slender ligatures across my body, from my armpits to my thighs.” J. J. Grandville, for the 1838 French edition of Gulliver's Travels. Public domain, via Wikimedia Commons.

And the same scene, with the ropes named:

types lps TLC z3 conform facts fresh the host checked, not proved

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

The zone, running in your browser.

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

17.5°C
target 20.0 °C
heats below 19.0 °C
targetlow setpointheatingwindow openheating with the window open
Each change sends window-changed.
Power
°C
The schema allows 5.0 to 30.0. Try 40.
°C
0.1 to 3.0. It heats below target minus this.

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

offzone valve closed
Never heating with the window open: holdingThe monitor asks the row, not the machine, after every step.

What the machine was last told

waiting for the first step

Events, newest first

    • Let it heat, then open the window. It stops at once.
    • Close the window, turn on Careless host, wait for it to heat, and open the window again. It keeps heating, and the monitor turns red.
    • Set the target to 40. The decoder refuses the row, and the machine is told nothing until the row is valid again.

    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

    A heating zone with a window.

    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

    Two files are authored. Most of the rest is generated from them.

    PartNotation, and how it is tied to the others
    The dataSQL. 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 behaviourA 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 decoderRefinement 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 proofsTLA+ 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 toolchainNix. 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

    How the pieces connect

    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

    What is proved of the machine, and what the host is trusted to do.

    "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.

    The machine guarantees

    • M1: it starts heating only on a step that says the window is closed.
    • M2: told the window changed and is open, it stops heating.

    Proved of the machine told anything at all, by TLC and by z3, with no assumption about the host.

    The host must

    • H-frame: change the window fact only with a window-changed event.
    • H-faithful: tell the machine what the row says, at every step.

    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

    Every break, and what caught it.

    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.

    #Breaktlcz3conformfactslpsfresh
    The machine
    B1window guard dropped from idle → heatingM1M1
    B2heating guard made too strictR1R1
    B3never stops at the targetR2R2
    B4power-off leaves FaultI2I2
    B10heating ignores the window openingM2, I1M2
    B12a new case: window open and reading above 100.0 → heatingM1M1
    The tools between the notations
    B5interpreter: ≥ evaluated as >✓
    B6tTLA+ generator: ≥ as >R2✓
    B6sSMT generator: ≥ as >R2✓
    B11M2, as stated for the solver, weakened to "true"I1
    The data and the code that reads it
    B7asetpoint code: target + hysteresis✓✓
    B7bthe same, with its spec changed to match✓
    B8aschema: target allowed from 0✓
    B8bschema: hysteresis allowed from −0.5H1H1✓
    B9decoder: 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 hostmonitorstepsframechain
    HB1the row's window written, and no event follows✓✓
    HB2sends reading where it should send window-changed✓✓
    HB3throws away the state each step returns✓
    HB4interpreter: ≥ as >, on a day with 21.0 against a 21.0 target✓
    HB5caches 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

    Two agents, each trying to break the other's work.

    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

    Gaps the breaks missed, and a pattern.

    • Decoder
      A decoder that rejects every row was proved safe, because "whatever I accept is valid" says nothing about what it refuses. Now it is proved to accept exactly what the schema allows.
    • Decoder
      A decoder that returns a constant still passed that. Now what it returns must equal what it was given, field by field, by name.
    • Decoder
      Two swapped columns passed the proof, because the spec described a zone by position. liquid-purescript gained record types so that every link is by name, and the swap is now refuted (B9).
    • Proof
      The proof was of a function that doesn't run. The first version proved a hand-written copy of the machine while the host ran the JSON. Now the JSON itself is lowered and proved.
    • Window
      The window can change without an event, because the host re-reads the row on every reading. This is what forced the split in section 04.
    • Verifier
      The verifier could prove a false claim. A parameter written _ 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.
    • Host
      A fact's declared kind bound the machine but not the host. A host could supply true-or-false for a number and it would run, with every comparison on it quietly false. Now it is a compile error.
    • Model
      The model checker tried too few numbers. It used the values 0 to 2, justified by a comment saying the rules compare quantities only with each other. Add a rule that compares with 1000 and the model checker found nothing; only the solver did. Glassbox now generates the values from the machine's own constants (B12).
    • Host
      The host's checks could pass on a broken run. They asked about what the host told the machine, so a host that cached the window passed them all. The second proviso, and HB5, came from this.

    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

    What this does not show.

    • One small system and about forty distinct breaks. It shows the method works here, not that it scales.
    • The host's obligations are checked on the days that were run and proved of none. A host that noticed every change to the row and sent the event itself would meet H-frame by construction; this one does not yet.
    • Time. Between events the host looks at nothing, and the gap between a change to the row and the machine hearing of it is the polling interval. It is unproved.
    • The order in which the host carries out commands is unchecked.
    • The claims are written twice, for TLA+ and for SMT, and nothing compares the two statements. That is why B11 is invisible to TLC.
    • A bug in a generator that all of its outputs share would pass. Freshness compares two runs of the same generator.
    • A record type can't be hidden the way a constructor can, so any module can build a Zone without the decoder. Inside the verified core that is reported; in the host, only the end-to-end fact check sees it.