Storm
A Modern Probabilistic Model Checker
|
An interface that captures the functionality of an SMT solver. More...
#include <SmtSolver.h>
Classes | |
class | ModelReference |
The base class for all model references. More... | |
Public Types | |
enum class | CheckResult { Sat , Unsat , Unknown } |
possible check results More... | |
Public Member Functions | |
SmtSolver (storm::expressions::ExpressionManager &manager) | |
Constructs a new Smt solver with the given options. | |
virtual | ~SmtSolver () |
Destructs the solver instance. | |
SmtSolver (SmtSolver const &other)=default | |
SmtSolver (SmtSolver &&other)=default | |
SmtSolver & | operator= (SmtSolver const &other)=delete |
SmtSolver & | operator= (SmtSolver &&other)=delete |
virtual void | push ()=0 |
Pushes a backtracking point on the solver's stack. | |
virtual void | pop ()=0 |
Pops a backtracking point from the solver's stack. | |
virtual void | pop (uint_fast64_t n) |
Pops multiple backtracking points from the solver's stack in the same way as pop() does. | |
virtual void | reset ()=0 |
Removes all assertions from the solver's stack. | |
virtual void | add (storm::expressions::Expression const &assertion)=0 |
Adds an assertion to the solver's stack. | |
void | add (std::set< storm::expressions::Expression > const &assertions) |
Adds the given set of assertions to the solver's stack. | |
void | add (std::initializer_list< storm::expressions::Expression > const &assertions) |
Adds the given list of assertions to the solver's stack. | |
virtual CheckResult | check ()=0 |
Checks whether the conjunction of assertions that are currently on the solver's stack is satisfiable. | |
virtual CheckResult | checkWithAssumptions (std::set< storm::expressions::Expression > const &assumptions)=0 |
Checks whether the conjunction of assertions that are currently on the solver's stack together with the provided assumptions is satisfiable. | |
virtual CheckResult | checkWithAssumptions (std::initializer_list< storm::expressions::Expression > const &assumptions)=0 |
Checks whether the conjunction of assertions that are currently on the solver's stack together with the provided assumptions is satisfiable. | |
virtual storm::expressions::SimpleValuation | getModelAsValuation () |
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that satisfies all assertions on the solver's stack (as well as provided assumptions), provided that the solver was instantiated with support for model generation. | |
virtual std::shared_ptr< ModelReference > | getModel () |
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that satisfies all assertions on the solver's stack (as well as provided assumptions), provided that the solver was instantiated with support for model generation. | |
virtual std::vector< storm::expressions::SimpleValuation > | allSat (std::vector< storm::expressions::Variable > const &important) |
Performs AllSat over the (provided) important atoms. | |
virtual uint_fast64_t | allSat (std::vector< storm::expressions::Variable > const &important, std::function< bool(storm::expressions::SimpleValuation &)> const &callback) |
Performs AllSat over the (provided) important atoms. | |
virtual uint_fast64_t | allSat (std::vector< storm::expressions::Variable > const &important, std::function< bool(ModelReference &)> const &callback) |
Performs AllSat over the (provided) important atoms. | |
virtual std::vector< storm::expressions::Expression > | getUnsatCore () |
If the last call to check() returned Unsat, this function can be used to retrieve the unsatisfiable core of the assertions on the solver's stack, provided that the solver has been instantiated with support for the generation of unsatisfiable cores. | |
virtual std::vector< storm::expressions::Expression > | getUnsatAssumptions () |
If the last call to checkWithAssumptions() returned Unsat, this function can be used to retrieve a subset of the assumptions such that the assertion stack and these assumptions are unsatisfiable. | |
virtual void | setInterpolationGroup (uint_fast64_t group) |
Sets the current interpolation group. | |
virtual storm::expressions::Expression | getInterpolant (std::vector< uint_fast64_t > const &groupsA) |
If the last call to check() returned Unsat, the solver has been instantiated with support for interpolant generation and at least two non-empty interpolation groups have been added, the function can be used to retrieve an interpolant for the pair (A, B) of formulas where A is the conjunction of all the assertions in the groups provided as a parameter and B is the set of all other assertions. | |
storm::expressions::ExpressionManager const & | getManager () const |
Retrieves the expression manager associated with the solver. | |
storm::expressions::ExpressionManager & | getManager () |
Retrieves the expression manager associated with the solver. | |
virtual bool | setTimeout (uint_fast64_t milliseconds) |
If supported by the solver, this will limit all subsequent satisfiability queries to the given number of milliseconds. | |
virtual bool | unsetTimeout () |
If supported by the solver, this unsets a previous timeout. | |
virtual std::string | getSmtLibString () const |
If supported by the solver, this function returns the current assertions in the SMT-LIB format. | |
An interface that captures the functionality of an SMT solver.
Definition at line 22 of file SmtSolver.h.
|
strong |
storm::solver::SmtSolver::SmtSolver | ( | storm::expressions::ExpressionManager & | manager | ) |
Constructs a new Smt solver with the given options.
manager | The expression manager responsible for all expressions that in some way or another interact with this solver. |
storm::exceptions::IllegalArgumentValueException | if an option is unsupported for the solver. |
Definition at line 17 of file SmtSolver.cpp.
|
virtual |
Destructs the solver instance.
Definition at line 21 of file SmtSolver.cpp.
|
default |
|
default |
void storm::solver::SmtSolver::add | ( | std::initializer_list< storm::expressions::Expression > const & | assertions | ) |
Adds the given list of assertions to the solver's stack.
assertions | The assertions to add. |
Definition at line 31 of file SmtSolver.cpp.
void storm::solver::SmtSolver::add | ( | std::set< storm::expressions::Expression > const & | assertions | ) |
Adds the given set of assertions to the solver's stack.
assertions | The assertions to add. |
Definition at line 25 of file SmtSolver.cpp.
|
pure virtual |
Adds an assertion to the solver's stack.
assertion | The assertion to add. |
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
virtual |
Performs AllSat over the (provided) important atoms.
That is, this function returns all models of the assertions on the solver's stack.
important | The set of important atoms over which to perform all sat. |
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 51 of file SmtSolver.cpp.
|
virtual |
Performs AllSat over the (provided) important atoms.
That is, this function determines all models of the assertions on the solver's stack. While doing so, every time a model is found, the provided callback is called and informed about the content of the current model. The callback function can signal to abort the enumeration process by returning false.
important | The set of important atoms over which to perform all sat. |
callback | A function to call for each found model. |
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 59 of file SmtSolver.cpp.
|
virtual |
Performs AllSat over the (provided) important atoms.
That is, this function determines all models of the assertions on the solver's stack. While doing so, every time a model is found, the provided callback is called and informed about the content of the current model. The callback function can signal to abort the enumeration process by returning false.
important | The set of important atoms over which to perform all sat. |
callback | A function to call for each found model. |
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 55 of file SmtSolver.cpp.
|
pure virtual |
Checks whether the conjunction of assertions that are currently on the solver's stack is satisfiable.
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
pure virtual |
Checks whether the conjunction of assertions that are currently on the solver's stack together with the provided assumptions is satisfiable.
The assumptions are, however, not added to the solver's stack, but are merely considered for this one call.
assumptions | The assumptions to add to the call. |
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
pure virtual |
Checks whether the conjunction of assertions that are currently on the solver's stack together with the provided assumptions is satisfiable.
The assumptions are, however, not added to the solver's stack, but are merely considered for this one call.
assumptions | The assumptions to add to the call. |
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
virtual |
If the last call to check() returned Unsat, the solver has been instantiated with support for interpolant generation and at least two non-empty interpolation groups have been added, the function can be used to retrieve an interpolant for the pair (A, B) of formulas where A is the conjunction of all the assertions in the groups provided as a parameter and B is the set of all other assertions.
To obtain meaningful results, the conjunction of the formulas within one group should be satisfiable.
groupsA | The indices of all interpolation groups whose conjunctions form the formula A. |
Reimplemented in storm::solver::MathsatSmtSolver.
Definition at line 75 of file SmtSolver.cpp.
storm::expressions::ExpressionManager & storm::solver::SmtSolver::getManager | ( | ) |
Retrieves the expression manager associated with the solver.
Definition at line 83 of file SmtSolver.cpp.
storm::expressions::ExpressionManager const & storm::solver::SmtSolver::getManager | ( | ) | const |
Retrieves the expression manager associated with the solver.
Definition at line 79 of file SmtSolver.cpp.
|
virtual |
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that satisfies all assertions on the solver's stack (as well as provided assumptions), provided that the solver was instantiated with support for model generation.
Note that this function may throw an exception if it is not called immediately after a call to check() or checkWithAssumptions() that returned Sat depending on the implementation.
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 47 of file SmtSolver.cpp.
|
virtual |
If the last call to check() or checkWithAssumptions() returned Sat, this method retrieves a model that satisfies all assertions on the solver's stack (as well as provided assumptions), provided that the solver was instantiated with support for model generation.
Note that this function may throw an exception if it is not called immediately after a call to check() or checkWithAssumptions() that returned Sat depending on the implementation.
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 43 of file SmtSolver.cpp.
|
virtual |
If supported by the solver, this function returns the current assertions in the SMT-LIB format.
Reimplemented in storm::solver::Z3SmtSolver.
Definition at line 95 of file SmtSolver.cpp.
|
virtual |
If the last call to checkWithAssumptions() returned Unsat, this function can be used to retrieve a subset of the assumptions such that the assertion stack and these assumptions are unsatisfiable.
This may only be called provided that the solver has been instantiated with support for the generation of unsatisfiable cores.
Reimplemented in storm::solver::MathsatSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 67 of file SmtSolver.cpp.
|
virtual |
If the last call to check() returned Unsat, this function can be used to retrieve the unsatisfiable core of the assertions on the solver's stack, provided that the solver has been instantiated with support for the generation of unsatisfiable cores.
Definition at line 63 of file SmtSolver.cpp.
|
pure virtual |
Pops a backtracking point from the solver's stack.
This deletes all assertions from the solver's stack that were added after the last call to push().
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
virtual |
Pops multiple backtracking points from the solver's stack in the same way as pop() does.
n | The number of backtracking points to pop. |
Reimplemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
Definition at line 37 of file SmtSolver.cpp.
|
pure virtual |
Pushes a backtracking point on the solver's stack.
A following call to pop() deletes exactly those assertions from the solver's stack that were added after this call.
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
pure virtual |
Removes all assertions from the solver's stack.
Implemented in storm::solver::MathsatSmtSolver, storm::solver::SmtlibSmtSolver, and storm::solver::Z3SmtSolver.
|
virtual |
Sets the current interpolation group.
All terms added to the assertion stack after this call will belong to the set group until the next call to this function. Note that, depending on the solver, it might not be possible to "re-open" groups, so this should be used with care. Also, this functionality is only available if the solver has been instantiated with support for interpolant generation.
group | The index of the interpolation group with which all assertions added after this call will be associated. |
Reimplemented in storm::solver::MathsatSmtSolver.
Definition at line 71 of file SmtSolver.cpp.
|
virtual |
If supported by the solver, this will limit all subsequent satisfiability queries to the given number of milliseconds.
milliseconds | The amount of milliseconds before timing out. |
Reimplemented in storm::solver::Z3SmtSolver.
Definition at line 87 of file SmtSolver.cpp.
|
virtual |
If supported by the solver, this unsets a previous timeout.
Reimplemented in storm::solver::Z3SmtSolver.
Definition at line 91 of file SmtSolver.cpp.