@@ -65,4 +65,45 @@ SCENARIO("bdd_expr", "[core][solver][prop][bdd_expr]")
65
65
}
66
66
}
67
67
}
68
+
69
+ GIVEN (" (!a | b) xor (a => b) " )
70
+ {
71
+ const symbol_exprt a (" a" , bool_typet ());
72
+ const symbol_exprt b (" b" , bool_typet ());
73
+ const bddt bdd = bdd_expr_converter.from_expr (
74
+ xor_exprt{or_exprt{not_exprt{a}, b}, implies_exprt{a, b}});
75
+ THEN (" It reduces to false" )
76
+ {
77
+ REQUIRE (bdd.is_false ());
78
+ }
79
+ }
80
+
81
+ GIVEN (" e = (a | b) xor (c | d)" )
82
+ {
83
+ const symbol_exprt a (" a" , bool_typet ());
84
+ const symbol_exprt b (" b" , bool_typet ());
85
+ const symbol_exprt c (" c" , bool_typet ());
86
+ const symbol_exprt d (" d" , bool_typet ());
87
+
88
+ const xor_exprt expr{or_exprt{a, b}, or_exprt{c, d}};
89
+ const bddt bdd = bdd_expr_converter.from_expr (expr);
90
+
91
+ THEN (" e xor e is false" )
92
+ {
93
+ REQUIRE (bdd.bdd_xor (bdd_expr_converter.from_expr (expr)).is_false ());
94
+ }
95
+
96
+ THEN (" e xor !e is true" )
97
+ {
98
+ REQUIRE (
99
+ bdd.bdd_xor (bdd_expr_converter.from_expr (not_exprt{expr})).is_true ());
100
+ }
101
+
102
+ THEN (" Converting to expr and back to BDD gives the same BDD" )
103
+ {
104
+ const exprt expr_of_bdd = bdd_expr_converter.as_expr (bdd);
105
+ const bddt bdd_of_expr = bdd_expr_converter.from_expr (expr_of_bdd);
106
+ REQUIRE (bdd_of_expr.equals (bdd));
107
+ }
108
+ }
68
109
}
0 commit comments