mirror of
https://github.com/Z3Prover/z3
synced 2025-08-23 19:47:52 +00:00
minor univariate tweak
This commit is contained in:
parent
ac0e9ebe5f
commit
59592754d8
3 changed files with 7 additions and 6 deletions
|
@ -120,15 +120,16 @@ namespace polysat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: shouldn't the simplification step of the underlying solver already support this transformation? how to enable?
|
|
||||||
// 2^k*x --> x << k
|
// 2^k*x --> x << k
|
||||||
// n*x --> n * x
|
// n*x --> n * x
|
||||||
expr* mk_poly_term(rational const& coeff, expr* xpow) const {
|
expr* mk_poly_term(rational const& coeff, expr* xpow) const {
|
||||||
unsigned pow;
|
unsigned pow;
|
||||||
|
SASSERT(!coeff.is_zero());
|
||||||
|
if (coeff.is_one())
|
||||||
|
return xpow;
|
||||||
if (coeff.is_power_of_two(pow))
|
if (coeff.is_power_of_two(pow))
|
||||||
return bv->mk_bv_shl(xpow, mk_numeral(rational(pow)));
|
return bv->mk_bv_shl(xpow, mk_numeral(rational(pow)));
|
||||||
else
|
return bv->mk_bv_mul(mk_numeral(coeff), xpow);
|
||||||
return bv->mk_bv_mul(mk_numeral(coeff), xpow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// [d,c,b,a] --> d + c*x + b*(x*x) + a*(x*x*x)
|
// [d,c,b,a] --> d + c*x + b*(x*x) + a*(x*x*x)
|
||||||
|
@ -321,7 +322,7 @@ namespace polysat {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool find_two(rational& out1, rational& out2) {
|
bool find_two(rational& out1, rational& out2) override {
|
||||||
out1 = model();
|
out1 = model();
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
push();
|
push();
|
||||||
|
|
|
@ -344,7 +344,7 @@ namespace polysat {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
do {
|
do {
|
||||||
LOG("refine-equal-lin for src: " << e->src);
|
LOG("refine-equal-lin for src: " << lit_pp(s, e->src));
|
||||||
rational coeff_val = mod(e->coeff * val, mod_value);
|
rational coeff_val = mod(e->coeff * val, mod_value);
|
||||||
if (e->interval.currently_contains(coeff_val)) {
|
if (e->interval.currently_contains(coeff_val)) {
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace polysat {
|
||||||
find_t find_viable(pvar v, rational& out_val);
|
find_t find_viable(pvar v, rational& out_val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a next viable value for variable by determining currently viable lower and upper bounds.
|
* Find a next viable value for variable. Attempts to find two different values, to distinguish propagation/decision.
|
||||||
* @return l_true on success, l_false on conflict, l_undef on resource limit
|
* @return l_true on success, l_false on conflict, l_undef on resource limit
|
||||||
*/
|
*/
|
||||||
lbool find_viable(pvar v, rational& out_lo, rational& out_hi);
|
lbool find_viable(pvar v, rational& out_lo, rational& out_hi);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue