3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

#6999 deal with implicit assumptions, more robust pattern matching

The code is making some assumptions that arrays are 1-dimensional. This is not generally true.
Introducing pattern matching to ensure the assumption is met.
Avoid get_arg(..) especially when there is an approach based on pattern matching recognizers.
This commit is contained in:
Nikolaj Bjorner 2023-11-17 10:06:20 -08:00
parent 6d6d6b8ed0
commit b9455c3692
2 changed files with 76 additions and 34 deletions

View file

@ -186,6 +186,21 @@ public:
bool is_store_ext(expr* e, expr_ref& a, expr_ref_vector& args, expr_ref& value);
bool is_select1(expr* n) const { return is_select(n) && to_app(n)->get_num_args() == 2; }
bool is_select1(expr* n, expr*& a, expr*& i) const {
return is_select1(n) && (a = to_app(n)->get_arg(0), i = to_app(n)->get_arg(1), true);
}
bool is_store1(expr* n) const { return is_store(n) && to_app(n)->get_num_args() == 3; }
bool is_store1(expr* n, expr*& a, expr*& i, expr*& v) const {
app* _n;
return is_store1(n) && (_n = to_app(n), a = _n->get_arg(0), i = _n->get_arg(1), v = _n->get_arg(2), true);
}
MATCH_BINARY(is_subset);
};
@ -213,6 +228,11 @@ public:
return mk_store(args.size(), args.data());
}
app * mk_select(expr* a, expr* i) const {
expr* args[2] = { a, i };
return mk_select(2, args);
}
app * mk_select(unsigned num_args, expr * const * args) const {
return m_manager.mk_app(m_fid, OP_SELECT, 0, nullptr, num_args, args);
}