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 @@ -1362,6 +1362,38 @@ void smt2_convt::convert_expr(const exprt &expr)
13621362 }
13631363 out << " )" ;
13641364 }
1365+ else if (expr.id () == ID_nand || expr.id () == ID_nor || expr.id () == ID_xnor)
1366+ {
1367+ DATA_INVARIANT (
1368+ expr.is_boolean (),
1369+ " logical nand, nor, xnor expressions should have Boolean type" );
1370+ DATA_INVARIANT (
1371+ expr.operands ().size () >= 1 ,
1372+ " logical nand, nor, xnor expressions should have at least one operand" );
1373+
1374+ // SMT-LIB doesn't have nand, nor, xnor
1375+ out << " (not " ;
1376+ if (expr.operands ().size () == 1 )
1377+ convert_expr (to_multi_ary_expr (expr).op0 ());
1378+ else
1379+ {
1380+ if (expr.id () == ID_nand)
1381+ out << " (and" ;
1382+ else if (expr.id () == ID_nor)
1383+ out << " (and" ;
1384+ else if (expr.id () == ID_xnor)
1385+ out << " (xor" ;
1386+ else
1387+ DATA_INVARIANT (false , " unexpected expression" );
1388+ for (const auto &op : expr.operands ())
1389+ {
1390+ out << ' ' ;
1391+ convert_expr (op);
1392+ }
1393+ out << ' )' ; // or, and, xor
1394+ }
1395+ out << ' )' ; // not
1396+ }
13651397 else if (expr.id ()==ID_implies)
13661398 {
13671399 const implies_exprt &implies_expr = to_implies_expr (expr);
You can’t perform that action at this time.
0 commit comments