unchanged · A short history
Machines change. Work, unchanged.
Open-source software, built on models, proofs and verifiers.
unchanged · A short history
Open-source software, built on models, proofs and verifiers.
01Method
Each generation raised the level at which programs are written. None changed what it takes to know a program is correct.
Say what must hold in every reachable state, before the code exists.
Machine code, assembly, high-level languages, natural language. Each generation automated more of this step, and it is the only one that changed. In TLA+, UNCHANGED asserts that a step leaves the listed variables as they were. The name is taken from it.
Check what was written against what was stated. The author of the code, human or agent, is not its judge.
VARIABLES language, understand, write, verify \* Stated first: all three are still required.Inv == understand /\ write /\ verify
Next == \E l \in Languages : /\ language' = l \* "machine code" /\ UNCHANGED <<understand, write, verify>>
$ java -jar tla2tools.jar Engineering.tlaModel checking completed. No error has been found.17 states generated, 4 distinct states found,0 states left on queue.
02Specification
The language defines what a program means, so a compiler can preserve it. What was written is what runs.
One sentence admits many programs. The agent picks one, and nothing in the sentence says whether it picked yours.
Each question gets one answer, in a form a tool can check. A person approves it. After that the code may be rewritten freely; the specification may not.
int add(int a, int b) { return a + b;} ; cc -O1 -S add.c (arm64)_add: add w0, w1, w0 ret
> A committed transaction is never lost. # committed: acknowledged, or on stable storage?# lost: after a crash, power loss, a torn page?# never: in every interleaving, or the ones tested?
Commit(t) == /\ t \in synced \ acked /\ acked' = acked \cup {t} /\ UNCHANGED <<wal, synced>> \* An acknowledged transaction is on stable storage.Inv == acked \subseteq synced
03Evidence
Establishes that the design keeps the invariant in every reachable state, within the bounds checked. Blind to the code: nothing here says the implementation follows the model.
Establishes that the code meets its contract on every input. Blind to whether the contract is the one you meant. This one says sorted, not a permutation of the input, so an empty vector verifies.
Establishes that the real code did the right thing on the runs it made. Blind to every run it did not make. Here one test catches what the proof accepted.
$ java -jar tla2tools.jar -deadlock Commit.tlaModel checking completed. No error has been found.134 states generated, 64 distinct states found,0 states left on queue. \* Txns = {t1, t2, t3}
// spec: the result is sortedpub fn sort(v: Vec<u64>) -> (r: Vec<u64>) ensures forall|i: int, j: int| 0 <= i < j < r.len() ==> r[i] <= r[j],{ Vec::new()}
$ rustc --test sort_test.rs && ./sort_testtest keeps_every_element ... FAILED assertion `left == right` failed left: 0 right: 3 test result: FAILED. 0 passed; 1 failed
04Verifiers
A replicated log, a parser and a cipher fail differently. A map of the field: which verifier sees which failure, and what each is blind to.
JepsenMaelstromTLA+QuintPCatches split brain, lost acknowledged writes, stale reads under partition.
Blind to faults the nemesis never schedules.
ElleKnossosPorcupineLincheckCatches linearizability violations and isolation anomalies: G0, G1c, G2, lost updates.
Blind to operations no client ever issued.
Seeded DSTturmoilmadsimAntithesisCatches rare orderings of time, network and disk, replayed exactly from a seed.
Blind to anything outside the simulated world.
Crash-state enumerationALICECrashMonkeytorn writesCatches data lost, or resurrected, after a crash at any point.
Blind to devices that break the disk model.
loomShuttleCoyoteGenMCThreadSanitizerCatches races, deadlocks and weak-memory reorderings.
Blind to protocols too large to enumerate.
Property testsproptestHypothesislibFuzzerAFL++Catches crashes and broken contracts: round-trips, idempotence, equivalence to a reference.
Blind to deep states, and bugs the reference shares.
MiriASanMSanUBSanKaniCBMCCatches out-of-bounds access, use-after-free, undefined behaviour.
Blind to object bounds the tool was never told.
SQLancerTLPNoRECmetamorphic testingHerbieCatches optimizer logic bugs and floating-point error: wrong answers that never crash.
Blind to relations the metamorphic rule does not state.
TamarinProVerifWycheproofdudectCatches protocol attacks, known-bad edge cases, timing leaks.
Blind to the gap between the protocol model and the code.
Mutation testingplanted defectsmust-fail model configsCatches a suite that passes because it cannot fail.
Blind to defect classes nobody thought to plant.
05Software
Four systems, each built from a specification, with models for the design and verifiers on the code. Varaq, a B+tree database, comes first.
A fast embedded B+tree in Rust, with ACID transactions: the pages in use stay in memory, and a page that is not costs one 4 KiB read.
Version 0.1.0Announcement →See Varaq →
Vector and full-text search, built on object storage.
A black-box verifier for key-value stores: drives a target over its own protocol, injects process, disk, network and clock faults, and checks the history against its contract.
A multi-modal HTAP store: embedded-first, with optional object storage, a query engine, and multi-node and edge.
Models for the design, proofs for the code, verifiers for the running system, each covering what the others miss.