3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

fix parity propagation code, add tail-spin unit tests. The unit tests diverge because conflict resolution removes conflicting literals from the conflict clause before the decision variable gets processed. We have to change how conflict resolution is processed for such conflict clauses

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-12-08 09:57:38 -08:00
parent 3c8718615a
commit 33902c7c9e
3 changed files with 107 additions and 55 deletions

View file

@ -204,7 +204,7 @@ namespace polysat {
for (test_record const* r : m_records) {
if (!r->m_finished)
continue;
r->display(out, max_name_len);
r->display(out, static_cast<unsigned>(max_name_len));
out << std::endl;
if (r->m_result == test_result::ok && r->m_answer == l_true)
n_sat++;
@ -629,6 +629,47 @@ namespace polysat {
SASSERT(cl->size() == 2);
}
// 8 * x + 3 == 0 is unsat
static void test_parity1() {
scoped_solver s(__func__);
simplify_clause simp(s);
clause_builder cb(s);
auto x = s.var(s.add_var(8));
auto y = s.var(s.add_var(8));
auto z = s.var(s.add_var(8));
s.add_clause({s.eq(x * y + z), s.eq(x * y + 5)}, false);
s.add_eq(y, 8);
s.add_eq(z, 3);
s.check();
s.expect_unsat();
}
// 8 * x + 4 == 0 is unsat
static void test_parity2() {
scoped_solver s(__func__);
simplify_clause simp(s);
clause_builder cb(s);
auto x = s.var(s.add_var(8));
auto y = s.var(s.add_var(8));
s.add_clause({ s.eq(x * y + 2), s.eq(x * y + 4) }, false);
s.add_eq(y, 8);
s.check();
s.expect_unsat();
}
// x * y + 4 == 0 & 16 divides y is unsat
static void test_parity3() {
scoped_solver s(__func__);
simplify_clause simp(s);
clause_builder cb(s);
auto x = s.var(s.add_var(8));
auto y = s.var(s.add_var(8));
s.add_clause({ s.eq(x * y + 2), s.eq(x * y + 4) }, false);
s.add_eq(16 * y);
s.check();
s.expect_unsat();
}
/**
* Check unsat of:
@ -1583,9 +1624,13 @@ static void STD_CALL polysat_on_ctrl_c(int) {
void tst_polysat() {
using namespace polysat;
#if 0 // Enable this block to run a single unit test with detailed output.
#if 1 // Enable this block to run a single unit test with detailed output.
collect_test_records = false;
test_max_conflicts = 50;
test_polysat::test_parity1();
// test_polysat::test_parity2();
// test_polysat::test_parity3();
return;
// test_polysat::test_band5();
// test_polysat::test_band5_clause();
// test_polysat::test_ineq_axiom1(32, 1);