mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
parent
28bdda326b
commit
0cf401c67b
3 changed files with 52 additions and 19 deletions
|
@ -36,6 +36,8 @@ Notes:
|
|||
namespace {
|
||||
class tactic2solver : public solver_na2as {
|
||||
expr_ref_vector m_assertions;
|
||||
expr_ref_vector m_last_assertions;
|
||||
unsigned m_last_assertions_valid;
|
||||
unsigned_vector m_scopes;
|
||||
ref<simple_check_sat_result> m_result;
|
||||
tactic_ref m_tactic;
|
||||
|
@ -101,7 +103,9 @@ ast_manager& tactic2solver::get_manager() const { return m_assertions.get_manage
|
|||
|
||||
tactic2solver::tactic2solver(ast_manager & m, tactic * t, params_ref const & p, bool produce_proofs, bool produce_models, bool produce_unsat_cores, symbol const & logic):
|
||||
solver_na2as(m),
|
||||
m_assertions(m) {
|
||||
m_assertions(m),
|
||||
m_last_assertions(m),
|
||||
m_last_assertions_valid(false) {
|
||||
|
||||
m_tactic = t;
|
||||
m_logic = logic;
|
||||
|
@ -126,18 +130,21 @@ void tactic2solver::collect_param_descrs(param_descrs & r) {
|
|||
}
|
||||
|
||||
void tactic2solver::assert_expr_core(expr * t) {
|
||||
m_last_assertions_valid = false;
|
||||
m_assertions.push_back(t);
|
||||
m_result = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void tactic2solver::push_core() {
|
||||
m_last_assertions_valid = false;
|
||||
m_scopes.push_back(m_assertions.size());
|
||||
m_result = nullptr;
|
||||
TRACE("pop", tout << m_scopes.size() << "\n";);
|
||||
}
|
||||
|
||||
void tactic2solver::pop_core(unsigned n) {
|
||||
m_last_assertions_valid = false;
|
||||
TRACE("pop", tout << m_scopes.size() << " " << n << "\n";);
|
||||
n = std::min(m_scopes.size(), n);
|
||||
unsigned new_lvl = m_scopes.size() - n;
|
||||
|
@ -150,6 +157,7 @@ void tactic2solver::pop_core(unsigned n) {
|
|||
lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * assumptions) {
|
||||
if (m_tactic.get() == nullptr)
|
||||
return l_false;
|
||||
m_last_assertions_valid = false;
|
||||
ast_manager & m = m_assertions.m();
|
||||
m_result = alloc(simple_check_sat_result, m);
|
||||
m_tactic->cleanup();
|
||||
|
@ -185,8 +193,9 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as
|
|||
if (!reason_unknown.empty())
|
||||
m_result->m_unknown = reason_unknown;
|
||||
if (num_assumptions == 0 && m_scopes.empty()) {
|
||||
m_assertions.reset();
|
||||
g->get_formulas(m_assertions);
|
||||
m_last_assertions.reset();
|
||||
g->get_formulas(m_last_assertions);
|
||||
m_last_assertions_valid = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -278,11 +287,11 @@ void tactic2solver::set_reason_unknown(char const* msg) {
|
|||
}
|
||||
|
||||
unsigned tactic2solver::get_num_assertions() const {
|
||||
return m_assertions.size();
|
||||
return m_last_assertions_valid ? m_last_assertions.size() : m_assertions.size();
|
||||
}
|
||||
|
||||
expr * tactic2solver::get_assertion(unsigned idx) const {
|
||||
return m_assertions.get(idx);
|
||||
return m_last_assertions_valid ? m_last_assertions.get(idx) : m_assertions.get(idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue