Académique Documents
Professionnel Documents
Culture Documents
Boolean Algebra
and
Karnaugh Maps
AND
C A B C is true if A and B are both true.
OR
A
B
C C A B C is true if either A or B or both are true.
NOT
CA C is true if A is not true, and vice-versa.
NAND
C A B C is NOT of (A AND B).
NOR
C ( A B) C is NOT of (A OR B).
XOR
C A B AB A B
C is true if either A or B, but not both, are true.
Truth Tables
The Truth Table for a given logic variable, gives the state of that
variable for all possible input combinations.
AND OR NAND NOR ExOR
A B C A B C AB C(A B) C(AB) C A B
FALSE FALSE FALSE FALSE TRUE TRUE FALSE
FALSE TRUE FALSE TRUE TRUE FALSE TRUE
TRUE FALSE FALSE TRUE TRUE FALSE TRUE
TRUE TRUE TRUE TRUE FALSE FALSE FALSE
Axioms
Commutative
(a + b) = (b + a) (a * b) = (b * a)
Associative Law
(a + b) + c = a + (b + c) (a * b) * c = a * (b * c)
Distributive Law
a * (b + c) = (a * b) + (a * c) a + (b * c) = (a + b) * (a + c)
(different from normal algebra)
Operation with 0 and 1
a+0=a a*1=a 0+0=0 0*1=0
0+1=1 0*0=0
a+1=1 a*0=0
1+1=1 1*1=1
Duality Principle
Duality Principle
Any algebraic equality derived from the axioms of Boolean
algebra remains true when the operators OR and AND are
interchanged and the elements 0 and 1 are also
interchanged.
For example, a+1=1
a * 0 = 0 (dual)
Another example
a * (b + c) = (a * b) + (a * c)
a + (b * c) = (a + b) * (a + c) (dual)
Axioms
Idempotent Theorem
a+a=a a * a = a (dual)
Law of Absorption
a*b+a=a (a + b) * a = a (dual)
DeMorgans Theorem
DeMorgans Theorem
( x y) x y ( x y z) x y z
( x y ) x y (dual) ( x y z ) x y z (dual)
Min-terms
For a Boolean function of n variables, a product term in which each
of the n variables appears once (in either its complemented form or
uncomplemented form) is called a minterm. If there are n variables,
then there will be 2n minterms.
Examples:
Minterms for 2 variables: Minterms for 3 variables:
Corresponding binary
numbers
Boolean Algebra and K-maps Page 11 ME3242E Industrial Automation
Department of Mechanical Engineering
NATI O NAL U N I V E R S ITY O F SI N GAPO R E
Simplication: Sum-of-Products
Karnaugh Maps
Limitation of Boolean algebra
Not easy to get to the simplest form of the expression
Needs skill and familiarity to do algebraic manipulation.
Karnaugh Maps
Graphical approach to representing Boolean functions.
Easier to get to the simplest form of the Boolean function
quickly
Structure of Karnaugh Maps or K-maps
The K-map has as many squares as there are minterms.
For a K-map of a Boolean function with n variables, there will
be 2n minterms and thus 2n squares in the K-map.
Each square of the K-map contains the value of the function
for that minterm condition.
Two-variable K-Map
A
Single variable map 1 0
B 1 AB AB
Two-variable map by
0
adding a second variable. AB AB
0
A
Two-variable K-Map
A
1 0
B 1 AB AB
Two-variable map by
0
adding a second variable. AB AB
B 1
B
0
Three-variable K-Map
A BC
A
Two- variable map AC: 10 11 01 00
B 1
Three-variable map by
0
adding a third variable.
C ABC
AB C
Any two(or four) adjacent
squares can also be covered
together. The resulting Boolean
BC
AC A
AC: 10 11 01 00
function will then have one (or
two) fewer variable than a B 1 A
minterm.
0
C
BC
Four-variable K-Map
A A BC D
Three-variable map
B
Four-variable map by D
adding a fourth variable.
C
AB C D
Any two/four/8 adjacent squares
can be covered together. The
resulting Boolean function will A CD
then have one/two/three fewer
variable than a minterm. B
D
AC D
A
AC D C
CD
Five-variable K-Map
A BC E
Four-variable map
B
Five-variable map by D
adding a fifth variable and
dividing all the squares C
into two.
E
AD
Any 2/4/8/16 adjacent squares E A
can be covered together. A B
square in the top figure is B
considered adjacent to the D
corresponding square in the AD E
bottom figure.
C
1) Draw the K-map and fill all the squares with the
required value of the function.
2) Cover all the 1s. Each cover will have 2n squares,
n = 0, 1, 2,
3) Make each cover as large as possible by covering
any appropriate adjacent squares containing 1 but
not including any square with 0.
4) Use a minimum number of covers.
5) The Boolean function is then the sum of the Boolean
expressions for all the covers.
4-variable Example
Solution:
A 4-bit binary number will have the range of 0~15.
Y will be true for the binary numbers 2, 4, 6, 8,10, 12 and
14.
B
D
A
1 0 1 1
B D
1 1
0 1 1 0
C
g D B C BC A B
5-variable K-Maps
K-map for F
5-variable K-Maps
BC
Problem: The K-map for F is shown.
Obtain the Boolean expression for F.
BD
AB
F A B B C B D A C D
5-variable K-Maps
AB
F A B B D A C D
D 11
BD
01
00
C
4-variable K-map With sides labelled
A A A
C C C C
E C 001
BDE
E A 100
110 BD C E
B AD
D 010
ADE
000
C Sequence of BD the same for both top and bottom half.
Any cover in the top half can be combined with the same
cover in the bottom half, eliminating variable E.
End