3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-25 07:13:41 +00:00

increase build version, better propagation in euf-egraph, handle assumptions in sat.smt

- increase build version to 4.12.1. This prepares updated release for MacOs-11 build on x86
- move literal propagation mode in euf-egraph to a callback and traversal of equivalence class. Track antecedent by newest equality instead of root. This makes equality propagation to literals have similar behavior as in legacy solver and appears to result in a speedup (10% fewer conflicts on QF_UF/QG-classification/qg5/iso_icl478.smt2 in preliminary testing)
- fix interaction of pre-processing and assumptions. Pre-processing has to freeze assumption literals so they don't get eliminated. This is similar to dependencies that are already frozen.
This commit is contained in:
Nikolaj Bjorner 2023-01-17 14:07:07 -08:00
parent c8f197d0ca
commit 7368f9f7d3
22 changed files with 201 additions and 162 deletions

View file

@ -51,7 +51,6 @@ class dependent_expr_state {
void freeze_recfun();
void freeze_lambda();
void freeze_terms(expr* term, bool only_as_array, ast_mark& visited);
void freeze(expr* term);
void freeze(func_decl* f);
struct thaw : public trail {
unsigned sz;
@ -89,6 +88,7 @@ public:
/**
* Freeze internal functions
*/
void freeze(expr* term);
bool frozen(func_decl* f) const { return m_frozen.is_marked(f); }
bool frozen(expr* f) const { return is_app(f) && m_frozen.is_marked(to_app(f)->get_decl()); }
void freeze_suffix();

View file

@ -23,11 +23,13 @@ Author:
// substitutions that use variables from the dependent expressions.
// TODO: add filters to skip sections of the trail that do not touch the current free variables.
void model_reconstruction_trail::replay(unsigned qhead, dependent_expr_state& st) {
void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumptions, dependent_expr_state& st) {
ast_mark free_vars;
scoped_ptr<expr_replacer> rp = mk_default_expr_replacer(m, false);
for (unsigned i = qhead; i < st.qtail(); ++i)
for (unsigned i = qhead; i < st.qtail(); ++i)
add_vars(st[i], free_vars);
for (expr* a : assumptions)
add_vars(a, free_vars);
for (auto& t : m_trail) {
if (!t->m_active)
@ -63,7 +65,7 @@ void model_reconstruction_trail::replay(unsigned qhead, dependent_expr_state& st
mrp.insert(head, t->m_def, t->m_dep);
dependent_expr de(m, t->m_def, nullptr, t->m_dep);
add_vars(de, free_vars);
for (unsigned i = qhead; i < st.qtail(); ++i) {
auto [f, p, dep1] = st[i]();
expr_ref g(m);
@ -73,6 +75,15 @@ void model_reconstruction_trail::replay(unsigned qhead, dependent_expr_state& st
if (f != g)
st.update(i, dependent_expr(m, g, nullptr, dep2));
}
for (unsigned i = 0; i < assumptions.size(); ++i) {
expr* a = assumptions.get(i);
expr_ref g(m);
expr_dependency_ref dep(m);
mrp(a, nullptr, g, dep);
if (a != g)
assumptions[i] = g;
// ignore dep.
}
continue;
}
@ -103,7 +114,15 @@ void model_reconstruction_trail::replay(unsigned qhead, dependent_expr_state& st
CTRACE("simplifier", f != g, tout << "updated " << mk_pp(g, m) << "\n");
add_vars(d, free_vars);
st.update(i, d);
}
}
for (unsigned i = 0; i < assumptions.size(); ++i) {
expr* a = assumptions.get(i);
auto [g, dep2] = rp->replace_with_dep(a);
if (a != g)
assumptions[i] = g;
// ignore dep.
}
}
}

View file

@ -74,13 +74,17 @@ class model_reconstruction_trail {
scoped_ptr_vector<entry> m_trail;
unsigned m_trail_index = 0;
void add_vars(dependent_expr const& d, ast_mark& free_vars) {
for (expr* t : subterms::all(expr_ref(d.fml(), d.get_manager())))
void add_vars(expr* e, ast_mark& free_vars) {
for (expr* t : subterms::all(expr_ref(e, m)))
free_vars.mark(t, true);
}
void add_vars(dependent_expr const& d, ast_mark& free_vars) {
add_vars(d.fml(), free_vars);
}
bool intersects(ast_mark const& free_vars, dependent_expr const& d) {
expr_ref term(d.fml(), d.get_manager());
expr_ref term(d.fml(), m);
auto iter = subterms::all(term);
return any_of(iter, [&](expr* t) { return free_vars.is_marked(t); });
}
@ -126,7 +130,7 @@ public:
* register a new depedent expression, update the trail
* by removing substitutions that are not equivalence preserving.
*/
void replay(unsigned qhead, dependent_expr_state& fmls);
void replay(unsigned qhead, expr_ref_vector& assumptions, dependent_expr_state& fmls);
/**
* retrieve the current model converter corresponding to chaining substitutions from the trail.