pub struct SpecTranslator<'a, 'b, T: ExpGenerator<'a>> { /* private fields */ }
Expand description

A helper which reduces specification conditions to assume/assert statements.

Implementations§

source§

impl<'a, 'b, T: ExpGenerator<'a>> SpecTranslator<'a, 'b, T>

source

pub fn translate_fun_spec( auto_trace: bool, for_call: bool, builder: &'b mut T, fun_env: &'b FunctionEnv<'a>, type_args: &[Type], param_substitution: Option<&'b [TempIndex]>, ret_locals: &'b [TempIndex] ) -> TranslatedSpec

Translates the specification of function fun_env. This can happen for a call of the function or for its definition (parameter for_call). This will process all the conditions found in the spec block of the function, dealing with references to old(..), and creating respective memory/spec var saves. If for_call is true, abort conditions will be translated for the current state, otherwise they will be treated as in an old. and creating respective memory/spec var saves. It also allows to provide type arguments with which the specifications are instantiated, as well as a substitution for temporaries. The later two parameters are used to instantiate a function specification for a given call context.

source

pub fn translate_invariants( auto_trace: bool, builder: &'b mut T, invariants: impl Iterator<Item = (&'b GlobalInvariant, Vec<Type>)> ) -> TranslatedSpec

Translates a set of invariants with type instantiations. If there are any references to old(...) they will be rewritten and respective memory/spec var saves will be generated.

source

pub fn translate_inline_property( builder: &'b mut T, prop: &Exp ) -> (TranslatedSpec, Exp)

Translate one inline property. If there are any references to old(...) they will be rewritten and respective memory/spec var saves will be generated.

source

pub fn translate_invariants_by_id( auto_trace: bool, builder: &'b mut T, inv_ids: impl Iterator<Item = (GlobalId, Vec<Type>)> ) -> TranslatedSpec

Trait Implementations§

source§

impl<'a, 'b, T: ExpGenerator<'a>> ExpRewriterFunctions for SpecTranslator<'a, 'b, T>

source§

fn rewrite_exp(&mut self, exp: Exp) -> Exp

Top-level entry for rewriting an expression. Can be re-implemented to do some pre/post processing embedding a call to do_rewrite.
source§

fn rewrite_local_var(&mut self, id: NodeId, sym: Symbol) -> Option<Exp>

source§

fn rewrite_temporary(&mut self, id: NodeId, idx: TempIndex) -> Option<Exp>

source§

fn rewrite_spec_var( &mut self, id: NodeId, mid: ModuleId, vid: SpecVarId, label: &Option<MemoryLabel> ) -> Option<Exp>

source§

fn rewrite_call( &mut self, id: NodeId, oper: &Operation, args: &[Exp] ) -> Option<Exp>

source§

fn rewrite_node_id(&mut self, id: NodeId) -> Option<NodeId>

source§

fn rewrite_enter_scope<'c>( &mut self, decls: impl Iterator<Item = &'c LocalVarDecl> )

source§

fn rewrite_exit_scope(&mut self)

source§

fn rewrite_vec(&mut self, exps: &[Exp]) -> Vec<Exp>

source§

fn rewrite_value(&mut self, id: NodeId, value: &Value) -> Option<Exp>

source§

fn rewrite_invoke(&mut self, id: NodeId, target: &Exp, args: &[Exp]) -> Option<Exp>

source§

fn rewrite_lambda( &mut self, id: NodeId, vars: &[LocalVarDecl], body: &Exp ) -> Option<Exp>

source§

fn rewrite_block( &mut self, id: NodeId, vars: &[LocalVarDecl], body: &Exp ) -> Option<Exp>

source§

fn rewrite_quant( &mut self, id: NodeId, vars: &[(LocalVarDecl, Exp)], triggers: &[Vec<Exp>], cond: &Option<Exp>, body: &Exp ) -> Option<Exp>

source§

fn rewrite_if_else( &mut self, id: NodeId, cond: &Exp, then: &Exp, else_: &Exp ) -> Option<Exp>

source§

fn rewrite_exp_descent(&mut self, exp: Exp) -> Exp

source§

fn internal_rewrite_id(&mut self, id: &NodeId) -> (bool, NodeId)

source§

fn internal_rewrite_exp(&mut self, exp: &Exp) -> (bool, Exp)

source§

fn internal_rewrite_vec(&mut self, exps: &[Exp]) -> Option<Vec<Exp>>

source§

fn internal_rewrite_decls( &mut self, decls: &[LocalVarDecl] ) -> (bool, Vec<LocalVarDecl>)

source§

fn internal_rewrite_quant_decls( &mut self, decls: &[(LocalVarDecl, Exp)] ) -> (bool, Vec<(LocalVarDecl, Exp)>)

Auto Trait Implementations§

§

impl<'a, 'b, T> !RefUnwindSafe for SpecTranslator<'a, 'b, T>

§

impl<'a, 'b, T> !Send for SpecTranslator<'a, 'b, T>

§

impl<'a, 'b, T> !Sync for SpecTranslator<'a, 'b, T>

§

impl<'a, 'b, T> Unpin for SpecTranslator<'a, 'b, T>where 'a: 'b,

§

impl<'a, 'b, T> !UnwindSafe for SpecTranslator<'a, 'b, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V