3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

Polysat: minor fixes (#5364)

* update include paths

* bdd fixes

* update/fix some tests

* work around assertion failure when constraint from clause becomes unit

* Remove old code

* use clause_builder

* Verify model when returning SAT

* log

* fix
This commit is contained in:
Jakob Rath 2021-06-22 18:27:18 +02:00 committed by GitHub
parent 52eb473c63
commit d7b8ea2f7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 73 additions and 95 deletions

View file

@ -1037,7 +1037,8 @@ namespace dd {
std::function<bdd(unsigned)> get_a = [&](unsigned k) {
if (k < i)
return mk_false();
return a[i - k] && b[i];
else
return a[k - i] && b[i];
};
result = mk_add(result, get_a);
}
@ -1056,11 +1057,10 @@ namespace dd {
SASSERT(a.size() == b.size());
bddv result = mk_zero(a.size());
// use identity (bvmul a b) == (bvneg (bvmul (bvneg a) b))
unsigned cnt = 0;
for (auto v : b) if (v) cnt++;
if (cnt*2 > b.size())
if (cnt*2 > b.size()+1)
return mk_usub(mk_mul(a, mk_usub(b)));
for (unsigned i = 0; i < a.size(); ++i) {

View file

@ -452,6 +452,7 @@ namespace dd {
inline pdd operator-(rational const& r, pdd const& b) { return b.rev_sub(r); }
inline pdd operator-(int x, pdd const& b) { return rational(x) - b; }
inline pdd operator-(pdd const& b, int x) { return b + (-rational(x)); }
inline pdd operator-(pdd const& b, rational const& r) { return b + (-r); }
inline pdd& operator&=(pdd & p, pdd const& q) { p = p & q; return p; }
inline pdd& operator^=(pdd & p, pdd const& q) { p = p ^ q; return p; }