1 - csbdsmath

advertisement
Discrete Mathematics and Its Applications
INTRODUCTION
 The English mathematician George Boole (1815-1864)
sought to give symbolic form to Aristotle's system of logic.
 Boole wrote a treatise on the subject in 1854, titled An
Investigation of the Laws of Thought, on Which Are
Founded the Mathematical Theories of Logic and
Probabilities, which codified several rules of relationship
between mathematical quantities limited to one of two
possible values: true or false, 1 or 0.
 His mathematical system became known as Boolean
algebra.
 All arithmetic operations performed with Boolean quantities have but one of
two possible outcomes: either 1 or 0. There is no such thing as "2" or "-1" or
"1/2" in the Boolean world.
 It is a world in which all other possibilities are invalid by fiat. As one might
guess, this is not the kind of math you want to use when balancing a
checkbook or calculating current through a resistor.
 However, Claude Shannon of MIT fame recognized how Boolean algebra
could be applied to on-and-off circuits, where all signals are characterized as
either "high" (1) or "low" (0). His 1938 thesis, titled A Symbolic Analysis of
Relay and Switching Circuits, put Boole's theoretical work to use in a way
Boole never could have imagined, giving us a powerful mathematical tool for
designing and analyzing digital circuits.
(http://www.databanker.org/Home/BoolAlg/tabid/53/Default.aspx)
 The rules of logic are used to design circuits and form the basis for
Boolean algebra. The circuits in all electronic devices like computers
have inputs that can be identified as either 1 or 0 to produce outputs
labeled as 1s and 0s OR switches that are in ‘on’ or in ‘off’ position.
 Boolean algebra provides the operations and the rules for working
with the set {0,1}. The operation of a circuit is defined by a Boolean
function that specifies the value of an output for each set of inputs.
This function is built using Boolean expressions and operations.
OPERATIONS IN BOOLEAN ALGEBRA
 COMPLEMENTATION
The complement of an element, denoted with a bar, is defined by:
0 1
1 0
 BOOLEAN SUM
The Boolean sum, denoted by + or by OR, has the following values:
11  1
0 1  1
1 0  1
00  0
 BOOLEAN PRODUCT
The Boolean product, denoted by or by AND, has the following values:
11  1
0 1  0
1 0  0
00  0
Rules of Precedence for Boolean Operators
 Unless parentheses are used, all complements are
computed first followed by Boolean products, then
followed by all Boolean sums.
The complement, Boolean sum, and the Boolean
product correspond to the logical operators , , , 
,respectively where 0 is False and 1 is True.
Example: Find the value of 1  0  (0  1) .
BOOLEAN FUNCTION
 Let B  {0,1}. Then
B n   x1 , x2 , x3 ,, xn  : xi  B for 1  i  n
is the set of all possible n-tuples of 0’s and 1’s.
The variable is called a Boolean variable if it
assumes values only from B, i.e., if its only possible
values are 0 and 1. A function from B to B is called a
Boolean function of degree n.
n
Example: The function F ( x, y )  x y from the set of ordered
pairs of Boolean variables to the set {0,1} is a Boolean function of
degree 2 with the values of F as shown in the table.
x
1
1
0
0
y
1
0
1
0
F ( x, y)
0
1
0
0
Clearly,
F (1,1)  0; F (1,0)  1; F (0,1)  0; F (0,0)  0
 The Boolean expressions in the variables
x , x , x ,, x are defined recursively as
1
2
3
n
0,1, x , x , x ,, x
1
2
3
n
are Boolean expressions; if E and E are Boolean
expressions, then,  E  E  and E , E E  are Boolean
expressions.
 Each Boolean expression represents a Boolean
function. The values of this function are obtained by
substituting 0 and 1 for the variables in the expression.
1
1
2
2
1
1
2
Example: Find the values of the Boolean function represented by
F ( x, y, z )  xy  z
x
1
1
1
1
0
0
0
0
y
z
xy
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
1
0
0
0
0
0
0
Remark:
z
0
1
0
1
0
1
0
1
xy  z
1
1
0
1
0
1
0
1
Two different Boolean expressions that represent the same function are equivalent.
Examples:
and
are equivalent.
xy, xy  0,
xy 1
DUALITY and COMPLEMENT
d
The dual of a Boolean expression denoted by e , is obtained by
interchanging Boolean sums and Boolean products, and interchanging 0’s and
d
1’s. The dual of the function F will be denoted by F .
Example: Find the dual of
For
For
x( y  0)
and
x 1   y  z .
x( y  0) , the dual is x   y  1 .
x 1   y  z  , the dual is x  0 yz  .
F is the function F .
F ( x , x x , x )  F ( x , x x , , x )
The complement of the function
1
2,
3,
n
1
2,
3
n
That is,
IDENTITIES
1. Digital computers contain circuits that implement Boolean
functions.
2. The simpler that we can make a Boolean function, the smaller the
circuit that will result.
 Simpler circuits are cheaper to build, consume less power, and
run faster than complex circuits.
3. With this in mind, we always want to reduce our Boolean
functions to their simplest form.
4. There are a number of Boolean identities that help us to do this.
Most Boolean identities have an AND (product) form as well as an
OR (sum) form. We give our identities using both forms.
Remark: The above identities can be translated to logical equivalences about propositions
and to identities about sets.
We can use Boolean identities to simplify the function
as follows:
Example: Find the complement of the function
Applying DeMorgan’s Laws,
OR, you can take the complement of the function by taking its dual,
then complement each literal (a variable or its complement).
REPRESENTATION OF BOOLEAN FUNCTIONS
PROBLEM: Given the values of a Boolean function, how can a Boolean expression
that represents this function be found?
Any Boolean function can be represented by a Boolean sum of Boolean
products of the variables and their complements.
Example: Find Boolean expressions that represents functions
G( x, y, z ) which are given in the following table.
z
x
y
1
1
1
0
0
1
0
1
0
1
1
0
0
0
1
0
1
0
0
1
0
1
1
0
F
0
0
1
0
0
0
0
0
G
0
1
0
0
0
1
0
0
F ( x, y, z ) and
To represent F , we need an expression that has the value 1.
A combination of values of the variables for which the function
has the value 1 leads to a Boolean product of the variables or
their complements. From the table, F has the value 1 when
x  z  1 and y  0 , and the value 0 otherwise. To form the
Boolean product that has the value 1, x yz is obtained. What
about function G ?
CANONICAL FORMS of a Boolean Function
DEFINITION
A literal is a Boolean variable or its complement. A minterm is a Boolean
product of n literals, with one literal for each variable. A minterm is the standard product.
A minterm has the value 1 for one and only combination of values of its
variables.
Example: Find a minterm that equals 1 if
and equal 0 otherwise.
x1  x3  0 and x2  x4  x5  1
A minterm that has the value 1 is
x1 x2 x3 x4 x5 .
Given a Boolean function, a Boolean sum of Boolean products (minterms) or
simply, sum of minterms, can be formed that has the value 1 when this Boolean
function has the value 1, and has the value 0 when the function has the value 0.
The minterms in this Boolean sum correspond to those combinations of
values for which the function has the value 1. The sum of minterms that
represents this function is called the sum-of-products expansion or the disjunctive
normal form (DNF) of the Boolean function.
Example: Find the sum-of-products expansion for the function
F ( x, y , z )  ( x  y ) z .
The sum-of-products expansion of the function can be done in two ways:
1.
Use the Boolean identities to expand the product and simplify.
F ( x, y , z )  ( x  y ) z
 x z  y z  x1z  1y z
 x( y  y ) z  ( x  x) y z
 xy z  x y z  xy z  x y z
 xy z  x y z  x y z
2. Construct a table and form the Boolean sum of minterms that have the
value 1.
x
y
z x  y z ( x  y) z
1
1
1
1
0
0
1
1
0
1
1
1
1
0
1
1
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
1
0
1
1
11
0
0
0
0
1
0
0
0
0
1
0
0
Based on the table, the sum-of-terms expansion for the Boolean
function is F ( x, y, z )  xy z  x y z . x y z
It is also possible to get a Boolean expression that represents a Boolean
function by taking a Boolean product of Boolean sums (maxterms). The maxterms
in this Boolean product correspond to those combinations of values for
which the function has the value 0. The resulting expansion is called the
product-of-sums expansion or the conjunctive normal form (CNF) of the
function.
A maxterm is the standard sum. A maxterm has the value 0 for one and only
combination of values of its variables.
A minterm is the complement of a maxterm, and vice versa.
To get the CNF for
:
1. Take the complement F .
2. Obtain the DNF for F .
3. Complement both sides of the DNF obtained in (2) .
F
Boolean functions expressed as a sum of minterms (DNF) or product
of maxterms (CNF), are said to be in canonical form.
Minterms & Maxterms
for 3 Binary Variables
Minterms
Maxterms
xyz
Term
Term
000
x’y’z’
x+y+z
001
x’y’z
x+y+z’
010
x’yz’
x+y’+z
011
x’yz
x+y’+z’
100
xy’z’
x’+y+z
101
xy’z
x’+y+z’
110
xyz’
x’+y’+z
111
xyz
x’+y’+z’
LOGIC GATES
1.
2.
3.
4.
5.
6.
7.
8.
Boolean Algebra is used to model circuitry of electronic devices.
Each circuit is designed using the rules of Boolean Algebra.
The basic elements of circuits are called gates.
Each type of gate implements a Boolean operation.
The circuits give output that depends only on the input.
Circuits have no memory capabilities.
These circuits are called combinational circuits or gating
networks and can be constructed using a combination of gates
that may share inputs.
Each input (entering a gate) and each output (leaving a gate) of a
circuit is a member of the set {0,1}.
Basic types of Gates
Inverter or NOT Gate
x
F
0
1
1
0
Accepts the value of one Boolean variable
as input and produces the complement of
this value as output.
AND Gate
x
y
F
0
0
0
0
1
0
1
0
0
1
1
1
The inputs to this gate are 2 or more
Boolean variables. The output is the
Boolean product of their values.
OR Gate
x
y
F
0
0
0
0
1
1
1
0
1
1
1
1
The inputs to this gate are the values of 2
or more Boolean variables. The output is
the Boolean sum of their values.
NAND Gate
x
y
F
0
0
1
0
1
1
1
0
1
1
1
0
NOR Gate
x
y
F
0
0
1
0
1
1
1
0
1
1
1
0
XOR Gate
x
y
F
0
0
0
0
1
1
1
0
1
1
1
0
XNOR Gate
x
y
F
0
0
1
0
1
0
1
0
0
1
1
1
Discrete Mathematical Structures: Theory and Applications
Discrete Mathematical Structures: Theory and Applications
Discrete Mathematical Structures: Theory and Applications
Discrete Mathematical Structures: Theory and Applications
Discrete Mathematical Structures: Theory and Applications
Examples
1.
Find two ways to draw the same circuit that produces the
output xy  x y.
2.
Construct circuits that produce the following outputs:
a.
3.
( x  y) x
b.
x( y  z )
c.
( x  y  z )( x y z )
Construct a circuit using NAND gates only to produce the following
outputs.
a.
x
b.
xy
c.
x y
Download