Chapter

01

States, steps, behaviors

Part I · Behaviors before syntax

  • 4 lessons
  • 2 h 40 min of core lessons
  • Skills: abstraction

Lessons

About

A luggage lock with three wheels. How many states can it be in? And when it springs open, is "open" a state, or an event?

Those two questions open the chapter. A state is a snapshot: a value for every variable at one instant. A step is a pair of states, before and after. A behavior is an infinite sequence of states, even for a system that stops. A spec is a filter that lets some behaviors through and holds the rest back. The logic underneath TLA+ is built from these four ideas, so you meet them first, before any syntax.

There is no TLA+ to write here. You draw state graphs by hand, then build small models in the state-graph builder, which computes every reachable state in your browser. The numbers the lessons quote come from TLC, run on TLA+ copies of the same models. Chapter 02 reads the traffic light, and a close variant of the dial lock, in TLA+.

Before you start

  • Chapter 00, or at least lesson 00-02 (states and interleavings).
  • A pencil and paper for 01-02.
  • The tools from 00-03 are optional: every lesson works in the browser, and ends with one ./tla check command for those who have them.
  • Time: the chapter page shows the estimate, generated from each lesson's own minutes field.

What else is here

  • specs/: TLA+ copies of the builder models (which are in labs/models/state-graph/) and of the Core results, plus a few cfgs that back claims in the prose.
  • No review, AI item or gate. The AI thread resumes in chapter 02, and gates start in chapter 03.

Run it

From the repository root, if you have the tools:

shell
./tla check 01-01
./tla check 01-04

Skills

abstraction: choosing what a model's state holds, and what it leaves out.

Elsewhere

  • Web version: https://indicogni.com/learn/tla-plus/01-states-steps-behaviors/
  • Recap of each lesson: CONCEPTS.md. Builder hints and explanation checks: HINTS.md. Predictions without answers: PREDICT.md.
  • Answers to every prediction: solutions/chapters/01-states-steps-behaviors/PREDICT-ANSWERS.md. Reference answers for the builder tasks: solutions/chapters/01-states-steps-behaviors/TASKS.md.