Skip to content

Commit 5a5e39a

Browse files
fix incrementality bug for pre-processing: replay has to be invoked on every push regardless.
1 parent 8ff4036 commit 5a5e39a

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

src/ast/simplifiers/elim_unconstrained.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void elim_unconstrained::eliminate() {
8080
continue;
8181
}
8282
expr* e = get_parent(v);
83-
IF_VERBOSE(11, for (expr* p : n.m_parents) verbose_stream() << "parent " << mk_bounded_pp(p, m) << " @ " << get_node(p).m_refcount << "\n";);
83+
TRACE("elim_unconstrained", for (expr* p : n.m_parents) verbose_stream() << "parent " << mk_bounded_pp(p, m) << " @ " << get_node(p).m_refcount << "\n";);
8484
if (!e || !is_app(e) || !is_ground(e)) {
8585
n.m_refcount = 0;
8686
continue;
@@ -107,13 +107,13 @@ void elim_unconstrained::eliminate() {
107107
n.m_refcount = 0;
108108
m_args.shrink(sz);
109109
if (!inverted) {
110-
IF_VERBOSE(11, verbose_stream() << "not inverted " << mk_bounded_pp(e, m) << "\n");
110+
TRACE("elim_unconstrained", tout << "not inverted " << mk_bounded_pp(e, m) << "\n");
111111
continue;
112112
}
113113

114-
IF_VERBOSE(11, verbose_stream() << "replace " << mk_pp(t, m) << " / " << rr << " -> " << r << "\n");
114+
IF_VERBOSE(11, verbose_stream() << "replace " << mk_pp(t, m) << " : " << rr << " -> " << r << "\n");
115115

116-
TRACE("elim_unconstrained", tout << mk_pp(t, m) << " / " << rr << " -> " << r << "\n");
116+
TRACE("elim_unconstrained", tout << mk_pp(t, m) << " : " << rr << " -> " << r << "\n");
117117
SASSERT(r->get_sort() == t->get_sort());
118118
m_stats.m_num_eliminated++;
119119
m_trail.push_back(r);

src/ast/simplifiers/model_reconstruction_trail.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,28 @@ Module Name:
2020
#include "ast/converters/generic_model_converter.h"
2121

2222

23+
void model_reconstruction_trail::add_vars(expr* e, ast_mark& free_vars) {
24+
for (expr* t : subterms::all(expr_ref(e, m))) {
25+
if (is_app(t) && is_uninterp(t)) {
26+
func_decl* f = to_app(t)->get_decl();
27+
TRACE("simplifier", tout << "add var " << f->get_name() << "\n");
28+
free_vars.mark(f, true);
29+
if (m_model_vars.is_marked(f))
30+
m_intersects_with_model = true;
31+
}
32+
}
33+
}
34+
35+
2336
// accumulate a set of dependent exprs, updating m_trail to exclude loose
2437
// substitutions that use variables from the dependent expressions.
2538

2639
void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumptions, dependent_expr_state& st) {
2740

2841
if (m_trail.empty())
2942
return;
43+
if (qhead == st.qtail())
44+
return;
3045

3146
ast_mark free_vars;
3247
m_intersects_with_model = false;

src/ast/simplifiers/model_reconstruction_trail.h

+2-10
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class model_reconstruction_trail {
101101
*/
102102
void add_model_var(func_decl* f) {
103103
if (!m_model_vars.is_marked(f)) {
104+
verbose_stream() << "add model var " << f->get_name() << "\n";
104105
m_model_vars_trail.push_back(f);
105106
m_model_vars.mark(f, true);
106107
m_trail_stack.push(undo_model_var(*this));
@@ -112,16 +113,7 @@ class model_reconstruction_trail {
112113
* record if there is an intersection with the model_vars that are
113114
* registered when updates are added to the trail.
114115
*/
115-
void add_vars(expr* e, ast_mark& free_vars) {
116-
for (expr* t : subterms::all(expr_ref(e, m)))
117-
if (is_app(t) && is_uninterp(t)) {
118-
func_decl* f = to_app(t)->get_decl();
119-
TRACE("simplifier", tout << "add var " << f->get_name() << "\n");
120-
free_vars.mark(f, true);
121-
if (m_model_vars.is_marked(f))
122-
m_intersects_with_model = true;
123-
}
124-
}
116+
void add_vars(expr* e, ast_mark& free_vars);
125117

126118
void add_vars(dependent_expr const& d, ast_mark& free_vars) {
127119
add_vars(d.fml(), free_vars);

src/solver/simplifier_solver.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ class simplifier_solver : public solver {
130130
unsigned qhead = m_preprocess_state.qhead();
131131
expr_ref_vector orig_assumptions(assumptions);
132132
m_core_replace.reset();
133+
m_preprocess_state.replay(qhead, assumptions);
134+
for (unsigned i = 0; i < assumptions.size(); ++i)
135+
m_core_replace.insert(assumptions.get(i), orig_assumptions.get(i));
136+
133137
if (qhead < m_fmls.size()) {
134138
m_preprocess.reduce();
135139
if (!m.inc())
@@ -138,11 +142,7 @@ class simplifier_solver : public solver {
138142
m_preprocess_state.display(tout));
139143
m_preprocess_state.advance_qhead();
140144
}
141-
if (!assumptions.empty()) {
142-
m_preprocess_state.replay(m_preprocess_state.qhead(), assumptions);
143-
for (unsigned i = 0; i < assumptions.size(); ++i)
144-
m_core_replace.insert(assumptions.get(i), orig_assumptions.get(i));
145-
}
145+
146146
m_mc = m_preprocess_state.model_trail().get_model_converter();
147147
m_cached_mc = nullptr;
148148
for (; qhead < m_fmls.size(); ++qhead)

0 commit comments

Comments
 (0)