@@ -1109,42 +1109,10 @@ module DynamoDBFilterExpr {
1109
1109
1 + StringsFollowing (input[..|input|-1])
1110
1110
}
1111
1111
1112
- // generic version should be moved back to standard library
1113
- method HasSubString< T (==)> (haystack: seq < T> , needle: seq < T> )
1114
- returns (o: Wrappers. Option< nat > )
1115
-
1116
- ensures o. Some? ==>
1117
- && o. value <= |haystack| - |needle| && haystack[o. value.. (o. value + |needle|)] == needle
1118
- && (forall i | 0 <= i < o. value :: haystack[i.. ][.. |needle|] != needle)
1119
-
1120
- ensures |haystack| < |needle| ==> o. None?
1121
-
1122
- ensures o. None? && |needle| <= |haystack| && |haystack| <= (UINT64_MAX_LIMIT- 1) ==>
1123
- (forall i | 0 <= i <= (|haystack|- |needle|) :: haystack[i.. ][.. |needle|] != needle)
1124
- {
1125
- SequenceIsSafeBecauseItIsInMemory (haystack);
1126
- SequenceIsSafeBecauseItIsInMemory (needle);
1127
- if |haystack| as uint64 < |needle| as uint64 {
1128
- return Wrappers. None;
1129
- }
1130
-
1131
- var size : uint64 := |needle| as uint64;
1132
- var limit: uint64 := Add (|haystack| as uint64 - size, 1);
1133
-
1134
- for index := 0 to limit
1135
- invariant forall i | 0 <= i < index :: haystack[i.. ][.. size] != needle
1136
- {
1137
- if Sequence. SequenceEqual (seq1 := haystack, seq2 := needle, start1 := index, start2 := 0, size := size) {
1138
- return Wrappers. Some (index as nat);
1139
- }
1140
- }
1141
- return Wrappers. None;
1142
- }
1143
-
1144
1112
// true if haystack contains needle
1145
1113
method seq_contains< T (==)> (haystack : seq < T> , needle : seq < T> ) returns (ret : bool )
1146
1114
{
1147
- var result := HasSubString (haystack, needle);
1115
+ var result := String . HasSubString (haystack, needle);
1148
1116
return result. Some?;
1149
1117
}
1150
1118
0 commit comments