3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-07 18:05:21 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-07-20 21:19:20 -07:00
parent 1b83a4556b
commit 32614722ef
3 changed files with 15 additions and 6 deletions

View file

@ -377,8 +377,8 @@ public:
};
class get_interpolant_cmd : public cmd {
expr* m_a;
expr* m_b;
scoped_ptr<expr_ref> m_a;
scoped_ptr<expr_ref> m_b;
public:
get_interpolant_cmd():cmd("get-interpolant") {}
char const * get_usage() const override { return "<expr> <expr>"; }
@ -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";
}
};

View file

@ -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);

View file

@ -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;