mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 18:31:49 +00:00
Merge pull request #347 from NikolajBjorner/master
bind variables in queries generated from Horn tactic to enforce that …
This commit is contained in:
commit
2916f14b40
|
@ -7,7 +7,7 @@ Module Name:
|
|||
|
||||
Abstract:
|
||||
|
||||
Utility to find constants that are declard as varaibles.
|
||||
Utility to find constants that are declard as variables.
|
||||
|
||||
Author:
|
||||
|
||||
|
|
|
@ -973,7 +973,7 @@ namespace datalog {
|
|||
}
|
||||
}
|
||||
|
||||
void context::get_raw_rule_formulas(expr_ref_vector& rules, svector<symbol>& names, vector<unsigned> &bounds) {
|
||||
void context::get_raw_rule_formulas(expr_ref_vector& rules, svector<symbol>& names, unsigned_vector &bounds) {
|
||||
for (unsigned i = 0; i < m_rule_fmls.size(); ++i) {
|
||||
expr_ref r = bind_vars(m_rule_fmls[i].get(), true);
|
||||
rules.push_back(r.get());
|
||||
|
@ -988,7 +988,6 @@ namespace datalog {
|
|||
|
||||
// ensure that rules are all using bound variables.
|
||||
for (unsigned i = m_rule_fmls_head; i < m_rule_fmls.size(); ++i) {
|
||||
ptr_vector<sort> sorts;
|
||||
m_free_vars(m_rule_fmls[i].get());
|
||||
if (!m_free_vars.empty()) {
|
||||
rm.mk_rule(m_rule_fmls[i].get(), 0, m_rule_set, m_rule_names[i]);
|
||||
|
|
|
@ -377,7 +377,7 @@ namespace datalog {
|
|||
rule_set & get_rules() { flush_add_rules(); return m_rule_set; }
|
||||
|
||||
void get_rules_as_formulas(expr_ref_vector& fmls, expr_ref_vector& qs, svector<symbol>& names);
|
||||
void get_raw_rule_formulas(expr_ref_vector& fmls, svector<symbol>& names, vector<unsigned> &bounds);
|
||||
void get_raw_rule_formulas(expr_ref_vector& fmls, svector<symbol>& names, unsigned_vector &bounds);
|
||||
|
||||
void add_fact(app * head);
|
||||
void add_fact(func_decl * pred, const relation_fact & fact);
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace Duality {
|
|||
|
||||
expr_ref_vector rules(m_ctx.get_manager());
|
||||
svector< ::symbol> names;
|
||||
vector<unsigned> bounds;
|
||||
unsigned_vector bounds;
|
||||
// m_ctx.get_rules_as_formulas(rules, names);
|
||||
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue