Disjunctive Normal Form in Python

前端 未结 2 815
情深已故
情深已故 2020-12-12 07:46

Using python, what is the best way to convert a string of ANDs and ORs into disjunctive normal form (also known as \"sum of products\")?

b AND (c OR (a AND d         


        
2条回答
  •  渐次进展
    2020-12-12 08:27

    Maybe this library can help: pyeda

    here is a method to turn an expression into DNF: to_dnf()

    Of course you must turn your string into a valid pyeda expression...

提交回复
热议问题