22#include <minisat/core/Solver.h>
23#include <minisat/simp/SimpSolver.h>
26#error "Expected HAVE_MINISAT2"
29void convert(
const bvt &bv, Minisat::vec<Minisat::Lit> &dest)
32 bv.size() <=
static_cast<std::size_t
>(std::numeric_limits<int>::max()));
33 dest.capacity(
static_cast<int>(bv.size()));
45 bv.size() <=
static_cast<std::size_t
>(std::numeric_limits<int>::max()));
46 dest.capacity(
static_cast<int>(bv.size()));
66 if(
a.var_no()>=(
unsigned)
solver->model.size())
96 catch(Minisat::OutOfMemoryException)
98 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
99 status = statust::ERROR;
100 throw std::bad_alloc();
118 return "MiniSAT 2.2.1 without simplifier";
123 return "MiniSAT 2.2.1 with simplifier";
129 while((
unsigned)
solver->nVars()<no_variables())
148 "variable not added yet");
152 Minisat::vec<Minisat::Lit>
c;
176 solver_hardness->register_clause(
182 catch(
const Minisat::OutOfMemoryException &)
184 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
185 status = statust::ERROR;
186 throw std::bad_alloc();
207 log.statistics() << (no_variables() - 1) <<
" variables, "
216 log.status() <<
"SAT checker inconsistent: instance is UNSATISFIABLE"
218 status = statust::UNSAT;
219 return resultt::P_UNSATISFIABLE;
223 for(
const auto &assumption : assumptions)
225 if(assumption.is_false())
227 log.status() <<
"got FALSE as assumption: instance is UNSATISFIABLE"
229 status = statust::UNSAT;
230 return resultt::P_UNSATISFIABLE;
237 using Minisat::lbool;
243 if(time_limit_seconds != 0)
248 log.warning() <<
"Failed to set solver time limit" <<
messaget::eom;
250 alarm(time_limit_seconds);
264 if(time_limit_seconds != 0)
266 log.warning() <<
"Time limit ignored (not supported on Win32 yet)"
276 log.status() <<
"SAT checker: instance is SATISFIABLE" <<
messaget::eom;
278 status = statust::SAT;
279 return resultt::P_SATISFIABLE;
284 log.status() <<
"SAT checker: instance is UNSATISFIABLE" <<
messaget::eom;
285 status = statust::UNSAT;
286 return resultt::P_UNSATISFIABLE;
289 log.status() <<
"SAT checker: timed out or other error" <<
messaget::eom;
290 status = statust::ERROR;
291 return resultt::P_ERROR;
293 catch(
const Minisat::OutOfMemoryException &)
295 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
296 status=statust::ERROR;
297 return resultt::P_ERROR;
308 unsigned v =
a.var_no();
309 bool sign =
a.sign();
312 solver->model.growTo(v + 1);
314 solver->model[v] = Minisat::lbool(value);
316 catch(
const Minisat::OutOfMemoryException &)
318 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
319 status = statust::ERROR;
320 throw std::bad_alloc();
329 time_limit_seconds(0)
341 for(
int i=0; i<
solver->conflict.size(); i++)
342 if(var(
solver->conflict[i])==v)
358 solver->setFrozen(
a.var_no(),
true);
361 catch(
const Minisat::OutOfMemoryException &)
365 throw std::bad_alloc();
373 return solver->isEliminated(
a.var_no());
static bool convert(const irep_idt &identifier, const std::ostringstream &s, symbol_table_baset &symbol_table, message_handlert &message_handler)
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
bool is_in_conflict(literalt a) const override
Returns true if an assumption is in the final conflict.
std::unique_ptr< Minisat::SimpSolver > solver
~satcheck_minisat2_baset() override
A default destructor defined in the .cpp is used to ensure the unique_ptr to the solver is correctly ...
resultt do_prop_solve(const bvt &) override
satcheck_minisat2_baset(message_handlert &message_handler)
void set_polarity(literalt a, bool value)
void lcnf(const bvt &bv) override final
tvt l_get(literalt a) const override final
void set_assignment(literalt a, bool value) override
std::string solver_text() const override
void set_frozen(literalt a) override final
bool is_eliminated(literalt a) const
std::string solver_text() const override final
std::vector< literalt > bvt
std::unique_ptr< T > util_make_unique(Ts &&... ts)
void convert_assumptions(const bvt &bv, Glucose::vec< Glucose::Lit > &dest)
static Minisat::Solver * solver_to_interrupt
static void interrupt_solver(int signum)
void convert_assumptions(const bvt &bv, Minisat::vec< Minisat::Lit > &dest)
void convert(const bvt &bv, Minisat::vec< Minisat::Lit > &dest)
void solver(std::vector< framet > &frames, const std::unordered_set< symbol_exprt, irep_hash > &address_taken, const solver_optionst &solver_options, const namespacet &ns, std::vector< propertyt > &properties, std::size_t property_index)
#define CHECK_RETURN(CONDITION)
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.