Chapter
09
Eventually
Part III · Time
Lessons
About
Here is a finite log from a server: a request, then nothing. Can it show that the server will never respond?
It cannot, and the reason opens the second half of the course. Every invariant you have written so far says that something bad never happens, and a finite trace can show the bad thing. This chapter is about the other kind of claim: that something good eventually happens. No finite trace can refute that, so TLC shows you an infinite behavior instead, drawn as a lasso. And it turns out that a spec allows the system to do nothing at all, which is why "eventually" always needs an assumption.
The goals: safety and liveness, defined precisely; the operators [], <>, []<>, <>[] and ~>; reading lasso counterexamples; PROPERTY and the separate liveness cfg; and three things that are easy to confuse: deadlock, termination and liveness.
Before you start
- Chapters 03 and 04: TLC, invariants, and stuttering.
- Chapter 06 helps for the review and for one practice item.
- Time: the chapter page shows the estimate, generated from the lessons.
What else is here
specs/:TrafficLight,Lighthouse,Elevator,BoundedBuffer, and the one-change variants the lessons run. Every spec but the lighthouse has a safety cfg and, where it matters, a.live.cfg; the lighthouse has one cfg per property, for the table in 09-02.review/(09-review): a teammate's nightly backup, with deadlock checking on and a reason it never fires.ai/1-guarantees-progress/(09-ai1): an AI-written dispatcher and a message claiming "this guarantees progress".gate/(09-gate): a three-floor dumbwaiter;gate/twin/(09-gate-twin): a ticket queue at a deli counter. You write the liveness property and the assumption it needs.
Run it
From the repository root:
./tla check 09-01
./tla check 09-review
./tla check --gate 09Skills
intent (stating intent as properties), counterexamples (reading them).
Elsewhere
- Web version: https://indicogni.com/learn/tla-plus/09-eventually/
- Recaps:
CONCEPTS.md. Hints and explanation checks:HINTS.md. Predictions without answers:PREDICT.md. - Solutions:
solutions/chapters/09-eventually/, including the gate references and their mutants.
Beyond the lessons
- 09-review Review a teammate’s spec ·
chapters/09-eventually/review/·./tla check 09-review - 09-ai1 AI item ·
chapters/09-eventually/ai/1-guarantees-progress/·./tla check 09-ai1 - 09-gate Gate ·
./tla check --gate 09Hints
Hint 1
Write
TypeOK,Init,CallandClosefirst, with the cfg, and run it after each. ThenOpen, then the three movements. WriteLivenessbefore you add the assumption toSpec, and watch it fail.Hint 2
UpandDowneach need four conditions: the direction, a closed hatch, no call at the car's own floor, and a waiting floor ahead.Turnneeds waiting floors, none at the car's floor, and none ahead in the current direction.Hint 3 (nearly the answer; opening it marks a pass as "passed with help")
Safetyrelateshatchandcar.Livenessis about every floor, and aboutcallsandhatch; lesson 09-02's table has the operator for "whenever this, later that".Specgets the assumption from lesson 09-04. - 09-gate-twin Gate twin, another domain ·
./tla check --gate 09 --twinHints
Hint 1
Write
TypeOK,Init,TakeTicketandShutWindowfirst, with the cfg, and run it after each. ThenOpenWindow, then the three movements. WriteLivenessbefore you add the assumption toSpec, and watch it fail.Hint 2
StepRightandStepLefteach need four conditions: the heading, a shut window, no ticket at the clerk's own station, and a waiting station ahead.TurnAroundneeds waiting stations, none at the clerk's station, and none ahead.Hint 3 (nearly the answer; opening it marks a pass as "passed with help")
Safetyrelateswindowandclerk.Livenessis about every station, and aboutticketsandwindow; lesson 09-02's table has the operator for "whenever this, later that".Specgets the assumption from lesson 09-04.