File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1413,6 +1413,38 @@ void smt2_convt::convert_expr(const exprt &expr)
14131413 }
14141414 out << " )" ;
14151415 }
1416+ else if (expr.id () == ID_nand || expr.id () == ID_nor || expr.id () == ID_xnor)
1417+ {
1418+ DATA_INVARIANT (
1419+ expr.is_boolean (),
1420+ " logical nand, nor, xnor expressions should have Boolean type" );
1421+ DATA_INVARIANT (
1422+ expr.operands ().size () >= 1 ,
1423+ " logical nand, nor, xnor expressions should have at least one operand" );
1424+
1425+ // SMT-LIB doesn't have nand, nor, xnor
1426+ out << " (not " ;
1427+ if (expr.operands ().size () == 1 )
1428+ convert_expr (to_multi_ary_expr (expr).op0 ());
1429+ else
1430+ {
1431+ if (expr.id () == ID_nand)
1432+ out << " (and" ;
1433+ else if (expr.id () == ID_nor)
1434+ out << " (and" ;
1435+ else if (expr.id () == ID_xnor)
1436+ out << " (xor" ;
1437+ else
1438+ DATA_INVARIANT (false , " unexpected expression" );
1439+ for (const auto &op : expr.operands ())
1440+ {
1441+ out << ' ' ;
1442+ convert_expr (op);
1443+ }
1444+ out << ' )' ; // or, and, xor
1445+ }
1446+ out << ' )' ; // not
1447+ }
14161448 else if (expr.id ()==ID_implies)
14171449 {
14181450 const implies_exprt &implies_expr = to_implies_expr (expr);
You can’t perform that action at this time.
0 commit comments