mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
adding support for distinct for dt2bv, re-entry harness for ~Context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
375682e98d
commit
5f5ef8b38d
2 changed files with 20 additions and 2 deletions
|
@ -60,10 +60,15 @@ class dt2bv_tactic : public tactic {
|
|||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
expr_ref a0(m), a1(m);
|
||||
expr_ref_vector _args(m);
|
||||
if (m.is_eq(f) && reduce_arg(args[0], a0) && reduce_arg(args[1], a1)) {
|
||||
result = m.mk_eq(a0, a1);
|
||||
return BR_DONE;
|
||||
}
|
||||
else if (m.is_distinct(f) && reduce_args(num, args, _args)) {
|
||||
result = m.mk_distinct(_args.size(), _args.c_ptr());
|
||||
return BR_DONE;
|
||||
}
|
||||
else if (m_t.m_dt.is_recognizer(f) && reduce_arg(args[0], a0)) {
|
||||
unsigned idx = m_t.m_dt.get_recognizer_constructor_idx(f);
|
||||
a1 = m_t.m_bv.mk_numeral(rational(idx), get_sort(a0));
|
||||
|
@ -75,6 +80,15 @@ class dt2bv_tactic : public tactic {
|
|||
}
|
||||
}
|
||||
|
||||
bool reduce_args(unsigned sz, expr*const* as, expr_ref_vector& result) {
|
||||
expr_ref tmp(m);
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!reduce_arg(as[i], tmp)) return false;
|
||||
result.push_back(tmp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool reduce_arg(expr* a, expr_ref& result) {
|
||||
expr* b;
|
||||
if (m_cache.find(a, b)) {
|
||||
|
@ -203,6 +217,9 @@ class dt2bv_tactic : public tactic {
|
|||
if (m.is_eq(a)) {
|
||||
return;
|
||||
}
|
||||
if (m.is_distinct(a)) {
|
||||
return;
|
||||
}
|
||||
if (m_t.m_dt.is_recognizer(a->get_decl()) &&
|
||||
m_t.is_fd(a->get_arg(0))) {
|
||||
m_t.m_fd_sorts.insert(get_sort(a->get_arg(0)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue