3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-11 09:44:43 +00:00

update namespace, hoist exported functions outside of embedded namespace

This commit is contained in:
Nikolaj Bjorner 2025-05-07 15:57:47 -07:00
parent 644118660f
commit a51239c641
4 changed files with 32 additions and 36 deletions

View file

@ -60,7 +60,7 @@ Revision History:
#define IS_CGR_SUPPORT true #define IS_CGR_SUPPORT true
namespace q { namespace euf {
// ------------------------------------ // ------------------------------------
// //
// Trail // Trail
@ -3885,31 +3885,32 @@ namespace q {
} }
}; };
void mam::ground_subterms(expr* e, ptr_vector<app>& ground) {
ground.reset();
expr_fast_mark1 mark;
ptr_buffer<app> todo;
if (is_app(e))
todo.push_back(to_app(e));
while (!todo.empty()) {
app * n = todo.back();
todo.pop_back();
if (mark.is_marked(n))
continue;
mark.mark(n);
if (n->is_ground())
ground.push_back(n);
else {
for (expr* arg : *n)
if (is_app(arg))
todo.push_back(to_app(arg));
}
}
}
mam* mam::mk(euf::mam_solver& ctx, euf::on_binding_callback& em) {
return alloc(mam_impl, ctx, em, true);
}
} }
void euf::mam::ground_subterms(expr* e, ptr_vector<app>& ground) {
ground.reset();
expr_fast_mark1 mark;
ptr_buffer<app> todo;
if (is_app(e))
todo.push_back(to_app(e));
while (!todo.empty()) {
app* n = todo.back();
todo.pop_back();
if (mark.is_marked(n))
continue;
mark.mark(n);
if (n->is_ground())
ground.push_back(n);
else {
for (expr* arg : *n)
if (is_app(arg))
todo.push_back(to_app(arg));
}
}
}
euf::mam* euf::mam::mk(euf::mam_solver& ctx, euf::on_binding_callback& em) {
return alloc(mam_impl, ctx, em, true);
}

View file

@ -39,16 +39,11 @@ namespace euf {
virtual ~on_binding_callback() = default; virtual ~on_binding_callback() = default;
virtual void on_binding(quantifier* q, app* pat, euf::enode* const* binding, unsigned max_generation, unsigned min_gen, unsigned max_gen) = 0; virtual void on_binding(quantifier* q, app* pat, euf::enode* const* binding, unsigned max_generation, unsigned min_gen, unsigned max_gen) = 0;
}; };
};
namespace q {
typedef euf::enode enode; typedef euf::enode enode;
typedef euf::egraph egraph; typedef euf::egraph egraph;
typedef euf::enode_vector enode_vector; typedef euf::enode_vector enode_vector;
class ematch;
/** /**
\brief Matching Abstract Machine (MAM) \brief Matching Abstract Machine (MAM)
*/ */

View file

@ -76,7 +76,7 @@ namespace q {
if (!ctx.relevancy_enabled()) if (!ctx.relevancy_enabled())
ctx.get_egraph().set_on_make(_on_make); ctx.get_egraph().set_on_make(_on_make);
} }
m_mam = mam::mk(ctx, *this); m_mam = euf::mam::mk(ctx, *this);
} }
void ematch::relevant_eh(euf::enode* n) { void ematch::relevant_eh(euf::enode* n) {
@ -85,7 +85,7 @@ namespace q {
} }
void ematch::ensure_ground_enodes(expr* e) { void ematch::ensure_ground_enodes(expr* e) {
mam::ground_subterms(e, m_ground); euf::mam::ground_subterms(e, m_ground);
for (expr* g : m_ground) for (expr* g : m_ground)
m_qs.e_internalize(g); m_qs.e_internalize(g);
} }
@ -557,7 +557,7 @@ namespace q {
* Attach ground subterms of patterns so they appear shared. * Attach ground subterms of patterns so they appear shared.
*/ */
void ematch::attach_ground_pattern_terms(expr* pat) { void ematch::attach_ground_pattern_terms(expr* pat) {
mam::ground_subterms(pat, m_ground); euf::mam::ground_subterms(pat, m_ground);
for (expr* g : m_ground) { for (expr* g : m_ground) {
euf::enode* n = ctx.get_egraph().find(g); euf::enode* n = ctx.get_egraph().find(g);
if (!n->is_attached_to(m_qs.get_id())) if (!n->is_attached_to(m_qs.get_id()))
@ -602,7 +602,7 @@ namespace q {
if (!unary && j >= num_eager_multi_patterns) { if (!unary && j >= num_eager_multi_patterns) {
TRACE("q", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";); TRACE("q", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";);
if (!m_lazy_mam) if (!m_lazy_mam)
m_lazy_mam = mam::mk(ctx, *this); m_lazy_mam = euf::mam::mk(ctx, *this);
m_lazy_mam->add_pattern(q, mp); m_lazy_mam->add_pattern(q, mp);
} }
else else

View file

@ -75,7 +75,7 @@ namespace q {
queue m_inst_queue; queue m_inst_queue;
svector<prop> m_prop_queue; svector<prop> m_prop_queue;
pattern_inference_rw m_infer_patterns; pattern_inference_rw m_infer_patterns;
scoped_ptr<q::mam> m_mam, m_lazy_mam; scoped_ptr<euf::mam> m_mam, m_lazy_mam;
ptr_vector<clause> m_clauses; ptr_vector<clause> m_clauses;
obj_map<quantifier, unsigned> m_q2clauses; obj_map<quantifier, unsigned> m_q2clauses;
vector<unsigned_vector> m_watch; // expr_id -> clause-index* vector<unsigned_vector> m_watch; // expr_id -> clause-index*