R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001

# R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001

## R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. R. JohnsonbaughDiscrete Mathematics5th edition, 2001 Chapter 9 Boolean Algebras and Combinatorial Circuits

2. A bit is a 0 or a 1. Input x1, x2 can be 0 or 1 ------------------------------------------- Conjunction: AND x1 x2 = 1 if x1 = x2 = 1 0 otherwise Logical gates 9.1 Combinatorial circuits

3. Inclusive disjunction OR x1 v x2 = 1 if x1 = 1 or x2 = 1 0 otherwise

4. NOT ~ x = 1 if x = 0 0 if x = 1 Negation

5. A logic table of a combinatorial circuit is a table with all possible inputs and all its resulting outputs Logic Tables

6. A Boolean expression such as y = ~((x1^x2)vx3) is composed of literals like x1, x2, x3 and symbols like ^, v, ~, ) and ( We write y = y(x1, x2, x3) The value of a Boolean expression is the bit obtained when the literals are replaced by bits, e.g. y(0,1,0) = 1. Boolean expressions

7. Combinatorial circuits

8. The logic table corresponding to the Boolean expression y = ~((x1 ^ x2) v x3). Logic table

9. 4. Identity laws av0 = a a^1 = a 5. Complement laws av(~a) = 1 a^(~a) = 0 For a, b, c  {0, 1} 1. Associative laws av(bvc) = (avb)vc a^(b^c) = (a^b)^c 2. Commutative laws avb = bva a^b = b^a 3. Distributive laws a^(bvc) = (a^b) v (a^c) av(b^c) = (avb) ^ (avc) 9.2 Properties of Combinatorial Circuits

10. Boolean expressions Two Boolean expressions X = X(x1, x2,…,xn) and Y = Y(x1, x2,…, xn) are equal (write X = Y) if and only if X(a1,a2,…, an) = Y(a1, a2,…, an) for all ai{0, 1}, 1 < i < n. • Example: X(x1,x2, x3) = ~x1^(x2vx3) and Y(x1,x2, x3) = (~x1^x2) v (~x1^x3) are equal.

11. Equivalent combinatorial circuits • Two combinatorial circuits, each having inputs x1,…, xn and a single output for each set of inputs, are equivalent if, given the same inputs, the two circuits produce the same output. • Theorem 9.2.7: Let C and D be two combinatorial circuits with X and Y the Boolean expressions that represent C and D, respectively. C and D are equivalent if and only if X = Y,

12. Let A be a nonempty set containing distinct elements 0 and 1, endowed with two binary operations + and • and a unary operation ~ (complement) that satisfy properties 1 to 5. Then A is called a Boolean algebra. 1. Associative laws a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c 2. Commutative laws a + b = b + a a • b = b • a 3. Distributive laws a • (b + c) = (a • b) + (a • c) a + (b • c) = (a + b) • (a + c) 4. Identity laws a + 0 = a a • 1 = a 5. Complement laws a + (~a) = 1 a • (~a) = 0 9.3 Boolean algebras

13. Example 1 of a Boolean algebra Example 1: Z2 = {0,1}, with the operations  and  defined by the tables below, is a Boolean algebra.

14. Let U be a universal set and S = P(U) = power set of U. For any elements X, Y  S define X + Y = X  Y X·Y = X  Y ~X = U - X Let 0 =  and 1 = U. Then properties 1-5 hold and S is a Boolean algebra. Example 2: Power set

15. Complement in a Boolean algebra • In a Boolean algebra A, given x  A, an element x' such that x' + x = 1 and x' • x = 0 is called the complement of x. Theorem 9.3.4: The complement x' of each x in a Boolean algebra is unique. Specifically, if x + y = 1 and x • y = 0 then y = x'.

16. Equations in Boolean algebras come in pairs. For example, the identity laws x+0 = x and x•1 = x. These are called dual statements. The dual of a statement in Boolean algebras is obtained by making the following replacements: 0 replaced by 1, 1 replaced by 0, + replaced by •, • replaced by + Dual statements

17. A duality theorem The following is an important theorem about duality statements in a Boolean algebra: • Theorem 9.3.10: The dual of a theorem about Boolean algebras is also a theorem.

18. 9.4 Boolean functions and synthesis of circuits Let X(x1,…, xn) be a Boolean expression. • A Boolean function is a function of the form f(x1,…, xn) = X(x1,…, xn) • Its domain is (Z2)n = {(x1, x2,…, xn) |xi {0, 1}, 1 < i < n} and its range is Z2 = {0, 1} X : (Z2)n Z2

19. Exclusive OR, in symbol  The binary operation  can be expressed as a Boolean function x1 x2 = X(x1 ,x2), with domain = {(1,1),(1,0),(0,1),(0,0)} = (Z2)2; and range = Z2 = {0, 1}. Example of a Boolean function

20. Minterm A minterm in the symbols x1,…, xn is a Boolean expression of the form m = y1^y2^…^yn where each yk is either xk or its complement xk', 1 < k < n.

21. Disjunctive normal form Theorem 9.4.6: Let f: (Z2)n Z2 be a Boolean function not identically zero. • Let A1, A2,…, Ak denote the elements of (Z2)n such that f(Ai) = 1. • For each Ai = (a1,…, an) set mi = y1^…^ yn • where yj = xj (if aj = 1) OR ~xj (if aj = 0). • Then f(x1,…, xn) = m1v…v mk. • The disjunctive normal form of a Boolean function is a representation of f as a disjunction of mk's as in the theorem.

22. Let f(x1, x2) = (~x1)vx2. Its truth table is A1 = (1,1) A2 = (0,1) A3 = (0,0) Then m1 = x1^ x2 m2 = (~x1)^x2 m3 = (~x1)^(~x2) It can be verified that f(x1, x2) = m1 v m2 v m3 Use of disjunctive normal form

23. Definition of functionally complete set of gates: A gate is a function f : (Z2)n  Z2 , for n > 1 A set of gates S = {g1, g2,…, gk} is said to be functionally complete if given any positive integer n and a function f : (Z2)n  Z2 , it is possible to construct a combinatorial circuit that computes f using only the set of gates S. 9.5 Applications

24. NAND • The NAND gate x1x2 is equivalent to ~(x1^x2), and is defined by the table and the diagram

25. NAND circuits • Using NAND we can write • x' = xx • x v y = (xx)(yy)

26. Functionally complete sets of gates Theorem 9.4.6: The set of gates {AND, OR, NOT} is functionally complete. Theorem 9.5.5: The sets of gates S1 = {AND, NOT} and S2 = {OR, NOT} are functionally complete. Theorem 9.5.7: The set {NAND} is functionally complete.

27. Minimization problem The minimization problem consists of finding the circuit that represents a Boolean function with the minimal number of gates. • Example: The following circuit represents the Boolean function f(x,y,z) = xyz v xyz' v xy'z' = x(y v z')

28. Input: two bits x and y Two outputs: binary sum cs, where c is the carry bit and s is the sum bit. Half adder

29. Half adder circuit Two outputs: • s = (x v y)^[~(x^y)] = x  y • c = x^y