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

add first test for band

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-12-18 12:28:59 -08:00
parent 8f8d88bc9d
commit c1d5111159
6 changed files with 81 additions and 27 deletions

View file

@ -979,6 +979,34 @@ namespace polysat {
s.check();
}
static void test_band(unsigned bw = 32) {
{
scoped_solver s(__func__);
auto p = s.var(s.add_var(bw));
auto q = s.var(s.add_var(bw));
s.add_ult(p, s.band(p, q));
s.check();
s.expect_unsat();
}
{
scoped_solver s(__func__);
auto p = s.var(s.add_var(bw));
auto q = s.var(s.add_var(bw));
s.add_ult(q, s.band(p, q));
s.check();
s.expect_unsat();
}
{
scoped_solver s(__func__);
auto p = s.var(s.add_var(bw));
auto q = s.var(s.add_var(bw));
s.add_ule(p, s.band(p, q));
s.check();
s.expect_sat();
}
}
// Goal: we probably mix up polysat variables and PDD variables at several points; try to uncover such cases
// NOTE: actually, add_var seems to keep them in sync, so this is not an issue at the moment (but we should still test it later)
@ -1036,6 +1064,13 @@ namespace polysat {
auto pb = to_pdd(m, s, expr2pdd, b);
r = alloc(pdd, s.lshr(pa, pb));
}
else if (bv.is_bv_and(e) && to_app(e)->get_num_args() == 2) {
a = to_app(e)->get_arg(0);
b = to_app(e)->get_arg(1);
auto pa = to_pdd(m, s, expr2pdd, a);
auto pb = to_pdd(m, s, expr2pdd, b);
r = alloc(pdd, s.lshr(pa, pb));
}
else if (bv.is_numeral(e, n, sz))
r = alloc(pdd, s.value(n, sz));
else if (is_uninterp(e))
@ -1106,6 +1141,9 @@ namespace polysat {
void tst_polysat() {
polysat::test_band();
return;
polysat::test_quot_rem();
return;