StaticSMTContext

Struct StaticSMTContext 

Source
pub struct StaticSMTContext {
    solver: SMTSolver,
    params: HashMap<Parameter, SMTExpr>,
    locs: HashMap<Location, SMTExpr>,
    vars: HashMap<Variable, Vec<SMTExpr>>,
}
Expand description

A simple static context for encoding expressions related to threshold automata into SMT constraints and checking satisfiability

This context is used to encode expressions into SMT constraints and check their satisfiability. It should be only used to encode simple expressions, and is not designed to handle expressions over multiple configurations.

Fields§

§solver: SMTSolver§params: HashMap<Parameter, SMTExpr>§locs: HashMap<Location, SMTExpr>§vars: HashMap<Variable, Vec<SMTExpr>>

Implementations§

Source§

impl StaticSMTContext

Source

pub fn new( solver_builder: SMTSolverBuilder, params: impl IntoIterator<Item = Parameter>, locs: impl IntoIterator<Item = Location>, vars: impl IntoIterator<Item = Variable>, ) -> Result<Self, SMTSolverError>

Create a new static SMT context

This function creates a new static SMT context with the given solver builder and declares variables for the given parameters, locations, and variables.

Source

pub fn get_true(&self) -> SMTExpr

Get the SMT expression for the true value

Source

pub fn encode_to_smt<T>(&self, expr: &T) -> Result<SMTExpr, SMTSolverError>
where T: EncodeToSMT<T, Self>,

Encode the given expression into an SMT expression and return the expression

Trait Implementations§

Source§

impl GetAssignment<Location> for StaticSMTContext

Source§

fn get_assignment( &mut self, res: SMTSolution, var: &T, ) -> Result<Option<u64>, SMTSolverError>

Get the assigned solution of the variable Read more
Source§

impl GetAssignment<Parameter> for StaticSMTContext

Source§

fn get_assignment( &mut self, res: SMTSolution, var: &T, ) -> Result<Option<u64>, SMTSolverError>

Get the assigned solution of the variable Read more
Source§

impl GetAssignment<Variable> for StaticSMTContext

Source§

fn get_assignment( &mut self, res: SMTSolution, var: &T, ) -> Result<Option<u64>, SMTSolverError>

Get the assigned solution of the variable Read more
Source§

impl SMTSolverContext for StaticSMTContext

Source§

fn get_smt_solver_mut(&mut self) -> &mut SMTSolver

Get a mutable reference to the SMT solver associated with this context
Source§

fn get_smt_solver(&self) -> &SMTSolver

Get the SMT solver associated with this context
Source§

fn assert_and_check_expr( &mut self, expr: SMTExpr, ) -> Result<SMTSolution, SMTSolverError>

Check the satisfiability of the given SMTExpr
Source§

impl SMTVariableContext<Location> for StaticSMTContext

Source§

fn get_expr_for(&self, loc: &Location) -> Result<SMTExpr, SMTSolverError>

Get the corresponding SMTExpr for the given expression of type T Read more
Source§

fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Location>
where Location: 'a,

Get all expressions for which the current context holds an assignment
Source§

fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
where T: 'a + Eq + Hash + Clone,

Get the solution assignment
Source§

impl SMTVariableContext<Parameter> for StaticSMTContext

Source§

fn get_expr_for(&self, param: &Parameter) -> Result<SMTExpr, SMTSolverError>

Get the corresponding SMTExpr for the given expression of type T Read more
Source§

fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Parameter>
where Parameter: 'a,

Get all expressions for which the current context holds an assignment
Source§

fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
where T: 'a + Eq + Hash + Clone,

Get the solution assignment
Source§

impl SMTVariableContext<Variable> for StaticSMTContext

Source§

fn get_expr_for(&self, var: &Variable) -> Result<SMTExpr, SMTSolverError>

Get the corresponding SMTExpr for the given expression of type T Read more
Source§

fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Variable>
where Variable: 'a,

Get all expressions for which the current context holds an assignment
Source§

fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
where T: 'a + Eq + Hash + Clone,

Get the solution assignment

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.