mirror of
https://github.com/Z3Prover/z3
synced 2025-08-24 03:57:51 +00:00
Polysat (#5187)
* test_l2 works now * Linear propagation: test whether a is odd * Linear propagation with even coefficients (wip)
This commit is contained in:
parent
feb31045f5
commit
cb9dda19dd
2 changed files with 77 additions and 4 deletions
|
@ -35,11 +35,9 @@ namespace polysat {
|
|||
auto a = s.var(s.add_var(2));
|
||||
s.add_eq(a + 1);
|
||||
s.check();
|
||||
// Expected result: SAT with a = 3
|
||||
}
|
||||
|
||||
// TBD: we get the wrong result / conflicts.
|
||||
// it claims that v1 + 2*v0 + 1 with v0 replaced by 0 is 1.
|
||||
// it should be v1 + 1
|
||||
static void test_l2() {
|
||||
scoped_solver s;
|
||||
auto a = s.var(s.add_var(2));
|
||||
|
@ -47,6 +45,36 @@ namespace polysat {
|
|||
s.add_eq(2*a + b + 1);
|
||||
s.add_eq(2*b + a);
|
||||
s.check();
|
||||
// Expected result: SAT with a = 2, b = 3
|
||||
}
|
||||
|
||||
static void test_l3() {
|
||||
scoped_solver s;
|
||||
auto a = s.var(s.add_var(2));
|
||||
auto b = s.var(s.add_var(2));
|
||||
s.add_eq(3*b + a + 2);
|
||||
s.check();
|
||||
// Expected result: SAT
|
||||
}
|
||||
|
||||
static void test_l4() {
|
||||
scoped_solver s;
|
||||
auto a = s.var(s.add_var(3));
|
||||
// auto b = s.var(s.add_var(3));
|
||||
s.add_eq(4*a + 2);
|
||||
s.check();
|
||||
// Expected result: UNSAT
|
||||
}
|
||||
|
||||
// Goal: test propagate_eq in case of 2*a*x + 2*b == 0
|
||||
static void test_l5() {
|
||||
scoped_solver s;
|
||||
auto a = s.var(s.add_var(3));
|
||||
auto b = s.var(s.add_var(3));
|
||||
s.add_eq(a + 2*b + 4);
|
||||
s.add_eq(a + 4*b + 4);
|
||||
s.check();
|
||||
// Expected result: UNSAT
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,6 +153,9 @@ namespace polysat {
|
|||
void tst_polysat() {
|
||||
polysat::test_l1();
|
||||
polysat::test_l2();
|
||||
polysat::test_l3();
|
||||
polysat::test_l4();
|
||||
polysat::test_l5();
|
||||
#if 0
|
||||
// worry about this later
|
||||
polysat::test_p1();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue