mirror of
https://github.com/Z3Prover/z3
synced 2025-05-05 14:55:45 +00:00
finally!
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f1d46b58a4
commit
7bf76dd1f6
5 changed files with 30 additions and 23 deletions
|
@ -49,26 +49,33 @@ namespace polysat {
|
|||
return out << "ovfl*(" << m_p << ", " << m_q << ")";
|
||||
}
|
||||
|
||||
bool mul_ovfl_constraint::is_always_false(bool is_positive, pdd const& p, pdd const& q) const {
|
||||
if (!is_positive && (p.is_zero() || q.is_zero() ||
|
||||
p.is_one() || q.is_one()))
|
||||
return true;
|
||||
lbool mul_ovfl_constraint::eval(pdd const& p, pdd const& q) const {
|
||||
if (p.is_zero() || q.is_zero() || p.is_one() || q.is_one())
|
||||
return l_false;
|
||||
|
||||
if (p.is_val() && q.is_val()) {
|
||||
bool ovfl = p.val() * q.val() > p.manager().max_value();
|
||||
return is_positive == ovfl;
|
||||
if (p.val() * q.val() > p.manager().max_value())
|
||||
return l_true;
|
||||
else
|
||||
return l_false;
|
||||
}
|
||||
return l_undef;
|
||||
}
|
||||
|
||||
bool mul_ovfl_constraint::is_always_false(bool is_positive, pdd const& p, pdd const& q) const {
|
||||
switch (eval(p, q)) {
|
||||
case l_true: return !is_positive;
|
||||
case l_false: return is_positive;
|
||||
default: return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mul_ovfl_constraint::is_always_true(bool is_positive, pdd const& p, pdd const& q) const {
|
||||
if (is_positive && (p.is_zero() || q.is_zero() ||
|
||||
p.is_one() || q.is_one()))
|
||||
return true;
|
||||
if (p.is_val() && q.is_val()) {
|
||||
bool noovfl = p.val() * q.val() <= p.manager().max_value();
|
||||
return is_positive == noovfl;
|
||||
switch (eval(p, q)) {
|
||||
case l_true: return is_positive;
|
||||
case l_false: return !is_positive;
|
||||
default: return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mul_ovfl_constraint::is_always_false(bool is_positive) const {
|
||||
|
@ -124,11 +131,6 @@ namespace polysat {
|
|||
signed_constraint premise = is_positive ? s.ule(p0, p.val()) : s.ule(p.val(), p0);
|
||||
signed_constraint conseq = is_positive ? s.ule(bound, q0) : s.ult(q0, bound);
|
||||
|
||||
//std::cout << premise << "\n";
|
||||
//std::cout << sc << "\n";
|
||||
//std::cout << conseq << "\n";
|
||||
//std::cout << "Already true " << conseq.is_currently_true(s) << "\n";
|
||||
|
||||
SASSERT(premise.is_currently_true(s));
|
||||
SASSERT(bound * p.val() > max);
|
||||
SASSERT((bound - 1) * p.val() <= max);
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace polysat {
|
|||
bool is_always_false(bool is_positive, pdd const& p, pdd const& q) const;
|
||||
bool is_always_true(bool is_positive, pdd const& p, pdd const& q) const;
|
||||
bool narrow_bound(solver& s, bool is_positive, pdd const& p0, pdd const& q0, pdd const& p, pdd const& q);
|
||||
lbool eval(pdd const& p, pdd const& q) const;
|
||||
|
||||
public:
|
||||
~mul_ovfl_constraint() override {}
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace polysat {
|
|||
rational lambda_l = floor(coeff_val / e->coeff);
|
||||
lo = val - lambda_l;
|
||||
}
|
||||
LOG("forbidden interval " << e->interval << " - " << val << " " << coeff_val << " [" << lo << ", " << hi << "[");
|
||||
LOG("forbidden interval " << e->coeff << " * " << e->interval << " [" << lo << ", " << hi << "[");
|
||||
SASSERT(hi <= max_value);
|
||||
entry* ne = alloc_entry();
|
||||
ne->src = e->src;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue