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 Init predicate and a Next action, 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

Abstract state-machine specificationState variables, initial state and next-state relation
1

Read

In this order, only the parts listed

0 of 4 done

  1. Lecture 1: Introduction to TLA+TLA+ Video Course

    Full lecture (21:18): what TLA+ is and the state-machine idea behind every later lecture

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

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

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

2

Focus on

  • A spec is variables plus Init plus Next. Init constrains the starting state; each disjunct of Next constrains one step as a relation between unprimed and primed variables.
  • An action that never mentions a variable leaves it unconstrained. UNCHANGED vars is 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 + 1 as 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 found without the bound. The sentence is only true with the constant assignment attached.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write a two-jug spec skeleton from memory: variables, 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.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.What are the three parts of a TLA+ state-machine spec, and what does each constrain?Answer

    State variables hold the state. Init constrains the starting state. Next constrains each step as a relation between the current and the next state, usually run as Init /\ [][Next]_vars.

  2. 2.An action sets x' = 1 and never mentions y. What values can y take in the next state?Answer

    Any value at all: TLA+ variables have no implicit type. Add UNCHANGED y to keep it still, or constrain its next value explicitly.

  3. 3.TLC prints No error has been found for your jugs spec. What exactly have you established?Answer

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

5

Practice

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.tla with their .cfg files) 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 RuleBasedStateMachine against 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.