moon-tla

    Pure-MoonBit TLA+ distributed protocol model checker, official TLC-compatible engine, native SVG counterexample trace visualizer, and zero-upload browser studio

    tla
    tlaplus
    model-checker
    formal-methods
    distributed-systems
    verification
    Download zip
    Version
    0.2.0
    License
    Apache-2.0
    Last updated
    2 hours ago
    Downloads
    6

    #moon-tla

    Pure-MoonBit TLA+ distributed protocol model checker, official TLC-compatible engine, native SVG counterexample trace visualizer, and zero-upload browser studio.

    • Zero third-party dependencies in the root library (Sam-Hui-dot/moon-tla), verified across all four MoonBit targets (wasm, wasm-gc, js, native) with --deny-warn.
    • Zero JVM dependency: compiles directly to native binaries and browser JS/Wasm for millisecond-scale startup and interactive exploration.
    • Verified against official Java TLC v1.7.4 (tlaplus/tlaplus tla2tools.jar): 16/16 unmodified distributed protocol .tla + .cfg specs (including Single-Decree Synod Paxos, SYMMETRY Permutations quotient reduction, and per-action WF/SF liveness) match exact verdict, exact distinct state counts, exact BFS diameters, and exact shortest counterexample lengths.
    • Interactive Zero-Upload Browser Studio: https://sam-hui-dot.github.io/moon-tla/ — edit real TLA+ specs in the browser, toggle Symmetry Reduction and one-line protocol defects (Raft split-brain, Two-Phase Commit, Peterson Mutex, Fair Starvation Lasso), and inspect native SVG counterexample timelines and state-space graphs without uploading any files.

    #Counterexample Visualization Preview

    Running moon-tla on demo/specs/RaftSplitBrainBuggy.tla (3-node Raft election with the single-vote-per-term guard omitted) detects the shortest 6-step dual-leader counterexample (ElectionSafety) and renders native SVGs directly from MoonBit:

    Raft Split-Brain Counterexample Trace

    #Official Java TLC v1.7.4 Differential Oracle

    All 16 specifications in demo/specs/ are executed unmodified by both Native moon-tla (--release) and official Java tlc2.TLC (tla2tools.jar v1.7.4, -workers 1 deterministic BFS) in demo/verify_tlc.py and in GitHub Actions CI:

    ProtocolVerdict (Both)Distinct States (moon-tla / TLC)Diameter (moon-tla / TLC)Trace / LassoNative moon-tlaJVM TLC v1.7.4End-to-End Ratio
    DieHardINVARIANT:NotSolved14 / 14—7 states128.6 ms1022.4 ms8.0x
    TwoPhaseOK288 / 28811 / 11—38.2 ms722.9 ms18.9x
    TwoPhaseBuggyINVARIANT:TCConsistent158 / 158—6 states41.1 ms897.1 ms21.8x
    TwoPhaseSym (SYMMETRY)OK80 / 8011 / 11—28.0 ms746.0 ms26.6x
    MutexPetersonOK26 / 268 / 8—22.7 ms703.5 ms31.0x
    MutexBuggyINVARIANT:MutualExclusion9 / 9—5 states28.6 ms711.2 ms24.8x
    PetersonLiveness (Per-Action WF)OK26 / 268 / 8—20.5 ms739.9 ms36.1x
    StarvationBuggy (Per-Action WF)LIVENESS:StarvationFree8 / 8—5 states (loop@2)14.8 ms898.3 ms60.6x
    RaftElectionOK282 / 2828 / 8—48.1 ms751.0 ms15.6x
    RaftSplitBrainBuggyINVARIANT:ElectionSafety597 / 597—7 states47.2 ms947.3 ms20.1x
    PaxosConsensus (Synod Paxos)OK3,921 / 3,92117 / 17—1167.6 ms946.3 ms0.8x
    BankTransferOK5 / 53 / 3—30.1 ms693.5 ms23.0x
    BankTransferBuggyINVARIANT:NoOverdraft15 / 15—5 states27.9 ms708.8 ms25.4x
    DiningPhilosophersDEADLOCK14 / 14—4 states29.5 ms708.5 ms24.0x
    TokenRingOK8 / 85 / 5—29.0 ms720.9 ms24.8x
    TokenRingLiveness ([]<>)OK4 / 44 / 4—16.8 ms883.4 ms52.6x
    Total (16 specs)16/16 EXACT16/16 EXACT9/9 EXACT7/7 EXACT1718.8 ms12801.3 ms7.4x

    Measurement note: Wall-clock timings were recorded on Windows (JDK 17 vs MoonBit native release) and reflect end-to-end single-invocation CLI execution; on small-to-medium state spaces JVM startup dominates Java TLC's time, whereas on larger state spaces (PaxosConsensus, 3,921 states) JIT-compiled Java TLC catches up (946 ms vs 1168 ms).

    #Supported TLA+ & TLC Feature Set (0.2.0)

    See docs/conformance.md for the complete TLC semantic conformance matrix and known gaps. Key additions in 0.2.0:
    • Symmetry Reduction (symmetry.mbt): SYMMETRY SymName with Permutations(S) (exact lexicographically minimum canonical orbit representative for , compressing TwoPhaseSym from 288 down to 80 states — exact match with Java TLC).
    • Per-Action WF_v(A) / SF_v(A) Emerson-Lei SCC Liveness (liveness.mbt): Top-level and quantified fairness (\A p \in S : WF_v(Act(p)) / SF_v(Act(p))), iterative SCC fairness pruning, []<>Q and \A-quantified temporal properties, and Prefix/Cycle Lasso trace highlighting.
    • RECURSIVE Operator Declarations (parser.mbt, eval.mbt): Standard RECURSIVE Op(_, _) declarations with depth-bounded evaluation.

    • Parser (lexer.mbt, parser.mbt, cfg.mbt):
      • Module headers/footers (---- MODULE Name ---- / ====), EXTENDS, CONSTANTS, VARIABLES, ASSUME, LOCAL, line comments \*, nested block comments (* ... *).
      • Indentation-sensitive vertical conjunction (/\\) and disjunction (\\/) bullet lists.
      • Full expression & action syntax: operator definitions, LET ... IN, IF ... THEN ... ELSE, CASE ... [] ... [] OTHER -> ..., \A / \E / CHOOSE (including multi-variable and <<x, y>> tuple patterns), sets ({...}, {x \in S : P}, {e : x \in S}, SUBSET, UNION, a..b, \cup, \cap, \, \X), functions & records ([x \in S |-> e], [S -> T], [a |-> 1], [a : S], DOMAIN, chained [f EXCEPT ![k].field = @ + 1]), tuples/sequences (<<...>>, \o), primes x', UNCHANGED, ENABLED, [Next]_vars, WF_vars(Next), SF_vars(Next).
      • Standard .cfg directives: SPECIFICATION, INIT, NEXT, INVARIANT/INVARIANTS, PROPERTY/PROPERTIES, CONSTANT/CONSTANTS (scalars, model values, sets, <- overrides), CHECK_DEADLOCK.
    • Evaluator & Standard Modules (value.mbt, eval.mbt):
      • Total-order canonical TlaVal with unique normal forms (functions with domain 1..n unified with sequences/tuples; records unified with string-keyed functions) and 128-bit state fingerprinting.
      • Built-in semantics for Naturals, Integers (floor/Euclidean \div and %), Sequences (Len, Head, Tail, Append, SubSeq, SelectSeq, Seq), FiniteSets (Cardinality, IsFiniteSet), and TLC (:>, @@, Print, PrintT, Assert, ToString).
      • Symbolic membership checks for infinite/large domains (Nat, Int, STRING, BOOLEAN, [S -> T], [a : S], SUBSET S, Seq(S)).
    • Model Checker & Liveness (checker.mbt, liveness.mbt):
      • Nondeterministic Init / Next constraint solver with deferred conjunct resolution and automatic top-level action name attribution.
      • Exact BFS exploration guaranteeing shortest safety/deadlock counterexample traces and TLC-aligned diameter computation.
      • Tarjan strongly connected component (SCC) cycle detection for temporal properties ([]P, <>P, P ~> Q, [](P => <>Q)) with lasso counterexample reconstruction.
    • Visualization & Reporting (viz.mbt, report.mbt):
      • Native SVG counterexample sequence timelines (render_trace_svg) with per-step variable diffs and lasso loop-back arcs.
      • Layered BFS state-space graph SVGs (render_state_graph_svg) with hover state snapshots.
      • Plain-text (TLC-style), Markdown, and structured JSON reports.

    #Library Usage (MoonBit)

    Add Sam-Hui-dot/moon-tla in moon.mod:

    import {
    "Sam-Hui-dot/moon-tla@0.2.0",
    }

    Check a specification programmatically and render SVG / Markdown diagnostics:

    fn main raise {
    let tla =
    #|---- MODULE Counter ----
    #|EXTENDS Integers
    #|VARIABLE x
    #|Init == x = 0
    #|Step == x < 5 /\ x' = x + 1
    #|Next == Step
    #|Bound == x < 3
    #|====
    let cfg = "INIT Init\nNEXT Next\nINVARIANT Bound"
    let result = @moon-tla.check_spec_sources(tla, cfg)
    println(@moon-tla.render_result_text(result))
    let svg = @moon-tla.render_trace_svg(result)
    println("SVG length: \{svg.length()}")
    }

    #CLI Usage

    Build the native CLI:

    moon build --target native --release cmd/main

    Run model checking and export reports or SVGs:

    # Terminal summary + shortest counterexample trace ./_build/native/release/build/cmd/main/main check demo/specs/RaftSplitBrainBuggy.tla \ --cfg demo/specs/RaftSplitBrainBuggy.cfg # Export native SVG counterexample timeline ./_build/native/release/build/cmd/main/main check demo/specs/RaftSplitBrainBuggy.tla \ --cfg demo/specs/RaftSplitBrainBuggy.cfg \ --format trace-svg --out trace.svg --exit-zero # Export layered BFS state-space graph SVG ./_build/native/release/build/cmd/main/main check demo/specs/TwoPhaseBuggy.tla \ --cfg demo/specs/TwoPhaseBuggy.cfg \ --format graph-svg --out graph.svg --exit-zero # Evaluate a standalone TLA+ expression ./_build/native/release/build/cmd/main/main eval "(-1) % 3"

    #Development & Verification

    # Format check + 4-target verification moon fmt --check for t in wasm wasm-gc js native; do moon check --target "$t" --deny-warn moon test --target "$t" --deny-warn done # Build and V8 smoke-test the zero-upload browser studio python3 demo/build_web.py # Run official Java TLC v1.7.4 differential oracle across all 11 specs python3 demo/verify_tlc.py

    #Current Scope & Roadmap

    Current 0.1.0 scope boundaries:
    • Explicit-state BFS in memory (max_states configurable, default 200,000); symmetry reduction (SYMMETRY Permutations(S)) is parsed in .cfg but not yet applied during state canonicalization.
    • Temporal properties cover []P, <>P, P ~> Q, and [](P => <>Q) with weak fairness on Next; arbitrary nested Buchi LTL formulas and per-action SF_v(A) fairness constraints are planned for 0.2.0.
    • INSTANCE ... WITH ... multi-module imports, RECURSIVE operators, and PlusCal translation are planned for 0.2.0–0.3.0.

    Planned milestones:
    • 0.2.0: Symmetry reduction (Permutations(S)), per-action weak/strong fairness liveness parity with Java TLC, and RECURSIVE operators.
    • 0.3.0: PlusCal-to-TLA+ compiler frontend and moon prove verification of core canonical-set and fingerprinting invariants.
    • 0.4.0: Official tlaplus/Examples 25+ protocol regression suite, bit-packed state storage, and reusable GitHub Action (action.yml).

    #License

    Apache-2.0

    TlaError

    pub(all) suberror TlaError {
    LexError(String)
    ParseError(String)
    CfgError(String)
    EvalError(String)
    CheckError(String)
    InvalidInput(String)
    } derive(Eq,
    Debug
    )

    Errors raised during TLA+ lexing, parsing, configuration loading, evaluation, or model checking.

    TlaError::equal

    fn TlaError::equal(TlaError, TlaError) -> Bool
    automatically derived

    TlaError::not_equal

    fn TlaError::not_equal(x : TlaError, y : TlaError) -> Bool
    automatically derived

    TlaError::to_repr

    automatically derived

    BinOp

    pub(all) enum BinOp {
    And
    Or
    Implies
    Iff
    LeadsTo
    Eq
    Neq
    Lt
    Le
    Gt
    Ge
    In
    NotIn
    SubsetEq
    ProperSubset
    SetUnion
    SetInter
    SetDiff
    Range
    Concat
    Add
    Sub
    Mul
    IntDiv
    Mod
    Pow
    Cross
    MapTo
    MergeFunc
    } derive(Eq,
    Debug
    )

    Binary operators in TLA+.

    BinOp::equal

    fn BinOp::equal(BinOp, BinOp) -> Bool
    automatically derived

    BinOp::not_equal

    fn BinOp::not_equal(x : BinOp, y : BinOp) -> Bool
    automatically derived

    BinOp::to_repr

    automatically derived

    BoundGroup

    pub(all) struct BoundGroup {
    pats : Array[BoundPat]
    domain : Expr
    } derive(Eq,
    Debug
    )

    One or more bound patterns sharing a common domain expression (x, y \in S).

    BoundGroup::equal

    fn BoundGroup::equal(BoundGroup, BoundGroup) -> Bool
    automatically derived

    BoundGroup::not_equal

    fn BoundGroup::not_equal(x : BoundGroup, y : BoundGroup) -> Bool
    automatically derived

    BoundGroup::to_repr

    automatically derived

    BoundPat

    pub(all) enum BoundPat {
    Single(String)
    TuplePat(Array[String])
    } derive(Eq,
    Debug
    )

    Bound pattern for quantifiers, set comprehensions, and function constructors.

    BoundPat::equal

    fn BoundPat::equal(BoundPat, BoundPat) -> Bool
    automatically derived

    BoundPat::not_equal

    fn BoundPat::not_equal(x : BoundPat, y : BoundPat) -> Bool
    automatically derived

    BoundPat::to_repr

    automatically derived

    CfgValue

    pub(all) enum CfgValue {
    CfgInt(Int64)
    CfgBool(Bool)
    CfgStr(String)
    CfgModel(String)
    CfgSet(Array[CfgValue])
    } derive(Eq,
    Debug
    )

    Parsed constant literal value from a TLC .cfg file.

    CfgValue::equal

    fn CfgValue::equal(CfgValue, CfgValue) -> Bool
    automatically derived

    CfgValue::not_equal

    fn CfgValue::not_equal(x : CfgValue, y : CfgValue) -> Bool
    automatically derived

    CfgValue::to_repr

    automatically derived

    CheckOptions

    pub(all) struct CheckOptions {
    max_states : Int
    max_graph_nodes : Int
    check_deadlock : Bool?
    use_symmetry : Bool
    } derive(Eq,
    Debug
    )

    Execution bounds and overrides for check_module.

    CheckOptions::equal

    automatically derived

    CheckOptions::not_equal

    fn CheckOptions::not_equal(x : CheckOptions, y : CheckOptions) -> Bool
    automatically derived

    CheckOptions::to_repr

    automatically derived

    CheckResult

    pub(all) struct CheckResult {
    module_name : String
    status : CheckStatus
    status_text : String
    states_generated : Int
    distinct_states : Int
    diameter : Int
    transitions : Int
    symmetry_applied : Bool
    variables : Array[String]
    invariants_checked : Array[String]
    properties_checked : Array[String]
    trace : Array[TraceStep]
    lasso_loop_start : Int?
    graph_nodes : Array[GraphNode]
    graph_edges : Array[GraphEdge]
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Full diagnostic output of a model-checking run.

    CheckResult::equal

    fn CheckResult::equal(CheckResult, CheckResult) -> Bool
    automatically derived

    CheckResult::not_equal

    fn CheckResult::not_equal(x : CheckResult, y : CheckResult) -> Bool
    automatically derived

    CheckResult::to_json

    automatically derived

    CheckResult::to_repr

    automatically derived

    CheckStatus

    pub(all) enum CheckStatus {
    Ok
    InvariantViolation(String)
    Deadlock
    LivenessViolation(String)
    StateLimitReached(Int)
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Final verdict returned by the TLA+ model checker.

    CheckStatus::equal

    fn CheckStatus::equal(CheckStatus, CheckStatus) -> Bool
    automatically derived

    CheckStatus::not_equal

    fn CheckStatus::not_equal(x : CheckStatus, y : CheckStatus) -> Bool
    automatically derived

    CheckStatus::to_json

    automatically derived

    CheckStatus::to_repr

    automatically derived

    ExceptClause

    pub(all) struct ExceptClause {
    path : Array[ExceptStep]
    value : Expr
    } derive(Eq,
    Debug
    )

    Single update clause inside an EXCEPT expression.

    ExceptClause::equal

    automatically derived

    ExceptClause::not_equal

    fn ExceptClause::not_equal(x : ExceptClause, y : ExceptClause) -> Bool
    automatically derived

    ExceptClause::to_repr

    automatically derived

    ExceptStep

    pub(all) enum ExceptStep {
    Index(Array[Expr])
    Field(String)
    } derive(Eq,
    Debug
    )

    Path component in [f EXCEPT ![k] = v, !.field = v2].

    ExceptStep::equal

    fn ExceptStep::equal(ExceptStep, ExceptStep) -> Bool
    automatically derived

    ExceptStep::not_equal

    fn ExceptStep::not_equal(x : ExceptStep, y : ExceptStep) -> Bool
    automatically derived

    ExceptStep::to_repr

    automatically derived

    Expr

    pub(all) enum Expr {
    BoolLit(Bool)
    IntLit(Int64)
    StrLit(String)
    BuiltinSet(String)
    Ident(String)
    At
    Call(String, Array[Expr])
    Unary(UnaryOp, Expr)
    Bin(BinOp, Expr, Expr)
    ConjList(Array[Expr])
    DisjList(Array[Expr])
    IfThenElse(Expr, Expr, Expr)
    CaseExpr(Array[(Expr, Expr)], Expr?)
    LetIn(Array[OpDef], Expr)
    ForAll(Array[BoundGroup], Expr)
    Exists(Array[BoundGroup], Expr)
    Choose(BoundPat, Expr, Expr)
    SetEnum(Array[Expr])
    SetFilter(BoundPat, Expr, Expr)
    SetMap(Expr, Array[BoundGroup])
    TupleLit(Array[Expr])
    RecordLit(Array[(String, Expr)])
    RecordSet(Array[(String, Expr)])
    FuncDef(Array[BoundGroup], Expr)
    FuncSet(Expr, Expr)
    FuncApply(Expr, Array[Expr])
    RecordField(Expr, String)
    Except(Expr, Array[ExceptClause])
    StutterAction(Expr, Expr)
    Fairness(FairnessKind, Expr, Expr)
    } derive(Eq,
    Debug
    )

    Core TLA+ expression / action / temporal formula AST.

    Expr::equal

    fn Expr::equal(Expr, Expr) -> Bool
    automatically derived

    Expr::not_equal

    fn Expr::not_equal(x : Expr, y : Expr) -> Bool
    automatically derived

    Expr::to_repr

    automatically derived

    FairnessKind

    pub(all) enum FairnessKind {
    Weak
    Strong
    } derive(Eq,
    Debug
    )

    Fairness kind (WF_v(A) or SF_v(A)).

    FairnessKind::equal

    automatically derived

    FairnessKind::not_equal

    fn FairnessKind::not_equal(x : FairnessKind, y : FairnessKind) -> Bool
    automatically derived

    FairnessKind::to_repr

    automatically derived

    GraphEdge

    pub(all) struct GraphEdge {
    from : Int
    to : Int
    action : String
    is_on_trace : Bool
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Directed transition edge in the visualized state-space graph snapshot.

    GraphEdge::equal

    fn GraphEdge::equal(GraphEdge, GraphEdge) -> Bool
    automatically derived

    GraphEdge::not_equal

    fn GraphEdge::not_equal(x : GraphEdge, y : GraphEdge) -> Bool
    automatically derived

    GraphEdge::to_json

    automatically derived

    GraphEdge::to_repr

    automatically derived

    GraphNode

    pub(all) struct GraphNode {
    id : Int
    depth : Int
    label : String
    detail : String
    is_init : Bool
    is_violation : Bool
    is_on_trace : Bool
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Node in the visualized state-space graph snapshot.

    GraphNode::equal

    fn GraphNode::equal(GraphNode, GraphNode) -> Bool
    automatically derived

    GraphNode::not_equal

    fn GraphNode::not_equal(x : GraphNode, y : GraphNode) -> Bool
    automatically derived

    GraphNode::to_json

    automatically derived

    GraphNode::to_repr

    automatically derived

    OpDef

    pub(all) struct OpDef {
    name : String
    params : Array[String]
    body : Expr
    is_local : Bool
    } derive(Eq,
    Debug
    )

    Operator definition (Op(a, b) == body).

    OpDef::equal

    fn OpDef::equal(OpDef, OpDef) -> Bool
    automatically derived

    OpDef::not_equal

    fn OpDef::not_equal(x : OpDef, y : OpDef) -> Bool
    automatically derived

    OpDef::to_repr

    automatically derived

    TlaConfig

    pub(all) struct TlaConfig {
    specification : String?
    init : String?
    next : String?
    invariants : Array[String]
    properties : Array[String]
    constants : Array[(String, CfgValue)]
    overrides : Array[(String, String)]
    symmetry : String?
    check_deadlock : Bool
    } derive(Eq,
    Debug
    )

    Parsed TLC .cfg configuration file.

    TlaConfig::equal

    fn TlaConfig::equal(TlaConfig, TlaConfig) -> Bool
    automatically derived

    TlaConfig::not_equal

    fn TlaConfig::not_equal(x : TlaConfig, y : TlaConfig) -> Bool
    automatically derived

    TlaConfig::to_repr

    automatically derived

    TlaModule

    pub(all) struct TlaModule {
    name : String
    extends : Array[String]
    constants : Array[String]
    variables : Array[String]
    assumes : Array[Expr]
    defs : Array[OpDef]
    } derive(Eq,
    Debug
    )

    Parsed TLA+ module.

    TlaModule::equal

    fn TlaModule::equal(TlaModule, TlaModule) -> Bool
    automatically derived

    TlaModule::find_def

    fn TlaModule::find_def(self : TlaModule, name : String) -> OpDef?

    Look up an operator definition by name inside a parsed TLA+ module.

    TlaModule::not_equal

    fn TlaModule::not_equal(x : TlaModule, y : TlaModule) -> Bool
    automatically derived

    TlaModule::to_repr

    automatically derived

    TlaVal

    pub(all) enum TlaVal {
    Bool(Bool)
    Int(Int64)
    Str(String)
    ModelVal(String)
    Set(Array[TlaVal])
    Tuple(Array[TlaVal])
    Func(Array[(TlaVal, TlaVal)])
    } derive(
    Debug
    )

    Canonical TLA+ runtime value with total ordering and unique normal form.
    • Set elements are strictly sorted and deduplicated.
    • Tuple represents sequences and 1..n-indexed functions (including empty <<>>).
    • Func represents general functions and records (with sorted unique keys); any function whose domain is exact 1..n is normalized to Tuple.
    impl Compare for TlaVal
    impl Eq for TlaVal

    TlaVal::compare

    fn TlaVal::compare(self : TlaVal, other : TlaVal) -> Int

    TlaVal::equal

    fn TlaVal::equal(self : TlaVal, other : TlaVal) -> Bool

    TlaVal::not_equal

    fn TlaVal::not_equal(x : TlaVal, y : TlaVal) -> Bool

    TlaVal::op_ge

    fn TlaVal::op_ge(x : TlaVal, y : TlaVal) -> Bool

    TlaVal::op_gt

    fn TlaVal::op_gt(x : TlaVal, y : TlaVal) -> Bool

    TlaVal::op_le

    fn TlaVal::op_le(x : TlaVal, y : TlaVal) -> Bool

    TlaVal::op_lt

    fn TlaVal::op_lt(x : TlaVal, y : TlaVal) -> Bool

    TlaVal::to_repr

    automatically derived

    TraceStep

    pub(all) struct TraceStep {
    step : Int
    action : String
    state_id : Int
    bindings : Array[VarBinding]
    diffs : Array[VarDiff]
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    One step in a shortest safety, deadlock, or lasso liveness counterexample trace.

    TraceStep::equal

    fn TraceStep::equal(TraceStep, TraceStep) -> Bool
    automatically derived

    TraceStep::not_equal

    fn TraceStep::not_equal(x : TraceStep, y : TraceStep) -> Bool
    automatically derived

    TraceStep::to_json

    automatically derived

    TraceStep::to_repr

    automatically derived

    UnaryOp

    pub(all) enum UnaryOp {
    Not
    Neg
    Subset
    Union
    Domain
    Prime
    Unchanged
    Enabled
    Always
    Eventually
    } derive(Eq,
    Debug
    )

    Unary operators in TLA+.

    UnaryOp::equal

    fn UnaryOp::equal(UnaryOp, UnaryOp) -> Bool
    automatically derived

    UnaryOp::not_equal

    fn UnaryOp::not_equal(x : UnaryOp, y : UnaryOp) -> Bool
    automatically derived

    UnaryOp::to_repr

    automatically derived

    VarBinding

    pub(all) struct VarBinding {
    name : String
    value : String
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Formatted variable assignment at a single trace state.

    VarBinding::equal

    fn VarBinding::equal(VarBinding, VarBinding) -> Bool
    automatically derived

    VarBinding::not_equal

    fn VarBinding::not_equal(x : VarBinding, y : VarBinding) -> Bool
    automatically derived

    VarBinding::to_json

    automatically derived

    VarBinding::to_repr

    automatically derived

    VarDiff

    pub(all) struct VarDiff {
    name : String
    before : String
    after : String
    } derive(Eq,
    Debug
    ,
    ToJson
    )

    Variable value transition between two consecutive trace states.

    VarDiff::equal

    fn VarDiff::equal(VarDiff, VarDiff) -> Bool
    automatically derived

    VarDiff::not_equal

    fn VarDiff::not_equal(x : VarDiff, y : VarDiff) -> Bool
    automatically derived

    VarDiff::to_json

    automatically derived

    VarDiff::to_repr

    automatically derived

    cfg_value_to_val

    fn cfg_value_to_val(v : CfgValue) -> TlaVal

    Convert a .cfg literal value into a canonical TlaVal.

    check_module

    fn check_module(tla_mod : TlaModule, cfg : TlaConfig, options? : CheckOptions) -> CheckResult raise TlaError

    Run explicit-state BFS safety, deadlock, and Tarjan SCC liveness checking on a parsed TlaModule and TlaConfig.

    check_options

    fn check_options(max_states? : Int, max_graph_nodes? : Int, check_deadlock? : Bool?, use_symmetry? : Bool) -> CheckOptions

    Construct default model-checking options.

    check_spec_sources

    fn check_spec_sources(tla_src : String, cfg_src : String, options? : CheckOptions) -> CheckResult raise TlaError

    Convenience entry point: parse both .tla and .cfg source strings and run model checking.

    compare_val

    fn compare_val(a : TlaVal, b : TlaVal) -> Int

    Deterministic total order over all canonical TlaVal values.

    default_config

    fn default_config(init? : String, next? : String, invariants? : Array[String], properties? : Array[String], constants? : Array[(String, CfgValue)], check_deadlock? : Bool) -> TlaConfig

    Construct a default empty TlaConfig for programmatic model checking.

    error_message

    fn error_message(error : Error) -> String

    Return a concise human-readable diagnostic message for any error.

    eval_expr_standalone

    fn eval_expr_standalone(expr : Expr, constants? : Array[(String, TlaVal)]) -> TlaVal raise TlaError

    Evaluate a standalone TLA+ expression with optional constant bindings.

    fingerprint_state

    fn fingerprint_state(var_names : Array[String], values : Array[TlaVal]) -> (UInt64, UInt64)

    Compute a deterministic 128-bit canonical fingerprint of a state vector.

    fingerprint_val

    fn fingerprint_val(v : TlaVal) -> (UInt64, UInt64)

    Compute a deterministic 128-bit canonical fingerprint of a TlaVal.

    format_val

    fn format_val(v : TlaVal) -> String

    Format any TlaVal into canonical human-readable TLA+ notation.

    func_domain

    fn func_domain(f : TlaVal) -> TlaVal raise TlaError

    Return the canonical DOMAIN set of a Tuple or Func.

    func_lookup

    fn func_lookup(f : TlaVal, key : TlaVal) -> TlaVal?

    Look up a key in a Tuple or Func.

    make_func

    fn make_func(entries : Array[(TlaVal, TlaVal)]) -> TlaVal

    Build a canonical TLA+ function; functions with domain 1..n (including empty) are normalized to Tuple to match TLA+ function/sequence identity.

    make_set

    fn make_set(items : Array[TlaVal]) -> TlaVal

    Build a canonical sorted, deduplicated TLA+ set.

    parse_cfg

    fn parse_cfg(src : String) -> TlaConfig raise TlaError

    Parse a standard TLC .cfg file string into TlaConfig.

    parse_expr_str

    fn parse_expr_str(src : String) -> Expr raise TlaError

    Parse a standalone TLA+ expression string (useful for tests and REPL queries).

    parse_module

    fn parse_module(src : String) -> TlaModule raise TlaError

    Parse a TLA+ module source string into a TlaModule AST.

    render_result_markdown

    fn render_result_markdown(result : CheckResult) -> String

    Render a GitHub-flavored Markdown report summarizing model-checking stats and any counterexample trace.

    render_result_text

    fn render_result_text(result : CheckResult) -> String

    Render a TLC-compatible plain-text diagnostic report for terminal output.

    render_state_graph_svg

    fn render_state_graph_svg(result : CheckResult) -> String

    Render a layered BFS state-space graph SVG highlighting initial states, counterexample paths, and offending/deadlock states with hover snapshots.

    render_trace_svg

    fn render_trace_svg(result : CheckResult) -> String

    Render a native SVG counterexample sequence timeline with per-step variable diffs (or a verification summary badge if no counterexample exists).

    set_contains

    fn set_contains(elems : Array[TlaVal], target : TlaVal) -> Bool

    Binary search for target in a canonical sorted array of TlaVal.