Form Conversion
Techniques for converting between DNF, CNF, and other representations of Boolean functions.
Form Conversion Overview
Converting between Boolean representations:
Main conversion paths:
Expression $\to$ Truth Table $\to$ Normal Form (Always works, can be slow for many variables)
Expression $\to$ Algebraic manipulation $\to$ Normal Form (Faster, requires knowing laws)
DNF $\leftrightarrow$ CNF via truth table (Build table, read off the other form)
DNF $\leftrightarrow$ CNF via De Morgan (Negate, convert, negate again)
Each method has tradeoffs between simplicity and efficiency.
Converting DNF to CNF
DNF $\to$ CNF conversion methods:
Method 1: Truth Table
- Evaluate DNF to build truth table
- Find FALSE rows
- Write maxterm for each FALSE row
- AND maxterms together
Method 2: Distribute Apply: A $\lor$ (B $\land$ C) = (A $\lor$ B) $\land$ (A $\lor$ C)
Example: (A $\land$ B) $\lor$ C = (A $\lor$ C) $\land$ (B $\lor$ C) $\leftarrow$ CNF!
Note: Distribution can cause exponential blowup in expression size.
Converting CNF to DNF
CNF $\to$ DNF conversion methods:
Method 1: Truth Table
- Evaluate CNF to build truth table
- Find TRUE rows
- Write minterm for each TRUE row
- OR minterms together
Method 2: Distribute Apply: A $\land$ (B $\lor$ C) = (A $\land$ B) $\lor$ (A $\land$ C)
Example: (A $\lor$ B) $\land$ C = (A $\land$ C) $\lor$ (B $\land$ C) $\leftarrow$ DNF!
Same exponential blowup risk as DNF$\to$CNF.
Negating Normal Forms
De Morgan's transforms between DNF and CNF:
Negating a DNF gives CNF:
- $\neg$[(A $\land$ B) $\lor$ (C $\land$ D)]
- = $\neg$(A $\land$ B) $\land$ $\neg$(C $\land$ D) [De Morgan on $\lor$]
- = ($\neg$A $\lor$ $\neg$B) $\land$ ($\neg$C $\lor$ $\neg$D) [De Morgan on $\land$]
- This is CNF!
Negating a CNF gives DNF:
- $\neg$[(A $\lor$ B) $\land$ (C $\lor$ D)]
- = ($\neg$A $\land$ $\neg$B) $\lor$ ($\neg$C $\land$ $\neg$D)
- This is DNF!
Key insight: $\neg$(DNF) = CNF with flipped literals, and vice versa.
Truth Table to Normal Form
Universal conversion via truth table:
Given any expression, to get DNF:
- Evaluate expression for all input combinations
- List rows where output = 1
- Write minterm for each TRUE row
- OR all minterms: $\Sigma$m(TRUE rows)
To get CNF from same table:
- List rows where output = 0
- Write maxterm for each FALSE row
- AND all maxterms: $\Pi$M(FALSE rows)
Both forms represent the same function!
Simplifying After Conversion
Canonical forms are often not minimal. After conversion, simplify:
Common simplifications:
Adjacency (terms differing by one literal): (A $\land$ B) $\lor$ (A $\land$ $\neg$B) = A
Absorption: A $\lor$ (A $\land$ B) = A
Idempotence: A $\lor$ A = A, A $\land$ A = A
Complement elimination: (A $\lor$ $\neg$A) = 1, (A $\land$ $\neg$A) = 0
Simplified form uses fewer gates in circuits.
Form Conversion Practice
Conversion summary:
| From | To | Method |
|---|---|---|
| Any $\to$ DNF | Truth table | Find TRUE rows, OR minterms |
| Any $\to$ CNF | Truth table | Find FALSE rows, AND maxterms |
| DNF $\to$ CNF | Distribute | OR over AND: A$\lor$(B$\land$C)=(A$\lor$B)$\land$(A$\lor$C) |
| CNF $\to$ DNF | Distribute | AND over OR: A$\land$(B$\lor$C)=(A$\land$B)$\lor$(A$\land$C) |
| DNF $\leftrightarrow$ $\neg$CNF | De Morgan | Negate, swap $\land$/$\lor$, complement literals |
Always simplify the result when possible!
Choosing Between DNF and CNF
When to use DNF:
- Function is TRUE for few rows (few minterms)
- Building AND-OR circuits (sum of products)
- When you need to check satisfiability quickly
- Representing "any of these conditions"
When to use CNF:
- Function is FALSE for few rows (few maxterms)
- SAT solving (standard input format)
- Building OR-AND circuits (product of sums)
- Representing "all of these constraints"
Rule of thumb: Use whichever has fewer terms.
Systematic Conversion Algorithms
Systematic conversion procedures:
To DNF (Sum of Products):
- Build truth table
- Find rows where output = 1
- Write minterm for each such row
- OR all minterms together
To CNF (Product of Sums):
- Build truth table
- Find rows where output = 0
- Write maxterm for each such row
- AND all maxterms together
Choosing the Optimal Form
When to use DNF:
- Few true outputs (sparse function)
- Implementing with OR-of-ANDs circuits
- Describing "success cases"
When to use CNF:
- Few false outputs
- SAT solver input
- Describing "constraints that must all hold"
- Implementing with AND-of-ORs circuits
Choose the form that gives fewer terms!
Verifying Conversion Correctness
Verifying conversion correctness:
- Truth table comparison: Both forms should have identical outputs
- Spot check: Test a few input combinations
- Algebraic verification: Apply laws to show equivalence
- Canonical form: Convert both to same canonical form
Always verify - conversion errors are common!
Normal Forms Synthesis
Normal Forms Summary:
| Concept | DNF | CNF |
|---|---|---|
| Structure | OR of ANDs | AND of ORs |
| Built from | Minterms (m) | Maxterms (M) |
| Uses rows where | Output = 1 | Output = 0 |
| Best when | Few true outputs | Few false outputs |
| Applications | Circuit design | SAT solvers |
Both forms can represent ANY Boolean function!
Normal Forms Challenge
This challenge integrates all Normal Forms concepts:
- Minterms and maxterms
- DNF and CNF construction
- Conversion between forms
- Minimization awareness
- Choosing optimal representations
Form Size Heuristic
The size heuristic:
- Canonical DNF has one minterm per TRUE row
- Canonical CNF has one maxterm per FALSE row
- TRUE rows + FALSE rows = 2ⁿ (for n variables)
The rule: Count TRUE and FALSE rows. The smaller count tells you which form is shorter.
- Few TRUE rows $\to$ compact DNF
- Few FALSE rows $\to$ compact CNF
- Equal counts $\to$ both forms are the same size
Ready to test your understanding?
Bitwit uses spaced repetition to help you truly master concepts like this—not just read about them. Each card generates with different values, so you can't just memorize answers.
Practice Form Conversion →