void check_predicate(ast_mark& mark, expr* a) { ptr_vector<expr> todo; todo.push_back(a); while (!todo.empty()) { a = todo.back(); todo.pop_back(); if (mark.is_marked(a)) { continue; } mark.mark(a, true); if (is_quantifier(a)) { a = to_quantifier(a)->get_expr(); todo.push_back(a); } else if (m.is_not(a) || m.is_and(a) || m.is_or(a) || m.is_implies(a)) { todo.append(to_app(a)->get_num_args(), to_app(a)->get_args()); } else if (m.is_ite(a)) { todo.push_back(to_app(a)->get_arg(1)); todo.push_back(to_app(a)->get_arg(2)); } else if (is_predicate(a)) { register_predicate(a); } } }
bool compute_mark1(proof *pr) { bool hyp_mark = false; // lemmas clear all hypotheses if (!m.is_lemma(pr)) { for (unsigned i = 0, sz = m.get_num_parents(pr); i < sz; ++i) { if (m_hypmark.is_marked(m.get_parent(pr, i))) { hyp_mark = true; break; } } } m_hypmark.mark(pr, hyp_mark); return hyp_mark; }
void reset() { m_cache.reset(); m_units.reset(); m_hyps.reset(); m_hypmark.reset(); m_pinned.reset(); }
bool for_each_parameter(ptr_vector<ast> & stack, ast_mark & visited, unsigned num_args, parameter const * params) { bool result = true; for (unsigned i = 0; i < num_args; i++) { parameter const& p = params[i]; if (p.is_ast() && !visited.is_marked(p.get_ast())) { stack.push_back(p.get_ast()); result = false; } } return result; }
void compute_marks(proof* pr) { proof *p; proof_post_order pit(pr, m); while (pit.hasNext()) { p = pit.next(); if (m.is_hypothesis(p)) { m_hypmark.mark(p, true); m_hyps.insert(m.get_fact(p)); } else { bool hyp_mark = compute_mark1(p); // collect units that are hyp-free and are used as hypotheses somewhere if (!hyp_mark && m.has_fact(p) && m_hyps.contains(m.get_fact(p))) { m_units.insert(m.get_fact(p), p); } } } }