@@ -353,29 +353,31 @@ exprt string_constraint_generatort::add_axioms_for_to_upper_case(
353
353
// \todo Add support for locales using case mapping information
354
354
// from the UnicodeData file.
355
355
356
- equal_exprt a1 (res.length (), str.length ());
357
- lemmas.push_back (a1);
358
-
359
- symbol_exprt idx1=fresh_univ_index (" QA_upper_case1" , index_type);
360
- const and_exprt is_lower_case (
361
- binary_relation_exprt (char_a, ID_le, str[idx1]),
362
- binary_relation_exprt (str[idx1], ID_le, char_z));
363
- minus_exprt diff (char_A, char_a);
364
- equal_exprt convert (res[idx1], plus_exprt (str[idx1], diff));
365
- implies_exprt body1 (is_lower_case, convert);
366
- string_constraintt a2 (idx1, zero_if_negative (res.length ()), body1);
367
- constraints.push_back (a2);
356
+ lemmas.push_back (equal_exprt (res.length (), str.length ()));
368
357
369
- symbol_exprt idx2=fresh_univ_index (" QA_upper_case2" , index_type);
370
- const not_exprt is_not_lower_case (
371
- and_exprt (
372
- binary_relation_exprt (char_a, ID_le, str[idx2]),
373
- binary_relation_exprt (str[idx2], ID_le, char_z)));
374
- equal_exprt eq (res[idx2], str[idx2]);
375
- implies_exprt body2 (is_not_lower_case, eq);
376
- string_constraintt a3 (idx2, zero_if_negative (res.length ()), body2);
377
- constraints.push_back (a3);
378
- return from_integer (0 , signedbv_typet (32 ));
358
+ constraints.push_back ([&] {
359
+ const symbol_exprt idx1 = fresh_univ_index (" QA_upper_case1" , index_type);
360
+ const exprt is_lower_case = and_exprt (
361
+ binary_relation_exprt (char_a, ID_le, str[idx1]),
362
+ binary_relation_exprt (str[idx1], ID_le, char_z));
363
+ const exprt diff = minus_exprt (char_A, char_a);
364
+ const exprt convert = equal_exprt (res[idx1], plus_exprt (str[idx1], diff));
365
+ const exprt body = implies_exprt (is_lower_case, convert);
366
+ return string_constraintt (idx1, zero_if_negative (res.length ()), body);
367
+ }());
368
+
369
+ constraints.push_back ([&] {
370
+ const symbol_exprt idx2 = fresh_univ_index (" QA_upper_case2" , index_type);
371
+ const exprt is_not_lower_case = not_exprt (
372
+ and_exprt (
373
+ binary_relation_exprt (char_a, ID_le, str[idx2]),
374
+ binary_relation_exprt (str[idx2], ID_le, char_z)));
375
+ const exprt eq = equal_exprt (res[idx2], str[idx2]);
376
+ const exprt body2 = implies_exprt (is_not_lower_case, eq);
377
+ return string_constraintt (idx2, zero_if_negative (res.length ()), body2);
378
+ }());
379
+
380
+ return from_integer (0 , get_return_code_type ());
379
381
}
380
382
381
383
// / Conversion of a string to upper case
0 commit comments