Download Chapter VI – Boolean Algebra Boolean Functions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
MATH 1130
1
Discrete Structures
Chapter VI – Boolean Algebra
Boolean Functions
Boolean Algebra
A Boolean algebra is a set B with two binary operations ∨ and ∧ , elements 0 and 1, and a unary
operation ¬ such that the following properties hold for all x, y and z in B.
x∨0 = x
x ∧1 = x
x ∨ ¬x = 1
x ∧ ¬x = 0
(x ∨ y ) ∨ z = x ∨ ( y ∨ z )
Identity laws
Complement laws
(x ∧ y ) ∧ z = x ∧ ( y ∧ z )
Associative laws
x∨ y = y∨ x
x∧ y = y∧x
Commutative laws
x ∨ ( y ∧ z ) = (x ∨ y ) ∧ (x ∨ z )
x ∧ ( y ∨ z ) = (x ∧ y ) ∨ (x ∧ z )
Distributive laws
Example
Let B be a power set of a set S, 0 = ∅ , 1 = S , ∨ ≡ ∪ (union), ∧ ≡ ∩ (intersection) and ¬ ≡
(Complement).
Then, for any X, Y and Z in B, the following properties hold:
X ∪∅ = X
X ∩S = X
X ∪X =S
X ∩X =∅
( X ∪ Y ) ∪ Z = X ∪ (Y ∪ Z )
( X ∩ Y ) ∩ Z = X ∩ (Y ∩ Z )
X ∪Y = Y ∪ X
X ∩Y = Y ∩ X
X ∪ (Y ∩ Z ) = ( X ∪ Y ) ∩ ( X ∪ Z )
X ∩ (Y ∪ Z ) = ( X ∩ Y ) ∪ ( X ∩ Z )
Identity laws
Complement laws
Associative laws
Commutative laws
Distributive laws
Therefore, the power set B of a set S with binary operations union and intersection, and a unary
operation complement form a Boolean algebra.
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
2
Discrete Structures
Boolean Sum, Boolean Product and Complement
In particular, we may consider a Boolean algebra formed by the set {0,1} with binary operations +
(OR) and ⋅ (AND), and an unary operation
The operations +, ⋅, and
(NOT) defined as follows:
0+0 = 0
0 +1 = 1
1+ 0 = 1
0⋅0 = 0
0 ⋅1 = 0
1⋅ 0 = 0
0 =1
1=0
1+1 = 1
1 ⋅1 = 1
are called Boolean sum, Boolean product and complement respectively.
Boolean variables and Boolean Functions
Let B = {0,1} with operations +, ⋅, and
.
Then B n = {( x1 , x2 ,K, xn ) | xi ∈ B for 1 ≤ i ≤ n} is the
set of all possible n-tuples of 0s and 1s. The variable x is called a Boolean variable if it assumes
values only from B, that is, if its only possible values are 0 and 1. A function from B n to B is called
a Boolean function of degree n.
Example
F ( x1 , x2 , x3 ) = ( x1 + x2 ) ⋅ ( x2 + ( x1 ⋅ x3 )) is a Boolean function of degree 3.
Remarks: i)
x1
x2
x3
F ( x1 , x2 , x3 ) = ( x1 + x2 ) ⋅ ( x2 + ( x1 ⋅ x3 ))
1
1
1
1
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
(x1 + x2 )⋅ (x2 + (x1 ⋅ x3 ))
is called a Boolean expression as it is made up from Boolean
variable and operations.
ii) Two Boolean expressions are called to be equivalent if they represent the same
Boolean function. For example, (x1 ⋅ x2 ) + (x1 ⋅ x2 ) + ( x1 ⋅ x3 ) ≡ x2 + (x1 ⋅ x3 ) .
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
3
Discrete Structures
Identities of Boolean Algebra
Identity
Name
x=x
x+x = x
x⋅ x = x
Law of the double complement
x+0 = x
x ⋅1 = x
x +1 = 1
Idempotent laws
Identity laws
x ⋅0 = 0
x+ y = y+x
Domination laws
x⋅ y = y⋅x
Commutative laws
x + ( y + z ) = (x + y ) + z
x ⋅ ( y ⋅ z ) = (x ⋅ y ) ⋅ z
x + ( y ⋅ z ) = (x + y ) ⋅ (x + z )
x ⋅ ( y + z ) = (x ⋅ y ) + (x ⋅ z )
x⋅ y = x + y
x+ y = x⋅y
x + (x ⋅ y ) = x
Associative laws
Distributive laws
De Morgan’s laws
x ⋅ (x + y ) = x
Absorption laws
x + x =1
Unit property
x⋅x = 0
Zero property
Duality
The dual of a Boolean expression is obtained by interchanging Boolean sums and Boolean Products
and interchanging 0s and 1s.
Example
The dual of x ⋅ ( y + 0 ) is x + ( y ⋅1) .
Duality Principle
An identity between functions represented by Boolean expressions remains valid when the duals of
both sides of the identity are taken.
Example
I)
x ⋅ ( y + z ) = (x ⋅ y ) + (x ⋅ z ) ⇔ x + ( y ⋅ z ) = (x + y ) ⋅ (x + z )
II)
x + x =1⇔ x⋅x = 0
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
4
Discrete Structures
Representing Boolean Functions
Literals and Minterms
A literal is a Boolean variable or its complement. A minterm of the Boolean variables x1 , x2 ,K, xn
is a Boolean product y1 ⋅ y 2 ⋅L ⋅ y n where yi = xi or yi = xi . Hence, a minterm is a product of n
literals, with one literal for each variable.
Example
x ⋅ y ⋅ z , x ⋅ y ⋅ z and x ⋅ y ⋅ z are minterms of Boolean variables x, y and z.
Sum-of-Products Expansions (Disjunctive Normal Form)
Any Boolean function can be written in the form of a Boolean sum of minterms. This representation
is called the sum-of-products expansion or the disjunctive normal form of a Boolean function.
Example
I)
F ( x, y , z ) = ( x + y ) ⋅ z
= (( y + y ) ⋅ x ⋅ z ) + (( x + x ) ⋅ y ⋅ z )
= ( y ⋅ x ⋅ z ) + ( y ⋅ x ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z )
= (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z )
= (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z )
= (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z ) + (x ⋅ y ⋅ z )
II) Given
x
y
z
F ( x, y , z )
1
1
1
0
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
0
0
1
0
1
0
0
1
0
0
0
0
F ( x, y , z ) = ( x ⋅ y ⋅ z ) + ( x ⋅ y ⋅ z ) + ( x ⋅ y ⋅ z ) + ( x ⋅ y ⋅ z )
1
Remark: As every Boolean Function can be represented by using Boolean operators +, ⋅ and
, the
{ } is said to be functionally complete.
set +,⋅,
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
5
Discrete Structures
Logic Gates
OR gate
x+ y
x
y
AND gate
x⋅ y
x
y
NOT gate (Inverter)
x
x
Combinations of Gates (Circuits)
Example
((x ⋅ y ) + (x ⋅ y )) + (x ⋅ z )
x⋅ y
x
y
x
(x ⋅ y ) + (x ⋅ y )
x
x⋅y
((x ⋅ y ) + (x ⋅ y )) + (x ⋅ z )
y
x
x
x⋅z
z
z
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
6
Discrete Structures
Half Adders and Full Adders
Half adder
x+ y
x
y
( )
Sum = (x + y ) ⋅ x ⋅ y
x⋅ y
x⋅ y
x
y
Carry = x ⋅ y
Input
Output
x
y
s
c
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
0
Full adder
ci
x
y
s = ( x ⋅ y ⋅ ci ) + ( x ⋅ y ⋅ ci ) + ( x ⋅ y ⋅ ci ) + ( x ⋅ y ⋅ ci )
Half
adder
Half
adder
ci +1 = ( x ⋅ y ⋅ ci ) + ( x ⋅ y ⋅ ci )
x⋅ y
+ ( x ⋅ y ⋅ c i ) + ( x ⋅ y ⋅ ci )
Input
x
y
ci
Output
ci +1
s
1
1
1
1
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
0
1
0
0
0
1
1
0
0
0
0
0
0
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
7
Discrete Structures
Adding Integers by Half and Full adders
Adding ( x2 x1 x0 )2 and
( y 2 y1 y0 )2
to produce (s3 s 2 s1 s0 )2 by the following setup of adders.
Half
adder
x0
y0
x1
y1
x2
y2
s0
c0
Full
adder
s1
c1
Full
adder
s2
c 2 = s3
Example
(101)2 + (110)2 = (1011)2
x0 = 1
s0 = 1
y0 = 0
c0 = 0
x1 = 0
s1 = 1
y1 = 1
c1 = 0
x2 = 1
y2 = 1
s2 = 0
c 2 = s3 = 1
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
8
Discrete Structures
Minimization of Circuits
As different circuits may produce the same set of outputs, for example,
(x ⋅ y ) + (x ⋅ y ) + (x ⋅ z ) ≡ y + (x ⋅ z ) ,
we will discuss in this section about using the Karnaugh maps to minimize the number of logic gates
in a circuit to produce the output.
Example
I)
The following is a given set of outputs:
x
1
1
1
1
0
0
0
0
y
1
1
0
0
1
1
0
0
z
1
0
1
0
1
0
1
0
output
0
1
0
1
0
1
1
1
The Karnaugh map
x⋅ y
x⋅ y
x⋅y
x⋅y
z
0
0
1
0
z
1
1
1
1
The minimum circuit is z + ( x ⋅ y )
x
x
y
y
z
x⋅y
z + (x ⋅ y )
z
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
MATH 1130
9
Discrete Structures
II) The following is a given set of outputs:
p
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
q
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
r
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
s
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
output
0
1
0
1
0
1
0
0
1
0
1
0
1
1
1
1
The Karnaugh map
p⋅q
p⋅q
p⋅q
p⋅q
r ⋅s
0
0
1
1
r⋅s
1
1
1
0
r ⋅s
1
0
1
0
r ⋅s
0
0
1
1
The minimum circuit is
p
( p ⋅ q ) + ( p ⋅ s) + ( p ⋅ r ⋅ s ) + ( p ⋅ q ⋅ s )
p
p⋅q
q
p
q
p
p⋅s
s
p⋅r ⋅s
p
r
s
s
p⋅q⋅s
p
q
s
( p ⋅ q ) + ( p ⋅ s) + ( p ⋅ r ⋅ s )
+( p ⋅ q ⋅ s )
s
Reference: K.H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill, 2003.
Daricks Chan
Related documents