mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
parent
1b83a4556b
commit
32614722ef
|
@ -377,8 +377,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class get_interpolant_cmd : public cmd {
|
class get_interpolant_cmd : public cmd {
|
||||||
expr* m_a;
|
scoped_ptr<expr_ref> m_a;
|
||||||
expr* m_b;
|
scoped_ptr<expr_ref> m_b;
|
||||||
public:
|
public:
|
||||||
get_interpolant_cmd():cmd("get-interpolant") {}
|
get_interpolant_cmd():cmd("get-interpolant") {}
|
||||||
char const * get_usage() const override { return "<expr> <expr>"; }
|
char const * get_usage() const override { return "<expr> <expr>"; }
|
||||||
|
@ -388,17 +388,24 @@ public:
|
||||||
return CPK_EXPR;
|
return CPK_EXPR;
|
||||||
}
|
}
|
||||||
void set_next_arg(cmd_context& ctx, expr * arg) override {
|
void set_next_arg(cmd_context& ctx, expr * arg) override {
|
||||||
if (m_a == nullptr)
|
ast_manager& m = ctx.m();
|
||||||
m_a = arg;
|
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
|
else
|
||||||
m_b = arg;
|
m_b = alloc(expr_ref, arg, m);
|
||||||
}
|
}
|
||||||
void prepare(cmd_context & ctx) override { m_a = nullptr; m_b = nullptr; }
|
void prepare(cmd_context & ctx) override { m_a = nullptr; m_b = nullptr; }
|
||||||
void execute(cmd_context & ctx) override {
|
void execute(cmd_context & ctx) override {
|
||||||
ast_manager& m = ctx.m();
|
ast_manager& m = ctx.m();
|
||||||
qe::interpolator mbi(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);
|
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";
|
ctx.regular_stream() << itp << "\n";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -536,6 +536,7 @@ namespace qe {
|
||||||
th_rewriter rewrite(m);
|
th_rewriter rewrite(m);
|
||||||
rewrite(a);
|
rewrite(a);
|
||||||
rewrite(b);
|
rewrite(b);
|
||||||
|
TRACE("interpolator", tout << a << " " << b << "\n");
|
||||||
solver_ref sA = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
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 sB = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
||||||
solver_ref sNotA = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
solver_ref sNotA = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
||||||
|
|
|
@ -154,6 +154,7 @@ void asserted_formulas::assert_expr(expr * e, proof * _in_pr) {
|
||||||
force_push();
|
force_push();
|
||||||
proof_ref in_pr(_in_pr, m), pr(_in_pr, m);
|
proof_ref in_pr(_in_pr, m), pr(_in_pr, m);
|
||||||
expr_ref r(e, m);
|
expr_ref r(e, m);
|
||||||
|
SASSERT(m.is_bool(e));
|
||||||
|
|
||||||
if (inconsistent())
|
if (inconsistent())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue