Presentation on theme: "Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson."— Presentation transcript:
Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson
2 Boolean Expressions A Boolean expression is a Boolean function Any Boolean function can be written as a Boolean expression Disjunctive normal form (sums of products) For each row in the truth table where the output is true, write a product such that the corresponding input is the only input combination that is true Not unique E.G. (multiplexor function) s x 0 x 1 f 0 0 0 0 1 0 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1
Disjunctive Normal Form Theorem. Any boolean expression can be converted to an equivalent boolean exprssion in DNF. Proof. Any boolean expression defines a boolean function. Construct the truth table for the boolean expression and use the procedure on the previous slide to construct a boolean expression in DNF for the function defined by the truth table.
Alternative Proof A recursive conversion algorithm with corresponding inductive proof of correctness. Assume that implications and equivalences have been removed Assume that constants have been eliminated First convert to Negative Normal Form (NNF) (not expr) only occurs when expr is a variable Use DeMorgan’s Law and Double Negation Law Then convert to DNF Distribute and over or
Correctness (is-nnf (nnf expr) Structural induction on expr using De Morgan’s laws and Double Negation law (not (and p q)) (or (not p) (not q)) (not (or p q)) (and (not p) (not q)) (not (not p)) p Base case. Expr = var or (not var) Assume true for expr1 and expr2 and show for (not expr), (or expr1 expr2), and (and expr1 expr2) and and or are trivial
Correctness for (not expr) (is-nnf (nnf ‘(not expr)) (nnf ‘(not expr)) (nnf-not ‘(not expr)) Case 1. (nnf-not ‘(not (not expr))) = (nnf expr)) which is correct by induction and double negation Case 2. (nnf-not ‘(not (and expr1 expr2))) = (nnf ‘(or (not expr1) (not expr2))) = (list ‘or (nnf ‘(not expr1)) (nnf ‘(not expr2))) which is correct by induction and De Morgan Case 3. (nnf-not ‘(not (or expr1 expr2)))
Exponential Blowup Converting the following expression shows that an exponential increase in the size of the dnf form of a boolean expression is possible (x 1 y 1 ) (x n y n ) (x 1 x n ) (y 1 y n )
Exercise Prove that (dnf expr) terminates Hint show that the size of expr decreases in all recursive calls and that the base case must eventually be reached, where size of an expr is the number of not, and, and or operations. Use induction to prove (is-dnf (dnf expr)) Modify (dnf expr) to compute the conjunctive normal form (cnf expr). Hint cnf is duel to dnf
Your consent to our cookies if you continue to use this website.