3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-21 10:41:35 +00:00

arithmetic

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-01-13 10:29:50 -08:00
parent 33c43a474d
commit 93be3d2b2c
4 changed files with 53 additions and 22 deletions

View file

@ -22,7 +22,8 @@ Author:
namespace polysat {
std::ostream& operator<<(std::ostream& out, fi_record const& fi) {
out << "fi_record(bw = " << fi.bit_width << ", coeff = " << fi.coeff << ", " << fi.interval << ", " << fi.src << fi.side_cond << fi.deps << ")";
out << "fi_record(bw = " << fi.bit_width << ", coeff = " << fi.coeff << ", " << fi.interval << ", "
<< fi.src << (fi.src.empty()?"": " ") << fi.side_cond << (fi.side_cond.empty()?"":" ") << fi.deps << ")";
return out;
}

View file

@ -643,9 +643,15 @@ namespace polysat {
// Then value is chosen, min x . coeff * x >= t.
// In other words:
//
// coeff * (value - 1) <= t < coeff*value + 1
//
auto vlo = c.value(mod((e.value - 1) * p2eb, p2b), bw);
// x >= t div coeff
// => t <= coeff * x
// (x - 1) * coeff < t <= x * coeff
// a < x <= b <=>
// a + 1 <= x < b + 1
auto vlo = c.value(mod((e.value - 1) * p2eb + 1, p2b), bw);
auto vhi = c.value(mod(e.value * p2eb + 1, p2b), bw);
#if 0
@ -655,6 +661,7 @@ namespace polysat {
verbose_stream() << "before bw " << ebw << " " << bw << " " << *e.e << "\nafter bw " << abw << " " << aw << " " << *after.e << "\n";
if (!t.is_val())
IF_VERBOSE(0, verbose_stream() << "symbolic t : " << t << "\n");
#endif
auto sc = cs.ult(t - vlo, vhi - vlo);
CTRACE("bv", sc.is_always_false(), c.display(tout));