mirror of
https://github.com/Z3Prover/z3
synced 2025-08-07 19:51:22 +00:00
add marker for top-level expression in rule.
This commit is contained in:
parent
61ab72b6a3
commit
f639a7e1bc
1 changed files with 4 additions and 0 deletions
|
@ -222,6 +222,7 @@ bool rule_properties::check_accessor(app* n) {
|
||||||
to_app(t)->get_arg(0) == n->get_arg(0) &&
|
to_app(t)->get_arg(0) == n->get_arg(0) &&
|
||||||
m_dt.get_recognizer_constructor(to_app(t)->get_decl()) == c;
|
m_dt.get_recognizer_constructor(to_app(t)->get_decl()) == c;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto is_recognizer = [&](expr* t) {
|
auto is_recognizer = [&](expr* t) {
|
||||||
if (m.is_and(t))
|
if (m.is_and(t))
|
||||||
for (expr* arg : *to_app(t))
|
for (expr* arg : *to_app(t))
|
||||||
|
@ -240,6 +241,7 @@ bool rule_properties::check_accessor(app* n) {
|
||||||
obj_map<expr, ptr_vector<expr>> use_list;
|
obj_map<expr, ptr_vector<expr>> use_list;
|
||||||
for (unsigned i = ut_size; i < t_size; ++i) {
|
for (unsigned i = ut_size; i < t_size; ++i) {
|
||||||
app* t = m_rule->get_tail(i);
|
app* t = m_rule->get_tail(i);
|
||||||
|
use_list.insert_if_not_there(t, ptr_vector<expr>()).push_back(nullptr); // add marker for top-level expression.
|
||||||
for (expr* sub : subterms::all(expr_ref(t, m)))
|
for (expr* sub : subterms::all(expr_ref(t, m)))
|
||||||
if (is_app(sub))
|
if (is_app(sub))
|
||||||
for (expr* arg : *to_app(sub))
|
for (expr* arg : *to_app(sub))
|
||||||
|
@ -254,6 +256,8 @@ bool rule_properties::check_accessor(app* n) {
|
||||||
if (!use_list.contains(e))
|
if (!use_list.contains(e))
|
||||||
return false;
|
return false;
|
||||||
for (expr* parent : use_list[e]) {
|
for (expr* parent : use_list[e]) {
|
||||||
|
if (!parent)
|
||||||
|
return false; // top-level expressions are not guarded
|
||||||
if (is_recognizer(parent))
|
if (is_recognizer(parent))
|
||||||
continue;
|
continue;
|
||||||
if (m.is_ite(parent) && to_app(parent)->get_arg(1) == e && is_recognizer(to_app(parent)->get_arg(0)))
|
if (m.is_ite(parent) && to_app(parent)->get_arg(1) == e && is_recognizer(to_app(parent)->get_arg(0)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue