mirror of
https://github.com/Z3Prover/z3
synced 2026-03-22 04:28:50 +00:00
add built-in support for bvor: the rewriter converts bitwise and to bit-wise or so using bvor as a basis makes better sense
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e2c5d7d358
commit
e7c9c5f7a2
10 changed files with 279 additions and 137 deletions
|
|
@ -63,6 +63,12 @@ namespace polysat {
|
|||
return signed_constraint(ckind_t::op_t, cnstr);
|
||||
}
|
||||
|
||||
signed_constraint constraints::bor(pdd const& a, pdd const& b, pdd const& r) {
|
||||
auto* cnstr = alloc(op_constraint, op_constraint::code::or_op, a, b, r);
|
||||
c.trail().push(new_obj_trail(cnstr));
|
||||
return signed_constraint(ckind_t::op_t, cnstr);
|
||||
}
|
||||
|
||||
// parity p >= k if low order k bits of p are 0
|
||||
signed_constraint constraints::parity_at_least(pdd const& p, unsigned k) {
|
||||
if (k == 0)
|
||||
|
|
@ -82,6 +88,12 @@ namespace polysat {
|
|||
return eq(p * rational::power_of_two(N - k));
|
||||
}
|
||||
|
||||
// 2^{N-i-1}* p >= 2^{N-1}
|
||||
signed_constraint constraints::bit(pdd const& p, unsigned i) {
|
||||
unsigned N = p.manager().power_of_2();
|
||||
return uge(p * rational::power_of_two(N - i - 1), rational::power_of_two(N - 1));
|
||||
}
|
||||
|
||||
bool signed_constraint::is_eq(pvar& v, rational& val) {
|
||||
if (m_sign)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue