3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

fix mux extraction to check for top-level assertion

This commit is contained in:
Nikolaj Bjorner 2022-01-31 11:57:16 -08:00
parent 62bb234251
commit 6422b783b2

View file

@ -21,6 +21,7 @@ Author:
#include "sat/smt/pb_solver.h" #include "sat/smt/pb_solver.h"
#include "sat/smt/euf_solver.h" #include "sat/smt/euf_solver.h"
#include "sat/sat_simplifier_params.hpp" #include "sat/sat_simplifier_params.hpp"
#include "sat/sat_scc.h"
namespace pb { namespace pb {
@ -1422,7 +1423,7 @@ namespace pb {
c->watch_literal(*this, ~lit); c->watch_literal(*this, ~lit);
} }
if (!c->well_formed()) if (!c->well_formed())
std::cout << *c << "\n"; IF_VERBOSE(0, verbose_stream() << *c << "\n");
VERIFY(c->well_formed()); VERIFY(c->well_formed());
if (m_solver && m_solver->get_config().m_drat) { if (m_solver && m_solver->get_config().m_drat) {
std::function<void(std::ostream& out)> fn = [&](std::ostream& out) { std::function<void(std::ostream& out)> fn = [&](std::ostream& out) {
@ -3133,32 +3134,35 @@ namespace pb {
void solver::find_mutexes(literal_vector& lits, vector<literal_vector> & mutexes) { void solver::find_mutexes(literal_vector& lits, vector<literal_vector> & mutexes) {
sat::literal_set slits(lits); sat::literal_set slits(lits);
bool change = false; bool change = false;
for (constraint* cp : m_constraints) { for (constraint* cp : m_constraints) {
if (!cp->is_card()) continue; if (!cp->is_card())
continue;
if (cp->lit() != sat::null_literal)
continue;
card const& c = cp->to_card(); card const& c = cp->to_card();
if (c.size() == c.k() + 1) { if (c.size() != c.k() + 1)
literal_vector mux; continue;
for (literal lit : c) {
if (slits.contains(~lit)) {
mux.push_back(~lit);
}
}
if (mux.size() <= 1) {
continue;
}
for (literal m : mux) { literal_vector mux;
slits.remove(m); for (literal lit : c)
} if (slits.contains(~lit))
change = true; mux.push_back(~lit);
mutexes.push_back(mux);
} if (mux.size() <= 1)
continue;
for (literal m : mux)
slits.remove(m);
change = true;
mutexes.push_back(mux);
} }
if (!change) return; if (!change)
return;
lits.reset(); lits.reset();
for (literal l : slits) { for (literal l : slits)
lits.push_back(l); lits.push_back(l);
}
} }
void solver::display(std::ostream& out, ineq const& ineq, bool values) const { void solver::display(std::ostream& out, ineq const& ineq, bool values) const {