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
impl StaticSMTContext
Sourcepub fn new(
solver_builder: SMTSolverBuilder,
params: impl IntoIterator<Item = Parameter>,
locs: impl IntoIterator<Item = Location>,
vars: impl IntoIterator<Item = Variable>,
) -> Result<Self, SMTSolverError>
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.
Sourcepub fn encode_to_smt<T>(&self, expr: &T) -> Result<SMTExpr, SMTSolverError>where
T: EncodeToSMT<T, Self>,
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
impl GetAssignment<Location> for StaticSMTContext
Source§fn get_assignment(
&mut self,
res: SMTSolution,
var: &T,
) -> Result<Option<u64>, SMTSolverError>
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
impl GetAssignment<Parameter> for StaticSMTContext
Source§fn get_assignment(
&mut self,
res: SMTSolution,
var: &T,
) -> Result<Option<u64>, SMTSolverError>
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
impl GetAssignment<Variable> for StaticSMTContext
Source§fn get_assignment(
&mut self,
res: SMTSolution,
var: &T,
) -> Result<Option<u64>, SMTSolverError>
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
impl SMTSolverContext for StaticSMTContext
Source§fn get_smt_solver_mut(&mut self) -> &mut SMTSolver
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
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>
fn assert_and_check_expr( &mut self, expr: SMTExpr, ) -> Result<SMTSolution, SMTSolverError>
Check the satisfiability of the given
SMTExprSource§impl SMTVariableContext<Location> for StaticSMTContext
impl SMTVariableContext<Location> for StaticSMTContext
Source§fn get_expr_for(&self, loc: &Location) -> Result<SMTExpr, SMTSolverError>
fn get_expr_for(&self, loc: &Location) -> Result<SMTExpr, SMTSolverError>
Source§fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Location>where
Location: 'a,
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>
fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
Get the solution assignment
Source§impl SMTVariableContext<Parameter> for StaticSMTContext
impl SMTVariableContext<Parameter> for StaticSMTContext
Source§fn get_expr_for(&self, param: &Parameter) -> Result<SMTExpr, SMTSolverError>
fn get_expr_for(&self, param: &Parameter) -> Result<SMTExpr, SMTSolverError>
Source§fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Parameter>where
Parameter: 'a,
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>
fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
Get the solution assignment
Source§impl SMTVariableContext<Variable> for StaticSMTContext
impl SMTVariableContext<Variable> for StaticSMTContext
Source§fn get_expr_for(&self, var: &Variable) -> Result<SMTExpr, SMTSolverError>
fn get_expr_for(&self, var: &Variable) -> Result<SMTExpr, SMTSolverError>
Source§fn get_exprs<'a>(&'a self) -> impl IntoIterator<Item = &'a Variable>where
Variable: 'a,
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>
fn get_solution<'a>( &'a self, solver: &mut SMTSolver, res: SMTSolution, ) -> Result<HashMap<T, u32>, SMTSolverError>
Get the solution assignment
Auto Trait Implementations§
impl !Freeze for StaticSMTContext
impl !RefUnwindSafe for StaticSMTContext
impl Send for StaticSMTContext
impl !Sync for StaticSMTContext
impl Unpin for StaticSMTContext
impl !UnwindSafe for StaticSMTContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more