@@ -1289,6 +1289,19 @@ void smt2_convt::convert_expr(const exprt &expr)
1289
1289
CHECK_RETURN (it != defined_expressions.end ());
1290
1290
out << it->second ;
1291
1291
}
1292
+ else if (expr.id () == ID_array_comprehension)
1293
+ {
1294
+ const auto &array_comprehension = to_array_comprehension_expr (expr);
1295
+
1296
+ DATA_INVARIANT (
1297
+ array_comprehension.type ().id () == ID_array,
1298
+ " array_comprehension expression shall have array type" );
1299
+
1300
+ const auto it = defined_expressions.find (array_comprehension);
1301
+ CHECK_RETURN (it != defined_expressions.end ());
1302
+
1303
+ out << it->second ;
1304
+ }
1292
1305
else if (expr.id ()==ID_index)
1293
1306
{
1294
1307
convert_index (to_index_expr (expr));
@@ -4390,6 +4403,27 @@ void smt2_convt::find_symbols(const exprt &expr)
4390
4403
defined_expressions[expr]=id;
4391
4404
}
4392
4405
}
4406
+ else if (expr.id () == ID_array_comprehension)
4407
+ {
4408
+ if (defined_expressions.find (expr) == defined_expressions.end ())
4409
+ {
4410
+ const auto &array_comprehension = to_array_comprehension_expr (expr);
4411
+
4412
+ const irep_idt id =
4413
+ " array_comprehension." + std::to_string (defined_expressions.size ());
4414
+ out << " (define-fun " << id << " () " ;
4415
+ convert_type (array_comprehension.type ());
4416
+ out << " (lambda ((" ;
4417
+ convert_expr (array_comprehension.arg ());
4418
+ out << " " ;
4419
+ convert_type (array_comprehension.type ().size ().type ());
4420
+ out << " )) " ;
4421
+ convert_expr (array_comprehension.body ());
4422
+ out << " ))\n " ;
4423
+
4424
+ defined_expressions[expr] = id;
4425
+ }
4426
+ }
4393
4427
else if (expr.id ()==ID_array)
4394
4428
{
4395
4429
if (defined_expressions.find (expr)==defined_expressions.end ())
0 commit comments