Skip to content

Commit b502126

Browse files
fix #7634
1 parent 24090fc commit b502126

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/ast/rewriter/recfun_rewriter.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,25 @@ br_status recfun_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr *
3737

3838
// check if there is an argument that is a constructor
3939
// such that the recursive function can be partially evaluated.
40+
// at most one kind of accessor is allowed to prevent recursive
41+
// patterns that reconstruct the argument indirectly.
42+
// This can be relaxed to omitting at least one accessor, and probably other patterns.
4043
if (!safe_to_subst && !has_quantifiers(r)) {
4144
datatype::util u(m);
4245
auto is_decreasing = [&](unsigned i) {
4346
bool is_dec = true;
4447
unsigned idx = num_args - i - 1;
45-
for (auto t : subterms::all(expr_ref(r, m)))
46-
if (is_app(t) && any_of(*to_app(t), [&](expr* e) { return is_var(e) && to_var(e)->get_idx() == idx; }))
48+
func_decl* dec_fun = nullptr;
49+
for (auto t : subterms::all(expr_ref(r, m))) {
50+
if (is_app(t) && any_of(*to_app(t), [&](expr* e) { return is_var(e) && to_var(e)->get_idx() == idx; })) {
4751
if (!u.is_accessor(t) && !u.is_is(t) && !u.is_recognizer(t))
52+
is_dec = false;
53+
else if (u.is_accessor(t) && dec_fun && to_app(t)->get_decl() != dec_fun)
4854
is_dec = false;
55+
else if (u.is_accessor(t))
56+
dec_fun = to_app(t)->get_decl();
57+
}
58+
}
4959
return is_dec;
5060
};
5161
for (unsigned i = 0; i < num_args; ++i) {

src/sat/sat_solver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ namespace sat {
283283
m_stats.m_mk_var++;
284284
bool_var v = m_justification.size();
285285

286-
if (!m_free_vars.empty()) {
286+
if (!m_free_vars.empty() && false) {
287287
v = m_free_vars.back();
288288
m_free_vars.pop_back();
289289
m_active_vars.push_back(v);

0 commit comments

Comments
 (0)