Lec15 Boolean Algebra
Transcript of Lec15 Boolean Algebra
-
8/3/2019 Lec15 Boolean Algebra
1/33
[Lecture 15][Boolean Algebra]
Boolean Algebra
-
8/3/2019 Lec15 Boolean Algebra
2/33
[Lecture 15][Boolean Algebra]
Boolean Algebra
Invented by and named after George Boole.
Commonly, and especially in computer science and digital electronics, this
term is used to mean two-value logic.
Provide the operations and rules for working with the set {0,1}.
Map logical propositions to symbols.
Permit manipulation of logic statements using Mathematics.
Invented by and named after George Boole.
Commonly, and especially in computer science and digital electronics, this
term is used to mean two-value logic.
Provide the operations and rules for working with the set {0,1}.
Map logical propositions to symbols.
Permit manipulation of logic statements using Mathematics.
Definition:
ABoolean algebra written as (B, +, . , d , 0, 1), consists of a setB
containing distinct elements 0 and 1, binary operators + and . onB, and a
unary operatord onB, such that the identity laws, complement laws,associative laws, commutative laws and distributive laws holds.
Definition:
ABoolean algebra written as (B, +, . , d , 0, 1), consists of a setB
containing distinct elements 0 and 1, binary operators + and . onB, and a
unary operatord onB, such that the identity laws, complement laws,associative laws, commutative laws and distributive laws holds.
-
8/3/2019 Lec15 Boolean Algebra
3/33
[Lecture 15][Boolean Algebra]
Identity Law
x+ 0 =x,
x. 1 =x
Complement Law
x+xd = 1
x.xd = 0
Associative Law
(x+ y) + z=x+ (y+z)
(x. y) . z=x. (y. z)
Identity Law
x+ 0 =x,
x. 1 =x
Complement Law
x+xd = 1
x.xd = 0
Associative Law
(x+ y) + z=x+ (y+z)
(x. y) . z=x. (y. z)
Commutative Law
x + y = y + x
x . y = y . x
Distributive Law
x + (y . z) = (x + y) . (x + z)
x . (y + z) = x . y + x . z
Commutative Law
x + y = y + x
x . y = y . x
Distributive Law
x + (y . z) = (x + y) . (x + z)
x . (y + z) = x . y + x . z
-
8/3/2019 Lec15 Boolean Algebra
4/33
[Lecture 15][Boolean Algebra]
Note:
0 and 1 in the previous definition are merely symbolic names.
In general, they have nothing to do with the numbers 0 and 1. + and are merely binary operators. In general, they have
nothing to do with the ordinary addition and multiplication.
Some examples of Boolean algebras are
(a) ({0, 1}, , , d, 0, 1)
(b) (P(U), , ,D , , U)
where (i) and plays the role of +.
(ii) and plays the role of.
(iii)d
andD
plays the role of complement.(iv)plays the role of 0 and the universal set
U plays the role of 1.
Note:
0 and 1 in the previous definition are merely symbolic names.
In general, they have nothing to do with the numbers 0 and 1. + and are merely binary operators. In general, they have
nothing to do with the ordinary addition and multiplication.
Some examples of Boolean algebras are
(a) ({0, 1}, , , d, 0, 1)
(b) (P(U), , ,D , , U)
where (i) and plays the role of +.
(ii) and plays the role of.
(iii)d
andD
plays the role of complement.(iv)plays the role of 0 and the universal set
U plays the role of 1.
-
8/3/2019 Lec15 Boolean Algebra
5/33
[Lecture 15][Boolean Algebra]
5
Boolean Expressions and Boolean Functions
LetZ2 = {0, 1}, a variable x is called a Boolean variable if itassumes only values from Z2.
A function from toZ2 is called a Boolean function of
degree n, where = {(x1, , xn) | xi Z2 , 1 e i e n}.
Boolean functions can be represented using expressions
made up from variables and Boolean operations.
LetZ2 = {0, 1}, a variable x is called a Boolean variable if itassumes only values from Z2.
A function from toZ2 is called a Boolean function of
degree n, where = {(x1, , xn) | xi Z2 , 1 e i e n}.
Boolean functions can be represented using expressions
made up from variables and Boolean operations.
n
Z2
n
Z2
rprqprqpF !),,(
zxyzxzyxF !),,(
Example:
-
8/3/2019 Lec15 Boolean Algebra
6/33
[Lecture 15][Boolean Algebra]
Example:
F(x, y, z) = xy + z is a Boolean function wherexy + z
is a Boolean expression.
x y z xy z F(x, y, z) =xy + z
1 1 1 1 0 1
1 1 0 1 1 1
1 0 1 0 0 0
1 0 0 0 1 1
0 1 1 0 0 0
0 1 0 0 1 1
0 0 1 0 0 00 0 0 0 1 1
The truth table forF(x, y, z) = xy + z is:
-
8/3/2019 Lec15 Boolean Algebra
7/33
[Lecture 15][Boolean Algebra]
Example:How many Boolean functionsof degree 2 are there?
Soluti
on:A Boolean function of degree 2 is a function fromZ2
2= {(0,0), (0,1),(1,0), (1,1)} toZ2={0,1}. Hence, there are 16 different Booleanfunctionsof degree 2. The following table displays those functions,labeled F1, , F16.
x y F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Question: How many different Boolean Functions of degree n are there?
Answer:n22
-
8/3/2019 Lec15 Boolean Algebra
8/33
[Lecture 15][Boolean Algebra]
Identity Name Identity Name
(x + y) + z = x + (y + z)(x.y) z = x (y. z)
AssociativeLaws
x + 1 = 1x. 0 = 0
Domination/Bound Laws
x + y = y +x
x y =y x
Commutative
Laws
x + (x. y) =x
x. (x + y) =x
Absorption
Laws
x (y +z) = (x y) + (x z)
x+ (y z) = (x+ y) (x+ z)
Distributive
Laws
(xd)d = x Double
ComplementLaws
x + 0 =x
x 1 = x
Identity Laws 0 d = 1
1d = 0
0 and 1 Laws
x + xd = 1
x xd = 0 UnitP
ropertyZero Property
(x + y)d
= xd
.yd
(x. y)d = xd +
yd
D
eM
organsLaws
x + x = x
x x =x
Idempotent
Laws
-
8/3/2019 Lec15 Boolean Algebra
9/33
[Lecture 15][Boolean Algebra]
ExampleLet x, y, z be the Boolean variables. Determine
whether x + x.y.z = xistrue.
Solution:
x + x.y.z = x.1 + x.y.z Identity
= x.(1 + y.z) Distributive= x. 1 Domination
= x Identity
ExampleLet x, y, z be the Boolean variables. Determine
whether x + x.y.z = xistrue.
Solution:
x + x.y.z = x.1 + x.y.z Identity
= x.(1 + y.z) Distributive= x. 1 Domination
= x Identity
-
8/3/2019 Lec15 Boolean Algebra
10/33
[Lecture 15][Boolean Algebra]
Boolean identitiescome in pairs. Such pairs are called
duals. The dualof a Boolean expression isobtained
by interchanging Boolean sums (+) and Boolean product(.), and
by interchanging 0s and 1s.
Boolean identitiescome in pairs. Such pairs are called
duals. The dualof a Boolean expression isobtained
by interchanging Boolean sums (+) and Boolean product(.), and
by interchanging 0s and 1s.
Duality
Example
The dual of (x + y)d = xdyd is (xy)d = xd + yd
The dual ofxyd = 0 if and only ifxy = x is
x + yd = 1 if and only ifx + y = x
Example
The dual of (x + y)d = xdyd is (xy)d = xd + yd
The dual ofxyd = 0 if and only ifxy = x is
x + yd = 1 if and only ifx + y = x
-
8/3/2019 Lec15 Boolean Algebra
11/33
[Lecture 15][Boolean Algebra]
A literalis a Boolean variable or its complement.A literalis a Boolean variable or its complement.
Minterm and MaxtermMinterm and Maxterm
A minterm of the Boolean variables x1, x2, , xn is a Boolean
producty1y2yn, where yi = xi oryi = xid.
A minterm of the Boolean variables x1, x2, , xn is a Boolean
producty1y2yn, where yi = xi oryi = xid.
A maxterm is defined as a Boolean sum of n literals, with
one literal for each variable.
A maxterm is defined as a Boolean sum of n literals, with
one literal for each variable.
Hence, a minterm is a product ofn literals, with one literal foreach variable.
-
8/3/2019 Lec15 Boolean Algebra
12/33
[Lecture 15][Boolean Algebra]
x1 x2 x3 Minterm Maxterm
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Example: 3 variables
321xxx 321
xxx
321xxx 321 xxx
1 2 3x x x
1 2 3x x x
1 2 3 x x x
31 2 x x x
Complete the rest!
-
8/3/2019 Lec15 Boolean Algebra
13/33
[Lecture 15][Boolean Algebra]
Also known as sum-of-products expansion.
Sum of minterms corresponding to input combinations
for which the function produces a 1 as output.
Also known as sum-of-products expansion.
Sum of minterms corresponding to input combinations
for which the function produces a 1 as output.
A B C F1 F20 0 0 0 10 0 1 1 00 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 0
F1 = + ABC+ A'BC + AB'C + ABC'A'B'C
Disjunctive Normal Form (DNF)
-
8/3/2019 Lec15 Boolean Algebra
14/33
[Lecture 15][Boolean Algebra]
Discrete Structures 14
Also known asproduct-of-sums expansion. Sum of maxterms corresponding to input combinations
for which the function produces a 0 as output.
Also known asproduct-of-sums expansion. Sum of maxterms corresponding to input combinations
for which the function produces a 0 as output.
Conjunctive Normal Form (CNF)
Any Boolean Expression has a DNF and a CNF.
Given a Boolean function, we can obtain the DNF andCNF either by Truth table or Boolean identity laws.
-
8/3/2019 Lec15 Boolean Algebra
15/33
[Lecture 15][Boolean Algebra]
Logic Gates
Input
x
NOT GateOutput
x
Two inputs AND Gate
Inputs
x
y
Output
xy
x
0 1
1 0
x
x y
0 0 0
0 1 0
1 0 0
1 1 1
xy
-
8/3/2019 Lec15 Boolean Algebra
16/33
[Lecture 15][Boolean Algebra]
Inputs
x
y
Output
x + y
Two Inputs ORGate x y x+y
0 0 0
0 1 1
1 0 1
1 1 1
Logic Gates
-
8/3/2019 Lec15 Boolean Algebra
17/33
[Lecture 15][Boolean Algebra]
NORGate
NAND Gate
-
8/3/2019 Lec15 Boolean Algebra
18/33
[Lecture 15][Boolean Algebra]
Combination of Gates
-
8/3/2019 Lec15 Boolean Algebra
19/33
[Lecture 15][Boolean Algebra]
Examples:Construct circuits that produce the following outputs:
a) b) c)xyx )( )( zyx )()( zyxzyx
Solution:
b) )( zyx
xyx )( a)
-
8/3/2019 Lec15 Boolean Algebra
20/33
[Lecture 15][Boolean Algebra]
c) )()( zyxzyx
-
8/3/2019 Lec15 Boolean Algebra
21/33
[Lecture 15][Boolean Algebra]
Example: Given a function F(x, y, z) with the truth table below. Write
the sum-of-products (minterm expression) representing F(x,y, z) and
draw the corresponding logic diagram.
-
8/3/2019 Lec15 Boolean Algebra
22/33
-
8/3/2019 Lec15 Boolean Algebra
23/33
[Lecture 15][Boolean Algebra]
Example
A function f(x, y, z) has truth table as below.
Write the sum-of-products (minterm expression) representing f(x, y,z) .
Simplify the expression and draw a logic diagram using as few gates as possible.
x y z f(x, y, z)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 01 1 1 1
Discrete Structures 23
-
8/3/2019 Lec15 Boolean Algebra
24/33
[Lecture 15][Boolean Algebra]
zyxzyxzyxf !),,(
z
yyz
Solution:
Sum-of-product
Simplify the expression:
zy
zyxx
zyxzyxzyxf
!
!
!
)(
),,(
Logic diagram:
-
8/3/2019 Lec15 Boolean Algebra
25/33
[Lecture 15][Boolean Algebra]
Boolean expression for a logic circuit may be reduced
to a simpler form.
The simplified expression forms a circuit uses less logic
gates but performs the same function.
We can use Boolean identity laws to simplify a Boolean
function. Another method to simplify a Boolean function is by
using Karnaugh map.
Boolean expression for a logic circuit may be reduced
to a simpler form.
The simplified expression forms a circuit uses less logic
gates but performs the same function.
We can use Boolean identity laws to simplify a Boolean
function. Another method to simplify a Boolean function is by
using Karnaugh map.
Simplify this Boolean expression using
identity laws:F(x, y, z) = zyxzyxyzxzyx
Minimization ofCircuits
Answer: yxzx
-
8/3/2019 Lec15 Boolean Algebra
26/33
[Lecture 15][Boolean Algebra]
K-map for short
Invented in 1950 by Maurice Karnaugh, a telecommunication
engineer in Bell Labs.
An excellent aid for simplification of Boolean expression in
DNF form.
Make use of the human brain's excellent pattern-matchingcapability to decide which terms should be combined to get
the simplest expression.
K-map for short
Invented in 1950 by Maurice Karnaugh, a telecommunication
engineer in Bell Labs.
An excellent aid for simplification of Boolean expression in
DNF form.
Make use of the human brain's excellent pattern-matchingcapability to decide which terms should be combined to get
the simplest expression.
Karnaugh Map
-
8/3/2019 Lec15 Boolean Algebra
27/33
[Lecture 15][Boolean Algebra]
Karnaugh map in 2 variables
xy yx
yx yx
x
x
y y
Karnaugh map in 3 variables
xyz
yzx zyx
zxy zyx zyx
zyx zyx
x
x
yz zy zy zy
-
8/3/2019 Lec15 Boolean Algebra
28/33
[Lecture 15][Boolean Algebra]
Karnaugh map in 4 variables
wx
xw
yz zy zy zy
xw
xw xyzw
zw xy zywx zywx
yzxw zyxw zyxw zyxw
yzxw zyxw zyxw zyxw
wxyz
zxyw zyxw zyxw
-
8/3/2019 Lec15 Boolean Algebra
29/33
[Lecture 15][Boolean Algebra]
Important points:
1 isplaced in the cell representing a minterm if
thisminterm ispresent in the expansion.
Cells are said to be adjacent if the minterms
differ in exactly one literal.
Identify thelargest possib
le b
locks and cover allthe 1s with the fewest blocks.
Circle blocksof cells in the K-map that represent
minterms that can be combined and find the
corresponding
sum-of-product
s.
Important points:
1 isplaced in the cell representing a minterm if
thisminterm ispresent in the expansion.
Cells are said to be adjacent if the minterms
differ in exactly one literal.
Identify thelargest possib
le b
locks and cover allthe 1s with the fewest blocks.
Circle blocksof cells in the K-map that represent
minterms that can be combined and find the
corresponding
sum-of-product
s.
-
8/3/2019 Lec15 Boolean Algebra
30/33
[Lecture 15][Boolean Algebra]
Example:
Use Karnaugh map to simplify the following Boolean expressions:
1)
2)
3)
4)
yxyx
zyxyzxzyxzyxxyz
zyxzyxzxyzyxxyz
zyxwzyxwzyxwzxywzywxzwxy
Given a truth table of a Boolean expression,we can also simplify the expression by first
constructing the DNF from the truth table.
-
8/3/2019 Lec15 Boolean Algebra
31/33
[Lecture 15][Boolean Algebra]
Solution:
xyxyx !
zyyxyzzyxyzxzyxzyxxyz !
1 1
x
x
y y
1 1
1 1 1
x
x
yz zy zy zy
2.
1.
xyyxyxyx !! )(
-
8/3/2019 Lec15 Boolean Algebra
32/33
[Lecture 15][Boolean Algebra]
zxyzyxzyxzxyzyxxyz !
zyxwzywzxwzwxzyxwzyxwzyxwzxywzywxzwxy !
3.
1 1 1
1 1
x
x
yz zy zy zy
4.
wx
xw
yz zy zy zy
1 1
1 1
1 1
xw
xw
-
8/3/2019 Lec15 Boolean Algebra
33/33
[Lecture 15][Boolean Algebra]
Answer:
1. The duals are x + (y.1) and (xd + 0)(ydz).
2.
Question:
1. Find the duals ofx(y + 0) and xd.1 + (yd + z).
2. Use K-map to simplify .yxyxyx
1
1 1
x
x
y y
yxyxyxyx !