<< Chapter < Page | Chapter >> Page > |
In high school algebra, you saw that while and 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 canonicalnormalforms 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.
is equivalent to . This latter formula is in CNF, since it is the conjunction ofdisjunctions, and each disjunction consists only of propositions and negated propositions.
The conjunctions and disjunctions need not be binary. The following formula is also is CNF.
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.
is equivalent to which is in DNF: three disjunctions, each being a clause with only one term.(It also happens to be in CNFa single clause with three terms!) It is also equivalent to the more fleshed out DNF formulawhere we insist that each clause include all three variables. We end up with a formula that includes each possibleclause except : That is, the formula .
Any Boolean function can be represented in CNF and in DNF. One way to obtain CNF and DNF formulasis based upon the truth table for the function.
Unknown function | |||
---|---|---|---|
For CNF, the false rows give us the following five clauses:
For DNF, the true rows give us the following three clauses:
This shows that, for any arbitrarily complicated WFF, we can find an equivalent WFF in CNF or DNF. These provide uswith two very regular and relatively uncomplicated forms to use.
The above example produced CNF and DNF formulas for a Boolean function, but they are not the simplest such formulas. For fun, can you find simpler ones?
Sometimes you'll see the form of CNF and DNF expressed in a notation with subscripts.
One question this notation brings up:
Note that often one of these forms might be more concise than the other.Here are two equivalently verbose ways of encoding , in CNF and DNF respectively: is equivalent to . The first version corresponds to enumerating the choices for each locationof a WaterWorld board; it has 26 two-variable clauses. This may seem like a lot, but compare it to the second version, whichcorresponds to enumerating all possible WaterWorld boards explicitly: it has all possible 26-variable clauses;there are 64 billion of them!
Notification Switch
Would you like to follow the 'Fundamentals of computer engineering' conversation and receive update notifications?