Skip to content

Commit 03325c9

Browse files
Correct bounds in instantiate method
This was not checking that the instantiate variable does not exceed the upper bound.
1 parent 812a965 commit 03325c9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/solvers/refinement/string_refinement.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,19 +2125,19 @@ static exprt instantiate(
21252125
const exprt &str,
21262126
const exprt &val)
21272127
{
2128-
exprt idx=find_index(axiom.body(), str, axiom.univ_var());
2128+
const exprt idx = find_index(axiom.body(), str, axiom.univ_var());
21292129
if(idx.is_nil())
21302130
return true_exprt();
21312131

2132-
exprt r=compute_inverse_function(stream, axiom.univ_var(), val, idx);
2133-
implies_exprt instance(axiom.premise(), axiom.body());
2132+
const exprt r = compute_inverse_function(stream, axiom.univ_var(), val, idx);
2133+
implies_exprt instance(
2134+
and_exprt(
2135+
binary_relation_exprt(axiom.univ_var(), ID_ge, axiom.lower_bound()),
2136+
binary_relation_exprt(axiom.univ_var(), ID_lt, axiom.upper_bound()),
2137+
axiom.premise()),
2138+
axiom.body());
21342139
replace_expr(axiom.univ_var(), r, instance);
2135-
// We are not sure the index set contains only positive numbers
2136-
and_exprt bounds(
2137-
axiom.univ_within_bounds(),
2138-
binary_relation_exprt(from_integer(0, val.type()), ID_le, val));
2139-
replace_expr(axiom.univ_var(), r, bounds);
2140-
return implies_exprt(bounds, instance);
2140+
return instance;
21412141
}
21422142

21432143
/// Instantiates a quantified formula representing `not_contains` by

0 commit comments

Comments
 (0)