Specifications & State · Page 5 of 6
Constants, Assumptions & Levels
A Constant[T] field is fixed by the Model and never changes
during execution. An Assume(lambda s: ...) clause checks that the constants
supplied to a model make sense before exploring any states.
Every expression in TLA⁺ has a level, and each clause enforces its maximum level:
| Level | May use | Clauses |
|---|---|---|
| 0 Constant | constants only | Assume, Where on Constant |
| 1 State | + variables, enabled | Init, Invariant, Requires, Pure |
| 2 Action | + prime, unchanged, result | Action, ActionInvariant, Ensures |
| 3 Temporal | + always, eventually, leads_to, fairness | Property, Fairness |
Using an expression above its clause's level — such as prime(s.used) inside
an Invariant — is rejected statically as level-error.
Try it: Change
constants={"limit": 3} to {"limit": 0}
to trigger FAIL assumption positive_limit. Then try putting prime(s.used)
inside within_limit to trigger ERROR [level-error]!