@@ -96,6 +96,10 @@ exprt string_constraint_generatort::add_axioms_for_index_of_string(
96
96
// a2 : !contains => offset=-1
97
97
// a3 : forall 0<=witness<|substring|.
98
98
// contains => str[witness+offset]=substring[witness]
99
+ // a4 : forall n:[0,offset[.
100
+ // contains => (exists m:[0,|substring|[. str[n+m]!=substring[m]])
101
+ // a5: forall n:[0,|str|-|substring|[.
102
+ // !contains => (exists m:[0,|substring|[. str[n+m]!=substring[m])
99
103
100
104
implies_exprt a1 (
101
105
contains,
@@ -118,6 +122,26 @@ exprt string_constraint_generatort::add_axioms_for_index_of_string(
118
122
equal_exprt (str[plus_exprt (qvar, offset)], substring[qvar]));
119
123
axioms.push_back (a3);
120
124
125
+ string_not_contains_constraintt a4 (
126
+ from_integer (0 , index_type),
127
+ offset,
128
+ contains,
129
+ from_integer (0 , index_type),
130
+ substring.length (),
131
+ str,
132
+ substring);
133
+ axioms.push_back (a4);
134
+
135
+ string_not_contains_constraintt a5 (
136
+ from_integer (0 , index_type),
137
+ minus_exprt (str.length (), substring.length ()),
138
+ not_exprt (contains),
139
+ from_integer (0 , index_type),
140
+ substring.length (),
141
+ str,
142
+ substring);
143
+ axioms.push_back (a5);
144
+
121
145
return offset;
122
146
}
123
147
0 commit comments