Unit 5 of 15 · about 5 hours · implement

A replicated-log or workflow specification

The capstone log is the largest thing you will specify in this track. This unit turns the lecture examples into your own log's first checked model.

You'll be able to

  • Write a state-machine spec of the capstone replicated log: variables for log, epoch, commit index and messages.
  • State its safety invariant (committed entries are never replaced) and its liveness assumption (what the network must eventually do).
  • Run TLC after every extension and keep the first meaningful counterexample, not just the final passing model.

Covers

Replicated-log or workflow specification
1

Read

In this order, only the parts listed

0 of 4 done

  1. Lectures 5 and 6: the commit-model repertoireTLA+ Video Course

    Lecture 5 (24:39) plus lecture 6 at https://lamport.azurewebsites.net/video/video6.html (21:22): abstract commit, then how 2PC achieves it; reuse their variable discipline (manager state, coordinator state, message set) for log, epoch and commit-index variables

  2. PaxosCommit.tla for depthTLA+ Examples

    PaxosCommit.tla with its .cfg: read how a fault-tolerant commit spec adds ballot state beside the commit state

    Read only. Your checked model here is your own reduced log, not PaxosCommit.

  3. How Amazon Web Services Uses Formal MethodsHow Amazon Web Services Uses Formal Methods (Newcombe et al., 2015)

    The full paper (CACM 58(4), pp. 66-73): which systems got models, the per-component spec sizes and bug counts in the findings table, and the design-tool framing

    Treat the line counts and bug counts as effort anecdotes from one organization, not productivity benchmarks. Your obligation is TLC bounds on your own model.

  4. Replicated Log and Stream Processor: protocol specificationReplicated Log and Stream Processor - Final Capstone

    Protocol and state-machine specification and invariants deliverable: the spec contract your model must satisfy

2

Focus on

  • Reduce before you specify. Model one partition's log with a fixed manager set first; multi-partition and membership changes are later extensions, each with its own TLC run.
  • Committed means what your spec says it means. Name the commit point (majority acknowledgment, leader decision) as an action, not as prose.
  • Every extension re-runs TLC. A passing run before the extension says nothing about the model after it.
  • Keep the first meaningful counterexample per extension. A trace that changed the spec is evidence; a final green run alone is not.
Common mistakes · 3
  • Specifying the whole capstone at once. Start with one partition and a fixed manager set, bound log length, values, epochs and messages too, and report completion and state counts for that exact model rather than promising a runtime.
  • Leaving the network's faults unstated. A persistent unordered message set with repeated receipt already represents loss, duplication and reordering, as TwoPhase does; a FIFO queue needs explicit fault actions.
  • Polishing away the failing trace. The first counterexample is the unit's main artifact; keep it with the bound that produced it.
3

Try it yourself

Closed-book, before checking anything

From a blank file, write Init and Next for a single-decree commit with two resource managers, bound it, and run TLC to a stated distinct-state count with No error has been found.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.What belongs in the first version of your log spec?Answer

    One partition, a fixed manager set, log plus epoch plus commit-index variables, append and commit actions, and the committed-entries-preserved invariant. Everything else is a later extension with its own run.

  2. 2.Why run TLC again after every extension?Answer

    Each extension changes the state space. A green run on the smaller model does not cover the larger one.

  3. 3.What does the AWS paper's findings table actually show?Answer

    Per-component spec sizes (for example an 804-line PlusCal model) beside the bugs each model found (two bugs for that one). It shows models find bugs; it does not set a bugs-per-line rate.

  4. 4.Your spec passes with three managers. What may you claim about five?Answer

    Nothing. A larger bound is a new check; report each bound with its own count.

You're done when

Your reduced log spec checks green at a stated bound, and each extension has its own run plus its first meaningful counterexample on file.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 11 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.

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

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

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

Also in this section

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

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