Open tomas789 opened 1 year ago
The function absorb should produce the same results no matter the order of the args passed to it.
args
There is a counter-example where this property does not hold.
import boolean algebra = boolean.BooleanAlgebra() TRUE, FALSE, NOT, AND, OR, symbol = algebra.definition() e = AND(OR(NOT(symbol("x1")), NOT(symbol("x2"))), TRUE, symbol("x2"), NOT(symbol("x1"))) args = [ OR(NOT(symbol("x1")), NOT(symbol("x2"))), NOT(symbol("x1")), symbol("x2"), ] print("ORIGINAL ORDER") print(e.absorb(args)) args[1], args[2] = args[2], args[1] print("SWAPPED") print(e.absorb(args))
Which produces following output
ORIGINAL ORDER [NOT(Symbol('x1')), Symbol('x2')] SWAPPED [NOT(Symbol('x1')), Symbol('x2'), NOT(Symbol('x1'))]
After more investigation it looks like this is the core cause of the previous issue https://github.com/bastikr/boolean.py/issues/111
The function absorb should produce the same results no matter the order of the
args
passed to it.There is a counter-example where this property does not hold.
Which produces following output