Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Алгебра_1 / Gilbert - Modern algebra with applications.pdf
Скачиваний:
34
Добавлен:
23.02.2015
Размер:
2.55 Mб
Скачать

26

2 BOOLEAN ALGEBRAS

 

18

6

9

2

3

1

Figure 2.17. Lattice that is not a boolean algebra.

a

b

c

d

e

Figure 2.18. Poset that is not a lattice.

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

If we have a complicated switching circuit represented by a boolean expression, such as

(A (B C ) ) ((B C ) A ),

we would like to know if we can build a simpler circuit that would perform the same function. In other words, we would like to reduce this boolean expression to a simpler form. In actual practice, it is usually desirable to reduce the circuit to the one that is cheapest to build, and the form this takes will depend on the state of the technology at the time; however, for our purposes we take the simplest form to mean the one with the fewest switches. It is difficult to find the simplest form for circuits with many switches, and there is no one method that will lead to that form. However, we do have methods for determining whether two boolean expressions are equivalent. We can reduce the expressions to a certain normal form, and the expressions will be the same if and only if their normal forms are the same. We shall look at one such form, called the disjunctive normal form.

In the boolean algebra of subsets of a set, every subset can be expressed as a union of singleton sets, and this union is unique to within the ordering of the terms. We shall obtain a corresponding result for arbitrary finite boolean algebras. The elements that play the role of singleton sets are called atoms. Here an atom in a boolean algebra (K, , , ) is a nonzero element B for which

B Y = B or B Y = 0 for each Y K.

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

27

Thus B is an atom if Y B implies that Y = 0 or Y = B. This implies that the atoms are the elements immediately above the zero element in the poset diagram. In the case of the algebra of divisors of a square-free integer, the atoms are the primes, because the definition of b being prime is that y|b implies that y = 1 or y = b.

We now give a more precise description of the algebra of switching circuits. The atoms of the algebra and the disjunctive normal form of an expression will become clear from this description.

An n-variable switching circuit can be viewed as a black box containing n independent switches A1, A2, . . . , An, as shown in Figure 2.19, where each switch can be either on or off. The effect of such a circuit can be tested by trying all the 2n different combinations of the n switches and observing when the box allows current to pass. In this way, each circuit defines a function of n variables

A1, A2, . . . , An:

f : {0, 1}n → {0, 1},

which we call the switching function of the circuit. Two circuits give rise to the same switching function if and only if they are equivalent.

For example, the circuit in Figure 2.20, corresponding to the expression

(A B ) (C A ), gives rise to the switching function f : {0, 1}3 → {0, 1} given in Table 2.10.

A1 A2 • • • An

Figure 2.19. n-Variable switching circuit.

 

A

 

C

 

B

 

A

 

Figure 2.20.

Circuit (A B ) (C A ).

TABLE 2.10. Switching Function

 

 

 

 

A

B

C

f = (A B ) (C A )

0

0

0

1

0

0

1

1

0

1

0

0

0

1

1

0

1

0

0

0

1

0

1

1

1

1

0

0

1

1

1

1

 

 

 

 

28 2 BOOLEAN ALGEBRAS

Denote the set of all n-variable switching functions from {0, 1}n to {0, 1} by Fn. Each of the 2n elements in the domain of such a function can be mapped to either of the two elements in the codomain. Therefore, the number of different n-variable switching functions, and hence the number of different circuits with n switches, is 22n .

Let f and g be the switching functions of two circuits of the n-variables A1, A2, . . . , An. When these circuits are connected in series or in parallel, they give rise to the switching functions f g or f g, respectively, where

(f g)(A1, . . . , An) = f (A1, . . . , An) g(A1, . . . , An)

and

(f g)(A1, . . . , An) = f (A1, . . . , An) g(A1, . . . , An).

The switching function of the opposite circuit to that defining f is f , where

f (A1, . . . , An) = (f (A1, . . . , An)) .

Theorem 2.19. The set of n-variable switching functions forms a boolean algebra (Fn, , , ) that contains 22n elements.

Proof. It can be verified that (Fn, , , ) satisfies all the axioms of a boolean algebra. The zero element is the function whose image is always 0, and the unit element is the function whose image is always 1.

The boolean algebra of switching functions of two variables contains 16 elements, which are displayed in Table 2.11. For example, f6(A, B) = 0 if A = B, and 1 if A = B. This function is the exclusive OR function or a modulo 2 adder. It is also the symmetric difference function, where the symmetric difference of A and B in a boolean algebra is defined by

A B = (A B ) (A B).

The operations NAND and NOR stand for “not and” and “not or,” respectively; these are discussed further in the section “Transistor Gates.”

As an example of the operations in the boolean algebra F2, we calculate the meet and join of f10 and f7, and the complement of f10 in Table 2.12. We

see that f10 f7 = f2, f10 f7 = f15 and f10 = f5. These correspond to the relations B (A B) = A B , B (A B) = 1, and (B ) = B.

In the boolean algebra Fn, f g if and only if f g = f , which happens if g(A1, . . . , An) = 1 whenever f (A1, . . . , An) = 1. The atoms of Fn are therefore the functions whose image contains precisely one nonzero element. Fn contains

2n atoms, and the expressions that realize these atoms are of the form Aα11 Aα22 · · · Aαnn , where each Aαi i = Ai or Ai .

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

29

 

TABLE 2.11. Two-Variable Switching Functions

 

 

 

 

 

 

 

 

 

 

A

0

0

1

1

Expressions in A and B

 

 

B

0

1

0

1

Representing the Function

 

 

 

 

 

 

 

 

 

 

f0

0

0

0

0

0

 

 

f1

0

0

0

1

A B

 

 

f2

0

0

1

0

A B or A B

 

 

f3

0

0

1

1

A

 

 

f4

0

1

0

0

A B or A B

 

 

f5

0

1

0

1

B

 

 

f6

0

1

1

0

A B or Exclusive OR(A, B)

 

 

f7

0

1

1

1

A B

 

 

f8

1

0

0

0

A B or NOR(A, B)

 

 

f9

1

0

0

1

A B or A B

 

 

f10

1

0

1

0

B

 

 

f11

1

0

1

1

A B or A B

 

 

f12

1

1

0

0

A

 

 

f13

1

1

0

1

A B or A B

 

 

f14

1

1

1

0

A B or NAND(A, B)

 

 

f15

1

1

1

1

1

 

TABLE 2.12. Some Operations in F 2

A

B

f10

f7

f10 f7

f10 f7

f10

0

0

1

0

0

1

0

0

1

0

1

0

1

1

1

0

1

1

1

1

0

1

1

0

1

0

1

1

 

 

 

 

 

 

 

The 16 elements of F2 are illustrated in Figure 2.21, and the four atoms are f1, f2, f4, and f8, which are defined in Table 2.11.

To show that every element of a finite boolean algebra can be written as a join of atoms, we need three preliminary lemmas.

Lemma 2.20. If A, B1, . . . , Br are atoms in a boolean algebra, then A (B1 · · · Br ) if and only if A = Bi , for some i with 1 i r.

Proof. If A (B1 · · · Br ), then A (B1 · · · Br ) = A; thus (A B1)

· · · (A Br ) = A. Since each Bi is an atom, A Bi = Bi or 0. Not all the elements A Bi can be 0, for this would imply that A = 0. Hence there is some i, with 1 i r, for which A Bi = Bi . But A is also an atom, so A = A Bi =

Bi .

 

The implication the other way is straightforward

Lemma 2.21. If Z is a nonzero element of a finite boolean algebra, there exists an atom B with B Z.

30

 

 

2

BOOLEAN ALGEBRAS

 

 

 

f15

 

 

 

f7

f11

f13

 

f14

f3

f5

f9

f6

f10

f12

 

f1

f2

f4

 

f8

f0

Figure 2.21. Poset diagram of the boolean algebra of two-variable switching functions.

Proof. If Z is an atom, take B = Z. If not, then it follows from the definition of atoms that there exists a nonzero element Z1, different from Z, with Z1 Z. If Z1 is not an atom, we continue in this way to obtain a sequence of distinct nonzero elements · · · Z3 Z2 Z1 Z, which, because the algebra is finite, must terminate in an atom B.

Lemma 2.22. If B1, . . . , Bn are all the atoms of a finite boolean algebra, then Y = 0 if and only if Y Bi = 0 for all i such that 1 i n.

Proof. Suppose that Y Bi = 0 for each i. If Y is nonzero, it follows from the previous lemma that there is an atom Bj with Bj Y . Hence Bj = Y Bj = 0, which is a contradiction, so Y = 0. The converse implication is trivial.

Theorem 2.23. Disjunctive Normal Form. Each element X of a finite boolean algebra can be written as a join of atoms

X = Bα Bβ · · · Bω.

Moreover, this expression is unique up to the order of the atoms.

Proof. Let Bα , Bβ , . . . , Bω be all the atoms less than or equal to X in the

partial order. It follows from Proposition 2.18(iii) that the join Y = Bα Bβ

· · · Bω X.

We will show that X Y = 0, which, by Proposition 2.18(iv), is equivalent to X Y . We have

X Y = X Bα · · · Bω.

If B is an atom in the join Y , say B = Bα , it follows that X Y B = 0, since Bα Bα = 0. If B is an atom that is not in Y , then X Y B = 0 also,

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

31

because X B = 0. Therefore, by Lemma 2.22, X Y = 0, which is equivalent to X Y . The antisymmetry of the partial order relation implies that X = Y .

To show uniqueness, suppose that X can be written as the join of two sets

of atoms

X = Bα · · · Bω = Ba · · · Bz.

Now Bα X; thus, by Lemma 2.20, Bα is equal to one of the atoms on the right-hand side, Ba , . . . , Bz. Repeating this argument, we see that the two sets of atoms are the same, except possibly for their order.

In the boolean algebra of n-variable switching functions, the atoms are realized

byαexpressionsi

of the form A1α1 αAi

2α2

· · · Anαn , where the αi ’s are

α01

or 1

αand2

A

 

α

A

=

A

, if

α

i = 0. The expression

A

1

A

2

Ai = αin, if

 

i = 1, whereas i

i

 

 

 

· · · An

is included in the disjunctive normal form of the function f if and

only if f (α1, α2, . . . , αn) = 1. Hence there is one atom in the disjunctive normal form for each time the element 1 occurs in the image of the switching function.

Example 2.24. Find the disjunctive normal form for the expression

(B (A C)) ((A C) B) , and check the result by using the axioms to reduce the expression to that form.

Solution. We see from the values of the switching function in Table 2.13 that the disjunctive normal form is (A B C ) (A B C).

From the axioms, we have

(B (A C)) ((A C) B) = (B (A C)) ((A C ) B )

=((B (A C)) (A C )) ((B (A C)) B )

=(B A C ) (A C A C ) (B B ) (A C B )

=(A B C ) 0 0 (A B C)

 

 

 

= (A B C ) (A B C).

 

TABLE 2.13. Switching Function

 

 

 

 

 

 

 

A

B

C

(B (A C)) ((A C) B)

 

0

0

0

0

 

 

0

0

1

0

 

 

0

1

0

1

 

 

0

1

1

0

 

 

1

0

0

0

 

 

1

0

1

1

 

 

1

1

0

0

 

 

1

1

1

0

 

 

 

 

 

 

 

 

32

 

 

 

2 BOOLEAN ALGEBRAS

TABLE 2.14. Switching Function

 

 

 

 

 

 

 

A

B

(A B) B

(A B) (A B)

(A B) (A B )

0

0

0

0

0

0

1

0

1

0

1

0

1

1

1

1

1

0

0

0

 

 

 

 

 

Example 2.25. Determine whether any of the three expressions

(A B) B , (A B) (A B) , and (A B) (A B ) equivalent.

Solution. We see from Table 2.14 that (A B) B = (A B) (A B )

and that these are

both equal to A B .

 

The atoms in

the boolean algebra F2

are realized by the expressions

A B , A B, A B , and A B. These atoms partition the Venn diagram in Figure 2.22 into four disjoint regions. The disjunctive normal form for any boolean expression involving the variables A and B can be calculated by shading the region of the Venn diagram corresponding to the expression and then taking the join of the atoms in the shaded region. Figure 2.23 illustrates the eight regions of the corresponding Venn diagram for three variables.

A

B

 

A BA B AB

 

AB

 

 

Figure 2.22. Venn diagram for F2.

 

A

 

B

A B C

 

A BC

AB C

 

A B C

 

A BC

AB C

 

ABC

C

 

 

ABC

Figure 2.23. Venn diagram for F3.

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

33

By looking at the shaded region of a Venn diagram corresponding to a boolean expression, it is often possible to see how to simplify the expression. Furthermore, the disjunctive normal form provides a method of proving hypotheses derived from these Venn diagrams.

However, Venn diagrams become too complicated and impractical for functions of more than four variables. For other general methods of simplifying circuits, consult a book on boolean algebras such as Mendelson [21].

Example 2.26. Find the disjunctive normal form and simplify the circuit in Figure 2.24.

Solution. This circuit is represented by the boolean expression

f = A ((B C) (A B C)).

The boolean function f : {0, 1}3 → {0, 1} that this expression defines is given in Table 2.15. It follows that the disjunctive normal form is

(A B C) (A B C) (A B C ) (A B C)

(A B C ) (A B C),

which is certainly not simpler than the original. However, by looking at the Venn diagram in Figure 2.25, we see that this expression is equivalent to just A C; thus a simpler equivalent circuit is given in Figure 2.25.

A

A

B

B

C C

Figure 2.24. Series-parallel circuit.

TABLE 2.15. Switching

Function

A

B

C

f

 

 

 

 

0

0

0

0

0

0

1

1

0

1

0

0

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

1

1

1

1

1

 

 

 

 

34

2 BOOLEAN ALGEBRAS

A

B

 

A

C

C

Figure 2.25. Venn diagram and simplified circuit.

In building a computer, one of the most important pieces of equipment needed is a circuit that will add two numbers in binary form. Consider the problem of adding the numbers 15 and 5. Their binary forms are 1111 and 101, respectively. The binary and decimal additions are shown below. In general, if we add the number . . . a2a1a0 to . . . b2b1b0, we have to carry the digits . . . c2c1 to obtain the sum . . . s2s1s0.

1111

 

 

15

. . . a2a1a0

101

 

 

5

. . . b2b1b0

1111 carry digits

1

 

. . . c2c1

 

 

 

 

 

 

10100

 

 

20

. . . s2s1s0

 

 

 

 

 

 

binary addition

decimal addition

 

Let us first design a circuit to add a0 and b0 to obtain s0 and the carry digit c1. This is called a half adder. The digits s0 and c1 are functions of a0 and b0 which are given by Table 2.16. For example, in binary arithmetic, 1 + 1 = 10, which means that if a0 = 1 and b0 = 1, s0 = 0, and we have to carry c1 = 1.

We see from Table 2.16 that c1 = a0 b0 and s0 = (a0 b0) (a0 b0). These circuits are shown in Figure 2.26.

TABLE 2.16. Switching

Functions for the Half

Adder

a0

b0

c1

s0

0

0

0

0

0

1

0

1

1

0

0

1

1

1

1

0

 

 

 

 

a

b

0

 

 

0

 

s0

 

 

 

 

a

0

b

 

 

 

0

 

a0

b0

c1

Figure 2.26. Circuits for the half adder.

NORMAL FORMS AND SIMPLIFICATION OF CIRCUITS

35

TABLE 2.17. Switching Functions

for a Full Adder

 

 

ai

bi

ci

ci+1

si

0

0

0

0

0

0

0

1

0

1

0

1

0

0

1

0

1

1

1

0

1

0

0

0

1

1

0

1

1

0

1

1

0

1

0

1

1

1

1

1

 

ai

 

bi

 

 

 

 

ci +1 shaded

 

 

 

ci

 

 

 

ai

 

bi

 

 

 

 

si shaded

 

ci

Figure 2.27. Venn diagrams for a full adder.

b

c

i

 

a

i

 

 

 

 

 

 

i

 

c

 

b

i

 

 

 

i

si

b

c

 

ai

i

 

i

 

 

 

 

 

bi

ci

 

bi

 

 

 

 

ai

 

ci

ci +1

 

 

bi

 

ci

 

Figure 2.28. Circuits for a full adder.

A circuit that adds ai , bi , and the carry digit, ci , to obtain si , with ci+1 to carry, is called a full adder. The functions ci+1 and si are defined by Table 2.17, and their Venn diagrams are given in Figure 2.27. Notice that si = ai bi ci .

Suitable expressions for a full adder are as follows. The corresponding circuits are shown in Figure 2.28.