@@ -175,9 +175,8 @@ exprt string_constraint_generatort::add_axioms_for_trim(
175
175
const symbol_exprt idx = fresh_exist_index (" index_trim" , index_type);
176
176
const exprt space_char = from_integer (' ' , char_type);
177
177
178
- exprt a1=str.axiom_for_length_ge (
179
- plus_exprt_with_overflow_check (idx, res.length ()));
180
- lemmas.push_back (a1);
178
+ // Axiom 1.
179
+ lemmas.push_back (str.axiom_for_length_ge (plus_exprt (idx, res.length ())));
181
180
182
181
binary_relation_exprt a2 (idx, ID_ge, from_integer (0 , index_type));
183
182
lemmas.push_back (a2);
@@ -197,32 +196,31 @@ exprt string_constraint_generatort::add_axioms_for_trim(
197
196
string_constraintt a6 (n, idx, non_print);
198
197
constraints.push_back (a6);
199
198
200
- symbol_exprt n2=fresh_univ_index (" QA_index_trim2" , index_type);
201
- minus_exprt bound (str.length (), plus_exprt_with_overflow_check (idx,
202
- res.length ()));
203
- binary_relation_exprt eqn2 (
204
- str[plus_exprt (idx, plus_exprt (res.length (), n2))],
205
- ID_le,
206
- space_char);
207
-
208
- string_constraintt a7 (n2, bound, eqn2);
209
- constraints.push_back (a7);
199
+ // Axiom 7.
200
+ constraints.push_back ([&] { // NOLINT
201
+ const symbol_exprt n2 = fresh_univ_index (" QA_index_trim2" , index_type);
202
+ const minus_exprt bound (minus_exprt (str.length (), idx), res.length ());
203
+ const binary_relation_exprt eqn2 (
204
+ str[plus_exprt (idx, plus_exprt (res.length (), n2))], ID_le, space_char);
205
+ return string_constraintt (n2, bound, eqn2);
206
+ }());
210
207
211
208
symbol_exprt n3=fresh_univ_index (" QA_index_trim3" , index_type);
212
209
equal_exprt eqn3 (res[n3], str[plus_exprt (n3, idx)]);
213
210
string_constraintt a8 (n3, res.length (), eqn3);
214
211
constraints.push_back (a8);
215
212
216
- minus_exprt index_before (
217
- plus_exprt_with_overflow_check (idx, res.length ()),
218
- from_integer (1 , index_type));
219
- binary_relation_exprt no_space_before (str[index_before], ID_gt, space_char);
220
- or_exprt a9 (
221
- equal_exprt (idx, str.length ()),
222
- and_exprt (
223
- binary_relation_exprt (str[idx], ID_gt, space_char),
224
- no_space_before));
225
- lemmas.push_back (a9);
213
+ // Axiom 9.
214
+ lemmas.push_back ([&] {
215
+ const plus_exprt index_before (
216
+ idx, minus_exprt (res.length (), from_integer (1 , index_type)));
217
+ const binary_relation_exprt no_space_before (
218
+ str[index_before], ID_gt, space_char);
219
+ return or_exprt (
220
+ equal_exprt (idx, str.length ()),
221
+ and_exprt (
222
+ binary_relation_exprt (str[idx], ID_gt, space_char), no_space_before));
223
+ }());
226
224
return from_integer (0 , f.type ());
227
225
}
228
226
@@ -511,10 +509,7 @@ exprt string_constraint_generatort::add_axioms_for_delete_char_at(
511
509
const array_string_exprt str = get_string_expr (f.arguments ()[2 ]);
512
510
exprt index_one=from_integer (1 , str.length ().type ());
513
511
return add_axioms_for_delete (
514
- res,
515
- str,
516
- f.arguments ()[3 ],
517
- plus_exprt_with_overflow_check (f.arguments ()[3 ], index_one));
512
+ res, str, f.arguments ()[3 ], plus_exprt (f.arguments ()[3 ], index_one));
518
513
}
519
514
520
515
// / Add axioms stating that `res` corresponds to the input `str`
0 commit comments