Unit 1 of 15 · about 4 hours · explain, implement
Abstract state-machine specifications: variables, initial state and next-state relation
Model checking explores a spec, not code. If you cannot write variables plus Init plus Next, every later check in this section has nothing to run on.
You'll be able to
- Write a TLA+ state-machine spec with named state variables, an
Initpredicate and aNextaction, and state what each variable abstracts away. - Run TLC on a finite model and report the constant assignment with every result.
- Distinguish the specification from any implementation, and say which details the spec deliberately omits.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Lecture 1: Introduction to TLA+TLA+ Video Course
Full lecture (21:18): what TLA+ is and the state-machine idea behind every later lecture
- Lecture 2: State Machines in TLA+TLA+ Video Course
Full lecture (15:40): the first spec; copy each variable, Init and Next definition by hand
- Lecture 3: Resources and ToolsTLA+ Video Course
Full lecture (11:13): install the Toolbox, open a spec, view the pretty-printed version and run TLC
If the Toolbox demo moves too fast, pause on each click and repeat it on the Die Hard files from Lecture 4 rather than on a spec of your own.
- Lecture 4: Die HardTLA+ Video Course
Full lecture (19:39): write the water-jugs spec and check it with the parser and TLC
Read the corrections page at https://lamport.azurewebsites.net/video/corrections.html for lectures 1, 3 and 4 before you run anything.
Focus on
- A spec is variables plus
InitplusNext.Initconstrains the starting state; each disjunct ofNextconstrains one step as a relation between unprimed and primed variables. - An action that never mentions a variable leaves it unconstrained.
UNCHANGED varsis what keeps the rest of the state still. - TLC checks a finite model, not the spec in general. Give every declared constant a concrete value, and bound every other source of unbounded state; constant assignments alone need not make the model finite.
- The variables choose the abstraction. The Die Hard variables record jug contents, not jug hardware, pour durations or arm movements.
Common mistakes · 3
- Reading
x' = x + 1as assignment. It is a constraint on the step; anything the action does not constrain may change arbitrarily. - Assuming assigned constants make the model finite. An unassigned constant is a configuration error, but unbounded counters and queues still need explicit bounds, and every bound travels with the result.
- Quoting
No error has been foundwithout the bound. The sentence is only true with the constant assignment attached.
Try it yourself
Closed-book, before checking anything
Init, one pour action with primed assignments and UNCHANGED where needed, and run TLC to an explicit No error has been found result with the bound stated.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What are the three parts of a TLA+ state-machine spec, and what does each constrain?Answer
State variables hold the state.
Initconstrains the starting state.Nextconstrains each step as a relation between the current and the next state, usually run asInit /\ [][Next]_vars.2.An action sets
x' = 1and never mentionsy. What values canytake in the next state?AnswerAny value at all: TLA+ variables have no implicit type. Add
UNCHANGED yto keep it still, or constrain its next value explicitly.3.TLC prints
No error has been foundfor your jugs spec. What exactly have you established?AnswerThat the checked properties hold on the explored finite model only. The claim must name the constant assignment, for example the jug capacities and the pour bound.
4.Why does the Die Hard spec record water levels rather than pour events?Answer
The variables fix the abstraction level. Levels are what the goal and the pour rule talk about; hardware and timing are deliberately omitted.
Practice
- TLA+ Video Course Lecture 4: specify the Die Hard jugs and check them with TLC
Write the spec from the lecture, run the parser and TLC on it
Keep the first TLC error you hit and its fix. The section mini-project reuses this loop on your own model.
You're done when
You write a two-variable toggle spec from memory, TLC reports on it with the bound stated, and you can point to one detail the spec omits on purpose.
Only when you can do this without notes.
Leads to
Notes
Resources · 1 for this unit, 14 more in the section
- TLA+ Video CourseLeslie Lamport · primary
Complete lectures 1 to 10 (lectures 8, 9 and 10 have two parts each) and check the corrections page, while specifying a reduced transaction, workflow or replicated-log model from the capstone. Run TLC after every extension, report the model bounds with every result, and retain the first meaningful counterexample rather than polishing only the final model.
Also in this section
- TLA+ ExamplesTLA+ Foundation · support
Check
specifications/transaction_commit/(TCommit.tla,TwoPhase.tla,PaxosCommit.tlawith their.cfgfiles) with TLC alongside the lectures, and read the Paxos specifications for depth.specifications/TwoPhase/is a hardware handshake, not transaction commit. - Cambridge Concurrent and Distributed Systems Notes (Kleppmann) - CRDTs and CollaborationUniversity of Cambridge (Martin Kleppmann) · support
Use Section 8.1 (operation-based and state-based CRDTs, operational transformation) for the CRDT unit, and work Exercise 21 (prove the operation-based map CRDT converges) and Exercise 22 (its multi-value variant).
- A Comprehensive Study of Convergent and Commutative Replicated Data Types (Shapiro et al., 2011)INRIA report (Berkeley course copy) · support
Read Sections 1 to 3 (state-based and operation-based definitions, the semilattice and delivery conditions) and one example type for your implementation, not the whole catalog.
- Learn TLA+Hillel Wayne · support
Use the core lessons and the examples as a second explanation when a lecture stalls, and as the PlusCal reference if you write algorithms rather than raw actions.
- Hypothesis - Stateful TestingHypothesis · required
Use
RuleBasedStateMachineagainst a reference model for property-based state-machine tests of your extension, keep the failing seeds and shrunk examples, and plant a bug to show the machine detects it. - MIT 6.5840 - Verification Lecture and Final ProjectMIT PDOS · required
Study the Spring 2026 verification lecture and IronFleet reading, then use the final-project guidance to frame a bounded real-system extension, evaluation and report. Course grading and staff review are unavailable to self-study, so use the roadmap defense rubric.
- Jepsen - Consistency Models and AnalysesJepsen · required
Use the framework's generator, client, nemesis and checker roles to design the campaign, Knossos for single-register linearizability and Elle for transactional anomalies on recorded histories, and the public analyses for fault models. A simplified local checker must declare its object, model and completeness limits.
- Elle: Inferring Isolation Anomalies from Experimental Observations (Kingsbury and Alvaro)arXiv · required
Read how Elle infers version orders from list-append and register histories and detects cycles for G0 to G2. It needs complete histories, and a clean run is not a proof of serializability.
- How Amazon Web Services Uses Formal Methods (Newcombe et al., 2015)Amazon Science · support
Read it for why industrial teams specify designs in TLA+ and which bugs model checking found that testing missed. Its effort figures are anecdotes, not benchmarks.
- FoundationDB: A Distributed Unbundled Transactional Key Value Store (Zhou et al., 2021)FoundationDB · support
Read the simulation-testing section (deterministic single-threaded simulation, fault injection, seed replay) as the model for your own scheduler, and the architecture for unbundled transactions.
- DDIA 2e - Chapters 9, 10 and 14 ReviewMartin Kleppmann and Chris Riccomini · required
Revisit uncertainty, consistency, consensus and responsible system design while extracting the final contract. Use the book to challenge assumptions and alternatives, not to replace executable evidence.
- HLD Handbook - CRDTs, Multi-Region and Architecture Trade-offsHLD Handbook · support
Read the CRDT, multi-region, distributed SQL and relevant case-study chapters only after the formal core passes. Use its design prompts to prepare the final comparison and defense.
- CMU 15-721 - Selected Advanced Database Systems UnitsCarnegie Mellon Database Group · depth
Select at most one lecture group that informs your extension: #02 and #03 (data formats and encoding), #08 (scheduling and coordination) or #17 to #22 (system analyses such as BigQuery, Databricks, Snowflake, DuckDB and Redshift), with their papers. The course project needs a group, cloud credits and staff sign-off, so there is no runnable self-study project.
- Replicated Log and Stream Processor - Final CapstoneRoadmap-Final · support
Finish the protocol and invariant specification, deterministic fault campaign, bounded real-code extension, fallback, ablations, workload regions, negative result, operations dossier and independent reproduction package.