TLA+ has a rich set of operators. Let's cover the most common ones.
| Operator | Meaning | ASCII form |
/\ | AND (conjunction) | /\ |
\/ | OR (disjunction) | \/ |
~ | NOT (negation) | ~ |
=> | IMPLIES | => |
<=> | EQUIVALENCE | <=> |
Almost every TLA+ spec follows this pattern:
Init == /\ x = 0
/\ y = 0
Next == \/ ActionA
\/ ActionB
In Init, /\ means "and" — all conditions must hold.
In Next, \/ means "or" — any one action can happen.
An action describes one kind of state transition. It uses primed variables (x') to refer to the value in the next state:
Increment == /\ x' = x + 1
/\ y' = y ( y stays the same )
Instead of writing y' = y, you can use:
Increment == /\ x' = x + 1
/\ UNCHANGED y
For multiple variables: UNCHANGED <
Max(a, b) == IF a > b THEN a ELSE b
The spec demonstrates a simple traffic light with Init/Next pattern and boolean operators.