boolean logic - How to convert formula to CNF? -


i know 4 rules convert formulas cnf, i'm not quite sure how apply them formula ((x v y) ^ ¬ z) ->w

could give me hand , bit of explanation? thanks!

recipe converting expression cnf
1 way convert formula cnf is:

  1. write truth table (only terms relevant formula evaluates false)
  2. in every term of truth table invert literals
  3. take resulting terms cnf clauses

this recipe can made plausible follows:
none of clauses must false, unless overall expression false. therefore, every clause representing minterm of inverted expression. make sure term false, none of inverted literals can true.

for n input variables, truth table has 2^n terms. therefore, method practical small expressions.

to demonstrate steps sample formula

((x or y) , not z) implies w

truth table (f = expression value):

wxyz|f ----+- 0000|1 1000|1 0100|0 1100|1 0010|0 1010|1 0110|0 1110|1 0001|1 1001|1 0101|1 1101|1 0011|1 1011|1 0111|1 1111|1 ----+- 

false terms (f = 0):

wxyz|f ----+- 0100|0 0010|0 0110|0 ----+- 

literals inverted , output column omitted:

wxyz ---- 1011 1101 1001 ---- 

resulting cnf clauses:

(w or !x or y or z) , (w or x or !y or z) , (w or !x or !y or z)

resulting cnf clauses minimized merging clauses:

(w or !x or z) , (w or !y or z)

if in doubt, can ask wolfram|alpha.

from karnaugh map, becomes clear how 3 false terms can merged 2 clauses:

             wx        00  01  11  10       +---+---+---+---+    00 | 1 | 0 | 1 | 1 |       +---+---+---+---+    01 | 1 | 1 | 1 | 1 | yz    +---+---+---+---+    11 | 1 | 1 | 1 | 1 |       +---+---+---+---+    10 | 0 | 0 | 1 | 1 |       +---+---+---+---+ 

Comments