The desugared core syntax of TLA⁺ expressions — the output of desugaring, and the language the type checker and everything downstream actually works against.
Relative to SurfaceTLAPlus.Expression:
@is eliminated entirely (substituted away during desugaring).- Conjunction/disjunction lists become binary
infixCalls (.conj/.disjdon't exist here). - Every prefix/infix/postfix operator application becomes an ordinary (prefix-style)
opCall, with the operator referenced by its canonical spelling through the samevarconstructor used for ordinary identifiers — no separate operator-enum or value constructors. - Every quantifier-like binder (
\A/\E/\AA/\EE/CHOOSE/set-map/set-filter/function literals) binds exactly one variable over at most one domain; multi-variable and tuple-pattern binders are surface sugar eliminated before reaching this type.
TLA⁺ expressions after desugaring. α carries whatever comment-annotation payload the binders
(quantifiers, LET in the future, record fields, …) need.
- var
{α : Type}
: String → Expression α
An unqualified identifier: a variable, a user-defined 0-ary operator, or (by canonical spelling, e.g.
"+","\\in","DOMAIN") a builtin operator referenced as a value. - opCall
{α : Type}
: Expression α → List (Expression α) → Expression α
An operator application
f(e₁, …, eₙ)— the only form of application here, used uniformly for user-defined operators and (applying a builtinvar) builtins alike. - forall
{α : Type}
: String → α → Option (Expression α) → Expression α → Expression α
Bounded (
\A x ∈ A : P,domain = some A) or unbounded (\A x : P,domain = none, the annotationαonxcarrying the required explicit type) universal quantification. - exists
{α : Type}
: String → α → Option (Expression α) → Expression α → Expression α
Bounded or unbounded existential quantification, dual to
forall. - fforall
{α : Type}
: String → α → Expression α → Expression α
Temporal universal quantification
\AA x : P— always unbounded. - eexists
{α : Type}
: String → α → Expression α → Expression α
Temporal existential quantification, dual to
fforall. - choose
{α : Type}
: String → α → Option (Expression α) → Expression α → Expression α
Hilbert's epsilon operator: bounded (
CHOOSE x ∈ A : P) or unbounded (CHOOSE x : P, checked against the expected type rather than annotated). - set
{α : Type}
: List (Expression α) → Expression α
A literal set
{e₁, …, eₙ}. - collect
{α : Type}
: String → α → Expression α → Expression α → Expression α
Set filtering
{x ∈ A : P}. - map'
{α : Type}
: Expression α → String → α → Expression α → Expression α
The image of a function by a set
{e : x ∈ A}. - fnCall
{α : Type}
: Expression α → Expression α → Expression α
A function call
f[e]— always unary; a surface multi-index callf[e₁, …, eₙ](n > 1) desugars tof[<<e₁, …, eₙ>>]. - fn
{α : Type}
: String → α → Expression α → Expression α → Expression α
A function literal
[x ∈ A ↦ e]. - fnSet
{α : Type}
: Expression α → Expression α → Expression α
The set of all functions from a domain to a codomain,
[A -> B]. - record
{α : Type}
: List (α × String × Expression α) → Expression α
A literal record
[a |-> e₁, …, z |-> eₙ]. - recordSet
{α : Type}
: List (α × String × Expression α) → Expression α
The set of all records whose fields are in the given sets,
[a : A, …, z : Z]. - except
{α : Type}
: Expression α → List (List (String ⊕ Expression α) × Expression α) → Expression α
Function update
[f EXCEPT ![e] = e₂]— each path step's index (.inr) is unary, same asfnCall. - recordAccess
{α : Type}
: Expression α → String → Expression α
Record access
r.x. - tuple
{α : Type}
: List (Expression α) → Expression α
A literal tuple
<<e₁, …, eₙ>>— also TLA⁺'s only literal sequence former (Seq(S)is an ordinaryopCall, not a literal). - if
{α : Type}
: Expression α → Expression α → Expression α → Expression α
Conditional
IF e₁ THEN e₂ ELSE e₃. - case
{α : Type}
: List (Expression α × Expression α) → Option (Expression α) → Expression α
Case distinction
CASE p₁ -> e₁ [] … [] OTHER -> eₙ₊₁. - nat {α : Type} : String → Expression α
- str {α : Type} : String → Expression α
- true {α : Type} : Expression α
- false {α : Type} : Expression α
- stutter
{α : Type}
: Expression α → Expression α → Expression α
The stuttering-allowed action
[A]_e.
Instances For
Equations
Equations
Equations
Equations
- CoreTLAPlus.instFunctorExpression = { map := fun {α β : Type} => CoreTLAPlus.Expression.map }
Equations
Instances For
Equations
- CoreTLAPlus.instTraversableExpression = { toFunctor := CoreTLAPlus.instFunctorExpression, traverse := fun {m : Type → Type} [Applicative m] {α β : Type} => CoreTLAPlus.Expression.traverse }
Whether x occurs free in e — some .var x not under a binder that binds x. A binder's own
domain is outside its scope.
A top-level TLA⁺ declaration. Module INSTANCE is not represented. Own type rather than an
abbrev over Core/Declaration.lean's shared one: a CONSTANT's own arity (0 for an
ordinary value, matching CONSTANT F(_, _)'s written arity otherwise) is only needed up to the
elaborator's arity-vs-annotation consistency check, and has no role in TypedTLAPlus.Declaration,
which reuses the shared type unchanged — same reason .recursive (below) emits no
TypedTLAPlus.Declaration at all: a RECURSIVE predeclaration is discharged by a later
.operator, never becomes a typed declaration in its own right.
- constants {α : Type} : List (String × ℕ × α) → Declaration α
- variables {α : Type} : List (String × α) → Declaration α
- assume {α : Type} : Expression α → Declaration α
- operator
{α : Type}
: α → String → List (String × ℕ) → Expression α → Declaration α
An operator definition, optionally with higher-order arguments. Each parameter's
Natis its arity (0forx,3forF(_, _, _), …). - function
{α : Type}
: α → String → List (String × Expression α) → Expression α → Declaration α
A function definition, with an explicit domain for every argument.
- recursive
{α : Type}
: List (String × ℕ × α) → Declaration α
A
RECURSIVEpredeclaration list — each entry's own canonical name/arity, no defining expression (that's a separate, later.operator).
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
A desugared TLA⁺ module, wrapping the embedded (still-Surface, not-yet-desugared-at-the-
statement-level) PlusCal algorithm at whatever α the caller instantiates it at — kept abstract
to avoid a cyclic import. Own type for the same reason Declaration above is.
- name : String
- declarations₁ : List (Declaration β)
- pcalAlgorithm : Option α
- declarations₂ : List (Declaration β)
Instances For
Equations
Hand-written, same reason as Declaration's Repr instance above.
Equations
- One or more equations did not get rendered due to their size.
@@ posOf m, same reason Core/Declaration.lean's TLAModule instance carries it: mapping
a module rebuilds the structure, and a rebuilt node that isn't re-registered has no position of
its own.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.