Specifications & State · Page 3 of 6
Actions, Guards, and prime
Each action method has up to four clause kinds inside its Annotated[...] return type:
Requires(p)— the guard. The action is enabled only when everyRequiresholds.Action(p)— the transition, relating before (s.x) and after (prime(s.x)).Ensures(p)— postcondition on the step and returnresult.Modifies("v", ...)— explicit frame restricting which variables may change.
Automatic frame rule: In TLA⁺ you must manually write
UNCHANGED <<...>> for every variable an action leaves alone. In
temporal-typing, an action changes only the variables in its frame (the
ones named in Modifies, written by its body, or placed under prime(...)).
Every other variable is implicitly unchanged — though you may still write
unchanged(s.level) explicitly for emphasis.
Try it: Look at
fill: it primes only s.level, so
valve_open stays unchanged automatically. Change s.level < 5 to
s.level <= 5 and click Check to violate within_capacity.