How can I recast a CNF expression to 3-CNF?

和自甴很熟 提交于 2019-12-11 11:23:07

问题


I have a CNF expression like this and I want recast it to 3-CNF:

(a+b+c+d)(~a)(~b+d)(a+b+~d)

Does anyone know how I can do that?


回答1:


A 3-CNF is a Conjunctive Normal Form where all clauses have three or less literals. To obtain such a form for your expression, you could translate the expression into a nested Boolean expression where all operators (and, or) have two operands:

t1a = (a+b)
t1b = (c+d)
t1 = t1a + t1b
t2 = (~a)
t3 = (~b+d)
t4a = (a+b)
t4 = t4a + ~d
t5a = t1 t2
t5b = t3 t4
t5 = t5a t5b

You can directly translate this nested expression into a set of 3-CNF clauses.

Minimized solution:

(~a)(~b + d)(b + ~d)(c + d)  

as suggested by WolframAlpha is a 3-CNF of your expression as it does not contain longer clauses.

For small cases, you could fill a truth table. Look at all rows with output 0 and find minterms covering all these rows. If you then invert all literals in the minterms, you have a CNF. In case clauses have more than 3 literals, they can be broken up into two or more shorter clauses by introducing intermediate variables. The widely used procedure for that is called Tseitin Transformation or Tseitin Encoding.



来源:https://stackoverflow.com/questions/22925923/how-can-i-recast-a-cnf-expression-to-3-cnf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!