31
21-04-2014 1 Boolean Algebra 1 Basic Definition. 2

Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

1

Boolean Algebra

1

Basic Definition.

2

Page 2: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

2

Postulate 1: Set and Operators

•(Definition): A Boolean algebra is a closed algebraic systemcontaining a set K of two or more elements and the twooperators · and + which refer to logical “AND” and logical “OR”.

3

Postulate 2: Identity Elements

• There exist 0 and 1 elements in K, such that for every element a in K

• a + 0 = a

• a · 1 = a

• Definitions:

• 0 is the identity element for + operation

• 1 is the identity element for · operation

Note:a · 0 = 0a + 1 = 1

4

Page 3: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

3

Postulate 3: Commutativity

• Binary operators + and · are commutative.

• That is, for any elements a and b in K:

• a + b = b + a

• a · b = b · a

5

Postulate 4: Distributivity

• Binary operator (+) is distributive over (·) and (·) is distributive over (+).

• That is, for any elements a, b and c in K:

• a + (b · c) = (a + b) · (a + c)

• a · (b + c) = (a · b) + (a · c)

6

Page 4: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

4

Postulate 5: Complement

• A unary operation, complementation, exists for every element of K.

• That is, for any elements a in K:

7

Basic Theorems

8

Page 5: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

5

Duality Principle

• Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed into the other and vice-versa by interchanging the operators, + ↔ ·, and identity elements, 0 ↔ 1.

• The two expressions are called the duals of each other.

• Example: dualsA + (BC) = (A+B)(A+C) ↔ A (B+C) = AB + AC

9

Properties of Boolean Algebra

•Properties stated as theorems.

10

Page 6: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

6

11

Theorem 1: Idempotency

• For all elements a in K: x + x = x;

x.x = x.• Proof:

x + x = (x + x)1, (identity element)= (x + x)(x + x`), (complement)= x + x x`, (distributivity)= x + 0, (complement)= x, (complement)

Similar proof for x.x = x

12

Page 7: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

7

Theorem 2: Null Elements Exist• x + 1 = 1 ….. for (+) operator.

• x · 0 = 0 ….. for (·) operator.

• Proof: x + 1 = (x + 1)1, (identity element)

= 1(x + 1), (commutativity)

= (x+ x`)(x + 1), (complement)

= x + x`. 1, (distributivity)

= x + x`, (identity element)

= 1, (complement)

Similar proof for x. 0 = 0.

13

Theorem 3: Involution Holds

• (x`)` = x

• Proof: x + x` = 1 and x.x` = 0, (complements)

or x` + x = 1 and x`.x = 0, (commutativity)

i.e., x is complement of x`

Therefore, x`` = x

14

Page 8: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

8

Theorem 6: Absorption

• a + a b = a

• a (a + b) = a

• Proof: a + a b = a 1 + a b, (identity element)

= a(1 + b), (distributivity)

= a 1, (Theorem 2)

= a, (identity element)

Similar proof for a (a + b) = a.

15

Theorem 5: De Morgan

16

Page 9: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

9

Theorem 4: Associativity

• Binary operators + and · are associative.

• That is, for any elements a, b and c in K:

• a + (b + c) = (a + b) + c

• a · (b · c) = (a · b) · c

17

Operator precedence

•Example:(x+y)`X`.y`

18

Page 10: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

10

Boolean Functions

19

Boolean functions

• Binary variable takes values 0 or 1.

• Boolean function is an expression formed with: binary variables, binary operators (AND, OR), and unary operator (NOT), parentheses, equal sign.

• Function can be 1 or 0.

EX:

F1= xyz`….. When does F1=1?

20

Page 11: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

11

Boolean function representation

Boolean functions can be represented by :

1. Algebraic expression:

2. Truth table:

– We need 2n combinations of 1’s and 0’s.

– A column showing the combinations where function = 1 or 0.

EX: if we have F=xyz, then :we have 23=8 combinations

3. Logical diagram (using AND,OR,NOT gates).21

• Consider the following functions:

F1=xyz` F2=x+y`z

F3=x`y`z+x`yz+xy` F4=xy`+x`z

The Truth table is:

22

Page 12: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

12

• We can see that F3 = F4

• The question: is it possible to find 2 algebraic expressions that specify the same function?

Answer is yes.

• Manipulation of Boolean expression is applied tofind simpler expressions for the same function

23

• Implementation of previous functions using gates:

24

Page 13: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

13

Simpler is better

25

26

Page 14: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

14

Function Minimization using Boolean Algebra

• Examples:

a + ab = a(1+b)=a

a(a + b) = a.a +ab=a+ab=a(1+b)=a.

a + a'b = (a + a')(a + b)=1(a + b) =a+b

a(a' + b) = a. a' +ab=0+ab=ab

27

Try

• F = abc + abc’ + a’c

=(a.b(c+c’)) + a’.c

= ab.(1)+ a’c

=ab+ a’c

28

Page 15: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

15

The other type of question

Show that;

1- ab + ab' = a

2- (a + b)(a + b') = a

1- ab + ab' = a(b+b') = a.1=a

2- (a + b)(a + b') = a.a +a.b' +a.b+b.b'

= a + a.b' +a.b + 0

= a + a.(b' +b) + 0

= a + a.1 + 0

= a + a = a

29

More Examples

• Show that;

(a) ab + ab'c = ab + ac

(b) (a + b)(a + b' + c) = a + bc

(a) ab + ab'c = a(b + b'c)

= a((b+b').(b+c))=a(b+c)=ab+ac

(b) (a + b)(a + b' + c)

= (a.a + a.b' + a.c + ab +b.b' +bc)

= …

30

Page 16: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

16

31

32

Page 17: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

17

33

Page 18: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

1

Philadelphia University

Faculty of Information Technology

Department of Computer Science

Computer Logic Design

By

Dareen Hamoudeh

Dareen Hamoudeh 1

(Standard Forms of Expression)

Minterms and Maxterms

Canonical Forms

Dareen Hamoudeh 2

Page 19: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

2

Why STANDARD FORMS?

• All Boolean expressions, regardless of their form, can be converted into either of two standard forms: the sum-of-products form or the product-of-sums form.

• Standardization makes the evaluation, simplification, and implementation of Boolean expressions much more systematic and easier.

Dareen Hamoudeh 3

Examples

Product Terms : Terms that are ANDed together.

• XYZ

• (A+B)(C+D)(A+D)

Sum Terms: Terms that are ORed together.

• X+Y+Z

• XYZ + VX

Dareen Hamoudeh 4

Page 20: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

3

Minterms

• So, if we have two literals (x,y) with AND operation then we have 4 combinations:

X’Y’ X’Y XY’ XY

Each combination is called minterm.

• Now,For 3 variables we have 23= 8 minterms:

X’Y’Z’ X’Y’Z … XYZ

• In general, if a function has n variables there are 2n

minterms.

Dareen Hamoudeh 5

Minterms

Dareen Hamoudeh 6

Page 21: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

4

Minterms• If we have the function

When does it =1 ?

After implementing its truth table:

We notice that f1 =1 in the terms m1, m4, m7 … so:

Dareen Hamoudeh 7

Minterms

• Also called sum of products (SOP) or Standard Product expression contains:

– Only OR (sum) operations at the “outermost” level.

– Each term that is summed must be a product of literals:

f(x,y,z) = y’ + x’yz’ + xz

• Every function can be written as a sum of minterms, which is a special kind of sum of products form.

• The sum of minterms form for any function is unique.

• If you have a truth table for a function, you can write a sum of minterms expression just by picking out the rows of the table where the function output is 1. And can be expressed in the following notation:

f = x’y’z + xy’z’ + xyz = m1 + m4 + m7

= f(x,y,z) = m(1,4,7)

= f(x,y,z) = (1,4,7)

Dareen Hamoudeh 8

Page 22: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

5

sum of products (SOP)

• Now, if we have the following truth table, can you extract the sum of minterms for the function F2.

Dareen Hamoudeh

The advantage is that any sum of products expression can be implemented using a two-level circuit

• literals and their complements at the “0th” level• AND gates at the first level• a single OR gate at the second level

sum of products (SOP)

Dareen Hamoudeh 10

Page 23: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

6

sum of products (SOP) “complement”

x y z f(x,y,z) f’(x,y,z)

0 0 0 1 0

0 0 1 1 0

0 1 0 1 0

0 1 1 1 0

1 0 0 0 1

1 0 1 0 1

1 1 0 1 0

1 1 1 0 1

f = x’y’z’ + x’y’z + x’yz’ + x’yz + xyz’= m0 + m1 + m2 + m3 + m6

= m(0,1,2,3,6)

f’ = xy’z’ + xy’z + xyz= m4 + m5 + m7

= m(4,5,7)

f’ contains all the minterms not in f

Dareen Hamoudeh 11

Maxterms

• if we have two literals (x,y) with OR operation then we have 4 combinations:

X’+Y’ X’+Y X+Y’ X+Y

Each combination is called maxterm.

• Now,For 3 variables we have 23= 8 minterms:

X’+Y’+Z’ X’+Y’+Z … X+Y+Z

• In general, if a function has n variables there are 2n

maxterms.

Dareen Hamoudeh 12

Page 24: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

7

Maxterms

Dareen Hamoudeh 13

Maxterms• If we have the function

When does it =0 ?

We notice that f1 =0 in the terms M0, M2, M3, M5,M6… so:

F1= (X+Y+Z)(X+Y’+Z)(X+Y’+Z’)(X’+Y+Z’)(X’+Y’+Z) = M0 . M2 . M3 . M5 . M6Dareen Hamoudeh 14

Page 25: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

8

Maxterms

• Also called Product of sums (POS) or Standard Sums expression contains:

– Only AND(product) operations at the “outermost” level.

– Each term must be a Sum of literals:

f(x,y,z) = y’ (x’ + y + z’) (x + z)

• Every function can be written as a product of maxterms, which is a special kind of products of sums form.

• The product of maxterms form for any function is unique.

• If you have a truth table for a function, you can write a product of maxterms expression by picking out the rows of the table where the function output is 0. And can be expressed in the following notation:

F = (X+Y+Z)(X+Y’+Z)(X+Y’+Z’)(X’+Y+Z’)(X’+Y’+Z) = M0 . M2 . M3 . M5 . M6

= F(x,y,z) = ΠM(0,2,3,5,6)

= F(x,y,z) = Π(0,2,3,5,6)

Dareen Hamoudeh 15

Product of sums (POS)

• Now, if we have the following truth table, can you extract the Product of maxterms for the function F2.

Dareen Hamoudeh 16

Page 26: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

9

Product of sums (POS) “complement”

f = (x’ + y + z)(x’ + y + z’)(x’ + y’ + z’)= M4 M5 M7

= ΠM(4,5,7)

f’ = (x + y + z)(x + y + z’)(x + y’ + z)(x + y’ + z’)(x’ + y’ + z)

= M0 M1 M2 M3 M6

= ΠM(0,1,2,3,6)

f’ contains all the maxterms not in f

x y z f(x,y,z) f’(x,y,z)

0 0 0 1 0

0 0 1 1 0

0 1 0 1 0

0 1 1 1 0

1 0 0 0 1

1 0 1 0 1

1 1 0 1 0

1 1 1 0 1

Dareen Hamoudeh 17

Minterms and maxterms are related

• Any minterm mi is the complement of the corresponding maxterm Mi

• For example, m4’ = M4 because (xy’z’)’ = x’ + y + z

Dareen Hamoudeh 18

Page 27: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

10

Converting between standard forms

• We can convert a sum of minterms to a product of maxterms

• In general, just replace the minterms with maxterms, using maxterm numbers that don’t appear in the sum of minterms:

• The same thing works for converting from a product of maxterms to a sum of minterms.

From before f = m(0,1,2,3,6)and f’ = m(4,5,7)

= m4 + m5 + m7

complementing (f’)’ = (m4 + m5 + m7)’so f = m4’ m5’ m7’ [ DeMorgan’s law ]

= M4 M5 M7 [ By the previous page ]= ΠM(4,5,7)

f = m(0,1,2,3,6)= ΠM(4,5,7)

Dareen Hamoudeh 19

Product of Sums

• If f(x, y, z) = sum of minterms (0, 1, 4, 5), represent f as a product of maxterms

– A: product of maxterms(2, 3)

– B: product of maxterms(2, 3, 6, 7)

– C: product of maxterms(0, 1, 4, 5)

– D: product of maxterms(5, 6, 7)

20Dareen Hamoudeh

Page 28: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

11

Sum Of Minterms

Dareen Hamoudeh 21

Example 1

• Express the function F(A,B,C) = AB+A’C in minterm notation

• First term AB misses the variable C, so AND term with (C+C’):

AB= AB(C+C’) = ABC + ABC’ • Second term A’C misses the variable B so, AND

term with (B+B’):A’C= A’C(B+B’)= A’BC + A’B’C

Now we combine the terms:F(A,B,C)=ABC + ABC’ + A’BC + A’B’C

= m7 + m6 + m3 + m1

Dareen Hamoudeh 22

Page 29: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

12

Example 2

• Express E = Y’ + X’Z’ in minterm notation.

E = (X+X’)Y’ + X’Z’(Y+Y’)

= XY’(Z+Z’) + X’Y’(Z+Z’)+X’YZ’+X’Y’Z’

= XY’Z+XY’Z’+X’Y’Z+X’Y’Z’+X’YZ’

= m5 + m4 + m1 + m0 + m2

= m5 + m4 + m2 + m1 + m0

Dareen Hamoudeh 23

Product of maxterms

Dareen Hamoudeh 24

Page 30: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

13

Example 1

Dareen Hamoudeh 25

Example 1 cont.

Dareen Hamoudeh 26

Page 31: Boolean Algebra - Philadelphia University...21-04-2014 5 Duality Principle •Each postulate of Boolean algebra contains a pair of expressions or equations such that one is transformed

21-04-2014

14

Note

Dareen Hamoudeh 27