Trait move_model::exp_generator::ExpGenerator
source · pub trait ExpGenerator<'env> {
Show 34 methods
// Required methods
fn function_env(&self) -> &FunctionEnv<'env>;
fn get_current_loc(&self) -> Loc;
fn set_loc(&mut self, loc: Loc);
fn add_local(&mut self, ty: Type) -> TempIndex;
fn get_local_type(&self, temp: TempIndex) -> Type;
// Provided methods
fn global_env(&self) -> &'env GlobalEnv { ... }
fn set_loc_from_node(&mut self, node_id: NodeId) { ... }
fn new_node(&self, ty: Type, inst_opt: Option<Vec<Type>>) -> NodeId { ... }
fn new_temp(&mut self, ty: Type) -> TempIndex { ... }
fn mk_bool_const(&self, value: bool) -> Exp { ... }
fn mk_call(&self, ty: &Type, oper: Operation, args: Vec<Exp>) -> Exp { ... }
fn mk_call_with_inst(
&self,
ty: &Type,
inst: Vec<Type>,
oper: Operation,
args: Vec<Exp>
) -> Exp { ... }
fn mk_ite(&self, cond: ExpData, if_true: ExpData, if_false: ExpData) -> Exp { ... }
fn mk_bool_call(&self, oper: Operation, args: Vec<Exp>) -> Exp { ... }
fn mk_not(&self, arg: Exp) -> Exp { ... }
fn mk_eq(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_identical(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_and(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_or(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_implies(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_iff(&self, arg1: Exp, arg2: Exp) -> Exp { ... }
fn mk_builtin_num_const(&self, oper: Operation) -> Exp { ... }
fn mk_join_bool(
&self,
oper: Operation,
args: impl Iterator<Item = Exp>
) -> Option<Exp> { ... }
fn mk_join_opt_bool(
&self,
oper: Operation,
arg1: Option<Exp>,
arg2: Option<Exp>
) -> Option<Exp> { ... }
fn mk_vector_quant_opt<F>(
&self,
kind: QuantKind,
vector: Exp,
elem_ty: &Type,
f: &mut F
) -> Option<Exp>
where F: FnMut(Exp) -> Option<Exp> { ... }
fn mk_mem_quant_opt<F>(
&self,
kind: QuantKind,
mem: QualifiedId<StructId>,
f: &mut F
) -> Option<ExpData>
where F: FnMut(Exp) -> Option<Exp> { ... }
fn mk_inst_mem_quant_opt<F>(
&self,
kind: QuantKind,
mem: &QualifiedInstId<StructId>,
f: &mut F
) -> Option<Exp>
where F: FnMut(Exp) -> Option<Exp> { ... }
fn mk_decl(&self, name: Symbol, ty: Type, binding: Option<Exp>) -> LocalVarDecl { ... }
fn mk_symbol(&self, str: &str) -> Symbol { ... }
fn mk_type_domain(&self, ty: Type) -> Exp { ... }
fn mk_field_select(
&self,
field_env: &FieldEnv<'_>,
targs: &[Type],
exp: Exp
) -> Exp { ... }
fn mk_temporary(&self, temp: TempIndex) -> Exp { ... }
fn mk_local(&self, name: &str, ty: Type) -> Exp { ... }
fn get_memory_of_node(&self, node_id: NodeId) -> QualifiedInstId<StructId> { ... }
}
Expand description
A trait that defines a generator for Exp
.
Required Methods§
sourcefn function_env(&self) -> &FunctionEnv<'env>
fn function_env(&self) -> &FunctionEnv<'env>
Get the functional environment
sourcefn get_current_loc(&self) -> Loc
fn get_current_loc(&self) -> Loc
Get the current location
sourcefn add_local(&mut self, ty: Type) -> TempIndex
fn add_local(&mut self, ty: Type) -> TempIndex
Add a local variable with given type, return the local index.
sourcefn get_local_type(&self, temp: TempIndex) -> Type
fn get_local_type(&self, temp: TempIndex) -> Type
Get the type of a local given at temp
index
Provided Methods§
sourcefn global_env(&self) -> &'env GlobalEnv
fn global_env(&self) -> &'env GlobalEnv
Get the global environment
sourcefn set_loc_from_node(&mut self, node_id: NodeId)
fn set_loc_from_node(&mut self, node_id: NodeId)
Sets the default location from a node id.
sourcefn new_node(&self, ty: Type, inst_opt: Option<Vec<Type>>) -> NodeId
fn new_node(&self, ty: Type, inst_opt: Option<Vec<Type>>) -> NodeId
Creates a new expression node id, using current default location, provided type, and optional instantiation.
sourcefn mk_bool_const(&self, value: bool) -> Exp
fn mk_bool_const(&self, value: bool) -> Exp
Make a boolean constant expression.
sourcefn mk_call_with_inst(
&self,
ty: &Type,
inst: Vec<Type>,
oper: Operation,
args: Vec<Exp>
) -> Exp
fn mk_call_with_inst( &self, ty: &Type, inst: Vec<Type>, oper: Operation, args: Vec<Exp> ) -> Exp
Makes a Call expression with type instantiation.
sourcefn mk_ite(&self, cond: ExpData, if_true: ExpData, if_false: ExpData) -> Exp
fn mk_ite(&self, cond: ExpData, if_true: ExpData, if_false: ExpData) -> Exp
Makes an if-then-else expression.
sourcefn mk_bool_call(&self, oper: Operation, args: Vec<Exp>) -> Exp
fn mk_bool_call(&self, oper: Operation, args: Vec<Exp>) -> Exp
Makes a Call expression with boolean result type.
sourcefn mk_identical(&self, arg1: Exp, arg2: Exp) -> Exp
fn mk_identical(&self, arg1: Exp, arg2: Exp) -> Exp
Make an identical equality expression. This is stronger than make_equal
because
it requires the exact same representation, not only interpretation.
sourcefn mk_implies(&self, arg1: Exp, arg2: Exp) -> Exp
fn mk_implies(&self, arg1: Exp, arg2: Exp) -> Exp
Make an implies expression.
sourcefn mk_builtin_num_const(&self, oper: Operation) -> Exp
fn mk_builtin_num_const(&self, oper: Operation) -> Exp
Make a numerical expression for some of the builtin constants.
sourcefn mk_join_bool(
&self,
oper: Operation,
args: impl Iterator<Item = Exp>
) -> Option<Exp>
fn mk_join_bool( &self, oper: Operation, args: impl Iterator<Item = Exp> ) -> Option<Exp>
Join an iterator of boolean expressions with a boolean binary operator.
sourcefn mk_join_opt_bool(
&self,
oper: Operation,
arg1: Option<Exp>,
arg2: Option<Exp>
) -> Option<Exp>
fn mk_join_opt_bool( &self, oper: Operation, arg1: Option<Exp>, arg2: Option<Exp> ) -> Option<Exp>
Join two boolean optional expression with binary operator.
sourcefn mk_vector_quant_opt<F>(
&self,
kind: QuantKind,
vector: Exp,
elem_ty: &Type,
f: &mut F
) -> Option<Exp>where
F: FnMut(Exp) -> Option<Exp>,
fn mk_vector_quant_opt<F>( &self, kind: QuantKind, vector: Exp, elem_ty: &Type, f: &mut F ) -> Option<Exp>where F: FnMut(Exp) -> Option<Exp>,
Creates a quantifier over the content of a vector. The passed function f
receives
an expression representing an element of the vector and returns the quantifiers predicate;
if it returns None, this function will also return None, otherwise the quantifier will be
returned.
sourcefn mk_mem_quant_opt<F>(
&self,
kind: QuantKind,
mem: QualifiedId<StructId>,
f: &mut F
) -> Option<ExpData>where
F: FnMut(Exp) -> Option<Exp>,
fn mk_mem_quant_opt<F>( &self, kind: QuantKind, mem: QualifiedId<StructId>, f: &mut F ) -> Option<ExpData>where F: FnMut(Exp) -> Option<Exp>,
Creates a quantifier over the content of memory. The passed function f
receives
sourcefn mk_inst_mem_quant_opt<F>(
&self,
kind: QuantKind,
mem: &QualifiedInstId<StructId>,
f: &mut F
) -> Option<Exp>where
F: FnMut(Exp) -> Option<Exp>,
fn mk_inst_mem_quant_opt<F>( &self, kind: QuantKind, mem: &QualifiedInstId<StructId>, f: &mut F ) -> Option<Exp>where F: FnMut(Exp) -> Option<Exp>,
Creates a quantifier over the content of instantiated memory. The passed function f
receives an expression representing a value in memory and returns the quantifiers predicate;
sourcefn mk_decl(&self, name: Symbol, ty: Type, binding: Option<Exp>) -> LocalVarDecl
fn mk_decl(&self, name: Symbol, ty: Type, binding: Option<Exp>) -> LocalVarDecl
Makes a local variable declaration.
sourcefn mk_type_domain(&self, ty: Type) -> Exp
fn mk_type_domain(&self, ty: Type) -> Exp
Makes a type domain expression.
sourcefn mk_field_select(
&self,
field_env: &FieldEnv<'_>,
targs: &[Type],
exp: Exp
) -> Exp
fn mk_field_select( &self, field_env: &FieldEnv<'_>, targs: &[Type], exp: Exp ) -> Exp
Makes an expression which selects a field from a struct.
sourcefn mk_temporary(&self, temp: TempIndex) -> Exp
fn mk_temporary(&self, temp: TempIndex) -> Exp
Makes an expression for a temporary.
sourcefn get_memory_of_node(&self, node_id: NodeId) -> QualifiedInstId<StructId>
fn get_memory_of_node(&self, node_id: NodeId) -> QualifiedInstId<StructId>
Get’s the memory associated with a Call(Global,..) or Call(Exists, ..) node. Crashes if the the node is not typed as expected.