pub enum ExprKind {
Show 38 variants
Bool(bool),
Int(i64),
String(String),
Ident(String),
Primed(String),
Binary {
op: BinOp,
left: Box<Expr>,
right: Box<Expr>,
},
Unary {
op: UnaryOp,
operand: Box<Expr>,
},
Index {
base: Box<Expr>,
index: Box<Expr>,
},
Slice {
base: Box<Expr>,
lo: Box<Expr>,
hi: Box<Expr>,
},
Field {
base: Box<Expr>,
field: Ident,
},
Call {
func: Box<Expr>,
args: Vec<Expr>,
},
SetLit(Vec<Expr>),
SeqLit(Vec<Expr>),
TupleLit(Vec<Expr>),
DictLit(Vec<(Expr, Expr)>),
FnLit {
var: Ident,
domain: Box<Expr>,
body: Box<Expr>,
},
SetComprehension {
element: Box<Expr>,
var: Ident,
domain: Box<Expr>,
filter: Option<Box<Expr>>,
},
RecordUpdate {
base: Box<Expr>,
updates: Vec<RecordFieldUpdate>,
},
Quantifier {
kind: QuantifierKind,
bindings: Vec<Binding>,
body: Box<Expr>,
},
Choose {
var: Ident,
domain: Box<Expr>,
predicate: Box<Expr>,
},
Fix {
var: Ident,
predicate: Box<Expr>,
},
Let {
var: Ident,
value: Box<Expr>,
body: Box<Expr>,
},
If {
cond: Box<Expr>,
then_branch: Box<Expr>,
else_branch: Box<Expr>,
},
Require(Box<Expr>),
Changes(Ident),
Enabled(Ident),
SeqHead(Box<Expr>),
SeqTail(Box<Expr>),
Len(Box<Expr>),
Keys(Box<Expr>),
Values(Box<Expr>),
BigUnion(Box<Expr>),
Powerset(Box<Expr>),
Always(Box<Expr>),
Eventually(Box<Expr>),
LeadsTo {
left: Box<Expr>,
right: Box<Expr>,
},
Range {
lo: Box<Expr>,
hi: Box<Expr>,
},
Paren(Box<Expr>),
}Expand description
The kind of expression.
Variants§
Bool(bool)
Boolean literal.
Int(i64)
Integer literal.
String(String)
String literal.
Ident(String)
Identifier.
Primed(String)
Primed identifier (next-state variable).
Binary
Binary operation.
Unary
Unary operation.
Index
Function/set/sequence indexing e[i].
Slice
Sequence slicing e[lo..hi].
Field
Field access e.field.
Call
Function call f(args).
SetLit(Vec<Expr>)
Set literal { a, b, c } or empty {}.
SeqLit(Vec<Expr>)
Sequence literal [a, b, c] or empty [].
TupleLit(Vec<Expr>)
Tuple literal (a, b, c).
DictLit(Vec<(Expr, Expr)>)
Dict literal { key: value, ... } where keys are expressions.
FnLit
Function literal fn(x in S) => e.
SetComprehension
Set comprehension { e for x in S } or { x in S if P } or { e for x in S if P }.
RecordUpdate
Record update e with { field: value, ... }.
Quantifier
Quantifier forall x in S: P or exists x in S: P.
Choose
Choose choose x in S: P.
Fix
Fix fix x: P - picks an arbitrary value satisfying P (used for CHOOSE without domain).
Let
Let binding let x = e1 in e2.
If
Conditional if c then t else f.
Require(Box<Expr>)
Require statement (in action body).
Changes(Ident)
Changes operator (explicit nondeterminism).
Enabled(Ident)
Enabled predicate enabled(Action).
SeqHead(Box<Expr>)
Sequence head head(seq) - get first element.
SeqTail(Box<Expr>)
Sequence tail tail(seq) - get all but first element.
Len(Box<Expr>)
Length len(x) - get length of sequence, set, or function.
Keys(Box<Expr>)
Function keys keys(f) - get domain of function as set.
Values(Box<Expr>)
Function values values(f) - get range of function as set.
BigUnion(Box<Expr>)
Distributed union union_all(S) - union of all sets in S.
Powerset(Box<Expr>)
Powerset powerset(S) - set of all subsets of S.
Always(Box<Expr>)
Temporal: always P.
Eventually(Box<Expr>)
Temporal: eventually P.
LeadsTo
Temporal: P leads_to Q.
Range
Range expression lo..hi (as value, not type).
Paren(Box<Expr>)
Parenthesized expression (for preserving source).