Skip to content

Commit

Permalink
add option to select with folding
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Aug 4, 2022
1 parent a8ff976 commit 9da6895
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/smt/theory_array_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ namespace smt {
return r;
}

app * theory_array_base::mk_select_reduce(unsigned num_args, expr * * args) {
array_util util(m);
while (util.is_store(args[0])) {
bool are_distinct = false;
for (unsigned i = 1; i < num_args && !are_distinct; ++i)
are_distinct |= m.are_distinct(args[i], to_app(args[0])->get_arg(i));
if (!are_distinct)
break;
args[0] = to_app(to_app(args[0])->get_arg(0));
}
return mk_select(num_args, args);
}


app * theory_array_base::mk_store(unsigned num_args, expr * const * args) {
return m.mk_app(get_family_id(), OP_STORE, 0, nullptr, num_args, args);
}
Expand Down
1 change: 1 addition & 0 deletions src/smt/theory_array_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace smt {
bool is_select_arg(enode* r);

app * mk_select(unsigned num_args, expr * const * args);
app * mk_select_reduce(unsigned num_args, expr * * args);
app * mk_select(expr_ref_vector const& args) { return mk_select(args.size(), args.data()); }
app * mk_store(unsigned num_args, expr * const * args);
app * mk_default(expr* a);
Expand Down

0 comments on commit 9da6895

Please sign in to comment.