Normal Forms: CNF and DNF
🎯 Learning Objectives
- Define Conjunctive Normal Form (CNF) and Disjunctive Normal Form (DNF)
- Convert any propositional formula to CNF and DNF step by step
- Understand clausal form and its importance for SAT solving
- Apply conversion algorithms efficiently for GATE questions
1. Terminology
A literal is a propositional variable or its negation. If P is a variable, then P and ¬P are both literals. P is a positive literal and ¬P is a negative literal.
A clause is a disjunction of literals: (l₁ ∨ l₂ ∨ ... ∨ lₖ). A clause with a single literal is called a unit clause. An empty clause (no literals) is equivalent to ⊥ (False).
A term (or conjunctive clause) is a conjunction of literals: (l₁ ∧ l₂ ∧ ... ∧ lₖ).
2. Conjunctive Normal Form (CNF)
A formula is in Conjunctive Normal Form (CNF) if it is a conjunction of clauses:
(l₁₁ ∨ l₁₂ ∨ ... ) ∧ (l₂₁ ∨ l₂₂ ∨ ... ) ∧ ... ∧ (lₖ₁ ∨ lₖ₂ ∨ ... )
In other words: AND of ORs.
CNF Examples
- (P ∨ Q) ∧ (¬P ∨ R) ∧ (¬Q ∨ ¬R) — ✅ CNF (3 clauses)
- P ∧ Q ∧ R — ✅ CNF (3 unit clauses)
- (P ∨ ¬Q) — ✅ CNF (single clause)
- P ∨ (Q ∧ R) — ❌ Not CNF (OR of an AND)
3. Disjunctive Normal Form (DNF)
A formula is in Disjunctive Normal Form (DNF) if it is a disjunction of terms:
(l₁₁ ∧ l₁₂ ∧ ... ) ∨ (l₂₁ ∧ l₂₂ ∧ ... ) ∨ ... ∨ (lₖ₁ ∧ lₖ₂ ∧ ... )
In other words: OR of ANDs.
DNF Examples
- (P ∧ Q) ∨ (¬P ∧ R) ∨ (Q ∧ ¬R) — ✅ DNF
- P ∨ Q ∨ R — ✅ DNF (3 single-literal terms)
- (P ∧ ¬Q ∧ R) — ✅ DNF (single term)
- P ∧ (Q ∨ R) — ❌ Not DNF (AND of an OR)
4. Conversion to CNF (Step-by-Step Algorithm)
- Eliminate biconditionals (↔):
Replace α ↔ β with (α → β) ∧ (β → α) - Eliminate implications (→):
Replace α → β with ¬α ∨ β - Push negations inward (using De Morgan's):
¬(α ∧ β) → ¬α ∨ ¬β
¬(α ∨ β) → ¬α ∧ ¬β
¬¬α → α - Distribute ∨ over ∧:
α ∨ (β ∧ γ) → (α ∨ β) ∧ (α ∨ γ) - Simplify using idempotent, complement, and identity laws.
Example: Convert (P → Q) ↔ R to CNF
- Eliminate ↔: ((P → Q) → R) ∧ (R → (P → Q))
- Eliminate →:
- (P → Q) becomes (¬P ∨ Q)
- (¬P ∨ Q) → R becomes ¬(¬P ∨ Q) ∨ R
- R → (¬P ∨ Q) becomes ¬R ∨ (¬P ∨ Q)
- Push ¬ inward: ¬(¬P ∨ Q) = P ∧ ¬Q (De Morgan's + double negation)
Result: ((P ∧ ¬Q) ∨ R) ∧ (¬R ∨ ¬P ∨ Q) - Distribute ∨ over ∧: (P ∧ ¬Q) ∨ R = (P ∨ R) ∧ (¬Q ∨ R)
Result: (P ∨ R) ∧ (¬Q ∨ R) ∧ (¬R ∨ ¬P ∨ Q)
This is in CNF: three clauses joined by ∧.
Example: Convert ¬(P ∨ Q) → (R ∧ S) to CNF
- Eliminate →: ¬¬(P ∨ Q) ∨ (R ∧ S) = (P ∨ Q) ∨ (R ∧ S)
- Distribute ∨ over ∧: (P ∨ Q ∨ R) ∧ (P ∨ Q ∨ S)
Final CNF: (P ∨ Q ∨ R) ∧ (P ∨ Q ∨ S)
5. Conversion to DNF
- Eliminate ↔ and → (same as CNF steps 1-2)
- Push negations inward (same as CNF step 3)
- Distribute ∧ over ∨:
α ∧ (β ∨ γ) → (α ∧ β) ∨ (α ∧ γ)
📝 CNF vs DNF — Distribution Direction
The only difference between CNF and DNF conversion is the distribution step:
- CNF: Distribute ∨ over ∧ (push ∨ inside)
- DNF: Distribute ∧ over ∨ (push ∧ inside)
Example: Convert (P ∨ Q) ∧ (R ∨ S) to DNF
Distribute ∧ over ∨:
(P ∨ Q) ∧ (R ∨ S) = (P ∧ R) ∨ (P ∧ S) ∨ (Q ∧ R) ∨ (Q ∧ S)
Final DNF: (P ∧ R) ∨ (P ∧ S) ∨ (Q ∧ R) ∨ (Q ∧ S)
6. Obtaining Normal Forms from Truth Tables
DNF from Truth Table (Sum of Minterms)
For each row where the formula is True, construct a term (conjunction) where each variable appears positive if T in that row and negated if F. The DNF is the disjunction of all such terms.
CNF from Truth Table (Product of Maxterms)
For each row where the formula is False, construct a clause (disjunction) where each variable appears negated if T in that row and positive if F. The CNF is the conjunction of all such clauses.
Example: Build CNF and DNF from truth table
| P | Q | f(P,Q) |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | F |
DNF (from T rows): (P ∧ Q) ∨ (¬P ∧ Q) = Q
CNF (from F rows): (¬P ∨ Q) ∧ (P ∨ Q) = Q
Both simplify to Q, as expected.
7. Why CNF Matters
📝 Importance of CNF
- Resolution method requires formulas in CNF (clausal form).
- SAT solvers (DPLL, CDCL) operate on CNF formulas.
- Clause representation: A CNF formula can be represented as a set of clauses, which is convenient for automated reasoning.
- GATE questions frequently ask to convert to CNF before applying resolution.
⚠️ Exponential Blowup
Converting from DNF to CNF (or vice versa) can cause an exponential increase in the size of the formula. A formula with m terms in DNF, each of size n, can produce up to nm clauses in CNF. This is a key theoretical limitation.