3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-28 17:08:45 +00:00
This commit is contained in:
Nikolaj Bjorner 2022-06-11 11:56:32 -07:00
parent 46bc726391
commit 04f94d818f
4 changed files with 27 additions and 18 deletions

View file

@ -974,7 +974,7 @@ namespace smt {
/**
\brief A monomial is 'pure' if does not have a numeric coefficient.
*/
bool is_pure_monomial(expr * m) const { return m_util.is_mul(m) && (to_app(m)->get_num_args() > 2 || !m_util.is_numeral(to_app(m)->get_arg(0))); }
bool is_pure_monomial(expr * m) const;
bool is_pure_monomial(theory_var v) const { return is_pure_monomial(get_enode(v)->get_expr()); }
void mark_var(theory_var v, svector<theory_var> & vars, var_set & already_found);
void mark_dependents(theory_var v, svector<theory_var> & vars, var_set & already_found, row_set & already_visited_rows);

View file

@ -624,11 +624,9 @@ template<typename Ext>
bool theory_arith<Ext>::check_monomial_assignments() {
bool computed_epsilon = false;
for (theory_var v : m_nl_monomials) {
TRACE("non_linear", tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n";
tout << "check_monomial_assignments result: " << check_monomial_assignment(v, computed_epsilon) << "\n";
tout << "computed_epsilon: " << computed_epsilon << "\n";);
TRACE("non_linear", tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n");
if (ctx.is_relevant(get_enode(v)) && !check_monomial_assignment(v, computed_epsilon)) {
TRACE("non_linear_failed", tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n";
TRACE("non_linear", tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n";
display_var(tout, v););
return false;
}
@ -1254,6 +1252,17 @@ bool theory_arith<Ext>::in_monovariate_monomials(buffer<coeff_expr> & p, expr *
}
template<typename Ext>
bool theory_arith<Ext>::is_pure_monomial(expr* mon) const {
if (!m_util.is_mul(mon))
return false;
app* p = to_app(mon);
for (expr* arg : *p)
if (m_util.is_numeral(arg) || m_util.is_mul(arg))
return false;
return true;
}
/**
\brief Display a nested form expression
*/