Title: Simplifying Boolean Expressions
1Simplifying Boolean Expressions
- In this session we examine various ways of
simplifying Boolean expressions, in particular,
the use of Karnaugh maps.
2A Boolean (0,1) modelfor ?
- p T or F q T or F (T on F
off)pT, q T, p ? q T ? T T p T,
q F , p ? q T ? F T p F, q T, p
? q F ? T Tp F, q F, p ? q F ?
F F - p 0 or 1 q 0 or 1 1 1 1
? 1 1 1 0 1 ? 0
1 0 1 0 ? 1 1 0 0
0 ? 0 0
The "arithmetic" looks likea special addition pq
3A Boolean (0,1) modelfor ?
- p T or F q T or F (T on F
off)pT, q T, p ? q T ? T T p T,
q F , p ? q T ? F F p F, q T, p
? q F ? T Fp F, q F, p ? q F ?
F F - p 0 or 1 q 0 or 1 1 1 1
? 1 1 1 0 1 ? 0 0 0
1 0 ? 1 0 0 0
0 ? 0 0
The "arithmetic" looks like
multiplication pq
4A Boolean (0,1) modelfor ?
- p T or F (T on F off)p T , ? p
F p F , ? p T - p 0 or 1 1 0 0 1
It is ( 1 - p) p'
5Analysing a simple circuit
- In terms of logic clearly we have ? p ? q
pT, q T, ? p ? q F ? T F p T, q
F , ? p ? q F ? F F p F, q T, ? p ?
q T ? T T p F, q F, ? p ? q T ? F
F - 1 1 0 ? 1 0 1
0 0 ? 0 0 0 1
1 ? 1 1 0 0 1 ? 0
0
p'q
6Finding the Boolean expression for a circuit
- In terms of logical operators (p ? q) ? ? (p
? q) ? (pq)(pq)' ? (p ? q) ? (?p ??q)
? (pq)(p'q') ? (p?(?p ??q)) ? (q?(?p??q)
? p(p'q')q(p'q') ? ((p??p)?(p ??q))?
((q??p)?(q??q)) ? pp'pq'qp'qq'? (c?(p
??q))?((q??p)?c) ? 0 pq'qp' 0 ?
(p??q)?(q??p) ? pq'qp' (the symmetric
difference)
7Convention
- We will leave out the multiplication sign, ?, and
assume that multiplication is executed before
addition . Thus we shall write p q r for
(p ? q) rbut we will continue to write (p ?
q) ? rsince it is not usual to give ? precedence
over ?
8Some laws of Boolean Algebra
- x x' 0
- x'' x
- (x y)' x'y' (xy)' x'y'
- x 1 1 x 0 x
- x 1 x x 0 0
- x(xy) x x (xy) x
- 0' 1 1' 0
- x x x x(1-x) x- xx 0
9The algebra
10"Simplifying" Boolean Expressions
- Using the axioms and derived laws
- xz'x'y(yz)' xz'x'yy'z'
xz'1z'x'yy' (x1)z' x'yy' 1z'
x'y'' y' z'(xy')'y' z' ((xy')y)'
z' (xyy'y)' z' (xy0)'
z'(xy)' x'y'z' (xyz)' - (Identical to logic reductions but in different,
more compact, notation.)
11"Simplifying"
- x'yy' x'y'' y' (xy')'y'
((xy')y)' (xy0)' (xy)' x'y' - andxy' y x yyx' xx'y x(cf
Grossmanp.144)
12Picking out when f is "true"
- Consider the table x y f (x,y) 1 1
1 xy 1 1 0 1 xy' 1 0
1 1 x'y 1 0 0 0If any one
of the three cases is true then f is true, or,f
(x,y,z) xy xy' x'y(xx')yxy'yxy' x y - Recall that 11 1
Consider the table x y f (x,y) 1 1
1 xy 1 1 0 0 0 1
0 0 0 0In only one case is f is
true f (x,y,z) xy The sum of minterms is the
disjunctive normal form. (Not necessarily the
simplest form.)
13Minterms
- x y z w f(x,y,z,w)1 1 1 1 1
?xyzw1 1 1 0 01 1 0 1
01 1 0 0 1 ?xyz'w' 1 0 1 1
1 ?xy'zw1 0 1 0 01 0
0 1 01 0 0 0 1
?xy'z'w'0 1 1 1 00 1 1 0
0 0 1 0 1 00 1 0 0 00 0
1 1 1 ?x'y'zw0 0 1 0
00 0 0 1 1 ?x'y'z'w0 0 0 0
0
- Minterms are the products of factors, one for
each variable, which return 1 for each particular
case where f 1 - e.g. the minterms to right arexyzw, xyz'w',
xy'zw, xy'z'w', x'y'zw and x'y'z'w
14The Disjunctive Normal Form
- The disjunctive normal form for a Boolean
function is the sum of its minterms. - In the previous example, the disjunctive normal
form isf(x,y,z,w) xyzwxyz'w'xy'zw xy'z'w'
x'y'zw x'y'z'w - It is not necessarily the simplest expression for
the function.
15Karnaugh map for f (x,y)
- Suppose the disjunctive normal form for f (x,y)
is xyx'yxy'. In the table y y' x
1 1 x' 1 0the 1 entries
identify the presence of minterms. Boxing in
rows and columns of 1's identifies minterms with
common factors. Since xxx xyx'yxy'
xyx'yxyxy'(xx')yx(yy')xy which we can
deduce from the diagram.
16Karnaugh map for f (x,y,z)
- The table is set up as below (order of columns is
important) yz
y'z y'z' yz' x 1 0 0
1 - x' 0 1 0 1
- We search for
- four 1's in a row
- four 1's in a square -- assuming right and left
edges are adjacent - two adjacent 1's in a row or column -- "
- single 1's
- in that order. Loops may overlap and all 1's
must be covered, hopefully with as few loops as
possible with loops as large as possible.
17f (x,y,z) xyz xyz' x'y'z x'yz'
- The Karnaugh map is shown above and is boxed
accordingly. From the two-loops we get y and
yz' and from the single 1, x'y'z. Thus our
simplification is xy yz' x'y'z
18Karnaugh map for f (x,y,z,w)
- The table is set up as below (order of rows and
columns is important)
zw z'w z'w' zw' xy 1 0
0 0 x'y 0 1 0
0 x'y' 1 1 0 1 xy'
1 0 0 1 - We search for
- eight 1's in four by two or two by four
rectangles - four 1's in a row or a column (top and bottom,
left and right are adjacent - four 1's in a square
- two adjacent 1's in a row or column
- single 1's
19f (x,y,z,w) xyzw x'yz'w x'y'zw x'y'z'w
x'y'zw' xy'zw xy'zw'
- The table is set up as below (order of rows and
columns is important)
zw z'w z'w' zw' xy 1 0
0 0 x'y 0 1 0
0 x'y' 1 1 0 1
xy' 1 0 0 1 - The reduction is y'z xzw x'z'w
20The "don't care" option
- Occasionally the function table does not list
all possible inputs, possibly because some will
never occur e.g. x (agtb) y (altb) will
never have the inputs 1 1 or 0 0.In these
cases we can place a d in the Karnaugh map
and include it in a loop if desirable or ignore
it if preferred.
21Writing any given expression in disjunctive
normal form
- Note that x y is not in disjunctive normal
form. To obtain that form we re-write it as
x(yy') y(xx') xy xy' xy
x'y xy xy' x'y(as obtained earlier
from the function table). - Apply the same procedure, together with
distributive and deMorgan laws (etc) to any
expression to bring it to disjunctive normal form.
22f (x,y,z) (xy)'z (x'z z')y
- To write f in disjunctive normal form
(xy)'z (x'z z')y (x'y')z x'yz yz'
x'z y'z x'yz yz' x'(yy')z (xx')y'z
x'yz (xx')yz' x'yzx'y'z xy'zx'y'z x'yz
xyz'x'yz' xyz' xy'z x'yzx'y'z x'yz'
23Adding two bits again
- The input/output tables for adding two bits
are x y sum x y carry 0 0 0 0 0 0
1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 - Exercise produce a pair of circuits to do it.
24Adding three bits again
- The input/output tables for adding three bits
are x y z sum x y z carry
0 0 0 0 0 0 0 0 0 0
1 1 0 0 1 0 0 1 0 1
0 1 0 0 1 0 0 1 1 0 0
0 0 1 1 0 0 1 1 1
Exercise 1 0 1 0 1 0 1 1
produce a pair1 1 0 0 1 1
0 1 of circuits to do it 1 1 1
1 1 1 1 1
25Whats the big idea ?
- Logical reductions can be achieved by analysis
of the Boolean expressions that describe them
using the laws of logic and Karnaugh maps or
truth tables or the Venn diagrams that represent
those tables geometrically.