Boolean Algebra & Switching Functions

21
C. E. Stroud Boolean Algebra & Switching Functions (9/07) 1 Boolean Algebra Also known as Switching Algebra Invented by mathematician George Boole in 1849 Used by Claude Shannon at Bell Labs in 1938 To describe digital circuits built from relays Digital circuit design is based on Boolean Algebra • Attributes • Postulates • Theorems These allow minimization and manipulation of logic gates for optimizing digital circuits

Transcript of Boolean Algebra & Switching Functions

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

1

Boolean Algebra• Also known as Switching Algebra

› Invented by mathematician George Boole in 1849› Used by Claude Shannon at Bell Labs in 1938

• To describe digital circuits built from relays

• Digital circuit design is based on› Boolean Algebra

• Attributes• Postulates • Theorems

› These allow minimization and manipulation of logic gates for optimizing digital circuits

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

2

Boolean Algebra Attributes• Binary

› A1a: X=0 if X=1› A1b: X=1 if X=0

• Complement› aka invert, NOT› A2a: if X=0, X’=1› A2b: if X=1, X’=0

- The tick mark ’ means complement, invert, or NOT

- Other symbol for complement: X’=X

X•YYX

111001010000

• AND operation› A3a: 0•0=0› A4a: 1•1=1› A5a: 0•1=1•0=0

- The dot • means AND- Other symbol for AND:

X•Y=XY (no symbol)

• OR operation› A3b: 1+1=1› A4b: 0+0=0› A5b: 1+0=0+1=1

- The plus + means OR

X+YYX

111

101

110

000

0110

X’X

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

3

Boolean Algebra Postulates

• Identity Elements›› P2a: X+0=XP2a: X+0=X›› P2b: XP2b: X••1=X1=X

• Commutativity›› P3a: X+Y=Y+XP3a: X+Y=Y+X›› P3b: XP3b: X••Y=YY=Y••XX

• Complements›› P6a: X+XP6a: X+X’’=1=1›› P6b: XP6b: X••XX’’=0=0

00001111

XX’’

11000000

XX••YY

11110000

XX••11

11000000

YY••XX XX••XX’’YYXX

001111000011001100000000

00001111

XX’’

11111100

X+YX+Y

11111100

Y+XY+X

11110000

X+0X+0 X+XX+X’’YYXX

111111110011111100110000

OR operation

AND operation

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

4

Boolean Algebra Postulates• Associativity

›› P4a: (X+Y)+Z=X+(Y+Z)P4a: (X+Y)+Z=X+(Y+Z)›› P4b: (XP4b: (X••Y)Y)••Z=XZ=X••(Y(Y••Z)Z)

1111000000000000

XX••YY

1100000000000000

(X(X••Y)Y)••ZZ

1111111111111100

X+(Y+Z)X+(Y+Z)

0011111111111100

0000001111000011

0000111111110011

0000111111001111

11

110000YY

11

000000

YY••ZZ

11

111100

(X+Y)+Z(X+Y)+Z

11

111100

Y+ZY+Z

11

110000

X+YX+Y XX••(Y(Y••Z)Z)ZZXX

111111

000000001100000000

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

5

Boolean Algebra Postulates• Distributivity

›› P5a: X+(YP5a: X+(Y••Z) = (X+Y)Z) = (X+Y)••(X+Z) (X+Z) ›› P5b: XP5b: X••(Y+Z) = (X(Y+Z) = (X••Y)+(XY)+(X••Z)Z)

1111000000000000

XX••YY

1100110000000000

XX••ZZ

1111110000000000

XX••Y+Y+XX••ZZ

1111110011111100

Y+ZY+Z

1111110000000000

XX••(Y+Z)(Y+Z)

1111111111000000

X+ X+ (Y(Y••Z)Z)

1100000011000000

YY••ZZ

111111111100111111000011111111110011111111001111

11

110000YY

11

001100

X+ZX+Z

11

000000

(X+Y)(X+Y)••(X+Z)(X+Z)

11

110000

X+YX+YZZXX

1111

000011000000

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

6

Boolean Algebra Theorems

• Idempotency›› T1a: X+X=XT1a: X+X=X›› T1b: XT1b: X••X=XX=X

• Null elements›› T2a: X+1=1T2a: X+1=1›› T2b: XT2b: X••0=00=0

• Involution›› T3: (XT3: (X’’))’’=X=X=X=X

11000000

XX••YY

00000000

XX••00

11111100

X+YX+Y

00001111

XX’’

11110000

XX••XX

11111111

X+1X+1

11110000

X+XX+X XX’’’’YYXX

111111110011001100000000

OR AND

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

7

Boolean Algebra Theorems• Absorption (aka covering)

›› T4a: X+(XT4a: X+(X••Y)=XY)=X›› T4b: XT4b: X••(X+Y)=X(X+Y)=X›› T5a: X+(XT5a: X+(X’’••Y)=X+YY)=X+Y›› T5b: XT5b: X••(X(X’’+Y)=X+Y)=X••YY

0000

1111

XX’’

0000

1100

XX’•’•YY

1111

1100

X+X+(X(X’•’•Y)Y)

1100

0000

XX••YY

1100

0000

XX••(X(X’’+Y)+Y)

1111

1100

X+YX+Y

1111

0000

XX••(X+Y)(X+Y)

1100

1111

XX’’+Y+Y

1111

0000

X+X+(X(X••Y)Y)YYXX

11110011

11000000

OR AND

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

8

Boolean Algebra Theorems• Absorption (aka combining)

›› T6a: (XT6a: (X••Y)+(XY)+(X••YY’’)=X)=X›› T6b: (X+Y)T6b: (X+Y)••(X+Y(X+Y’’)=X)=X

0011

0011

YY’’

1100

0000

XX••YY

1111

0000

(X+Y)(X+Y)••(X+Y(X+Y’’))

1111

1100

X+YX+Y

1111

0000

(X(X••Y)+Y)+(X(X••YY’’))

1111

0011

X+YX+Y’’

0011

0000

XX••YY’’YYXX

11110011

11000000

OR AND

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

9

Boolean Algebra Theorems• Absorption (aka combining)

›› T7a: (XT7a: (X••Y)+(XY)+(X••YY’•’•Z)=(XZ)=(X••Y)+(XY)+(X••Z)Z)›› T7b: (X+Y)T7b: (X+Y)••(X+Y(X+Y’’+Z) = (X+Y)+Z) = (X+Y)••(X+Z)(X+Z)

1111111111000000

(X+Y)(X+Y)••(X+Y(X+Y’’+Z)+Z)

1111111111001100

X+ZX+Z

1100110000000000

XZXZ

1111110000000000

(XY)+(XY)+(XZ)(XZ)

1111111111110000

X+YX+Y

1111111111001111

X+YX+Y’’+Z+Z

1111111111000000

(X+Y)(X+Y)••(X+Z)(X+Z)

1111110000000000

(XY)+(XY)+(XY(XY’’Z)Z)

000000111100000011000011110011110011001100001111

11

110000YY

11

000000

XYXY

00

000000

XYXY’’ZZ

00

001111

YY’’ZZXX

1111

000011000000

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

10

Boolean Algebra Theorems• DeMorgan’s theorem (very important!)

›› T8a: (X+Y)T8a: (X+Y)’’= X= X’’••YY’’• X+Y = X•Y break (or connect) the bar & change the sign

›› T8b: (XT8b: (X••Y)Y)’’= X= X’’+Y+Y’’• X•Y = X+Y break (or connect) the bar & change the sign

› Generalized DeMorgan’s theorem:• GT8a: (X1+X2+…+Xn-1+Xn)’= X1’•X2’•…•Xn-1’•Xn’• GT8b: (X1•X2•…•Xn-1•Xn)’= X1’+X2’+…+Xn-1’+Xn’

0011

1111

(X(X••Y)Y)’’

0000

1111

XX’’

0011

0011

YY’’

1100

0000

XX••YY

0011

1111

XX’’+Y+Y’’

1111

1100

X+YX+Y

0000

0011

(X+Y)(X+Y)’’

0000

0011

XX’•’•YY’’YYXX

11110011

11000000

OR AND

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

11

Boolean Algebra Theorems• Consensus Theorem

›› T9a: (XT9a: (X••Y)+(XY)+(X’•’•Z)+(YZ)+(Y••Z) = (XZ) = (X••Y)+(XY)+(X’•’•Z)Z)›› T9b: (X+Y)T9b: (X+Y)••(X(X’’+Z)+Z)••(Y+Z) = (X+Y)(Y+Z) = (X+Y)••(X(X’’+Z)+Z)

1100110011110000

(X+Y)(X+Y)••(X(X’’+Z)+Z)••(Y+Z)(Y+Z)

1100000011000000

YZYZ

1111110011111100

Y+ZY+Z

1111000011001100

(XY)+(XY)+(X(X’’Z)Z)

1111111111110000

X+YX+Y

1100110011111111

XX’’+Z+Z

1100110011110000

(X+Y)(X+Y)••(X(X’’+Z)+Z)

1111000011001100

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

110011111100000000000011000000110011001100001111

11

110000YY

11

000000

XYXY

00

001100

XX’’ZZ

00

111111

XX’’ZZXX

1111

000011000000

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

12

More Theorems?• Shannon’s expansion theorem (also very important!)

› T10a: f(X1,X2,…,Xn-1,Xn)=(X1’•f(0,X2,…,Xn-1,Xn))+(X1•f(1,X2,…,Xn-1,Xn))• Can be taken further:

- f(X1,X2,…,Xn-1,Xn)= (X1’•X2’•f(0,0,…,Xn-1,Xn))+ (X1•X2’•f(1,0,…,Xn-1,Xn)) + (X1’•X2•f(0,1,…,Xn-1,Xn))+(X1•X2•f(1,1,…,Xn-1,Xn))

• Can be taken even further:- f(X1,X2,…,Xn-1,Xn)= (X1’•X2’•…•Xn-1’•Xn’•f(0,0,…,0,0))

+ (X1•X2’•…•Xn-1’•Xn’•f(1,0,…,0,0)) + …+ (X1•X2•…•Xn-1•Xn•f(1,1,…,1,1))

› T10b: f(X1,X2,…,Xn-1,Xn)=(X1+f(0,X2,…,Xn-1,Xn))•(X1’+ f(1,X2,…,Xn-1,Xn))• Can be taken further as in the case of T10a

• We’ll see significance of Shannon’s expansion theorem later

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

13

Principle of Duality• Any theorem or postulate in Boolean algebra

remains true if:› 0 and 1 are swapped, and› • and + are swapped

- BUT, be careful about operator precedence!!!• Operator precedence order:

1) Left-to-right2) Complement (NOT)3) AND4) OR

• Use parentheses liberally to ensure correct Boolean logic equation

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

14

Postulates w/ Precedence & Duality

aa••aa’’=0=0a+aa+a’’=1=16aa••(b+c(b+c) = () = (aa••b)+(ab)+(a••cc))a+(ba+(b••cc) = () = (a+b)a+b)••(a+c(a+c) ) 5((aa••b)b)••cc==aa••(b(b••cc))((a+b)+ca+b)+c==a+(b+ca+(b+c))4a••b=b••aa+b=b+a3aa••1=a1=aa+0=aa+0=a2

b. duala. expressionP.

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

15

Theorems w/ Precedence & Duality

f(X)=(x1+f(0,…,xn))(x1’+ f(1, …,xn))f(X)=x1’f(0,…,xn)+x1f(1, …,xn)10(a+b)(a’+c)(b+c)= (a+b)(a’+c)ab+a’c+bc=ab+a’c9(ab)’=a’+b’(a+b)’=a’b’8(a+b)(a+b’+c)=(a+b)(a+c)ab+ab’c=ab+ac7(a+b)(a+b’)=aab+ab’=a6a(a’+b)=aba+a’b=a+b5a(a+b)=aa+ab=a4

a’’=a3a•0=0a+1=12a•a=aa+a=a1

b. duala. expressionTh.

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

16

Switching Functions• For n variables, there are 2n possible

combinations of values› From all 0s to all 1s

• There are 2 possible values for the output of a function of a given combination of values of nvariables› 0 and 1

• There are 22n different switching functions for n variables

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

17

Switching Function Examples

• n=0 (no inputs) 22n = 220 = 21 = 2› Output can be either 0 or 1

• n=1 (1 input, A) 22n = 221 = 22 = 4› Output can be 0, 1, A, or A’

switchfunction

n=0

output

switchfunction

n=1

outputA A f0 f1 f2 f30 0 1 0 11 0 0 1 1

f0 = 0f1 = A’f2 = Af3 = 1

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

18

Switching Function Examples• n=2 (2 inputs, A and B) 22n = 222 = 24 = 16

A B f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f150 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

f0 = 0 logic 0f1 = A’B’ = (A+B)’ NOT-OR or NORf2 = A’Bf3 = A’B’+A’B = A’(B’+B) = A’ invert A

switchfunction

n=2

outputA

B

Most frequently used Less frequently used Least frequently used

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

19

Switching Function Examples• n=2 (2 inputs, A and B) 22n = 222 = 24 = 16

A B f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f150 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

switchfunction

n=2

outputA

B

f4 = AB’f5 = A’B’+AB’ = (A’+A)B’ = B’ invert Bf6 = A’B+AB’ exclusive-ORf7 = A’B’+A’B+AB’ = A’(B’+B)+(A’+A)B’

= A’+B’ = (AB)’ NOT-AND or NANDMost frequently used Less frequently used Least frequently used

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

20

Switching Function Examples• n=2 (2 inputs, A and B) 22n = 222 = 24 = 16

A B f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f150 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

switchfunction

n=2

outputA

B

f8 = AB ANDf9 = A’B’+AB exclusive-NORf10 = A’B+AB = (A’+A)B = B buffer Bf11 = A’B’+A’B+AB = A’(B’+B)+(A’+A)B = A’+B

Most frequently used Less frequently used Least frequently used

C. E. Stroud Boolean Algebra & Switching Functions (9/07)

21

Switching Function Examples• n=2 (2 inputs, A and B) 22n = 222 = 24 = 16

A B f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f150 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

switchfunction

n=2

outputA

B

f12 = AB’+AB = A(B’+B) = A buffer A f13 = A’B’+AB’+AB = A(B’+B)+A’B’ = A+A’B’ = A+B’f14 = A’B+AB’+AB = A(B’+B)+(A’+A)B = A+B ORf15 = A’B’+A’B+AB’+AB = A’(B’+B)+A(B’+B)

= A’+A = 1 logic 1Most frequently used Less frequently used Least frequently used