Skip to main content

Crate everystate

Crate everystate 

Source
Expand description

everystate: a TLA+ model checker (TLC-compatible). The core is free of direct file-system, clock and process access (see host), so it also builds for WebAssembly.

Modules§

ast
AST. Modules are parsed into owned trees and then leaked, so that the evaluator can hold &'static Node references freely.
bundled
cfg
TLC configuration (.cfg) file parser (port of cfg.ts).
checker
Explicit-state breadth-first model checker (port of checker.ts).
cli
Command-line driver (port of main.ts). Accepts TLC’s flags and prints TLC-compatible output, including -tool framing, -dump, the XMLExporter emulation and the java command-line shim.
codec
States and values as bytes: the form in which states cross threads (par.rs) and in which a state store keeps them (store.rs).
community
Native overrides for the remaining operators of the bundled community modules (port of the rest of community.ts; the hot operators live in stdlib.rs). Host access (files, environment, processes) goes through ev.host only.
compile
A compiled form of actions and invariants (the default; EVERYSTATE_EVAL=tree turns it off); the tree-walker of eval.rs stays the reference.
conform
Trace conformance: is a recorded run of the real system a behaviour of the specification?
eval
Expression evaluator and action (next-state / initial-state) enumerator. Port of eval.ts.
hashcons
Hash-consing of values: every distinct value the search keeps is stored once, in a per-thread table, and all its occurrences share that one allocation.
host
Everything the checker needs from its environment. The core never touches the file system, the clock or processes directly, so the same code runs natively and as WebAssembly.
intern
Two interners: Name for identifiers / operator names (arbitrary order), and StrId for TLA+ strings and model values, whose ids reproduce TLC’s “order of first interning” (see TLC_NOTES 1.1).
lexer
TLA+ lexer: produces a flat token array for one source file.
liveness
Liveness checking (port of liveness.ts): temporal formula normalisation, tableau construction, and SCC search over the product of the state graph and the tableau (same approach as TLC: possible error models made of []<> (AE) and <>[] (EA) constraints plus a particle tableau for the rest).
model
Builds a checkable model from a root module and a configuration (port of model.ts).
modules
Module loading, symbol tables and static name resolution (port of modules.ts).
par
Parallel breadth-first search (-workers N).
parser
TLA+ parser: tokens -> AST. Recursive descent with precedence climbing and column-sensitive junction lists. A direct port of parser.ts.
pcal
A PlusCal translator: a port of the Java pcal.trans of the TLA+ tools (version 1.12), which turns the PlusCal algorithm in a comment of a module into TLA+ between the \* BEGIN TRANSLATION and \* END TRANSLATION lines. The port follows the Java classes stage by stage (tokenize, parse, rename, explode into labeled steps, generate TLA+) and keeps their data model, so that the output, including its layout and the checksums, is the same.
pprint
Port of TLC’s value pretty-printer (tlc2.pprint.{PrettyPrint,Parse,Format,Node}) via pprint.ts. TLC re-parses the one-line string form of a value and re-wraps it at 80 columns. The parser is deliberately naive; whenever the Java code would throw, or would not consume the whole input, the input is returned unchanged. Indices are UTF-16 code units, as in Java.
simulate
Random simulation: TLC’s -simulate mode. Instead of enumerating every reachable state it generates random behaviours of bounded length and checks each of them, which is how models too large to enumerate are explored.
stdlib
Native implementations of the TLA+ standard modules (port of stdlib.ts) and of the hot operators of the bundled community modules (subset of community.ts).
stepcache
On by default with the compiled evaluator (EVERYSTATE_STEP_CACHE=off turns it off): a bounded cache of local steps, keyed on value ids.
store
The state store: where the search keeps the states it has found, when that is not memory.
tshash
The TypeScript engine’s state fingerprint (two 32-bit murmur-style streams), reproduced bit for bit. Only used for node identifiers in -dump dot output, so that dumps are identical to the reference.
value
Runtime values. Functions are kept in canonical form: domain 1..n => Tuple, non-empty all-string domain => Record, anything else => Fcn. Sets are an explicit sorted vector or a symbolic set.