I am trying to simplify a boolean expression involving a couple of hundreds boolean variables to a OR of Ands form (DNF). In addition, there are don't care terms can be represented by another boolean expression.
I found there are a couple of Python packages, such as SymPy, can be used to boolean expression minimization. However, it can not handle don't care terms in expressions format.
For example,
>>> from sympy.logic import SOPform
>>> from sympy import symbols
>>> w, x, y, z = symbols('w x y z')
>>> minterms = [[0, 0, 0, 1], [0, 0, 1, 1],
... [0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]]
>>> dontcares = [[0, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 1]]
>>> SOPform([w, x, y, z], minterms, dontcares)
Or(And(Not(w), z), And(y, z))
The SOPform function can deal with dontcares terms, but it requires the terms in truth table format, which is not suitable for my case due to the large number of variables.
The other function simplify_logic accepts expression format, but do not have the option of dontcares terms.
>>> from sympy.logic import simplify_logic
>>> from sympy.abc import x, y, z
>>> from sympy import S
>>> b = (~x & ~y & ~z) | ( ~x & ~y & z)
>>> simplify_logic(b)
And(Not(x), Not(y))
Is there a way in Python can take care of minimization of boolean expression with dont care terms in expression format?
Thank you!