@@ -324,9 +324,8 @@ void string_refinementt::set_to(const exprt &expr, bool value)
324
324
}
325
325
else
326
326
{
327
- if (has_char_array_subexpr (expr, ns))
328
- warning () << " WARNING: string_refinement.cpp: "
329
- " non string equation has char array subexpr" ;
327
+ INVARIANT (
328
+ !has_char_array_subexpr (expr, ns), " char array only appear in equations" );
330
329
supert::set_to (expr, value);
331
330
}
332
331
}
@@ -446,7 +445,13 @@ decision_proceduret::resultt string_refinementt::dec_solve()
446
445
#endif
447
446
448
447
#ifdef DEBUG
449
- generator.debug_arrays_of_pointers (debug ());
448
+ debug () << " dec_solve: arrays_of_pointers:" << eom;
449
+ for (auto pair : generator.get_arrays_of_pointers ())
450
+ {
451
+ debug () << " * " << from_expr (ns, " " , pair.first ) << " \t --> "
452
+ << from_expr (ns, " " , pair.second ) << " : "
453
+ << from_type (ns, " " , pair.second .type ()) << eom;
454
+ }
450
455
#endif
451
456
452
457
for (const auto &eq : equations)
@@ -1173,6 +1178,44 @@ exprt concretize_arrays_in_expression(
1173
1178
return expr;
1174
1179
}
1175
1180
1181
+ // / Debugging function which outputs the different steps an axiom goes through
1182
+ // / to be checked in check axioms.
1183
+ static void debug_check_axioms_step (
1184
+ messaget::mstreamt &stream,
1185
+ const namespacet &ns,
1186
+ const exprt &axiom,
1187
+ const exprt &axiom_in_model,
1188
+ const exprt &negaxiom,
1189
+ const exprt &with_concretized_arrays)
1190
+ {
1191
+ static const std::string indent = " " ;
1192
+ static const std::string indent2 = " " ;
1193
+ stream << indent2 << " - axiom:\n " << indent2 << indent;
1194
+
1195
+ if (axiom.id () == ID_string_constraint)
1196
+ stream << from_expr (ns, " " , to_string_constraint (axiom));
1197
+ else if (axiom.id () == ID_string_not_contains_constraint)
1198
+ stream << from_expr (ns, " " , to_string_not_contains_constraint (axiom));
1199
+ else
1200
+ stream << from_expr (ns, " " , axiom);
1201
+ stream << ' \n ' << indent2 << " - axiom_in_model:\n " << indent2 << indent;
1202
+
1203
+ if (axiom_in_model.id () == ID_string_constraint)
1204
+ stream << from_expr (ns, " " , to_string_constraint (axiom_in_model));
1205
+ else if (axiom_in_model.id () == ID_string_not_contains_constraint)
1206
+ stream << from_expr (
1207
+ ns, " " , to_string_not_contains_constraint (axiom_in_model));
1208
+ else
1209
+ stream << from_expr (ns, " " , axiom_in_model);
1210
+
1211
+ stream << ' \n '
1212
+ << indent2 << " - negated_axiom:\n "
1213
+ << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1214
+ stream << indent2 << " - negated_axiom_with_concretized_arrays:\n "
1215
+ << indent2 << indent << from_expr (ns, " " , with_concretized_arrays)
1216
+ << ' \n ' ;
1217
+ }
1218
+
1176
1219
// / \return true if the current model satisfies all the axioms
1177
1220
// / \return a Boolean
1178
1221
static std::pair<bool , std::vector<exprt>> check_axioms (
@@ -1227,28 +1270,14 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1227
1270
univ_var, get (bound_inf), get (bound_sup), get (prem), get (body));
1228
1271
1229
1272
exprt negaxiom=negation_of_constraint (axiom_in_model);
1230
-
1231
- stream << indent << i << " .\n "
1232
- << indent2 << " - axiom:\n "
1233
- << indent2 << indent << from_expr (ns, " " , axiom) << ' \n ' ;
1234
- stream << indent2 << " - axiom_in_model:\n "
1235
- << indent2 << indent << from_expr (ns, " " , axiom_in_model) << ' \n ' ;
1236
- stream << indent2 << " - negated_axiom:\n "
1237
- << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1238
1273
negaxiom = simplify_expr (negaxiom, ns);
1239
- stream << indent2 << " - simplified_negaxiom:\n "
1240
- << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1241
-
1242
1274
exprt with_concretized_arrays =
1243
1275
concretize_arrays_in_expression (negaxiom, max_string_length, ns);
1244
- stream << indent2 << " - negated_axiom_with_concretized_array_access:\n "
1245
- << indent2 << indent << from_expr (ns, " " , with_concretized_arrays)
1246
- << ' \n ' ;
1247
-
1248
1276
substitute_array_access (with_concretized_arrays);
1249
- stream << indent2 << " - negated_axiom_without_array_access:\n "
1250
- << indent2 << indent << from_expr (ns, " " , with_concretized_arrays)
1251
- << eom;
1277
+
1278
+ stream << indent << i << " .\n " ;
1279
+ debug_check_axioms_step (
1280
+ stream, ns, axiom, axiom_in_model, negaxiom, with_concretized_arrays);
1252
1281
1253
1282
if (const auto &witness=
1254
1283
find_counter_example (ns, ui, with_concretized_arrays, univ_var))
@@ -1290,24 +1319,16 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1290
1319
1291
1320
exprt negaxiom =
1292
1321
negation_of_not_contains_constraint (nc_axiom_in_model, univ_var);
1293
- stream << indent << i << " .\n "
1294
- << indent2 << " - axiom:\n "
1295
- << indent2 << indent << from_expr (ns, " " , nc_axiom) << ' \n ' ;
1296
- stream << indent2 << " - axiom_in_model:\n "
1297
- << indent2 << indent << from_expr (ns, " " , nc_axiom_in_model) << ' \n ' ;
1298
- stream << indent2 << " - negated_axiom:\n "
1299
- << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1300
1322
1301
1323
negaxiom = simplify_expr (negaxiom, ns);
1302
- stream << indent2 << " - simplified_negaxiom:\n "
1303
- << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1304
- negaxiom = concretize_arrays_in_expression (negaxiom, max_string_length, ns);
1305
- stream << indent2 << " - negated_axiom_with_concretized_array_access:\n "
1306
- << indent2 << indent << from_expr (ns, " " , negaxiom) << ' \n ' ;
1307
-
1308
- substitute_array_access (negaxiom);
1309
- stream << indent2 << " - negated_axiom_without_array_access:\n "
1310
- << indent2 << indent << from_expr (ns, " " , negaxiom) << eom;
1324
+ exprt with_concrete_arrays =
1325
+ concretize_arrays_in_expression (negaxiom, max_string_length, ns);
1326
+
1327
+ substitute_array_access (with_concrete_arrays);
1328
+
1329
+ stream << indent << i << " .\n " ;
1330
+ debug_check_axioms_step (
1331
+ stream, ns, nc_axiom, nc_axiom_in_model, negaxiom, with_concrete_arrays);
1311
1332
1312
1333
if (const auto witness = find_counter_example (ns, ui, negaxiom, univ_var))
1313
1334
{
0 commit comments