File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,16 @@ def optimizer(expr: Boolean) -> Boolean:
48
48
and len (expr .args ) == 2
49
49
and isinstance (expr .args [0 ], And )
50
50
and isinstance (expr .args [1 ], And )
51
- and expr .args [1 ].args [0 ] == Not (expr .args [0 ].args [0 ])
52
- and expr .args [1 ].args [1 ] == Not (expr .args [0 ].args [1 ])
51
+ and (
52
+ (
53
+ expr .args [1 ].args [0 ] == Not (expr .args [0 ].args [0 ])
54
+ and expr .args [1 ].args [1 ] == Not (expr .args [0 ].args [1 ])
55
+ )
56
+ or (
57
+ Not (expr .args [1 ].args [0 ]) == expr .args [0 ].args [0 ]
58
+ and Not (expr .args [1 ].args [1 ]) == expr .args [0 ].args [1 ]
59
+ )
60
+ )
53
61
):
54
62
a = optimizer (expr .args [0 ].args [0 ])
55
63
b = optimizer (expr .args [0 ].args [1 ])
@@ -66,15 +74,15 @@ def optimizer(expr: Boolean) -> Boolean:
66
74
raise CompilerException ("Constant in expression is not allowed" )
67
75
68
76
else :
69
- return expr
77
+ raise Exception ( expr )
70
78
71
79
72
80
class Compiler :
73
81
def __init__ (self ):
74
82
self .qmap = {}
75
83
76
84
def _symplify_exp (self , exp ):
77
- exp = simplify_logic (exp )
85
+ exp = simplify_logic (exp ) # TODO: remove this
78
86
exp = optimizer (exp )
79
87
print ("exp3" , exp )
80
88
return exp
You can’t perform that action at this time.
0 commit comments