Summary
You can access to a quick pdf summary about the tla+ language here: https://lamport.azurewebsites.net/tla/summary-standalone.pdf.
This is a web accessible version.
Summary of TLA
- Module-Level Constructs
- The Constant Operators
- Miscellaneous Constructs
- Action Operators
- Temporal Operators
- User-Definable Operator Symbols
- Precedence Ranges of Operators
- Operators Defined in Standard Modules.
- ASCII Representation of Typeset Symbols 1
Module-Level Constructs
MODULE Begins the module or submodule named .
EXTENDS
Incorporates the declarations, definitions, assumptions, and theorems from the modules named into the current module.
CONSTANTS
Declares the to be constant parameters (rigid variables). Each is either an identifier or has the form , the latter form indicating that is an operator with the indicated number of arguments.
\text { VARIABLES } x_{1}, \ldots, x_{n}^{(1)}
Declares the to be variables (parameters that are flexible variables).
ASSUME
Asserts as an assumption.
Defines to be the operator such that equals exp with each identifier replaced by . (For , it is written .)
Defines to be the function with domain such that for all in . (The symbol may occur in exp, allowing a recursive definition.)
(1) The terminal S in the keyword is optional.
(2) may be replaced by a comma-separated list of items , where is either a comma-separated list or a tuple of identifiers.
INSTANCE WITH
For each defined operator of module , this defines to be the operator whose definition is obtained from the definition of in by replacing each declared constant or variable of with . (If , the WITH is omitted.) INSTANCE WITH
For each defined operator of module , this defines to be the operator whose definition is obtained from the definition of by replacing each declared constant or variable of with , and then replacing each identifier with . (If , the WITH is omitted.)
THEOREM
Asserts that can be proved from the definitions and assumptions of the current module.
LOCAL def
Makes the definition(s) of def (which may be a definition or an INSTANCE statement) local to the current module, thereby not obtained when extending or instantiating the module.
Ends the current module or submodule.
The Constant Operators
Sets
.
[Set consisting of elements
(2) [Set of elements in satisfying ]
[Set of elements such that in
SUBSET [Set of subsets of ]
UNION Union of all elements of
Functions
\begin{array}{ll} f[e] & {[\text { Function application] }} \ \text { DOMAIN } f & {[\text { Domain of function } f]} \ {[x \in S \mapsto e]{ }^{(1)}} & {[\text { Function } f \text { such that } f[x]=e \text { for } x \in S]} \ {[S \rightarrow T]} & {[\text { Set of functions } f \text { with } f[x] \in T \text { for } x \in} \ {\left[f \text { EXCEPT }!\left[e_{1}\right]=e_{2}\right]^{(3)}} & {\left[\text { Function } \widehat{f} \text { equal to } f \text { except } \widehat{f}\left[e_{1}\right]=e_{2}\right]} \end{array}
Records
Tuples
\begin{array}{ll} e[i] & {\left[\text { The } i^{\text {th }} \text { component of tuple } e\right]} \ \left\langle e_{1}, \ldots, e_{n}\right\rangle & {\left[\text { The } n \text {-tuple whose } i^{\text {th }} \text { component is } e_{i}\right]} \ S_{1} \times \ldots \times S_{n} & \text { [The set of all } \left.n \text {-tuples with } i^{\text {th }} \text { component in } S_{i}\right] \end{array}
(1) may be replaced by a comma-separated list of items , where is either a comma-separated list or a tuple of identifiers
(2) may be an identifier or tuple of identifiers.
(3)! or !.h may be replaced by a comma separated list of items , where each is or..
Miscellaneous Constructs
Action Operators
The value of in the final state of a step] | |
---|---|
ENABLED | An step is possible |
UNCHANGED | |
Composition of actions |
Temporal Operators
\begin{array}{ll} \square F & {[F \text { is always true }]} \ \diamond F & {[F \text { is eventually true }]} \ \mathrm{WF}{e}(A) & {[\text { Weak fairness for action } A]} \ \mathrm{SF}{e}(A) & {[\text { Strong fairness for action } A]} \ F \sim G & {[F \text { leads to } G]} \end{array}
User-Definable Operator Symbols
Infix Operators
++ | ||||||
---|---|---|---|---|---|---|
- | ||||||
-- | ||||||
(1) | ||||||
Postfix Operators (7)
-
(1) Defined by the Naturals, Integers, and Reals modules.
(2) Defined by the Reals module.
(3) Defined by the Sequences module.
(4) is printed as .
(5) Defined by the Bags module.
(6) Defined by the module.
(7) is printed as , and similarly for and .
Precedence Ranges of Operators
The relative precedence of two operators is unspecified if their ranges overlap. Left-associative operators are indicated by (a).
Operators Defined in Standard Modules.
Modules Naturals, Integers, Reals
\begin{aligned} & +\quad-{ }^{(1)} \quad * \quad /^{(2)} \quad \sim^{-(3)} \quad \text {.. } \quad \text { Nat } \quad \text { Real }^{(2)} \ & \div \quad % \quad \geq \quad>\quad \text { Int }^{(4)} \quad \text { Infinity }{ }^{(2} \end{aligned}
(1) Only infix - is defined in Naturals.
(2) Defined only in Reals module.
(3) Exponentiation.
(4) Not defined in Naturals module.
Module Sequences
Head | SelectSeq | SubSeq | |
---|---|---|---|
Append | Len | Seq | Tail |
Module FiniteSets
IsFiniteSet Cardinality
Module Bags
BagIn | CopiesIn | SubBag | |
---|---|---|---|
BagOfAll | EmptyBag | ||
BagToSet | IsABag | ||
BagCardinality | BagUnion | SetToBag |
Module RealTime
RTBound RTnow now (declared to be a variable)
Module
Print Assert JavaTime Permutations SortSeq
ASCII Representation of Typeset Symbols
or | land | V | or lor | ||
---|---|---|---|---|---|
or | not or \neg | or \equiv | |||
\in | \notin | or | |||
\rangle | [] | ||||
\leq or | or | \geq or >= | |||
\ll | |||||
\prec | \succ | ||||
\preceq | \succeq | \div | |||
\subsete | \supseteq | . | \cdot | ||
\subset | \supset | 0 | \o or \circ | ||
\sqsubse | \sqsupset | \bullet | |||
\sqsubse | eteq | \sqsupseteq | \star | ||
-1 | O | \bigcirc | |||
\sim | |||||
\simeq | |||||
\cap or | \intersect | \cup or \union | \asymp | ||
\sqcap | \sqcup | \approx | |||
or 1 | \oplus | \uplus | \cong | ||
or 1 | \ominus | or \times | \doteq | ||
(.) or 1 | \odot | 2 | |||
or | \otimes | \propto | |||
(/) or 1 | \oslash | "s" | "s" (1) | ||
, | |||||
]_v | \rangle | ||||
SF_v |
(1) is a sequence of characters.
(2) and are any expressions.
(3) a sequence of four or more - or characters.
(1) Action composition (\cdot).
(2) Record field (period).