Skip to content

Commit ec3798f

Browse files
Merge pull request #1184 from romainbrenguier/bugfix/stringbuilder-setlength#244
Fix axioms introduced for StringBuilder.setLength
2 parents a5f87d4 + 84f0af1 commit ec3798f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/solvers/refinement/string_constraint_generator_transformation.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Author: Romain Brenguier, [email protected]
1414
#include <solvers/refinement/string_refinement_invariant.h>
1515
#include <solvers/refinement/string_constraint_generator.h>
1616

17-
/// add axioms to say that the returned string expression has length given by
18-
/// the second argument and whose characters are equal to those of the first
19-
/// argument for the positions which are defined in both strings
20-
/// \par parameters: function application with two arguments, the first of which
21-
/// is
22-
/// a string and the second an integer which should have same type has
23-
/// return by get_index_type()
24-
/// \return a new string expression
17+
/// add axioms to say that the returned string expression `res` has length `k`
18+
/// and characters at position `i` in `res` are equal to the character at
19+
/// position `i` in `s1` if `i` is smaller that the length of `s1`, otherwise
20+
/// it is the null character `\u0000`.
21+
/// \param f: function application with two arguments, the first of which
22+
/// is a string `s1` and the second an integer `k` which should have
23+
/// same type as the string length
24+
/// \return a new string expression `res`
2525
string_exprt string_constraint_generatort::add_axioms_for_set_length(
2626
const function_application_exprt &f)
2727
{
@@ -32,26 +32,26 @@ string_exprt string_constraint_generatort::add_axioms_for_set_length(
3232

3333
// We add axioms:
3434
// a1 : |res|=k
35-
// a2 : forall i<|s1|. i < |res| ==> res[i] = s1[i]
36-
// a3 : forall i<|s1|. i >= |res| ==> res[i] = 0
35+
// a2 : forall i<|res|. i < |s1| ==> res[i] = s1[i]
36+
// a3 : forall i<|res|. i >= |s1| ==> res[i] = 0
3737

3838
axioms.push_back(res.axiom_for_has_length(k));
3939

4040
symbol_exprt idx=fresh_univ_index(
4141
"QA_index_set_length", ref_type.get_index_type());
4242
string_constraintt a2(
4343
idx,
44-
s1.length(),
45-
res.axiom_for_is_strictly_longer_than(idx),
44+
res.length(),
45+
s1.axiom_for_is_strictly_longer_than(idx),
4646
equal_exprt(s1[idx], res[idx]));
4747
axioms.push_back(a2);
4848

4949
symbol_exprt idx2=fresh_univ_index(
5050
"QA_index_set_length2", ref_type.get_index_type());
5151
string_constraintt a3(
5252
idx2,
53-
s1.length(),
54-
res.axiom_for_is_shorter_than(idx2),
53+
res.length(),
54+
s1.axiom_for_is_shorter_than(idx2),
5555
equal_exprt(res[idx2], constant_char(0, ref_type.get_char_type())));
5656
axioms.push_back(a3);
5757

0 commit comments

Comments
 (0)