3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 08:28:44 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-06 12:27:53 -07:00
parent bffe7a2215
commit 077a2cf6f7

View file

@ -76,17 +76,16 @@ void arith_eq_solver::prop_mod_const(expr * e, unsigned depth, numeral const& k,
void arith_eq_solver::gcd_normalize(vector<numeral>& values) { void arith_eq_solver::gcd_normalize(vector<numeral>& values) {
numeral g(0); numeral g(0);
for (unsigned i = 0; !g.is_one() && i < values.size(); ++i) { for (auto const& n : values) {
SASSERT(values[i].is_int()); SASSERT(n.is_int());
if (!values[i].is_zero()) { if (g.is_zero())
if (g.is_zero()) { g = abs(n);
g = abs(values[i]); else
} g = gcd(abs(n), g);
else { if (g.is_one())
g = gcd(abs(values[i]), g); break;
}
}
} }
if (g.is_zero() || g.is_one()) { if (g.is_zero() || g.is_one()) {
return; return;
} }
@ -197,6 +196,9 @@ bool arith_eq_solver::solve_integer_equation(
// Instead used the coefficient 'm' at position 'index'. // Instead used the coefficient 'm' at position 'index'.
// //
for (auto const& n : values)
if (!n.is_int())
return false;
gcd_normalize(values); gcd_normalize(values);
if (!gcd_test(values)) { if (!gcd_test(values)) {
TRACE("arith_eq_solver", tout << "not sat\n"; TRACE("arith_eq_solver", tout << "not sat\n";