Skip to content

Commit f3f5a19

Browse files
Replacing str and substring by haystack and needle in the comments
This is to match the names of the variables.
1 parent 2d16c2c commit f3f5a19

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/solvers/refinement/string_constraint_generator_indexof.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ exprt string_constraint_generatort::add_axioms_for_index_of_string(
103103
symbol_exprt contains=fresh_boolean("contains_substring");
104104

105105
// We add axioms:
106-
// a1 : contains => from_index <= offset <= |str|-|substring|
106+
// a1 : contains => from_index <= offset <= |haystack|-|needle|
107107
// a2 : !contains <=> offset=-1
108108
// a3 : forall n:[0,|substring|[.
109-
// contains => str[n+offset]=substring[n]
109+
// contains => haystack[n+offset]=needle[n]
110110
// a4 : forall n:[from_index,offset[.
111-
// contains => (exists m:[0,|substring|[. str[m+n]!=substring[m]])
112-
// a5: forall n:[from_index,|str|-|substring|[.
113-
// !contains => (exists m:[0,|substring|[. str[m+n]!=substring[m])
111+
// contains => (exists m:[0,|needle|[. haystack[m+n]!=needle[m]])
112+
// a5: forall n:[from_index,|haystack|-|needle|[.
113+
// !contains => (exists m:[0,|needle|[. haystack[m+n]!=needle[m])
114114

115115
implies_exprt a1(
116116
contains,
@@ -161,10 +161,10 @@ exprt string_constraint_generatort::add_axioms_for_index_of_string(
161161
{
162162
// Unfold the existential quantifier as a disjunction in case of a constant
163163
// a4 && a5 <=> a6:
164-
// forall n:[from_index,|str|-|substring|].
164+
// forall n:[from_index,|haystack|-|needle|].
165165
// !contains || n < offset =>
166-
// str[n]!=substring[0] || ... ||
167-
// str[n+|substring|-1]!=substring[|substring|-1]
166+
// haystack[n]!=needle[0] || ... ||
167+
// haystack[n+|needle|-1]!=needle[|needle|-1]
168168
symbol_exprt qvar2=fresh_univ_index("QA_index_of_string_2", index_type);
169169
mp_integer sub_length;
170170
assert(!to_integer(needle.length(), sub_length));
@@ -223,14 +223,14 @@ exprt string_constraint_generatort::add_axioms_for_last_index_of_string(
223223
// We add axioms:
224224
// a1 : contains => offset <= from_index && offset <= |haystack| - |needle|
225225
// a2 : !contains <=> offset=-1
226-
// a3 : forall n:[0, substring.length[,
227-
// contains => str[n+offset]=substring[n]
228-
// a4 : forall n:[offset+1, min(from_index, |str| - |substring|)].
226+
// a3 : forall n:[0, needle.length[,
227+
// contains => haystack[n+offset]=needle[n]
228+
// a4 : forall n:[offset+1, min(from_index, |haystack| - |needle|)].
229229
// contains =>
230-
// (exists m:[0,|substring|[. str[m+n]!=substring[m]])
231-
// a5: forall n:[0, min(from_index, |str| - |substring|)].
230+
// (exists m:[0,|substring|[. haystack[m+n]!=needle[m]])
231+
// a5: forall n:[0, min(from_index, |haystack| - |needle|)].
232232
// !contains =>
233-
// (exists m:[0,|substring|[. str[m+n]!=substring[m])
233+
// (exists m:[0,|substring|[. haystack[m+n]!=needle[m])
234234

235235
implies_exprt a1(
236236
contains,
@@ -283,10 +283,10 @@ exprt string_constraint_generatort::add_axioms_for_last_index_of_string(
283283
{
284284
// Unfold the existential quantifier as a disjunction in case of a constant
285285
// a4 && a5 <=> a6:
286-
// forall n:[0, min(from_index,|str|-|substring|)].
286+
// forall n:[0, min(from_index,|haystack|-|needle|)].
287287
// !contains || n > offset =>
288-
// str[n]!=substring[0] || ... ||
289-
// str[n+|substring|-1]!=substring[|substring|-1]
288+
// haystack[n]!=needle[0] || ... ||
289+
// haystack[n+|substring|-1]!=needle[|substring|-1]
290290
symbol_exprt qvar2=fresh_univ_index("QA_index_of_string_2", index_type);
291291
mp_integer sub_length;
292292
assert(!to_integer(needle.length(), sub_length));

0 commit comments

Comments
 (0)