Karnaugh Maps

advertisement
Truth Tables, Karnaugh Maps, and Normal Forms
Take the expression ( P  (Q ¬ R ) ) P ¬Q R ) )
The truth table for this expression is
P
0
0
0
0
1
1
1
1
Q
0
0
1
1
0
0
1
1
R
0
1
0
1
0
1
0
1
(P
0 1
0 1
0 0
0 1
1 0
1 0
1 1
1 0
(Q ¬ R ) ) P ¬Q R ) )
0 0 10
1 0 1 10 0 0
0 0 01
0 0 0 10 1 1
1 1 10
1 0 1 01 0 0
1 0 01
1 0 1 01 0 1
0 0 10
1 1 0 10 0 0
0 0 01
1 1 1 10 1 1
1 1 10
0 1 0 01 0 0
1 0 01
1 1 0 01 0 1
where we have written the result for each term in the expression under that expression.
The final result, in bold, is under the main operator (that is, the last operator to be
evaluated).
Is there a simpler expression that produces this truth table? We can find this by
manipulating the original expression - or it could be obtained from a different sort of
truth table called a Karnaugh Map or K-map.
The corresponding Karnaugh Map for this truth table is
P
0
1
QR
00
1
1
01
0
1
11
1
1
10
1
0
Note that the values of QR change in only one position across the top of the k-map.
We can extract two expressions from this k-map – one by grouping zeros, and another by
grouping ones. See your lecture notes for grouping rules and examples. The first
grouping will give us an expression in conjunctive normal form or cnf. The second will
give us an expression in disjunctive normal form or dnf.
An expression in cnf always has the form A B C … Z where each clause is of the
form ( a1 a2 a3 … an ).
An expression in dnf always has the form A B C  … Z where each clause is of
the form ( a1 a2 a3 … an ).
Each grouping of zeros or ones in a k-map produces one clause in the corresponding cnf
or dnf expression.
Grouping Zeros in a Karnaugh Map always results in an expression in conjunctive
normal form or cnf.
There are only two zeros in this K-map, and they can’t be grouped together so we will
deal with them separately:
P
0
1
QR
00
1
1
01
0
1
11
1
1
10
1
0
The first zero occurs when P and Q are false and when R is true: that is, when the
expression ¬P ¬Q R is false. Therefore, we negate this expression (and use De
Morgan’s Theorem) to find an expression that yields true: P Q ¬R. This is the first
clause in our cnf expression. Similarly, the second zero yields ¬P ¬Q R. These two
clauses are conjoined to produce the final answer: (P Q ¬R )  (¬P ¬Q R )
Grouping Ones in a Karnaugh Map always results in an expression in disjunctive
normal form or dnf.
There are several groups of ones in this map:
P
0
1
QR
00
1
1
01
0
1
11
1
1
10
1
0
It’s fine if the groups overlap; the larger the group, the simpler the resulting expression.
However, in this case we have no overlapping groups and the best we can do is take three
groups of two each.
In the first group, Q and R are false and P doesn’t matter. The resulting term is ¬Q ¬R.
In the second group, P and R are both true and Q doesn’t matter: P R
In the third group, P is false, Q is true, and R doesn’t mater: ¬P Q.
Disjoining these three clauses produces the final answer:
(¬Q ¬R )  (P R )  (¬P Q )
Download