@@ -173,16 +173,6 @@ class solve_eqs_tactic : public tactic {
173
173
return false;
174
174
}
175
175
176
- #if 0
177
- bool not_bool_eq(expr * f, app_ref & var, expr_ref & def, proof_ref & pr) {
178
- if (!m().is_not(f))
179
- return false;
180
- expr * eq = to_app(f)->get_arg(0);
181
- if (!m().is_eq(f))
182
- return false;
183
-
184
- }
185
- #endif
186
176
187
177
/**
188
178
\brief Given t of the form (f s_0 ... s_n),
@@ -376,12 +366,7 @@ class solve_eqs_tactic : public tactic {
376
366
if (m().is_eq(f, arg1, arg2)) {
377
367
return solve_eq(arg1, arg2, f, var, def, pr);
378
368
}
379
-
380
- #if 0
381
- if (not_bool_eq(f, var, def, pr))
382
- return true;
383
- #endif
384
-
369
+
385
370
if (m_ite_solver && m().is_ite(f))
386
371
return solve_ite(to_app(f), var, def, pr);
387
372
@@ -966,31 +951,25 @@ class solve_eqs_tactic : public tactic {
966
951
}
967
952
968
953
void collect_num_occs(expr * t, expr_fast_mark1 & visited) {
969
- ptr_buffer<expr , 128> stack;
954
+ ptr_buffer<app , 128> stack;
970
955
971
- #define VISIT(ARG) { \
972
- if (is_uninterp_const(ARG )) { \
973
- m_num_occs.insert_if_not_there(ARG , 0)++; \
974
- } \
975
- if (!visited.is_marked(ARG)) { \
976
- visited.mark(ARG , true); \
977
- stack.push_back(ARG) ; \
978
- } \
979
- }
956
+ auto visit = [&](expr* arg) {
957
+ if (is_uninterp_const(arg )) {
958
+ m_num_occs.insert_if_not_there(arg , 0)++;
959
+ }
960
+ if (!visited.is_marked(arg) && is_app(arg)) {
961
+ visited.mark(arg , true);
962
+ stack.push_back(to_app(arg)) ;
963
+ }
964
+ };
980
965
981
- VISIT (t);
966
+ visit (t);
982
967
983
968
while (!stack.empty()) {
984
- expr * t = stack.back();
969
+ app * t = stack.back();
985
970
stack.pop_back();
986
- if (!is_app(t))
987
- continue;
988
- unsigned j = to_app(t)->get_num_args();
989
- while (j > 0) {
990
- --j;
991
- expr * arg = to_app(t)->get_arg(j);
992
- VISIT(arg);
993
- }
971
+ for (expr* arg : *t)
972
+ visit(arg);
994
973
}
995
974
}
996
975
@@ -1012,6 +991,12 @@ class solve_eqs_tactic : public tactic {
1012
991
return m_num_eliminated_vars;
1013
992
}
1014
993
994
+ //
995
+ // TBD: rewrite the tactic to first apply a topological sorting that
996
+ // approximates the dependencies between variables. Then apply
997
+ // simplification on top of this sorting, so that it can apply sub-quadratic
998
+ // equality and unit propagation.
999
+ //
1015
1000
void operator()(goal_ref const & g, goal_ref_buffer & result) {
1016
1001
model_converter_ref mc;
1017
1002
tactic_report report("solve_eqs", *g);
@@ -1023,13 +1008,15 @@ class solve_eqs_tactic : public tactic {
1023
1008
if (!g->inconsistent()) {
1024
1009
m_subst = alloc(expr_substitution, m(), m_produce_unsat_cores, m_produce_proofs);
1025
1010
m_norm_subst = alloc(expr_substitution, m(), m_produce_unsat_cores, m_produce_proofs);
1026
- while (true) {
1027
- if (!m_produce_proofs && m_context_solve) {
1011
+ unsigned rounds = 0;
1012
+ while (rounds < 20) {
1013
+ ++rounds;
1014
+ if (!m_produce_proofs && m_context_solve && rounds < 3) {
1028
1015
distribute_and_or(*(g.get()));
1029
1016
}
1030
1017
collect_num_occs(*g);
1031
1018
collect(*g);
1032
- if (!m_produce_proofs && m_context_solve) {
1019
+ if (!m_produce_proofs && m_context_solve && rounds < 3 ) {
1033
1020
collect_hoist(*g);
1034
1021
}
1035
1022
if (m_subst->empty()) {
@@ -1046,6 +1033,8 @@ class solve_eqs_tactic : public tactic {
1046
1033
}
1047
1034
save_elim_vars(mc);
1048
1035
TRACE("solve_eqs_round", g->display(tout); if (mc) mc->display(tout););
1036
+ if (rounds > 10 && m_ordered_vars.size() == 1)
1037
+ break;
1049
1038
}
1050
1039
}
1051
1040
g->inc_depth();
0 commit comments