Liveness & Fairness · Page 2 of 5
Temporal Properties & Stuttering
An Invariant expresses safety: nothing bad ever happens.
A Property expresses liveness: something good eventually happens.
Level-3 temporal primitives work inside Property:
always(p)—□p:pholds in every state of the behaviour.eventually(p)—◇p:pholds in some state of the behaviour.leads_to(p, q)—p ~> q: wheneverpholds,qeventually holds.
Now look at UnfairSemaphore on the right. It claims
leads_to(s.available == 0, s.available > 0) — whenever the semaphore runs out
of permits, a permit will eventually be released. Why does it FAIL?
Because in TLA⁺, □[Next]vars always permits stuttering:
the system is allowed to stop taking steps forever! Without a Fairness assumption,
the behaviour can reach available == 0 and simply sit there forever.
Try it: Click Check to see the stuttering lasso counterexample.
On the next page we'll fix it with
weak_fairness!