<<

Switching †Objectives The great advantage of using logical expressions to represent the behavior of gate networks is that there are mathematical tools available to manipulate these expressions. These tools are based on the theory of , so this section will: „ Define Boolean and derive those properties most useful for the design of gate networks. „ Illustrate the use of the of Boolean algebra to simplify logical expressions. „ Establish the connection between the two main behavioral models for gate networks, namely logical expressions and truth tables, using the two standard canonical forms of logical expressions.

EE/CoE 0132 1 Switching Algebra

†Reading Assignment „ Boolean algebra is introduced in section 2.5 of the latest edition of Brown and Vranesic. The classic approaches restrict the presentation to the 2-valued Boolean algebra and start with and theorems involving the operations AND, OR, and NOT. „ An alternate approach, that does not assume that the Boolean algebra has only two elements, is also presented here. It starts from a of axioms using only the operations AND and XOR. It is provided at the end of these notes.

EE/CoE 0132 2 Switching Algebra

1 Boolean Algebra

•Huntington’s Postulates •Proofs •Basic Theorems • Operator Precedence

Boolean Algebra

In 1845, introduced a systematic treatment of logic now called Boolean algebra. Logical statements are built up from:

Variables: a, x, etc. Variables can be used to represent (statements that are either true or false) or signals in digital circuits (voltages that are either high or low, representing 0 or 1).

Operators: The two operators (+, x) are used to combine variables to produce more complex statements or logic functions. These operators must satisfy certain properties.

The most well-known form of Boolean algebra is a two-valued system, in which all variables take values on the set {0, 1} and the operators (+,x) correspond to (OR, AND) respectively. In 1904, E. V. Huntington defined Boolean algebra by providing 6 postulates that must be satisfied, called Huntington’s Postulates:

with respect to the operators: any logical yields a value in the set {0, 1}. • Identity elements with respect to the operators: x + 0 = xxx 1 = x • Commutativity with respect to the operators: x + y = y + xxx y = y x x • Distributivity: x x (y + z) = (x x y) + (x x z) x + (y x z) = (x + y) x (x + z) • Complements exist for all the elements: x + x' = 1 x x x' = 0 • Distinct elements: 0 z 1

In 1938, Claude Shannon showed that a two-valued Boolean Algebra, which he called switching algebra, could be used to describe digital circuits.

•Two elements: {0,1} •Two binary operators: + (OR), x (AND) •One unary operator, the complement '

x y x + y x y x x y x x' 0 0 0 00 0 01 0 1 1 01 0 10 1 0 1 10 0 1 1 1 11 1

Is this really a Boolean algebra? Does it satisfy Huntington’s Postulates?

• Closure with respect to +, x: Yes, both operations produce 0 or 1 for all input combinations. • Identity elements with respect to +, x: Yes, from truth tables, x + 0 = x, x x 1 = x. • Commutativity with respect to +, x: Yes, if x and y columns are swapped, results are unchanged. • Distributivity: Yes (proof to follow). • Complements exist for all the elements: Yes, 0' = 1, 1' = 0. • Distinct Elements: Yes, by definition: 0 z 1.

Proofs: What are they?

Proofs are a tool for establishing new results or theorems in Boolean algebra. The kinds of things we need to prove usually fall into one of several categories.

•Prove that two logical expressions are equivalent. •Prove that two logic networks are functionally equivalent. •Prove that one logical expression is the complement of another. OK, so prove it! Hmmm, how do we do that?

Here are four ways to prove that two expressions are equivalent.

• Perfect Induction: show that the two expressions have identical truth tables. If there are n input variables, this requires 2n input combinations. This is a bad idea if there are more than 3 or 4 variables.

• Axiomatic Proof: apply Huntington’s postulates (or other theorems that have already been proven) to the expressions, until the two expressions are identical.

• Duality Principle:every in Boolean algebra remains valid if we interchange all AND’s and OR’s, and interchange all 0’s and 1’s.

• Proof by contradiction:assume that the hypothesis is false and then prove that the resulting equation can never be true.

Proof of Distributivity of x Over +, by Perfect Induction.

xyzy + zx x (y + z) x x yx x z (x x y) + (x x z) 000 0 0 0 0 0 001 1 0 0 0 0 010 1 0 0 0 0 011 1 0 0 0 0 100 0 0 0 0 0 101 1 1 0 1 1 110 1 1 1 0 1 111 1 1 1 1 1 Proof of Distributivity of + Over x, by Perfect Induction.

xyzy x zx + (y x z) x + yx + z (x + y) x (x + z) 000 0 0 0 0 0 001 0 0 0 1 0 010 0 0 1 0 0 011 1 1 1 1 1 100 0 1 1 1 1 101 0 1 1 1 1 110 0 1 1 1 1 111 1 1 1 1 1

OK, where are we so far?

So far, we have only shown (through 1 rigorous proof and several less formal ) that Huntington’s postulates are satisfied. Therefore, the two valued system with the operations (x, +) as defined above is a Boolean algebra.

Why do we care?

Armed with these 6 postulates, we can now go on to establish other theorems that will help us analyze logic circuits. Basic Theorems These theorems can be verified by examining the truth tables for {+, x, '}.

•Theorem 1 a) x + x = x b) x x x = x •Theorem 2 a) x + 1 = 1 b) x x 0 = 0 •Theorem 3 (x') ' = x •Associativity a) (x + y) + z = x + (y + z) b) (x x y) x z = x x (y x z)

Theorem: DeMorgan’s Law a) (x + y) ' = x ' x y ' Proof: by Perfect Induction.

xy(x + y)(x + y)' x' y' x' x y' 00 0 1 11 1 01 1 0 10 0 10 1 0 01 0 11 1 0 00 0

b) (x x y) ' = x '+ y ' Proof: apply the duality principle to the expression in part a. If we interchange all x and + operators, we obtain the expression in part b. Theorem: Absorption

a) x + (x x y) = x Axiomatic Proof: x + (x x y)= (x x 1) + (x x y) by x x 1 = x = x x (1 + y)by distributivity = x x (y + 1) by commutativity = x x 1by x + 1 = x = x by x x 1 = x

b) x x (x + y) = x Proof: apply the duality principle to the expression in part a. If we interchange all x and + operators, we obtain the expression in part b.

Two More Theorems

•Theorem 7 a) x + (x' x y) = x + y b) x x (x' + y) = x x y •Theorem 8 a) (x x y) + (y x z) + (x' x z) = (x x y) + (x' x z) b) (x + y) x (y + z) x (x'+ z) = (x + y) x (x'+ z)

Try to prove these theorems on your own. Note that each pair of equations are related through the duality principle. Theorem 7b is probably the easiest to prove. So now we have all these theorems. What good are they? Example 1: Find the compliment of the logical f. § · § · f xx¨ yz¸x¨ x yz¸ © ¹ © ¹

Solution: by repeated application of DeMorgan’s Law. f xx yz x x yz xx yz  x yz x yz  x yz x(yxz)(xx yxz)

So now we have all these theorems. What good are they? Example 2: Simplify the previous expression. f x(yxz)(xx yxz)

Solution: by algebraic manipulation. Apply the theorems of Boolean algebra. f x(xx yxz)(yxz) by Commutativity x(yxz)(yxz) by Theorem 7a x(y y)xz by Distributivity x1xz by Postulate 5a xz by Postulate 2b Precedence of Boolean Operators

To avoid confusion or incorrect evaluation, the operators in Boolean expressions are applied according to the following order of precedence:

1. Expressions in parentheses: () 2. NOT: ' 3. AND: x 4. OR: +

Also, it is conventional to omit the x for AND where convenient. As a result, many Boolean expressions can be written in a compact form, often eliminating extraneous parentheses. (xx y)œ xy xx(yz)œ x(yz) (xxz)(yxz)œ xz y z

Reference Sheet: Postulates and Theorems

•Postulate 1: Closure •Theorem 3: Involution (x')' = x •Postulate 2: Identity a) x + 0 = x •Theorem 4: Associativity b) x x 1 = x a) x + (y + z) = (x + y) + z b) x(yz) = (xy)z •Postulate 3: Commutativity a) x + y = y + x •Theorem 5: DeMorgan’s Law b) xy = yx a) (x + y)' = x'y' •Postulate 4: Distributivity b) (xy)' = x' + y' a) x(y + z) = xy + xz •Theorem 6: Absorption b) x + yz = (x + y)(x + z) a) x + xy = x •Postulate 5: Complement b) x(x + y) = x a) x + x' = 1 •Theorem 7: Common Identities b) x x x' = 0 a) x + x'y = x + y b) x(x' + y) = xy •Theorem 1: Idempotency a) x + x = x •Theorem 8: Consensus b) x x x = x a) xy + yz + x'z = xy + x'z b) (x + y)(y + z)(x'+ z) = (x + y)(x'+ z) •Theorem 2: Tautology and Contradiction a) x + 1 = 1 b) x x 0 = 0 Algebraic Simplification † Example 1

( (A †B)•(A•C) )•( (A•B)' (A †B) )

= ( (A•B'+A'•B)•(A•C) )•( (A'+B')+(A•B'+A'•B) ) = ( A•B'•A•C + A'•B•A•C ) • ( A'+B'+A•B'+A'•B ) = ( A•B'•C ) • ( A'+B' + A•B'+A'•B ) = ( A•B'•C ) • (A' + A'•B + B' + A•B' ) = (A•B'•C) • (A'+B') = A•B'•C•A' + A•B'•C•B' = A•B'•C

EE/CoE 0132 3 Switching Algebra

† Example 2

(X•Y' Y•Z)•(Y•Z'X•Z)

= X•Y'•Y•Z' + X•Y'•X•Z + Y•Z•Y•Z' + Y•Z•X•Z

= X•Y'•Z + X•Y•Z = X•Z•(Y'+Y) = X•Z•1 = X•Z

EE/CoE 0132 4 Switching Algebra

2 †Example 3

( ( (X•Y')' + Z•X')' • (X•Y'•Z') )' = ( ( (X•Y')' + Z•X')' )' + (X•Y'•Z')' = (X•Y')' + Z•X') + (X'+Y+Z) = (X'+Y + Z•X') + (X'+Y+Z) = (X'+Y) + (X'+Y+Z) = X'+Y+Z

EE/CoE 0132 5 Switching Algebra

Canonical Forms †Definitions (SOP) „ Literal: Variable or complement of a variable. „ Product Term: A single literal or a product (AND) of 2 or more literals. „ Sum of Products: Logical sum (OR) of product terms. „ Normal Product Term: Product term with no repeated variables. „ Minterm over N Variables: Normal product term with N variables. „ Canonical Sum Of Products: Sum of unique minterms.

EE/CoE 0132 6 Switching Algebra

3 †Definitions (POS) „ Sum Term: A single literal or a sum (OR) of 2 or more literals. „ Product of Sums: Logical product of sum terms. „ Normal Sum Term: Sum term with no repeated variables. „ Maxterm over N variables: Normal sum term with N variables. „ Canonical Product of Sums: Product of unique maxterms.

EE/CoE 0132 7 Switching Algebra

†Truth tables of Minterms „ The of a minterm has exactly one 1.

m0 = m1 = m2 = m3 = m4 = m5 = m6 = m7 = X Y Z X'•Y'•Z' X'•Y'•Z X'•Y•Z' X'•Y•Z X•Y'•Z' X•Y'•Z X•Y•Z' X•Y•Z 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1

„ Note that order is important:

m4(Z, Y, X) = Z•Y'•X'

m4(X, Y, Z) = X•Y'•Z'

EE/CoE 0132 8 Switching Algebra

4 †Truth Tables and Canonical Sum of Products Forms.

A B C m4 m2 m4+m2 m0+m1+m3+m4 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 †Listing the order of variables and the minterm subscripts is enough to completely specify a logical function of those variables. 6A,B,C (0, 1, 3, 4) = m0+m1+m3+m4 = A'•B'•C' + A'•B'•C + A'•B•C + A•B'•C'

EE/CoE 0132 9 Switching Algebra

†Truth Tables of Maxterms „ The truth table of a maxterm has exactly one 0.

M0 = M1 = M2 = M3 = M4 = M5 = M6 = M7 = X Y Z X+Y+Z X+Y+Z' X+Y'+Z X+Y'+Z' X'+Y+Z X'+Y+Z' X'+Y'+Z' X'+Y'+Z' 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0

EE/CoE 0132 10 Switching Algebra

5 †Truth tables and canonical product of sums forms

A B C M4 M2 M4•M2 M2 •M4 •M5 •M7 0 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0

3A,B,C(2, 4, 5, 7) = M2•M4 •M5 •M = (A+B'+C)•(A'+B+C)•(A'+B+C')•(A'+B'+C')

EE/CoE 0132 11 Switching Algebra

†Exercise:

„ Determine the relationship between minterm mi and maxterm Mi

„ Determine an easy way to convert a canonical sum of products to an equivalent canonical product of sums, and vice versa.

EE/CoE 0132 12 Switching Algebra

6 Review †The definitions and axioms that define Boolean algebras. „ The equivalence of different sets of definitions and axioms. † Algebraic proof technique. †Canonical Forms „ Minterms and Maxterms

EE/CoE 0132 13 Switching Algebra

Boolean Algebras, an alternate approach † DEFINITION. A Boolean algebra is a non- B and two binary operations • and † which satisfy the following axioms, for all X, Y, and Z in B.

A1. (X †Y) †Z = X †(Y †Z) Associative A2. X †Y = Y †X Commutative A3. There is an 0 in B, Identity such that X †0 = X A4. X †X = 0 Self Inverse

A5. (X•Y)•Z = X•(Y•Z) Associative A6. X•Y = Y•X Commutative A7. There is an element 1 in B, Identity such that X•1 = X A8. X•X = X Idempotent

A9. X•(Y †Z) = (X•Y) †(X•Z) Distributive

EE/CoE 0132 14 Switching Algebra

7 „ Example: BA2, the two-element Boolean algebra B = {0, 1}, • and † defined by the truth tables for AND and EXCLUSIVE OR. X Y X•Y X Y X†Y 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 †Truth Tables of Expressions in BA2: „ We can use truth tables of expressions to prove theorems and verify axioms, a technique called proof by perfect induction. Z Y X X•Y X•Z Y † Z X• (Y † Z) (X•Y) † (X•Z) 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0

EE/CoE 0132 15 Switching Algebra

†DEFINITION. Two logical expressions in BA2 are equivalent if they have the same truth table. †DEFINITION. The binary operation OR  and the NEGATION (') are defined as follows. D1. X Y = X †Y †(X•Y) D2. X' = 1 †X „ Example: In BA2 we see that + is the familiar OR operation.

X Y X•Y X†Y X †Y †(X•Y) 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1

EE/CoE 0132 16 Switching Algebra

8 † PRINCIPLE OF DUALITY. Given an identity involving only variables, the operations , •, and ', and the constants 0 and 1, another identity can be obtained by interchanging 's with •'s and 0's with 1's. These two identities are said to be duals of one another.

† The following three theorems develop properties of the OR operation that are similar to the AND and the Exclusive OR operations.

THEOREM T1. (Dual of A6) X Y = Y X Proof: X + Y = X † Y † (X•Y) (by D1) = Y † X † (Y•X) (by A2 and A6) = Y + X (by D1) THEOREM T2. (Dual of A8) X + X = X Proof: X X= X †X †X•X (by D1) = 0 † X•X) (by A4) = (X•X) (by A3) = X (by A8)

EE/CoE 0132 17 Switching Algebra

THEOREM T3. (Dual of A5) (X Y) Z = X (Y Z)

Proof: (X Y) Z= (X †Y †X•Y) Z = (X †Y †X•Y) †Z †(X †Y †X•Y)•Z = (X †Y †Z †X•Y) †(X•Z) †(Y•Z) †(X•Y•Z) X (Y Z) = X (Y †Z †Y•Z) = X †(Y †Z †Y•Z) †X•(Y †Z †Y•Z) = X †Y †Z †(X•Y) †(X•Z) † Y•Z) †(X•Y•Z) † The following five theorems show how the special elements 0 and 1 combine with other elements.

THEOREM T4. X•0 = 0

Proof: X• 0 = X•(X†X) = X•X † X•X = X † X = 0

THEOREM T5. X 1 = 1

Proof: This theorem is the dual of Theorem T4.

EE/CoE 0132 18 Switching Algebra

9 THEOREM T6. X 0 = X

Proof: X + 0 = X † 0 † X • 0 = X † 0 † 0 = X † 0 = X

THEOREM T7. 1' = 0 Proof: 1' = 1 †1(by D2) = 0 (by A4)

THEOREM T8. 0' = 1 Proof: This theorem is the dual of T7.

EE/CoE 0132 19 Switching Algebra

†Theorems T9 and T10 are distributive laws for the operations • and . Not only does • distributive over , but  distributes over •.

THEOREM T9. X•(YZ) = (X•Y)(X•Z) Proof: X•(YZ) = X•(Y † Z † Y•Z) (by D1) = (X•Y) † (X•Z) † (X•Y•Z) (by A9) (X•Y)(X•Z) = (X•Y) † (X•Z) † (X•Y) • (X•Z) (by D1) = (X•Y) † (X•Z) † (X•Y•Z) (by A6 and A8)

THEOREM T10. X(Y•Z) = (XY)•(XZ) Proof: This theorem is the dual of T9.

EE/CoE 0132 20 Switching Algebra

10 † The following theorems give three properties of the negation operation that are very useful in simplifying complex expressions.

THEOREM T11. X•X' = 0

Proof: X•X' = X•(1† X) = X•1 † X•X = X † X = 0

THEOREM T12. X  X' = 1

Proof: This is the dual of T11.

THEOREM T13. (X')' = X Proof: (X')' = (1 †X)' (by D2) = 1 †(1 †X) (by D2) = (1 †1) †X (by A1) = 0 †X(by A4) = X (by A3)

EE/CoE 0132 21 Switching Algebra

†The next two theorems establish another relationship between the operations †, , •, and '.

THEOREM T14. X †Y = X•Y' X'•Y

Proof: X•Y'X'•Y = (X•Y') †(X'•Y) †(X•Y')•(X'•Y) (by D1) = (X•Y') †(X'•Y) †(X•X')•(Y•Y') (by A6) = (X•Y') †(X'•Y) †0(by T11 and A8) = (X•Y') †(X'•Y) (by A3) = X•(1 †Y) †(1 †X)•Y (by D2) = X †(X•Y) †Y †(X•Y) (by A9) = (X †Y) †(X•Y †X•Y) (by A2) = (X †Y) †0(by A4) = (X †Y) (by A3)

THEOREM T15. X †Y = (X + Y)•(X' + Y') Proof: Exercise. Don’t use definitions D1 or D2.

EE/CoE 0132 22 Switching Algebra

11 †Theorem T16 and its dual, Theorem T17, are known as DeMorgan's Law. 7+(2R(07 (X•Y)' = X' + Y'

Proof: (X') + (Y') = X' †Y' †X'•Y' (by D1)

= (1 †X) †(1 †Y) †(1 †X)•(1 †Y) (by D2) = (1 †1) †X †Y †1 †X †Y †X•Y (by A2 and A9) = 1 †X•Y (by A4) = (X•Y)' (by D2)

THEOREM T17. (X Y)' = X'•Y'

Proof: This theorem is the dual of T16.

EE/CoE 0132 23 Switching Algebra

†The following theorems are useful for simplifying complex expressions since they show how an expression can be replaced by an equivalent expression with fewer symbols.

THEOREM T18. X•(X Y) = X Proof: X•(X Y) = X•(X †Y †X•Y) (by D1) = (X•X) †(X•Y) †(X•X•Y) (by A9) = X †(X•Y) †(X•Y) (by A8) = X †0(by A4) = X (by A3)

THEOREM T19. X  X•Y) = X

Proof: This theorem is the dual of T18.

EE/CoE 0132 24 Switching Algebra

12 THEOREM T20. X•(X'  Y) = X•Y Proof: X•(X'  Y) = X•(X'†Y †X'•Y) (by D1) = (X•X') †(X•Y) †(X•X'•Y) (by A9) = 0 †X•Y †0(by T11) = X•Y (by A3)

THEOREM T21. X  X'•Y = X  Y Proof: This theorem is the dual of T20.

DEFINITION. The binary operation {is defined as follows. D3. (X {Y) = (X †Y)'

EE/CoE 0132 25 Switching Algebra

†The last two theorems can be viewed as alternative definitions of the operation { in terms of the operations , •, and '.

THEOREM T22. (X{Y) = X'•Y' X•Y

Proof: Exercise.

THEOREM T23. (X{Y) = (X'  Y)•(X  Y')

Proof: Exercise.

EE/CoE 0132 26 Switching Algebra

13 †Exercises:

„ Let X be a set and P(X) be the set of all of X. Describe how you would prove that P(X) with the operations of set intersection, union, and complementation is a Boolean algebra.

„ Prove that NAND and NOR are universal primitives .

EE/CoE 0132 27 Switching Algebra

14