mirror of
https://github.com/Z3Prover/z3
synced 2026-01-21 01:24:43 +00:00
Move bit-wise expressions to constraint_manager
This commit is contained in:
parent
7662427d92
commit
a1736473a4
4 changed files with 64 additions and 73 deletions
|
|
@ -36,7 +36,7 @@ namespace polysat {
|
|||
m_restart(*this),
|
||||
m_bvars(),
|
||||
m_free_pvars(m_activity),
|
||||
m_constraints(m_bvars),
|
||||
m_constraints(*this),
|
||||
m_search(*this) {
|
||||
}
|
||||
|
||||
|
|
@ -166,41 +166,6 @@ namespace polysat {
|
|||
return r;
|
||||
}
|
||||
|
||||
pdd solver::bnot(pdd const& p) {
|
||||
return -p - 1;
|
||||
}
|
||||
|
||||
pdd solver::band(pdd const& p, pdd const& q) {
|
||||
auto& m = p.manager();
|
||||
unsigned sz = m.power_of_2();
|
||||
// TODO: use existing r if we call again with the same arguments
|
||||
pdd r = m.mk_var(add_var(sz));
|
||||
assign_eh(m_constraints.band(p, q, r), null_dependency);
|
||||
return r;
|
||||
}
|
||||
|
||||
pdd solver::bor(pdd const& p, pdd const& q) {
|
||||
// From "Hacker's Delight", section 2-2. Addition Combined with Logical Operations;
|
||||
// found via Int-Blasting paper; see https://doi.org/10.1007/978-3-030-94583-1_24
|
||||
// TODO: switch to op_constraint once supported
|
||||
return (p + q) - band(p, q);
|
||||
}
|
||||
|
||||
pdd solver::bxor(pdd const& p, pdd const& q) {
|
||||
// From "Hacker's Delight", section 2-2. Addition Combined with Logical Operations;
|
||||
// found via Int-Blasting paper; see https://doi.org/10.1007/978-3-030-94583-1_24
|
||||
// TODO: switch to op_constraint once supported
|
||||
return (p + q) - 2*band(p, q);
|
||||
}
|
||||
|
||||
pdd solver::bnand(pdd const& p, pdd const& q) {
|
||||
return bnot(band(p, q));
|
||||
}
|
||||
|
||||
pdd solver::bnor(pdd const& p, pdd const& q) {
|
||||
return bnot(bor(p, q));
|
||||
}
|
||||
|
||||
void solver::assign_eh(signed_constraint c, dependency dep) {
|
||||
backjump(base_level());
|
||||
SASSERT(at_base_level());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue