mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
partial fix to make computed term integer well-formed for solve_for functionality
This commit is contained in:
parent
bcb61ee12c
commit
1ab0962d43
2 changed files with 14 additions and 0 deletions
|
@ -3638,9 +3638,21 @@ public:
|
|||
rational coeff;
|
||||
if (!lp().solve_for(vi, t, coeff))
|
||||
return false;
|
||||
rational lc(1);
|
||||
if (is_int(v)) {
|
||||
lc = denominator(coeff);
|
||||
for (auto const& cv : t)
|
||||
lc = lcm(denominator(cv.coeff()), lc);
|
||||
if (lc != 1) {
|
||||
coeff *= lc;
|
||||
t *= lc;
|
||||
}
|
||||
}
|
||||
term = mk_term(t, is_int(v));
|
||||
if (coeff != 0)
|
||||
term = a.mk_add(a.mk_numeral(coeff, is_int(v)), term);
|
||||
if (lc != 1)
|
||||
term = a.mk_idiv(term, a.mk_numeral(lc, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue