3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-27 05:26:01 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2025-03-07 10:46:29 -08:00
parent 8df45b442b
commit 80f00f191a
26 changed files with 213 additions and 152 deletions

View file

@ -159,17 +159,14 @@ struct dl_context {
*/
class dl_rule_cmd : public cmd {
ref<dl_context> m_dl_ctx;
mutable unsigned m_arg_idx;
expr* m_t;
mutable unsigned m_arg_idx = 0;
expr* m_t = nullptr;
symbol m_name;
unsigned m_bound;
unsigned m_bound = UINT_MAX;
public:
dl_rule_cmd(dl_context * dl_ctx):
cmd("rule"),
m_dl_ctx(dl_ctx),
m_arg_idx(0),
m_t(nullptr),
m_bound(UINT_MAX) {}
m_dl_ctx(dl_ctx) {}
char const * get_usage() const override { return "(forall (q) (=> (and body) head)) :optional-name :optional-recursion-bound"; }
char const * get_descr(cmd_context & ctx) const override { return "add a Horn rule."; }
unsigned get_arity() const override { return VAR_ARITY; }
@ -193,10 +190,9 @@ public:
m_bound = bound;
m_arg_idx++;
}
void reset(cmd_context & ctx) override { m_dl_ctx->reset(); prepare(ctx); m_t = nullptr; }
void prepare(cmd_context& ctx) override { m_arg_idx = 0; m_name = symbol::null; m_bound = UINT_MAX; }
void finalize(cmd_context & ctx) override {
}
void reset(cmd_context& ctx) override { m_dl_ctx->reset(); prepare(ctx); m_t = nullptr; }
void prepare(cmd_context& ctx) override { m_arg_idx = 0; m_t = nullptr; m_name = symbol::null; m_bound = UINT_MAX; }
void finalize(cmd_context & ctx) override {}
void execute(cmd_context & ctx) override {
if (!m_t) throw cmd_exception("invalid rule, expected formula");
m_dl_ctx->add_rule(m_t, m_name, m_bound);