boolean algebra

52
©2004 Brooks/Cole FIGURES FOR CHAPTER 2 Boolean Algebra Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter in the book includes: Objectives Study Guide 2.1 Introduction 2.2 Basic Operations 2.3 Boolean Expressions and Truth Tables 2.4 Basic Theorems 2.5 Commutative, Associative, and Distributive Laws 2.6 Simplification Theorems 2.7 Multiplying Out and Factoring 2.8 DeMorgan’s Laws Problems Laws and Theorems of Boolean Algebra

Upload: kanyuma-jitjumnong

Post on 21-May-2015

511 views

Category:

Education


1 download

TRANSCRIPT

Page 1: boolean algebra

©2004 Brooks/Cole

FIGURES FOR

CHAPTER 2

Boolean Algebra

Click the mouse to move to the next page.Use the ESC key to exit this chapter.

This chapter in the book includes:ObjectivesStudy Guide

2.1 Introduction2.2 Basic Operations2.3 Boolean Expressions and Truth Tables2.4 Basic Theorems2.5 Commutative, Associative, and Distributive Laws2.6 Simplification Theorems2.7 Multiplying Out and Factoring2.8 DeMorgan’s Laws

ProblemsLaws and Theorems of Boolean Algebra

Page 2: boolean algebra

©2004 Brooks/Cole

The basic mathematics needed for the study of the logic design of digital systems is Boolean algebra. Boolean algebra has many other applications including set theory and mathematical logic, but we will restrict ourselves to its application to switching circuits in this text. Because all of the switching devices which we will use are essentially two-state devices (such as a transistor with high or low output voltage), we will study the special case of Boolean algebra in which all of the variables assume only one of two values. This two-valued Boolean algebra is often referred to as switching algebra. George Boole developed Boolean algebra in 1847 and used it to solve problems in mathematical logic. Claude Shannon first applied Boolean algebra to the design of switching circuits in 1939.

2.1 IntroductionBoolean Algebra

Page 3: boolean algebra

©2004 Brooks/Cole

We will use a Boolean variable, such as X or Y. to represent the input or output of a switching circuit. We will assume that each of these variables can take on only two different values. The symbols "o" and "1" are used to represent these two different values. Thus, if Xis a Boolean (switching) variable, then either X= o or X = 1.

The symbols "o" and "1" used in Boolean algebra do not have a numeric value; instead they represent two different states in a logic circuit and are the two values of a switching variable. In a logic gate circuit, o (usually) represents a range of low voltages, and 1 represents a range of high voltages. In a switch circuit, o (usually) represents an open switch, and 1 represents a closed circuit. In general, o and 1 can be used to represent the two states in any binary-valued system.

Page 4: boolean algebra

©2004 Brooks/Cole

The basic operations of Boolean algebra are AND, OR, and complement (or inverse). The complement of 0 is 1, and the complement of 1 is 0. Symbolically, we write

2.2 Basic Operations

0' = 1 and 1' = 0

X' = 1 if X = 0 and X' = 0 if X = 1

where the prime (') denotes complementation. If X is a switching variable,

Page 5: boolean algebra

©2004 Brooks/Cole

An alternate name for complementation is inversion, and the electronic circuit which forms the inverse of X is referred to as an inverter. Symbolically, we represent an inverter by

Section 2.2, p. 34

Page 6: boolean algebra

©2004 Brooks/Cole

where the circle at the output indicates inversion. If a logic 0 corresponds to a low voltage and a logic 1 corresponds to a high voltage, a low voltage at the inverter input produces a high voltage at the output and vice versa. Complementation is sometimes referred to as the NOT operation because X = 1 if X is not equal to 0.

 

The AND operation can be defined as follows:

Page 7: boolean algebra

©2004 Brooks/Cole

 

Section 2.2, p. 34

Page 8: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 34

Note that C = 1 if (if and only if) A and B are both 1, hence, the name AND operation. A logic gate which performs the AND operation is represented by

Page 9: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

The dot symbol (.) is frequently omitted in a Boolean expression, and we will usually write AB instead of A ~ B. The AND operation is also referred to as logical (or Boolean) multiplication.The OR operation can be defined as follows: 

 

Page 10: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

where" + " denotes OR. If we write C = A + B, then given the values of A and B, we can determine C from the following table:

Page 11: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

Note that C = 1 if A or B (or both) is 1, hence, the name OR operation. This type of OR operation is sometimes referred to as inclusive-OR. A logic gate which performs the OR operation is represented by

The OR operation is also referred to as logical (or Boolean) addition. Electronic circuits which realize inverters and AND and OR gates are described in Appendix A.

Page 12: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

Next, we will apply switching algebra to describe circuits containing switches. We will label each switch with a variable. If switch X is open, then we will define the value of X to be 0; if switch X is closed, then we will define the value of X to be 1.

Page 13: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

Now consider a circuit composed of two switches in a series. We will define the transmission between the terminals as T = 0 if there is an open circuit between the terminals and T = 1 if there is a closed circuit between the terminals.

Page 14: boolean algebra

©2004 Brooks/Cole

Section 2.2, p. 35

Now we have a closed circuit between terminals 1 and 2 (T = 1) iff (if and only if) switch A is closed and switch B is close.. Stating this algebraically,

Next consider a circuit composed of two switches in parallel.

 

Page 15: boolean algebra

©2004 Brooks/Cole

In this case, we have a closed circuit between terminals 1 and 2 if switch A is closed or switch B is closed. Using the same convention for defining variables as above, an equation which describes the behavior of this circuit is

Thus, switches in a series perform the AND operation and switches in parallel perform the OR operation.

 

Page 16: boolean algebra

©2004 Brooks/Cole

Boolean expressions are formed by application of the basic operations to one or more variables or constants. The simplest expressions consist of a single constant or variable, such as o, X. or Y. More complicated expressions are formed by combining two or more other expressions using AND or OR, or by complementing another expression. Examples of expressions are

2.3 Boolean Expressions and Truth Tables

AB’+C (2-1)[AC+D]’+BE (2-2)

Page 17: boolean algebra

©2004 Brooks/Cole

Parentheses are added as needed to specify the order in which the operations are performed. When parentheses are omitted, complementation is performed first followed by AND and then OR. Thus in Expression (2-1), B' is formed first, then AG', and finally AB' + C.

Each expression corresponds directly to a circuit of logic gates. Figure 2-1 gives the circuits for Expressions (2-1) and (2-2).

Page 18: boolean algebra

©2004 Brooks/Cole

Figure 2-1: Circuits for Expressions (2-1) and (2-2)

Page 19: boolean algebra

©2004 Brooks/Cole

An expression is evaluated by substituting a value of 0 or 1 for each variable. If A = B = C = 1 and D = E = 0, the value of Expression (2-2) is

 

Each appearance of a variable or its complement in an expression will be referred to as a literal. Thus, the following expression, which has three variables, has 10 literals:ab'c + a'b + a'bc' +

b'c'

Page 20: boolean algebra

©2004 Brooks/Cole

When an expression is realized using logic gates, each literal in the expression corresponds to a gate input.

A truth table (also called a table of combinations) specifies the values of a Boolean expression for every possible combination of values of the variables in the expression. The name truth table conies from a similar table which is used in symbolic logic to list the truth or falsity of a statement under all possible conditions. We can use a truth table to specify the output values for a circuit of logic gates in terms of the values of the input variables. The output of the circuit in Figure 2-2(a) is F = A' ± B. Figure 2-2(b) shows a truth table which specifies the output of the circuit for all possible combinations of values of the inputs A and B. The first two columns list the four combinations of values of A and B, and the next column gives the corresponding values of A' . The last column, which gives the values of A' + B. is formed by ORing together corresponding values of amid B in each row.

Page 21: boolean algebra

©2004 Brooks/Cole

Figure 2-2: 2-Input Circuit and Truth Table

Page 22: boolean algebra

©2004 Brooks/Cole

Next, we will use a truth table to specify the value of Expression (2-1) for all possible combinations of values of the variables A, B, and C. On the left side of Table 2-1, we list the values of the variables A. B. and C. Because each of the three variables can assume the value 0 or 1, there are 2 x 2 x 2 = 8 combinations of values of the variables. These combinations are easily obtained by listing the binary. numbers 000, 001, .. . , 111. In the next three columns of the truth table, we compute B'. AB'. and AB' + C, respectively.

Page 23: boolean algebra

©2004 Brooks/Cole

Two expressions are equal if they have the same value for every possible combination of the variables. The expression (A + C)(B' + C) is evaluated using the last three columns of Table 2-1. Because it has the same value as AB' + C for all eight combinations of values of the variables A, B, and C, we conclude

 AB' + C = (A + C)(B' + C) (2-3)

If an expression has n variables, and each variable can have the value 0 or 1, the number of different combinations of values of the variables is

Page 24: boolean algebra

©2004 Brooks/Cole

A B C B’ AB’ AB’+C A+C B’+C (A+C)(B’+C) 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 1

Table 2-1: Truth Table for 3 variables

Therefore, a truth table for an n-variable expression will have 2n rows.

Page 25: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 38

2.4 Basic TheoremsThe following basic laws and

theorems of Boolean algebra involve only a single variable: Operations with 0 and 1 :

 

 

 

Idempotent laws

Involution law 

Page 26: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 38

Each of these theorems is easily proved by showing that it is valid for both of the possible values of X. For example, to prove X +X' = 1, we observe that if

 

 

Laws of complementarity

Any expression can be substituted for the variable X in these. theorems. Thus, by Theorem (2-5), 

 

Page 27: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 38

We will illustrate some of the basic theorems with circuits of switches. As before, 0 will represent an open circuit or open switch, and 1 will represent a closed circuit or closed switch. If two switches are both labeled with the variable A, this means that both switches are open when A = 0 and both are closed when A = 1. Thus the circuit

and by Theorem (2-8D).

 

Page 28: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 38

can be replaced with a single switch:

 

Page 29: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 39

which illustrates the theorem A + A = A. A switch in parallel with an open circuit is equivalent to the switch alone

Page 30: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 39

while a switch in parallel with a short circuit is equivalent to a short: circuit.

Page 31: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 39

If a switch is labeled A', then it is open when A is closed and conversely. Hence, A in parallel with A' can be replaced with a closed circuit because one or the other of the two switches is always closed.

Page 32: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 39

Similarly, switch A in series with A' can be replaced with an open circuit (why?).

Page 33: boolean algebra

©2004 Brooks/Cole

Section 2.4, p. 39

Many of the laws of ordinary algebra, such as the commutative, and associative laws, also apply to Boolean algebra. The commutative laws for AND and OR, which follow directly from the definitions of the AND and OR operations, are

2.5 Commutative, Associative, and Distributive Laws

 

This means that the order in which the variables are written will not affect the result of applying the AND and OR operations.

Page 34: boolean algebra

©2004 Brooks/Cole

The associative laws also apply to AND and OR: 

When forming the AND (or OR) of three variables, the result is independent of which pair of variables we associate together first, so parentheses can be omitted as indicated in Equations (2-10) and (2-10D).

 

We will prove the associative law for AND by using a truth table (Table 2-2). On the left side of the table, we list all combinations of values of the variables X. Y, and Z. In the next two columns of the truth table, we compute XY and YZ for each combination of values of X. Y and Z. Finally, we compute (XY)Z and X(YZ). Because (XY)Z and X(17Z) are equal for all possible combinations of values of the variables, we conclude that Equation (2-10) is valid.

Page 35: boolean algebra

©2004 Brooks/Cole

Table 2-2: Proof of Associative Law for AND

Page 36: boolean algebra

©2004 Brooks/Cole

Figure 2-3 illustrates the associative laws using AND and OR gates. In Figure 2-3(a)two two-input AND gates are replaced with a single. three-input AND gate. Similarly, in Figure 2-3(b) two two-input OR gates are replaced with a single three-input OR gate.

Figure 2-3: Associative Law for AND and OR

Page 37: boolean algebra

©2004 Brooks/Cole

When two or more variables are ANDed together, the value of the result will be 1 if all of the variables have the value 1. If any of the variables have the value 0, the result of the AND operation will be 0. For example,When two or more variables are ORed together, the value, of the result will be 1 if any of the variables have the value 1. The result of the OR operation will be o if all of the variables have the value o. For example,

 

 

Page 38: boolean algebra

©2004 Brooks/Cole

Using a truth table, it is easy to show that the distributive law is valid:

In addition to the ordinary distributive law, a second distributive law is valid for Boolean algebra but not for ordinary algebra:

 

 

Page 39: boolean algebra

©2004 Brooks/Cole

Proof of the second distributive law follows: 

 

  

 

 

The ordinary distributive law states that the AND operation distributes over OR, while the second distributive law states that OR distributes over AND. This second law is very useful in manipulating Boolean expressions. In particular, an expression like A + BC, which cannot be factored in ordinary algebra, is easily factored using the second distributive, law:

 

Page 40: boolean algebra

©2004 Brooks/Cole

In each case, one expression can be replaced by a simpler one. Because each expression corresponds to a circuit of logic gates, simplifying an expression leads to simplifying the corresponding logic circuit

2.6 Simplification Theorems

 

 

 

 

 

 

The following theorems are useful in simplifying Boolean expressions:

Page 41: boolean algebra

©2004 Brooks/Cole

The proof of the remaining theorems is left as an exercise.

We will illustrate Theorem (2-14D), using switches. Consider the following circuit:

Each of the preceding theorems can be proved by using a truth table, or they can be proved algebraically starting with the basic theorems.

Page 42: boolean algebra

©2004 Brooks/Cole

Its transmission is T = Y+ XY' because there is a closed circuit between the terminals if switch Y is closed or switch X is closed and switch Y' is closed. The following circuit is equivalent because if Y is closed (Y = 1) both circuits have a transmission of 1; if Y is open (Y' = 1) both circuits have a transmission of X.

Section 2.6, p. 42

Page 43: boolean algebra

©2004 Brooks/Cole

The following example illustrates simplification of a logic gate circuit using one of the theorems. In Figure 2-4, the output of circuit (a) is

Section 2.6, p. 42

 

By Theorem (2-14), the expression for F simplifies to AB. Therefore, circuit (a) can be replaced with the equivalent circuit (b).

Page 44: boolean algebra

©2004 Brooks/Cole

Figure 2-4: Equivalent Gate Circuits

Any expressions can be substituted for X and Yin the theorems.

Page 45: boolean algebra

©2004 Brooks/Cole

EXAMPLE 1 Simplify Z = A'BC + A'This expression has the same form as (2-13) if we let X = A' and Y = BCTherefore, the expression simplifies to Z = X + X Y = X = A'.

Simplify (p. 42-43)

Page 46: boolean algebra

©2004 Brooks/Cole

The following example illustrates simplification of a logic gate circuit using one of the theorems. In Figure 2-4, the output of circuit (a) is

Section 2.6, p. 42

 

By Theorem (2-14), the expression for F simplifies to AB. Therefore, circuit (a) can be replaced with the equivalent circuit (b).

Page 47: boolean algebra

©2004 Brooks/Cole

EXAMPLE 1: Factor A + B'CD. This is of the form X + YZwhere X = A, Y = B', and Z = CD, so

A + B'CD = (X + Y)(X + Z) = (A + B')(A + CD) A + CD can be factored again using the second distributive law, so

A + B'CD = (A + B')(A + C)(A + D)

EXAMPLE 2: Factor AB' + C'D

EXAMPLE 3: Factor C'D + C'E' + G'H

Factor (p. 44-45)

Page 48: boolean algebra

©2004 Brooks/Cole

Figure 2-5: Circuits for Equations (2-15) and (2-17)

Page 49: boolean algebra

©2004 Brooks/Cole

Figure 2-6: Circuits for Equations (2-18) and (2-20)

Page 50: boolean algebra

©2004 Brooks/Cole

Operations with 0 and 1:1. X + 0 = X 1D. X • 1 = X2. X +1 = 1 2D. X • 0 = 0 Idempotent laws:3. X + X = X 3D. X • X = X Involution law:4. (X')' = X Laws of complementarity:5. X + X' = 1 5D. X • X' = 0 

LAWS AND THEOREMS (a)

Page 51: boolean algebra

©2004 Brooks/Cole

Commutative laws:6. X + Y = Y + X 6D. XY = YX Associative laws:7. (X + Y) + Z = X + (Y + Z) 7D. (XY)Z = X(YZ) = XYZ = X + Y + Z Distributive laws:8. X(Y + Z) = XY + XZ 8D. X + YZ = (X + Y)(X + Z)  Simplification theorems:9. XY + XY' = X 9D. (X + Y)(X + Y') = X10. X + XY = X 10D. X(X + Y) = X11. (X + Y')Y = XY 11D. XY' + Y = X + Y

LAWS AND THEOREMS (b)

Page 52: boolean algebra

©2004 Brooks/Cole

DeMorgan's laws:12. (X + Y + Z +...)' = X'Y'Z'... 12D. (XYZ...)' = X' + Y' + Z' +...  Duality:13. (X + Y + Z +...)D = XYZ... 13D. (XYZ...)D = X + Y + Z +...  Theorem for multiplying out and factoring:14. (X + Y)(X' + Z) = XZ + X'Y 14D. XY + X'Z = (X + Z)(X' + Y)  Consensus theorem:15. XY + YZ + X'Z = XY + X'Z 15D. (X + Y)(Y + Z)(X' + Z) = (X + Y)(X' + Z)

LAWS AND THEOREMS (c)