Skip to content

Commit

Permalink
modify #5454
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Aug 16, 2021
1 parent 429e5ed commit 904c6e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/sat/smt/array_axioms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,17 @@ namespace array {
ptr_buffer<expr> sel1_args, sel2_args;
unsigned num_args = select->get_num_args();

expr* arg = select->get_arg(0);
if (arg != store && !can_beta_reduce(arg) && expr2enode(arg)->get_root() == expr2enode(store)->get_root())
return false;
bool has_diff = false;
for (unsigned i = 1; i < num_args; i++)
has_diff |= expr2enode(select->get_arg(i))->get_root() != expr2enode(store->get_arg(i))->get_root();
if (!has_diff)
return false;

sel1_args.push_back(store);
sel2_args.push_back(store->get_arg(0));
sel2_args.push_back(arg);

for (unsigned i = 1; i < num_args; i++) {
sel1_args.push_back(select->get_arg(i));
Expand Down
3 changes: 1 addition & 2 deletions src/sat/smt/array_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ namespace array {
return !get_config().m_array_delay_exp_axiom && d.m_prop_upward;
}

bool solver::can_beta_reduce(euf::enode* n) const {
expr* c = n->get_expr();
bool solver::can_beta_reduce(expr* c) const {
return a.is_const(c) || a.is_as_array(c) || a.is_store(c) || is_lambda(c) || a.is_map(c);
}
}
3 changes: 2 additions & 1 deletion src/sat/smt/array_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ namespace array {
unsigned get_lambda_equiv_size(var_data const& d) const;
bool should_set_prop_upward(var_data const& d) const;
bool should_prop_upward(var_data const& d) const;
bool can_beta_reduce(euf::enode* n) const;
bool can_beta_reduce(euf::enode* n) const { return can_beta_reduce(n->get_expr()); }
bool can_beta_reduce(expr* e) const;

var_data& get_var_data(euf::enode* n) { return get_var_data(n->get_th_var(get_id())); }
var_data& get_var_data(theory_var v) { return *m_var_data[v]; }
Expand Down

0 comments on commit 904c6e2

Please sign in to comment.