3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

move from justified_expr to dependent_expr by aligning datatypes

This commit is contained in:
Nikolaj Bjorner 2025-01-22 10:58:51 -08:00
parent fc9ff946b7
commit decaee83f3
9 changed files with 52 additions and 51 deletions

View file

@ -20,12 +20,12 @@ public:
justified_expr& operator=(justified_expr const& other) {
SASSERT(&m == &other.m);
if (this != &other) {
m.inc_ref(other.get_fml());
m.inc_ref(other.get_proof());
m.inc_ref(other.fml());
m.inc_ref(other.pr());
m.dec_ref(m_fml);
m.dec_ref(m_proof);
m_fml = other.get_fml();
m_proof = other.get_proof();
m_fml = other.fml();
m_proof = other.pr();
}
return *this;
}
@ -53,7 +53,7 @@ public:
m_proof = nullptr;
}
expr* get_fml() const { return m_fml; }
expr* fml() const { return m_fml; }
proof* get_proof() const { return m_proof; }
proof* pr() const { return m_proof; }
};

View file

@ -177,7 +177,7 @@ void macro_manager::mark_forbidden(unsigned n, justified_expr const * exprs) {
expr_mark visited;
macro_manager_ns::proc p(m_forbidden_set, m_forbidden);
for (unsigned i = 0; i < n; i++)
for_each_expr(p, visited, exprs[i].get_fml());
for_each_expr(p, visited, exprs[i].fml());
}

View file

@ -313,14 +313,14 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
TRACE("quasi_macros", tout << "Finding quasi-macros in: " << std::endl;
for (unsigned i = 0; i < n; i++)
tout << i << ": " << mk_pp(exprs[i].get_fml(), m) << std::endl; );
tout << i << ": " << mk_pp(exprs[i].fml(), m) << std::endl; );
bool res = false;
m_occurrences.reset();
// Find out how many non-ground appearances for each uninterpreted function there are
for (unsigned i = 0 ; i < n ; i++)
find_occurrences(exprs[i].get_fml());
find_occurrences(exprs[i].fml());
TRACE("quasi_macros", tout << "Occurrences: " << std::endl;
for (auto kv : m_occurrences)
@ -331,9 +331,9 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
app_ref a(m);
expr_ref t(m);
quantifier_ref macro(m);
if (is_quasi_macro(exprs[i].get_fml(), a, t) &&
quasi_macro_to_macro(to_quantifier(exprs[i].get_fml()), a, t, macro)) {
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].get_fml(), m) << std::endl;
if (is_quasi_macro(exprs[i].fml(), a, t) &&
quasi_macro_to_macro(to_quantifier(exprs[i].fml()), a, t, macro)) {
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].fml(), m) << std::endl;
tout << "Macro: " << mk_pp(macro, m) << std::endl; );
proof * pr = nullptr;
if (m.proofs_enabled())
@ -377,9 +377,9 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector<j
for (unsigned i = 0 ; i < n ; i++) {
expr_ref r(m), rr(m);
proof_ref pr(m), prr(m);
proof * p = m.proofs_enabled() ? fmls[i].get_proof() : nullptr;
proof * p = m.proofs_enabled() ? fmls[i].pr() : nullptr;
expr_dependency_ref dep(m);
m_macro_manager.expand_macros(fmls[i].get_fml(), p, nullptr, r, pr, dep);
m_macro_manager.expand_macros(fmls[i].fml(), p, nullptr, r, pr, dep);
m_rewriter(r, rr, prr);
if (pr) pr = m.mk_modus_ponens(pr, prr);
new_fmls.push_back(justified_expr(m, rr, pr));

View file

@ -133,8 +133,8 @@ namespace sls {
m_sls_model = mdl;
}
sat::bool_var bool_flip() override {
return m_ddfw->bool_flip();
sat::bool_var external_flip() override {
return m_ddfw->external_flip();
}
bool is_external(sat::bool_var v) override {
@ -158,7 +158,7 @@ namespace sls {
sat::clause_info const& get_clause(unsigned idx) const override { return m_ddfw->get_clause_info(idx); }
ptr_iterator<unsigned> get_use_list(sat::literal lit) override { return m_ddfw->use_list(lit); }
void flip(sat::bool_var v) override {
m_ddfw->flip(v);
m_ddfw->external_flip(v);
}
bool try_rotate(sat::bool_var v, sat::bool_var_set& rotated, unsigned& budget) override {
return m_ddfw->try_rotate(v, rotated, budget);

View file

@ -88,8 +88,8 @@ namespace sls {
vector<sat::clause_info> const& clauses() const override { return m_ddfw.clauses(); }
sat::clause_info const& get_clause(unsigned idx) const override { return m_ddfw.get_clause_info(idx); }
ptr_iterator<unsigned> get_use_list(sat::literal lit) override { return m_ddfw.use_list(lit); }
void flip(sat::bool_var v) override { if (m_dirty) m_ddfw.reinit(), m_dirty = false; m_ddfw.flip(v); }
sat::bool_var bool_flip() override { if (m_dirty) m_ddfw.reinit(), m_dirty = false; return m_ddfw.bool_flip(); }
void flip(sat::bool_var v) override { if (m_dirty) m_ddfw.reinit(), m_dirty = false; m_ddfw.external_flip(v); }
sat::bool_var external_flip() override { if (m_dirty) m_ddfw.reinit(), m_dirty = false; return m_ddfw.external_flip(); }
bool try_rotate(sat::bool_var v, sat::bool_var_set& rotated, unsigned& budget) override { if (m_dirty) m_ddfw.reinit(), m_dirty = false; return m_ddfw.try_rotate(v, rotated, budget); }
double reward(sat::bool_var v) override { return m_ddfw.reward(v); }
double get_weigth(unsigned clause_idx) override { return m_ddfw.get_clause_info(clause_idx).m_weight; }