diff --git a/src/ast/arith_decl_plugin.cpp b/src/ast/arith_decl_plugin.cpp index 4fb098e3a..b1f7c5d89 100644 --- a/src/ast/arith_decl_plugin.cpp +++ b/src/ast/arith_decl_plugin.cpp @@ -647,6 +647,13 @@ bool arith_decl_plugin::are_distinct(app * a, app * b) const { if (is_app_of(a, m_family_id, OP_IRRATIONAL_ALGEBRAIC_NUM) && is_app_of(b, m_family_id, OP_IRRATIONAL_ALGEBRAIC_NUM)) { return am().neq(aw().to_anum(a->get_decl()), aw().to_anum(b->get_decl())); } + if (is_app_of(a, m_family_id, OP_IRRATIONAL_ALGEBRAIC_NUM) && is_app_of(b, m_family_id, OP_NUM)) { + std::swap(a, b); + } + if (is_app_of(a, m_family_id, OP_NUM) && is_app_of(b, m_family_id, OP_IRRATIONAL_ALGEBRAIC_NUM)) { + rational val = a->get_decl()->get_parameter(0).get_rational(); + return am().neq(aw().to_anum(b->get_decl()), val.to_mpq()); + } #define is_non_zero(e) is_app_of(e,m_family_id, OP_NUM) && !to_app(e)->get_decl()->get_parameter(0).get_rational().is_zero() diff --git a/src/ast/rewriter/bool_rewriter.cpp b/src/ast/rewriter/bool_rewriter.cpp index eab1b79a6..e645ee272 100644 --- a/src/ast/rewriter/bool_rewriter.cpp +++ b/src/ast/rewriter/bool_rewriter.cpp @@ -754,6 +754,12 @@ br_status bool_rewriter::mk_distinct_core(unsigned num_args, expr * const * args if (!all_value && all_diff) { for (unsigned j = 0; all_diff && j < i; ++j) { all_diff = m().are_distinct(arg, args[j]); + if (!all_diff) { + if (m().are_equal(arg, args[j])) { + result = m().mk_false(); + return BR_DONE; + } + } } } }