Checker Spec & Diagnostics
Every conforming checker (including Tanny) implements the four-stage pipeline defined in docs/checker.md:
- Read: Parse Python source without importing or executing it, resolve scopes and imports, extract units, and emit static diagnostics. (Implemented by
temporal_typing.frontendandpython -m temporal_typing.) - Translate: Give each valid
Modelits exact TLA⁺ semantics with Python operator behaviour. - Check: Explore the finite state space (or input domains for contracts) and verify every obligation.
- Report: Emit one verdict per model (
PASS,FAIL, orERROR) with Python-level traces.
Supported Python Subset#
Predicates and action/contract bodies accept a well-defined subset of Python given its exact Python meaning:
- Accepted:
int,bool,str,None,tuple,list,frozenset,set,dict,ModelValue; integer arithmetic (+,-,*,//,%), comparisons, comprehensions, common builtins (len,min,max,sum,abs,all,any,range); in bodies: assignment, in-place mutation of state lists/sets/dicts,if/elif/else,for,while,assert,raise,return. - Rejected (
unsupported): float division/,try/except,with, generators/yield,async/await, I/O, and calls into external libraries.
Verdicts & Failure Kinds#
| FAIL Kind | What It Names |
|---|---|
assumption | The failing Assume clause or Constant Where |
invariant | The failing Invariant or variable Where |
action-invariant | The failing ActionInvariant |
conformance | The action, parameter values, and failing conjunct (Action, Ensures, or frame) |
contract | The function, argument values, and failing return result |
assertion | The action and line number of the failing assert |
refinement | The abstract spec and failing obligation (init, step, fairness, invariant, property) |
property | The failing temporal Property (with lasso cycle trace) |
deadlock | The deadlocked state with no enabled actions |
runtime | A reachable runtime error (IndexError, KeyError, ZeroDivisionError, raise) |
All 26 Diagnostic Codes#
| Code | Severity | When Emitted |
|---|---|---|
syntax-error | error | File cannot be read, parsed, or compiled by Python |
unresolved-import | error | Imported specification, base, or refined class cannot be found in search roots |
duplicate-module | error | Two files share the same Python module name |
unknown-name | error | Unbound name, read-before-bind, unknown member, or unknown name in Model |
bad-binding | error | Clause lambda parameter binds nothing, wrong signature, or override alters action params |
bad-clause | error | Predicate is not a lambda/module-level function, non-string description, or bare @spec |
role-conflict | error | Two roles on one field, ClassVar with role, Pure on field, or role changed in subclass |
level-error | error | Expression exceeds clause's TLA⁺ level (e.g., prime in Invariant) |
misplaced-clause | error | Clause in wrong place (e.g., Requires without Action, @dataclass(slots=True) above @spec) |
duplicate-clause | error | Duplicate clause name, two Actions/Modifies, @spec applied twice |
no-init | error | Variable has neither default nor Init clause mentioning it |
no-actions | error | Model has zero actions |
no-transition | error | Action() with no predicate and a ... body |
missing-type | error | Action or contract parameter lacks a type annotation |
missing-domain | error | Quantified parameter type has no domain in Model.domains |
unbound-constant | error | Constant with no default is missing from Model.constants |
vacuous | error | Resolved domain is empty (or no initial state exists) |
bad-domain | error | Domain/constant value mismatches type, not finite, or Symmetry holds non-ModelValue |
bad-model | error | Invalid Model field or target is neither a specification nor a contract |
unsupported | error | Python construct outside the verifiable subset |
bad-write | error | Body writes a Constant, Modifies names a constant, or Pure mutates state |
missing-mapping | error | Refines[A] omits a variable or constant of A |
bad-arity | error | Operator, action, or builtin called with wrong argument count |
unannotated-mutator | warning | Public method mutates state but is not annotated as an Action |
symmetry-dropped | warning | Symmetry dropped because the model checks a Property or Refines |
unused-domain | warning | Entry in Model.domains is not used by any parameter |