freshcrate
Home > Uncategorized > tlaiser

tlaiser

Extract state machines from code and model-check with TLA+/PlusCal

Description

Extract state machines from code and model-check with TLA+/PlusCal

README

Tlaiser

What Is This?

TLAiser extracts state machine specifications from existing code and model-checks them with TLA+/PlusCal β€” catching concurrency bugs that no amount of testing finds.

TLA+ (Temporal Logic of Actions, by Leslie Lamport) is the gold standard for specifying and verifying concurrent and distributed systems. PlusCal is its imperative-style front-end that compiles to TLA+. The TLC model checker exhaustively explores all possible states to find invariant violations and liveness failures.

Amazon, Microsoft, and Intel use TLA+ internally to verify distributed systems. TLAiser brings this power to everyone β€” you describe your system, TLAiser generates the spec and runs the checker.

Pipeline

Source Code                TLA+ Spec              TLC Model Checker
    β”‚                         β”‚                        β”‚
    β–Ό                         β–Ό                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  extract   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  generate  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Your code β”‚ ────────► β”‚  State   β”‚ ────────► β”‚  TLA+/   β”‚
β”‚ or TOML   β”‚           β”‚ Machine  β”‚           β”‚ PlusCal  β”‚
β”‚ manifest  β”‚           β”‚  Model   β”‚           β”‚   Spec   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                     β”‚
                                                     β–Ό model-check
                                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                               β”‚   TLC    β”‚
                                               β”‚ Checker  β”‚
                                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                     β”‚
                                                     β–Ό
                                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                               β”‚ Invariantβ”‚
                                               β”‚ Violationβ”‚
                                               β”‚  Report  β”‚
                                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

TLA+ Concepts

TLAiser leverages the full power of TLA+ temporal logic:

  • β–‘ (Always) β€” safety properties: "bad things never happen" (e.g., no deadlock, no data corruption, mutual exclusion holds)

  • β—‡ (Eventually) β€” liveness properties: "good things eventually happen" (e.g., every request gets a response, every lock is eventually released)

  • ↝ (Leads-to) β€” temporal ordering: "if A happens, B eventually follows" (e.g., if a message is sent, it is eventually delivered)

  • Fairness conditions β€” weak/strong fairness constraints that prevent unrealistic infinite stuttering of enabled actions

Key Value

  • Catch distributed systems bugs before production β€” deadlocks, race conditions, protocol violations, split-brain scenarios

  • Exhaustive verification β€” TLC checks ALL possible interleavings, not just the ones your tests happen to exercise

  • Counterexample traces β€” when a violation is found, TLAiser shows exactly the sequence of steps that triggers the bug

  • Safety + Liveness β€” verify both that bad things never happen AND that good things eventually do

Use Cases

  • Distributed protocol verification β€” Raft, Paxos, 2PC, custom consensus

  • Database transaction isolation β€” verify serialisability, snapshot isolation, read-committed guarantees under concurrent transactions

  • Consensus algorithm validation β€” prove agreement, validity, and termination properties before implementation

  • Microservice choreography checking β€” verify saga patterns, event-driven workflows, and distributed state machines for deadlock-freedom

  • Lock-free data structure verification β€” prove linearisability of concurrent algorithms

How It Works

Describe your system’s state transitions in tlaiser.toml. TLAiser:

  1. Extracts state machine models from your code (or from the manifest)

  2. Generates TLA+ specifications with safety and liveness properties

  3. Runs the TLC model checker to exhaustively verify all reachable states

  4. Reports violations with concrete counterexample traces

# tlaiser.toml β€” example: distributed lock service
[workload]
name = "distributed-lock"
entry = "src/lock_service.rs::LockStateMachine"
strategy = "state-extraction"

[data]
input-type = "LockRequest"
output-type = "LockGrant | LockDenied | LockTimeout"

[properties]
safety = ["MutualExclusion", "NoDeadlock"]
liveness = ["EventualAccess"]
fairness = "weak"

[model]
processes = 3
max-steps = 50

Architecture

Follows the hyperpolymath -iser pattern (same as Chapeliser):

  • Manifest (tlaiser.toml) β€” describe WHAT you want to verify

  • Idris2 ABI (src/interface/abi/) β€” formal proofs: state machine types, temporal formulae, model check results all verified at compile time

  • Zig FFI (src/interface/ffi/) β€” C-ABI bridge to TLC runtime and state extraction engine

  • Codegen (src/codegen/) β€” generates TLA+/PlusCal specifications from extracted state machines

  • Rust CLI β€” parses manifest, extracts state machines, generates specs, invokes TLC, reports results

User writes zero TLA+. TLAiser generates everything.

Part of the -iser family of acceleration frameworks.

Quick Start

# Initialise a manifest in your project
tlaiser init

# Edit tlaiser.toml to describe your state machine

# Generate TLA+ specs and run TLC
tlaiser generate
tlaiser run

# Or all at once
tlaiser build && tlaiser run

Status

Pre-alpha. Architecture defined, scaffolding in place, codegen pending.

License

SPDX-License-Identifier: PMPL-1.0-or-later

Release History

VersionChangesUrgencyDate
main@2026-04-17Latest activity on main branchHigh4/17/2026
0.0.0No release found β€” using repo HEADHigh4/11/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

typedqliserAdd formal type safety (10 levels, dependent/linear/session types) to any query language β€” SQL, GraphQL, Cypher, SPARQL, VQLmain@2026-04-18
ponyiserWrap concurrent code in Pony reference capabilities for data-race freedommain@2026-04-18
oblibeniserMake operations reversible and auditable via OblΓ­benΓ½main@2026-04-18
verisimiserAugment any database with VeriSimDB octad capabilities β€” drift detection, provenance, temporal versioning, modality overlaysmain@2026-04-18
phronesiserAdd provably safe ethical constraints to AI agents via Phronesismain@2026-04-18