mirror of
https://github.com/Z3Prover/z3
synced 2025-05-02 13:27:01 +00:00
bind variables in queries generated from Horn tactic to enforce that rule formulas don't contain free variables. Issue #328
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
aa777bd5c6
commit
b3e8020c88
5 changed files with 21 additions and 5 deletions
|
@ -29,6 +29,7 @@ Revision History:
|
|||
#include"dl_transforms.h"
|
||||
#include"fixedpoint_params.hpp"
|
||||
#include"ast_util.h"
|
||||
#include"var_subst.h"
|
||||
|
||||
class horn_tactic : public tactic {
|
||||
struct imp {
|
||||
|
@ -37,6 +38,7 @@ class horn_tactic : public tactic {
|
|||
datalog::register_engine m_register_engine;
|
||||
datalog::context m_ctx;
|
||||
smt_params m_fparams;
|
||||
expr_free_vars m_free_vars;
|
||||
|
||||
imp(bool t, ast_manager & m, params_ref const & p):
|
||||
m(m),
|
||||
|
@ -228,6 +230,7 @@ class horn_tactic : public tactic {
|
|||
register_predicate(q);
|
||||
for (unsigned i = 0; i < queries.size(); ++i) {
|
||||
f = mk_rule(queries[i].get(), q);
|
||||
bind_variables(f);
|
||||
m_ctx.add_rule(f, symbol::null);
|
||||
}
|
||||
queries.reset();
|
||||
|
@ -303,6 +306,20 @@ class horn_tactic : public tactic {
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
void bind_variables(expr_ref& f) {
|
||||
m_free_vars.reset();
|
||||
m_free_vars(f);
|
||||
m_free_vars.set_default_sort(m.mk_bool_sort());
|
||||
if (!m_free_vars.empty()) {
|
||||
m_free_vars.reverse();
|
||||
svector<symbol> names;
|
||||
for (unsigned i = 0; i < m_free_vars.size(); ++i) {
|
||||
names.push_back(symbol(m_free_vars.size() - i - 1));
|
||||
}
|
||||
f = m.mk_forall(m_free_vars.size(), m_free_vars.c_ptr(), names.c_ptr(), f);
|
||||
}
|
||||
}
|
||||
|
||||
void simplify(expr* q,
|
||||
goal_ref const& g,
|
||||
goal_ref_buffer & result,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue