Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TLA+ Comparison

Specl is a modern replacement for TLA+/TLC. If you’re coming from TLA+, this page maps the concepts.

Syntax mapping

TLA+SpeclNotes
x' = x + 1x = x + 1No primed variables
x = y (equality)x == y= is assignment in Specl
UNCHANGED <<y, z>>(implicit)Variables not mentioned stay unchanged
/\andLogical AND
\/orLogical OR
~notLogical NOT
=>impliesImplication
<=>iffIf and only if
\ininSet membership
\notinnot inSet non-membership
\A x \in S: P(x)all x in S: P(x)Universal quantifier
\E x \in S: P(x)any x in S: P(x)Existential quantifier
CHOOSE x \in S: P(x)fix x in S: P(x)Deterministic choice
[f EXCEPT ![k] = v]f | { k: v }Dict update
[f EXCEPT ![k][j] = v]f | {k: f[k] | {j: v}}Nested dict update
{x \in S : P(x)}{x in S if P(x)}Set comprehension
SUBSET Spowerset(S)Powerset
UNION Sunion_all(S)Flatten set of sets
S \cup TS union TSet union
S \cap TS intersect TSet intersection
S \ TS diff TSet difference
S \subseteq TS subset_of TSubset test
Cardinality(S)len(S)Set/sequence size
Head(s)head(s)First element
Tail(s)tail(s)All but first
Len(s)len(s)Sequence length
s \o ts ++ tSequence concatenation
Append(s, x)s ++ [x]Append
SubSeq(s, lo, hi)s[lo..hi]Subsequence
Init == ...init { ... }Initial state
Next == A \/ B \/ C(implicit)All actions OR’d automatically
DOMAIN fkeys(f)Function/dict domain
IF p THEN a ELSE bif p then a else bConditional expression
LET x == expr IN bodylet x = expr in bodyLet binding

Key differences

No primed variables

TLA+ uses x' for the next-state value. Specl uses =:

TLA+:   Next == x' = x + 1 /\ y' = y
Specl:  action Step() { x = x + 1 }    // y unchanged implicitly

No UNCHANGED

In TLA+, every action must explicitly list unchanged variables:

TLA+:   Inc == x' = x + 1 /\ UNCHANGED <<y, z, w>>
Specl:  action Inc() { x = x + 1 }

Forgetting a variable in UNCHANGED is a common TLA+ bug. Specl eliminates this class of errors entirely.

No explicit Next

TLA+ requires an explicit Next formula that disjoins all actions:

TLA+:   Next == Inc \/ Dec \/ Reset
Specl:  // Not needed — all actions are implicitly OR'd

= vs ==

TLA+ uses = for both assignment and equality (context determines meaning). Specl separates them: = assigns, == compares.

Word-based operators

TLA+ uses symbolic operators (/\, \/, ~, \in). Specl uses words (and, or, not, in).

Translating TLA+ to Specl

Use the built-in translator:

specl translate spec.tla -o spec.specl

The translator handles most TLA+ syntax. Manual adjustments may be needed for:

  • Module composition (EXTENDS, INSTANCE) — not yet supported
  • Recursive operators — not yet supported
  • TLA+ idioms that don’t map directly (e.g., function sets [S -> T])