3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 20:18:18 +00:00
This commit is contained in:
Nikolaj Bjorner 2020-04-30 14:41:32 -07:00
parent dbfa3dd7f1
commit e9119a6eb5

View file

@ -220,6 +220,10 @@ interval theory_arith<Ext>::mk_interval_for(theory_var v) {
bound * l = lower(v); bound * l = lower(v);
bound * u = upper(v); bound * u = upper(v);
if (l && u) { if (l && u) {
// optimization may introduce non-standard bounds.
if (l->get_value() == u->get_value() && !l->get_value().get_infinitesimal().to_rational().is_zero()) {
return interval(m_dep_manager);
}
return interval(m_dep_manager, return interval(m_dep_manager,
l->get_value().get_rational().to_rational(), l->get_value().get_rational().to_rational(),
!l->get_value().get_infinitesimal().to_rational().is_zero(), !l->get_value().get_infinitesimal().to_rational().is_zero(),
@ -1167,16 +1171,17 @@ expr_ref theory_arith<Ext>::p2expr(buffer<coeff_expr> & p) {
SASSERT(!p.empty()); SASSERT(!p.empty());
TRACE("p2expr_bug", display_coeff_exprs(tout, p);); TRACE("p2expr_bug", display_coeff_exprs(tout, p););
ptr_buffer<expr> args; ptr_buffer<expr> args;
rational c2;
for (coeff_expr const& ce : p) { for (coeff_expr const& ce : p) {
rational const & c = ce.first; rational const & c = ce.first;
expr * var = ce.second; expr * var = ce.second;
if (!c.is_one()) { if (m_util.is_numeral(var, c2)) {
rational c2; expr* m = m_util.mk_numeral(c * c2, c.is_int() && m_util.is_int(var));
expr * m = nullptr; m_nl_new_exprs.push_back(m);
if (m_util.is_numeral(var, c2)) args.push_back(m);
m = m_util.mk_numeral(c*c2, m_util.is_int(var) && c.is_int() && c2.is_int()); }
else else if (!c.is_one()) {
m = m_util.mk_mul(m_util.mk_numeral(c, c.is_int() && m_util.is_int(var)), var); expr * m = m_util.mk_mul(m_util.mk_numeral(c, c.is_int() && m_util.is_int(var)), var);
m_nl_new_exprs.push_back(m); m_nl_new_exprs.push_back(m);
args.push_back(m); args.push_back(m);
} }
@ -1425,7 +1430,7 @@ expr_ref theory_arith<Ext>::horner(unsigned depth, buffer<coeff_expr> & p, expr
If var != 0, then it is used for performing the horner extension If var != 0, then it is used for performing the horner extension
*/ */
template<typename Ext> template<typename Ext>
expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p, expr * var) { expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p, expr * var) {
TRACE("non_linear", tout << "p.size: " << p.size() << "\n";); TRACE("non_linear", tout << "p.size: " << p.size() << "\n";);
if (var == nullptr) { if (var == nullptr) {
sbuffer<var_num_occs> varinfo; sbuffer<var_num_occs> varinfo;
@ -1561,11 +1566,12 @@ bool theory_arith<Ext>::is_cross_nested_consistent(buffer<coeff_expr> & p) {
*/ */
template<typename Ext> template<typename Ext>
bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) { bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) {
TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false););
if (!is_problematic_non_linear_row(r)) if (!is_problematic_non_linear_row(r))
return true; return true;
TRACE("cross_nested", tout << "problematic...\n";); TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false);
display(tout);
);
/* /*
The method is_cross_nested converts rows back to expressions. The method is_cross_nested converts rows back to expressions.