3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-22 11:07:51 +00:00

move out sign

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-01-19 09:34:22 -06:00
parent 89c91765f6
commit d3b105f9f8
15 changed files with 176 additions and 168 deletions

View file

@ -208,7 +208,7 @@ namespace nlsat {
\brief evaluate the given polynomial in the current interpretation.
max_var(p) must be assigned in the current interpretation.
*/
polynomial::sign sign(polynomial_ref const & p) {
::sign sign(polynomial_ref const & p) {
SASSERT(max_var(p) == null_var || m_assignment.is_assigned(max_var(p)));
auto s = m_am.eval_sign_at(p, m_assignment);
TRACE("nlsat_explain", tout << "p: " << p << " var: " << max_var(p) << " sign: " << s << "\n";);
@ -271,7 +271,7 @@ namespace nlsat {
polynomial_ref f(m_pm);
for (unsigned i = 0; i < num_factors; i++) {
f = m_factors.get(i);
if (sign(f) == polynomial::sign_zero) {
if (is_zero(sign(f))) {
m_zero_fs.push_back(m_factors.get(i));
m_is_even.push_back(false);
}
@ -338,7 +338,7 @@ namespace nlsat {
lc = m_pm.coeff(p, x, k, reduct);
TRACE("nlsat_explain", tout << "lc: " << lc << " reduct: " << reduct << "\n";);
if (!is_zero(lc)) {
if (sign(lc) != polynomial::sign_zero)
if (!::is_zero(sign(lc)))
return;
// lc is not the zero polynomial, but it vanished in the current interpretation.
// so we keep searching...
@ -653,7 +653,7 @@ namespace nlsat {
TRACE("nlsat_explain", tout << "done, psc is a constant\n";);
return;
}
if (sign(s) == polynomial::sign_zero) {
if (is_zero(sign(s))) {
TRACE("nlsat_explain", tout << "psc vanished, adding zero assumption\n";);
add_zero_assumption(s);
continue;
@ -1137,8 +1137,8 @@ namespace nlsat {
}
if (is_const(new_factor)) {
TRACE("nlsat_simplify_core", tout << "new factor is const\n";);
polynomial::sign s = sign(new_factor);
if (s == polynomial::sign_zero) {
auto s = sign(new_factor);
if (is_zero(s)) {
bool atom_val = a->get_kind() == atom::EQ;
bool lit_val = l.sign() ? !atom_val : atom_val;
new_lit = lit_val ? true_literal : false_literal;