boolean algebra - peoplebpbsma/downloads and stuff/chapt7.pdfthink truth table. 7. ... the boolean...

32
Boolean Algebra We have already studied two examples of a Boolean algebra last quarter: Sets with the operations , ,A 0 Logical propositions with the operations , , p Notice how we have two operations that involve a

Upload: dinhkhanh

Post on 22-Apr-2018

222 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 2: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 3: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 4: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 5: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 6: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 7: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 8: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 9: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

• 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

Page 10: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 11: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 12: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

• 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

Page 13: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 14: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

∗ 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

Page 15: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 16: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 17: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 18: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 19: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 20: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 21: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 22: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 23: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 24: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 25: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

3.3 HomeworkSection 7.4 #1, 3.

3.4 Not gate

We don’t use not gates25

Page 26: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 27: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

hall light on from any of threeswitches.

Example 10 Simplify the circuits shown.27

Page 28: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 29: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 30: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 31: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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

Page 32: Boolean Algebra - Peoplebpbsma/downloads and stuff/chapt7.pdfThink Truth Table. 7. ... the Boolean function f(x,y)=xy0 +x(x+y0) Show that the expression ... the Boolean expression

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