diff --git a/src/cmd_context/extra_cmds/dbg_cmds.cpp b/src/cmd_context/extra_cmds/dbg_cmds.cpp index 5a628ce58..c6f0b479a 100644 --- a/src/cmd_context/extra_cmds/dbg_cmds.cpp +++ b/src/cmd_context/extra_cmds/dbg_cmds.cpp @@ -377,8 +377,8 @@ public: }; class get_interpolant_cmd : public cmd { - expr* m_a; - expr* m_b; + scoped_ptr m_a; + scoped_ptr m_b; public: get_interpolant_cmd():cmd("get-interpolant") {} char const * get_usage() const override { return " "; } @@ -388,17 +388,24 @@ public: return CPK_EXPR; } void set_next_arg(cmd_context& ctx, expr * arg) override { - if (m_a == nullptr) - m_a = arg; + ast_manager& m = ctx.m(); + if (!m.is_bool(arg)) + throw default_exception("argument to interpolation is not Boolean"); + if (!m_a) + m_a = alloc(expr_ref, arg, m); else - m_b = arg; + m_b = alloc(expr_ref, arg, m); } void prepare(cmd_context & ctx) override { m_a = nullptr; m_b = nullptr; } void execute(cmd_context & ctx) override { ast_manager& m = ctx.m(); qe::interpolator mbi(m); + if (!m_a || !m_b) + throw default_exception("interpolation requires two arguments"); + if (!m.is_bool(*m_a) || !m.is_bool(*m_b)) + throw default_exception("interpolation requires two Boolean arguments"); expr_ref itp(m); - mbi.pogo(ctx.get_solver_factory(), m_a, m_b, itp); + mbi.pogo(ctx.get_solver_factory(), *m_a, *m_b, itp); ctx.regular_stream() << itp << "\n"; } }; diff --git a/src/qe/qe_mbi.cpp b/src/qe/qe_mbi.cpp index 0261ad979..b261e44be 100644 --- a/src/qe/qe_mbi.cpp +++ b/src/qe/qe_mbi.cpp @@ -536,6 +536,7 @@ namespace qe { th_rewriter rewrite(m); rewrite(a); rewrite(b); + TRACE("interpolator", tout << a << " " << b << "\n"); solver_ref sA = sf(m, p, false /* no proofs */, true, true, symbol::null); solver_ref sB = sf(m, p, false /* no proofs */, true, true, symbol::null); solver_ref sNotA = sf(m, p, false /* no proofs */, true, true, symbol::null); diff --git a/src/solver/assertions/asserted_formulas.cpp b/src/solver/assertions/asserted_formulas.cpp index c6a8093ff..e1345fe92 100644 --- a/src/solver/assertions/asserted_formulas.cpp +++ b/src/solver/assertions/asserted_formulas.cpp @@ -154,6 +154,7 @@ void asserted_formulas::assert_expr(expr * e, proof * _in_pr) { force_push(); proof_ref in_pr(_in_pr, m), pr(_in_pr, m); expr_ref r(e, m); + SASSERT(m.is_bool(e)); if (inconsistent()) return;