mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 00:18:45 +00:00
fix scope and mus with user-scopes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ee1a1b1135
commit
be1cceba34
3 changed files with 15 additions and 5 deletions
|
@ -134,7 +134,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
lbool mus_solver() {
|
lbool mus_solver() {
|
||||||
solver::scoped_push _sc(m_s);
|
|
||||||
init();
|
init();
|
||||||
init_local();
|
init_local();
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -178,10 +177,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
lbool mus_mss_solver() {
|
lbool mus_mss_solver() {
|
||||||
solver::scoped_push _sc(s());
|
|
||||||
init();
|
init();
|
||||||
init_local();
|
init_local();
|
||||||
enable_sls(m_asms);
|
//enable_sls(m_asms);
|
||||||
ptr_vector<expr> mcs;
|
ptr_vector<expr> mcs;
|
||||||
vector<ptr_vector<expr> > cores;
|
vector<ptr_vector<expr> > cores;
|
||||||
while (m_lower < m_upper) {
|
while (m_lower < m_upper) {
|
||||||
|
@ -222,7 +220,6 @@ public:
|
||||||
|
|
||||||
lbool mss_solver() {
|
lbool mss_solver() {
|
||||||
NOT_IMPLEMENTED_YET();
|
NOT_IMPLEMENTED_YET();
|
||||||
solver::scoped_push _sc(s());
|
|
||||||
init();
|
init();
|
||||||
init_local();
|
init_local();
|
||||||
ptr_vector<expr> mcs;
|
ptr_vector<expr> mcs;
|
||||||
|
|
|
@ -48,6 +48,13 @@ namespace sat {
|
||||||
literal_vector& core = m_core;
|
literal_vector& core = m_core;
|
||||||
literal_vector& mus = m_mus;
|
literal_vector& mus = m_mus;
|
||||||
core.append(s.get_core());
|
core.append(s.get_core());
|
||||||
|
for (unsigned i = 0; i < core.size(); ++i) {
|
||||||
|
s.m_user_scope_literals.contains(core[i]);
|
||||||
|
mus.push_back(core[i]);
|
||||||
|
core[i] = core.back();
|
||||||
|
core.pop_back();
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
|
||||||
while (!core.empty()) {
|
while (!core.empty()) {
|
||||||
TRACE("sat",
|
TRACE("sat",
|
||||||
|
@ -61,9 +68,10 @@ namespace sat {
|
||||||
literal lit = core.back();
|
literal lit = core.back();
|
||||||
core.pop_back();
|
core.pop_back();
|
||||||
unsigned sz = mus.size();
|
unsigned sz = mus.size();
|
||||||
mus.push_back(~lit); // TBD: measure
|
// mus.push_back(~lit); // TBD: measure
|
||||||
mus.append(core);
|
mus.append(core);
|
||||||
lbool is_sat = s.check(mus.size(), mus.c_ptr());
|
lbool is_sat = s.check(mus.size(), mus.c_ptr());
|
||||||
|
TRACE("sat", tout << "mus: " << mus << "\n";);
|
||||||
mus.resize(sz);
|
mus.resize(sz);
|
||||||
switch (is_sat) {
|
switch (is_sat) {
|
||||||
case l_undef:
|
case l_undef:
|
||||||
|
@ -83,6 +91,7 @@ namespace sat {
|
||||||
if (new_core.contains(~lit)) {
|
if (new_core.contains(~lit)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
TRACE("sat", tout << "new core: " << new_core << "\n";);
|
||||||
core.reset();
|
core.reset();
|
||||||
for (unsigned i = 0; i < new_core.size(); ++i) {
|
for (unsigned i = 0; i < new_core.size(); ++i) {
|
||||||
literal lit = new_core[i];
|
literal lit = new_core[i];
|
||||||
|
|
|
@ -896,6 +896,9 @@ namespace sat {
|
||||||
for (unsigned i = 0; i < num_lits; ++i)
|
for (unsigned i = 0; i < num_lits; ++i)
|
||||||
tout << lits[i] << " ";
|
tout << lits[i] << " ";
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
|
if (!m_user_scope_literals.empty()) {
|
||||||
|
tout << "user literals: " << m_user_scope_literals << "\n";
|
||||||
|
}
|
||||||
m_mc.display(tout);
|
m_mc.display(tout);
|
||||||
);
|
);
|
||||||
#define _INSERT_LIT(_l_) \
|
#define _INSERT_LIT(_l_) \
|
||||||
|
@ -2237,6 +2240,7 @@ namespace sat {
|
||||||
lit = m_user_scope_literal_pool.back();
|
lit = m_user_scope_literal_pool.back();
|
||||||
m_user_scope_literal_pool.pop_back();
|
m_user_scope_literal_pool.pop_back();
|
||||||
}
|
}
|
||||||
|
TRACE("sat", tout << "user_push: " << lit << "\n";);
|
||||||
m_user_scope_literals.push_back(lit);
|
m_user_scope_literals.push_back(lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue