3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-09-28 16:43:55 -07:00
parent 95e2d174c7
commit f3328c743e
3 changed files with 18 additions and 28 deletions

View file

@ -230,6 +230,8 @@ namespace polysat {
continue;
auto diseq = ~s.eq(s.var(v), s.get_value(v));
cm().ensure_bvar(diseq.get());
//if (diseq.bvalue(s) == l_undef)
// s.assign_bool(s.get_level(v), ~diseq.blit(), nullptr, nullptr);
lemma.push(diseq);
}
@ -271,8 +273,11 @@ namespace polysat {
// - cjust_v contains true constraints
// - core contains both false and true constraints (originally only false ones, but additional true ones may come from saturation)
if (is_bailout())
if (is_bailout()) {
if (!s.m_justification[v].is_decision())
m_vars.remove(v);
return false;
}
if (conflict_var() == v) {
forbidden_intervals fi;
@ -359,7 +364,7 @@ namespace polysat {
void conflict::inc_pref(pvar v) {
if (v >= m_pvar2count.size())
m_pvar2count.resize(v + 1);
m_pvar2count.resize(v + 1);
m_pvar2count[v]++;
}

View file

@ -621,24 +621,9 @@ namespace polysat {
// (L')^{L' \/ ¬L \/ ...}
// again L is in core, unless we core-reduced it away
clause_builder reason_builder = m_conflict.build_lemma();
clause_builder reason_builder = m_conflict.build_lemma();
SASSERT(std::find(reason_builder.begin(), reason_builder.end(), ~lit));
bool contains_lit = std::find(reason_builder.begin(), reason_builder.end(), ~lit);
if (!contains_lit) {
// At this point, we do not have ~lit in the reason.
// For now, we simply add it (thus weakening the reason)
//
// Alternative (to be considered later):
// - 'reason' itself (without ~L) would already be an explanation for ~L
// - however if it doesn't contain ~L, it breaks the boolean resolution invariant
// - would need to check what we can gain by relaxing that invariant
// - drawback: might have to bail out at boolean resolution
// Also: maybe we can skip ~L in some cases? but in that case it shouldn't be marked.
//
std::cout << "ADD extra " << ~lit << "\n";
reason_builder.push(~lit);
}
clause_ref reason = reason_builder.build();
if (reason->empty()) {
@ -868,8 +853,6 @@ namespace polysat {
signed_constraint sc(c, is_positive);
for (auto const& wlist : m_pwatch) {
auto n = std::count(wlist.begin(), wlist.end(), sc);
if (n > 1)
std::cout << sc << "\n" << * this << "\n";
VERIFY(n <= 1); // no duplicates in the watchlist
num_watches += n;
}

View file

@ -1047,15 +1047,13 @@ namespace polysat {
void tst_polysat() {
polysat::test_ineq_basic4();
return;
polysat::test_cjust();
polysat::test_p3();
polysat::test_var_minimize();
//return;
polysat::test_subst();
@ -1086,8 +1084,12 @@ void tst_polysat() {
polysat::test_ineq_basic4();
polysat::test_ineq_basic5();
polysat::test_ineq_basic6();
polysat::test_monot_bounds(2);
polysat::test_cjust();
polysat::test_subst();
polysat::test_monot_bounds(2);
polysat::test_var_minimize();
return;