Skip to content

Commit a2a3140

Browse files
Correct bounds in instantiate method
This was not checking that the instantiate variable does not exceed the upper bound.
1 parent 0910010 commit a2a3140

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
@@ -2128,19 +2128,19 @@ static exprt instantiate(
21282128
const exprt &str,
21292129
const exprt &val)
21302130
{
2131-
exprt idx=find_index(axiom.body(), str, axiom.univ_var());
2131+
const exprt idx = find_index(axiom.body(), str, axiom.univ_var());
21322132
if(idx.is_nil())
21332133
return true_exprt();
21342134

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

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

0 commit comments

Comments
 (0)