Skip to content

Commit 1714e22

Browse files
committed
format_expr can now do forall/exists with multiple bindings
This adds support for pretty-printing forall/exists expressions that have multiple bindings.
1 parent 49fb197 commit 1714e22

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/util/format_expr.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,32 @@ void format_expr_configt::setup()
356356

357357
expr_map[ID_forall] =
358358
[](std::ostream &os, const exprt &expr) -> std::ostream & {
359-
return os << u8"\u2200 " << format(to_quantifier_expr(expr).symbol())
360-
<< " : " << format(to_quantifier_expr(expr).symbol().type())
361-
<< " . " << format(to_quantifier_expr(expr).where());
359+
os << u8"\u2200 ";
360+
bool first = true;
361+
for(const auto &symbol : to_quantifier_expr(expr).variables())
362+
{
363+
if(first)
364+
first = false;
365+
else
366+
os << ", ";
367+
os << format(symbol) << " : " << format(symbol.type());
368+
}
369+
return os << " . " << format(to_quantifier_expr(expr).where());
362370
};
363371

364372
expr_map[ID_exists] =
365373
[](std::ostream &os, const exprt &expr) -> std::ostream & {
366-
return os << u8"\u2203 " << format(to_quantifier_expr(expr).symbol())
367-
<< " : " << format(to_quantifier_expr(expr).symbol().type())
368-
<< " . " << format(to_quantifier_expr(expr).where());
374+
os << u8"\u2203 ";
375+
bool first = true;
376+
for(const auto &symbol : to_quantifier_expr(expr).variables())
377+
{
378+
if(first)
379+
first = false;
380+
else
381+
os << ", ";
382+
os << format(symbol) << " : " << format(symbol.type());
383+
}
384+
return os << " . " << format(to_quantifier_expr(expr).where());
369385
};
370386

371387
expr_map[ID_let] = [](std::ostream &os, const exprt &expr) -> std::ostream & {

0 commit comments

Comments
 (0)