boolean algebra - peoplebpbsma/downloads and stuff/chapt7.pdfthink truth table. 7. ... the boolean...
TRANSCRIPT
Boolean Algebra
We have already studiedtwo examples of a Booleanalgebra last quarter:• Sets with the operations∩,∪, A0
• Logical propositions withthe operations ∧,∨,∼ p
Notice how we have twooperations that involve a
pair of elements and one thatnegates a single element.
Call T a tautology and F acontradiction.
Two illustrate the similari-ties ourselves, find equivalentexpressions for
2
Notice how they both sat-isfy the same rules. We can, asBool did, generalize these intothe following Axioms.
1 Axioms of aBoolean AlgebraKFor all elements a, b, c ∈ K thefollowing laws hold:
1. Associative Lawsa + (b + c) = (a + b) + c
a (bc) = (ab) c
3
2. Commutative Lawsa + b = b + a
ab = ba
3. Distributive Lawsa + (bc) = (a + b)(a + c)
a(b + c) = ab + ac
4. Identity Lawsa + 0 = a
a1 = a
5. Complement Lawsa + a0 = 1aa0 = 0
The two distinct elements 0and 1 are elements of K
4
Example 1 Show that real numberswith addition and subtractionare not a Boolean Algebra.
Example 2 Let B = {0, 1} be thesmallest Boolean algebra withthe operations +, · defined as
+ 0 1
0 0 1
1 1 1
· 0 10 0 0
1 0 1
Show that it really is a BooleanAlgebra.
5
What we called the smallestBoolean Algebra, B, can alsobe thought of at {0, 1} = {T, F}with the logic operations. Butmore importantly, all theoremand properties established forB hold for all other Booleanalgebras. SO we will buildideas with B and we knowthey translate up to more com-plicated Boolean algebras.
1.0.1 Boolean Expres-sions“A Boolean expression is any
6
Boolean variable or expres-sion built up from Booleanvariables using Boolean oper-ations and parentheses”
What’s a Boolean Variable?
Two Boolean expressionsare equivalent if every possiblecombination of values of theBoolean variables producesequivalent Boolean values inboth expressions.
Think Truth Table.
7
1.1 Perfect InductionTo prove two Boolean expres-sions are equivalent, constructa Truth Table. Use PerfectInduction to prove
• Idempotent Laws
• Absorption Laws
• Boundedness Laws
8
• De Morgan’s Laws(a + b)0 = a0b0
• Involution Law¡a0¢0= a
• Uniqueness of the Comple-ment: For any given elementa there is an element x = a0such that
a + x = 1
ax = 0
1.1.1 HomeworkSection 7.1, #1,2,5,7
9
Submit answer from Sheet
2 Boolean FunctionsConstruct a table to illustratethe Boolean function
f(x, y) = xy0 + x(x + y0)
Show that the expressionxy + xy0
is equivalent to the functionabove. Thus we can write
f(x, y) = xy + xy0
The later is expressed as acomplete sum-of-productsor disjunctive normal form of
10
f(x, y).
2.1 Creating the Dis-junctive Normal Form• add a column on the functiontable
x y f Minterms
0 0 0
0 1 0
1 0 1
1 1 1
• write the minterm in, where1 means not the complementand 0 means the comple-ment.
11
• Read down, using the valuesof f as the coefficients of theminterms
Example 3 Find the complete sum-of-products form of
xy + z(x0z + y0) + z0
These complete sum-of-product forms are unique.Therefore we can conclude
that two Boolean expressionsare equivalent if and only ifthey have the same completesum-of-product forms. Why?
12
2.1.1 HomeworkSection 7.2Sum-of-products only!# 1,2,3 Submit 2a,b,d
Prove
+ 0 1 2 3
0 0 1 2 3
1 1 1 3 3
2 2 3 2 3
3 3 3 3 3
13
∗ 0 1 2 30 0 0 0 0
1 0 1 0 1
2 0 0 2 2
3 0 1 2 3
is a Boolean Algebra, that ischeck the axioms hold a, b, c ∈{0, 1, 2, 3} the following lawshold:
1. Associative Lawsa + (b + c) = (a + b) + c
a (bc) = (ab) c
14
2. Commutative Lawsa + b = b + a
ab = ba
3. Distributive Lawsa + (bc) = (a + b)(a + c)
a(b + c) = ab + ac
4. Identity Lawsa + 0 = a
a1 = a
5. Complement Lawsa + a0 = 1aa0 = 0
15
3 Karnaugh MapsAKarnaugh map is a graphicalrepresentation of the completesum-of-squares. Let’s learn byexample. Say we start with aBoolean functionf(x, y, z) = x0yz+x0y0z+xyz0+x0y0z0
How many possible mintermscould there be? We need a cellfor each possible minterm.Draw the Karnaugh map for
the above function.
Let’s make our first Kar-naugh map theorem:
16
The Karnaugh map for aBoolean expression with nvariables has 2n cells, one foreach possible minterm.
Above we made the K-mapfrom the function, we can alsomake the function from theK-map. For example:
wz wz0 w0z0 w0zxy
xy0 1 1
x0y0 1
x0y 1 1
Also notice the ordering of17
the rows and column labels,each adjacent cell differs byonly one complement. List theadjacent cells for the cells
xy0wz0
xy0w0zxywz
If we define adjacent cellsas those that differ by onlyone complement, then howmany adjacent cells are thereif the function in questionhas 2 Boolean variables? 3Boolean variables? n Booleanvariables?
18
New Theorem: A Booleanexpression with n Booleanvariables creates a K-map withadjacent cells.
Example 4 Create the K-maps forthe three expressions
x+ z(y0 + xz0)x+ w + zy0
xy0 + x(y + x)
In the last example circleany two adjacent cells and usethe distributive law, comple-ment law and identity law tosimplify the expression.
19
Notice what remained in thesimplification of the circledterms, everything that wascommon remained.We call these circled terms
Basic Rectangles• Single isolated 1’s• two adjacent cells with 1’s• Four adjacent cells with 1’s,1× 4, 2× 2
• Eight adjacent cells 2× 4Draw examples of each
type and simplifyWhy not 3 in a row? Think
20
20, 21, 22, 23, 24
We are trying to simplifyBoolean functions as much aspossible, so let’s start with thebiggest rectangles possible,Define the term MaximalRectangle as a basic rectanglethat is not completely insideanother basic rectangle. Solet’s make a procedure:
• Circle any isolated 1’s• Circle any 16 cell basicrectangles
• Circle any 8 cell basic rec-21
tangles not completely insideanother
• Circle any 4 cell basic rec-tangles not completely insideanother
• Circle any 2 cell basic rec-tangles not completely insideanother
The common elements ineach basic rectangles are whatthey simplify to. Those com-mon elements are called theprime implicant.
22
Example 5 Find the prime impli-cants ofxy0z + x0y0z + x0yz + x0y0z0 + x0yz0
Example 6 Find the prime impli-cants ofxy0wz + x0y0w0z + x0yw0z + x0y0wz0 + x0ywz0
+xywz0 + xywz
3.1 HomeworkSection 7.3 #1-4, Submit4a,d
23
3.2 Logic CircuitsEquivalentsDraw an electrical circuit thatwill replicate an andDraw an electrical circuit
that will replicate an orDraw an electrical circuit
that will replicate(a + b) (b + c)
Write the Boolean equiva-lent of the electrical circuit
24
3.3 HomeworkSection 7.4 #1, 3.
3.4 Not gate
We don’t use not gates25
much because we assume thatboth x and x0 are inputs into anand or or gate.
Example 7 Draw the circuit for theexpression
x + y(x0 + z)
Example 8 Draw the block diagramfor the expression(x+ w)(y0 + z0 + xw) + y0w0 + xand the simplest equivalent cir-cuit.
Example 9 Create the simplest cir-cuit that has lets me turn the
26
hall light on from any of threeswitches.
Example 10 Simplify the circuits shown.27
3.5 Nand and NorGatesGiven the two diagrams shown,generate the function tables forthe NAND and NOR gates
There is a Theorem that we
28
can express any and, or, ornot gate as a combinations ofonly nand gates or only norgates.Show that each type of
gate can be replaced in such afashion.
Example 11 Create a circuit blockdiagram to represent the Booleanexpression
(x + y)0 z + z0
using only nand gates.
There are also two theoremsthat will allow us to create nor-
29
only networks and nand-onlynetworks with less thought,providing they are 2-level.
Theorem: Given any2-level or-and (and-or) net-work, an equivalent networkcan be constructed by simplyreplacing all the or and andgates by nor (nand) gates.The result is an equivalentnor-only ( nand-only) net-work.Define the ideas of 2-level
or-and (and-or) networks.Why does the theorem above
30
always work?
Example 12 Find the block diagramfor the circuit that representsthe Boolean expression¡
x0 + y¢ ¡x+ y0
¢Use the theorem above to makethe nor-only network and provethe two networks are equiva-lent by checking the 4 possibleinputs into both networks.
Example 13 Find the block diagramfor the circuit that represents
31
the Boolean expressionx + y (x + z)
Use the theorem above to makethe nand-only network and showthe two networks are not equiv-alent by checking the 4 possi-ble inputs into both networks.Why does this not fit with thetheorem?
3.5.1 HomeworkSection 7A, # 1,2,4,7 andSubmit 2a,b
32