Skip to content

Commit 8d42d90

Browse files
author
Joel Allred
authored
Merge pull request #4798 from allredj/replace-array-if-exprts-before-solve
Replace array if-exprts before giving to solver
2 parents 1ea4a76 + ef8f38f commit 8d42d90

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/solvers/strings/array_pool.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ array_string_exprt array_poolt::make_char_array_for_char_pointer(
9393
to_array_type(t.type()).size(),
9494
to_array_type(f.type()).size()));
9595
// BEWARE: this expression is possibly type-inconsistent and must not be
96-
// used for any purposes other than passing it to concretisation
96+
// used for any purposes other than passing it to concretization.
97+
// Array if-exprts must be replaced (using substitute_array_access) before
98+
// passing the lemmas to the solver.
9799
return to_array_string_expr(if_exprt(if_expr.cond(), t, f, array_type));
98100
}
99101
const bool is_constant_array =

src/solvers/strings/string_refinement.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,9 @@ decision_proceduret::resultt string_refinementt::dec_solve()
738738
}
739739

740740
for(const exprt &lemma : generator.constraints.existential)
741-
add_lemma(lemma);
741+
{
742+
add_lemma(substitute_array_access(lemma, generator.fresh_symbol, true));
743+
}
742744

743745
// All generated strings should have non-negative length
744746
for(const auto &pair : generator.array_pool.created_strings())
@@ -785,7 +787,9 @@ decision_proceduret::resultt string_refinementt::dec_solve()
785787
const auto initial_instances =
786788
generate_instantiations(index_sets, axioms, not_contain_witnesses);
787789
for(const auto &instance : initial_instances)
788-
add_lemma(instance);
790+
{
791+
add_lemma(substitute_array_access(instance, generator.fresh_symbol, true));
792+
}
789793

790794
while((loop_bound_--) > 0)
791795
{

0 commit comments

Comments
 (0)