Introduce Tanny and Temporal Typing

I’ve been experimenting with an idea: abuse Python’s type annotations to express not only the types, but also the TLA+ semantics.

One of the pain points of using TLA+ in practice is code drafts. It turns out that we can express state transitions, invariants, preconditions, postconditions, fairness, and temporal properties directly in class and method declarations.

I built two projects around this idea:

Tanny parses Python source code without importing or executing it, translates the annotated models into TLA+, and checks them.

It also checks whether method implementations conform to their declared specifications and reports counterexamples in terms of Python variables and method calls.

The workflow is intentionally similar to using mypy:

pip install tanny
tanny check src/

No separate .tla files to maintain. No JVM dependency. This doesn’t eliminate specification drift entirely, but bringing the specification and implementation into the same source file makes it much easier to detect and manage.

I’d like formal verification to become something Python developers can adopt incrementally, much like static typing, rather than a separate engineering activity.