mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 08:15:47 +00:00
parent
1b83a4556b
commit
32614722ef
3 changed files with 15 additions and 6 deletions
|
@ -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";
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue