Skip to content

Commit e9119a6

Browse files
fix #4168
1 parent dbfa3dd commit e9119a6

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/smt/theory_arith_nl.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ interval theory_arith<Ext>::mk_interval_for(theory_var v) {
220220
bound * l = lower(v);
221221
bound * u = upper(v);
222222
if (l && u) {
223+
// optimization may introduce non-standard bounds.
224+
if (l->get_value() == u->get_value() && !l->get_value().get_infinitesimal().to_rational().is_zero()) {
225+
return interval(m_dep_manager);
226+
}
223227
return interval(m_dep_manager,
224228
l->get_value().get_rational().to_rational(),
225229
!l->get_value().get_infinitesimal().to_rational().is_zero(),
@@ -1167,16 +1171,17 @@ expr_ref theory_arith<Ext>::p2expr(buffer<coeff_expr> & p) {
11671171
SASSERT(!p.empty());
11681172
TRACE("p2expr_bug", display_coeff_exprs(tout, p););
11691173
ptr_buffer<expr> args;
1174+
rational c2;
11701175
for (coeff_expr const& ce : p) {
11711176
rational const & c = ce.first;
11721177
expr * var = ce.second;
1173-
if (!c.is_one()) {
1174-
rational c2;
1175-
expr * m = nullptr;
1176-
if (m_util.is_numeral(var, c2))
1177-
m = m_util.mk_numeral(c*c2, m_util.is_int(var) && c.is_int() && c2.is_int());
1178-
else
1179-
m = m_util.mk_mul(m_util.mk_numeral(c, c.is_int() && m_util.is_int(var)), var);
1178+
if (m_util.is_numeral(var, c2)) {
1179+
expr* m = m_util.mk_numeral(c * c2, c.is_int() && m_util.is_int(var));
1180+
m_nl_new_exprs.push_back(m);
1181+
args.push_back(m);
1182+
}
1183+
else if (!c.is_one()) {
1184+
expr * m = m_util.mk_mul(m_util.mk_numeral(c, c.is_int() && m_util.is_int(var)), var);
11801185
m_nl_new_exprs.push_back(m);
11811186
args.push_back(m);
11821187
}
@@ -1425,7 +1430,7 @@ expr_ref theory_arith<Ext>::horner(unsigned depth, buffer<coeff_expr> & p, expr
14251430
If var != 0, then it is used for performing the horner extension
14261431
*/
14271432
template<typename Ext>
1428-
expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p, expr * var) {
1433+
expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p, expr * var) {
14291434
TRACE("non_linear", tout << "p.size: " << p.size() << "\n";);
14301435
if (var == nullptr) {
14311436
sbuffer<var_num_occs> varinfo;
@@ -1561,11 +1566,12 @@ bool theory_arith<Ext>::is_cross_nested_consistent(buffer<coeff_expr> & p) {
15611566
*/
15621567
template<typename Ext>
15631568
bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) {
1564-
TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false););
15651569
if (!is_problematic_non_linear_row(r))
15661570
return true;
15671571

1568-
TRACE("cross_nested", tout << "problematic...\n";);
1572+
TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false);
1573+
display(tout);
1574+
);
15691575

15701576
/*
15711577
The method is_cross_nested converts rows back to expressions.

0 commit comments

Comments
 (0)