In high school algebra, you saw that while x^{3}− 4x and x (x − 2) (x + 2) are equivalent, the second form is particularly useful in letting you quickly know the roots of the equation. Similarly, in Boolean algebra there are certain canonical "normal" forms which have nice properties.
A formula in Conjunctive Normal Form, or CNF, is the conjunction of CNF clauses. Each clause is a formula of a simple form: a disjunction of possibly-negated propositions.
Example 2.7
c ⇒ a ∧ b is equivalent to (a ∨¬c) ∧ (b ∨¬c). This latter formula is in CNF, since it is the conjunction of disjunctions, and each disjunction consists only of propositions and negated propositions.
Example 2.8
The conjunctions and disjunctions need not be binary. The following formula is also is CNF.
¬a ∧ (a ∨ b ∨¬c) ∧ (b ∨¬d ∨ e ∨ f)
Note that its first clause is just one negated proposition. It is still appropriate to think of this as a disjunction, since φ ≡ φ ∨ φ.
Another format, Disjunctive Normal Form, or DNF is the dual of conjunctive normal form. A DNF formula
is the disjunction of DNF clauses, each a conjunction of possibly-negated propositions.
Example 2.9
a ∧ b ⇒ c is equivalent to ¬a ∨¬b ∨ c which is in DNF: three disjunctions, each being a clause with only one term. (It also happens to be in CNF a single clause with three termsl) It is also equivalent to the more feshed out DNF formula where we insist that each clause include all three variables. We end up with a formula that includes each possible clause except a ∧ b ∧¬c: That is, the formula (a ∧ b ∧ c) ∨ (a ∧¬b ∧ c) ∨ (a ∧¬b ∧¬c) ∨ (¬a ∧ b ∧ c) ∨ (¬a ∧ b ∧¬c) ∨ (¬a ∧¬b ∧ c) ∨ (¬a ∧¬b ∧¬c).
ASIDE: Electrical Engineering courses, coming from more of a circuit perspective, sometimes call CNF product-of-sums, and call DNF sum-of-products, based on ∨,∧ being analogous to +,*.
Any Boolean function can be represented in CNF and in DNF. One way to obtain CNF and DNF formulas is based upon the truth table for the function.
- A DNF formula results from looking at a truth table, and focusing on the rows where the function is true: As if saying "I'm in this row, or in this row, or ...": For each row where the function is true, form a conjunction of the propositions. (E.g., for the row where a is false, and b is true, form ¬a ∧ b.) Now, form the disjunction of all those conjunctions.
- A CNF formula is the pessimistic approach, focusing on the rows where the function is false: "I'm not in this row, and not in this row, and ...". For each row where the function is false, create a formula for "not in this row": (E.g., if in this row a is false and b is true form ¬ (¬a ∧ b); then notice that by DeMorgan's law, this is a ∨¬b a disjunct. Now, form the conjunction of all those disjunctions.
Example 2.10
a |
b |
c |
Unknown function |
false |
false |
false |
false |
false |
false |
true |
false |
false |
true |
false |
true |
false |
true |
true |
true |
true |
false |
false |
false |
true |
false |
true |
true |
true |
true |
false |
false |
true |
true |
false |
false |
For CNF, the false rows give us the following five clauses:
- a ∨ b ∨ c
- a ∨ b ∨¬c
- ¬a ∨ b ∨ c
- ¬a ∨¬b ∨ c
- ¬a ∨¬b ∨¬c
and the full formula is the conjunction of these. Essentially, each clause rules out one row as being true.
For DNF, the true rows give us the following three clauses:
- ¬a ∧ b ∧¬c
- ¬a ∧ b ∧ c
- a ∧¬b ∧ c
and the full formula is the disjunction of these. Essentially, each clause allows one row to be true.
This shows that, for any arbitrarily complicated WFF, we can find an equivalent WFF in CNF or DNF. These provide us with two very regular and relatively uncomplicated forms to use.
Exercise 2.3.2.1
The above example (Example 2.10) produced CNF and DNF formulas for a Boolean function, but they are not the simplest such formulas. For fun, can you find simpler ones?
- 瀏覽次數：7312