Skip to content

Commit 9244f3f

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Add to_forall_expr
There was a cast operation for exists, but none for forall.
1 parent dc4ffae commit 9244f3f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/util/mathematical_expr.h

+18
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,24 @@ class forall_exprt : public quantifier_exprt
337337
}
338338
};
339339

340+
inline const forall_exprt &to_forall_expr(const exprt &expr)
341+
{
342+
PRECONDITION(expr.id() == ID_forall);
343+
DATA_INVARIANT(
344+
expr.operands().size() == 2,
345+
"forall expressions have exactly two operands");
346+
return static_cast<const forall_exprt &>(expr);
347+
}
348+
349+
inline forall_exprt &to_forall_expr(exprt &expr)
350+
{
351+
PRECONDITION(expr.id() == ID_forall);
352+
DATA_INVARIANT(
353+
expr.operands().size() == 2,
354+
"forall expressions have exactly two operands");
355+
return static_cast<forall_exprt &>(expr);
356+
}
357+
340358
/// \brief An exists expression
341359
class exists_exprt : public quantifier_exprt
342360
{

0 commit comments

Comments
 (0)