3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-03 19:35:42 +00:00
This commit is contained in:
Nikolaj Bjorner 2021-03-28 16:47:56 -07:00
parent 974ef3c147
commit dfb696becf
2 changed files with 17 additions and 5 deletions

View file

@ -888,6 +888,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
~scoped_reset() { ~scoped_reset() {
i.m_interface_vars.reset(); i.m_interface_vars.reset();
i.m_app2lit.reset(); i.m_app2lit.reset();
i.m_lit2app.reset();
} }
}; };
scoped_reset _reset(*this); scoped_reset _reset(*this);
@ -937,11 +938,14 @@ struct goal2sat::imp : public sat::sat_internalizer {
} }
void user_push() { void user_push() {
push();
force_push();
} }
void user_pop(unsigned n) { void user_pop(unsigned n) {
m_true = sat::null_literal; m_true = sat::null_literal;
pop(n);
} }
}; };
@ -990,22 +994,25 @@ void goal2sat::collect_param_descrs(param_descrs & r) {
void goal2sat::operator()(goal const & g, params_ref const & p, sat::solver_core & t, atom2bool_var & m, dep2asm_map& dep2asm, bool default_external) { void goal2sat::operator()(goal const & g, params_ref const & p, sat::solver_core & t, atom2bool_var & m, dep2asm_map& dep2asm, bool default_external) {
if (!m_imp) if (!m_imp) {
m_imp = alloc(imp, g.m(), p, t, m, dep2asm, default_external); m_imp = alloc(imp, g.m(), p, t, m, dep2asm, default_external);
for (unsigned i = 0; i < m_scopes; ++i)
m_imp->user_push();
}
(*m_imp)(g); (*m_imp)(g);
if (!t.get_extension() && m_imp->interpreted_funs().empty()) { if (!t.get_extension() && m_imp->interpreted_funs().empty()) {
dealloc(m_imp); dealloc(m_imp);
m_imp = nullptr; m_imp = nullptr;
} }
else
m_scopes = 0;
} }
void goal2sat::get_interpreted_funs(func_decl_ref_vector& funs) { void goal2sat::get_interpreted_funs(func_decl_ref_vector& funs) {
if (m_imp) { if (m_imp)
funs.append(m_imp->interpreted_funs()); funs.append(m_imp->interpreted_funs());
}
} }
bool goal2sat::has_interpreted_funs() const { bool goal2sat::has_interpreted_funs() const {
@ -1020,11 +1027,15 @@ void goal2sat::update_model(model_ref& mdl) {
void goal2sat::user_push() { void goal2sat::user_push() {
if (m_imp) if (m_imp)
m_imp->user_push(); m_imp->user_push();
else
m_scopes++;
} }
void goal2sat::user_pop(unsigned n) { void goal2sat::user_pop(unsigned n) {
if (m_imp) if (m_imp)
m_imp->user_pop(n); m_imp->user_pop(n);
else
m_scopes -= n;
} }

View file

@ -38,6 +38,7 @@ Notes:
class goal2sat { class goal2sat {
struct imp; struct imp;
imp * m_imp; imp * m_imp;
unsigned m_scopes { 0 };
public: public:
goal2sat(); goal2sat();