Checker Spec & Diagnostics

Every conforming checker (including Tanny) implements the four-stage pipeline defined in docs/checker.md:

  1. Read: Parse Python source without importing or executing it, resolve scopes and imports, extract units, and emit static diagnostics. (Implemented by temporal_typing.frontend and python -m temporal_typing.)
  2. Translate: Give each valid Model its exact TLA⁺ semantics with Python operator behaviour.
  3. Check: Explore the finite state space (or input domains for contracts) and verify every obligation.
  4. Report: Emit one verdict per model (PASS, FAIL, or ERROR) 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 KindWhat It Names
assumptionThe failing Assume clause or Constant Where
invariantThe failing Invariant or variable Where
action-invariantThe failing ActionInvariant
conformanceThe action, parameter values, and failing conjunct (Action, Ensures, or frame)
contractThe function, argument values, and failing return result
assertionThe action and line number of the failing assert
refinementThe abstract spec and failing obligation (init, step, fairness, invariant, property)
propertyThe failing temporal Property (with lasso cycle trace)
deadlockThe deadlocked state with no enabled actions
runtimeA reachable runtime error (IndexError, KeyError, ZeroDivisionError, raise)

All 26 Diagnostic Codes#

CodeSeverityWhen Emitted
syntax-errorerrorFile cannot be read, parsed, or compiled by Python
unresolved-importerrorImported specification, base, or refined class cannot be found in search roots
duplicate-moduleerrorTwo files share the same Python module name
unknown-nameerrorUnbound name, read-before-bind, unknown member, or unknown name in Model
bad-bindingerrorClause lambda parameter binds nothing, wrong signature, or override alters action params
bad-clauseerrorPredicate is not a lambda/module-level function, non-string description, or bare @spec
role-conflicterrorTwo roles on one field, ClassVar with role, Pure on field, or role changed in subclass
level-errorerrorExpression exceeds clause's TLA⁺ level (e.g., prime in Invariant)
misplaced-clauseerrorClause in wrong place (e.g., Requires without Action, @dataclass(slots=True) above @spec)
duplicate-clauseerrorDuplicate clause name, two Actions/Modifies, @spec applied twice
no-initerrorVariable has neither default nor Init clause mentioning it
no-actionserrorModel has zero actions
no-transitionerrorAction() with no predicate and a ... body
missing-typeerrorAction or contract parameter lacks a type annotation
missing-domainerrorQuantified parameter type has no domain in Model.domains
unbound-constanterrorConstant with no default is missing from Model.constants
vacuouserrorResolved domain is empty (or no initial state exists)
bad-domainerrorDomain/constant value mismatches type, not finite, or Symmetry holds non-ModelValue
bad-modelerrorInvalid Model field or target is neither a specification nor a contract
unsupportederrorPython construct outside the verifiable subset
bad-writeerrorBody writes a Constant, Modifies names a constant, or Pure mutates state
missing-mappingerrorRefines[A] omits a variable or constant of A
bad-arityerrorOperator, action, or builtin called with wrong argument count
unannotated-mutatorwarningPublic method mutates state but is not annotated as an Action
symmetry-droppedwarningSymmetry dropped because the model checks a Property or Refines
unused-domainwarningEntry in Model.domains is not used by any parameter