# Boolean Algebra Introduction Logical arguments are valid (or not) by virtue of their form, not content Example All men are mortal(premise 1) Harry is a.

## Presentation on theme: "Boolean Algebra Introduction Logical arguments are valid (or not) by virtue of their form, not content Example All men are mortal(premise 1) Harry is a."— Presentation transcript:

Boolean Algebra Introduction Logical arguments are valid (or not) by virtue of their form, not content Example All men are mortal(premise 1) Harry is a man(premise 2) ------------------------------------------- Harry is mortal(conclusion) This regularity allows implementation of logic by computers, which have no capacity to understand meaning

Boolean Algebra Logical variables P, Q, YourMamma, Waverly take values 0 or 1 only Logical operators OR operator AND operator NOT operator P1P2P1 + P2 00110011 01010101 01110111 P1P2P1  P2 00110011 01010101 00010001 P P’P’ 0101 1010

Boolean Algebra Truth tables Arbitrary functions can be composed from these elementary operators acting on variables Example Properties of truth tables 1) If there are n variables, there will be 2 n rows 2) Rows are listed in counting order 3) Intermediate results may be shown in inserted columns P1P2P3(P1 + P2)(P1 + P2)  P3 [(P1 + P2)  P3] ΄ 0000111100001111 0011001100110011 0101010101010101 0011111100111111 0001010100010101 1110101011101010

Boolean Algebra Other logical operators OR, AND, and NOT operators are sufficient to represent any logical function; however, other operators will prove useful in digital design NAND and NOR XOR

Boolean Algebra Tautology, Equivalence, and Logical Laws A tautology is a function that is always true Example Equivalence operator

Boolean Algebra Tautology, Equivalence, and Logical Laws (cont.) If an equivalence is a tautology, then the two expressions are interchangeable. Why? Because a function is completely defined by its truth values. Example This is one form of DeMorgan’s Law

Boolean Algebra Simplification Goal: Reduce size of a function Method 1: Successive application of equivalence theorems Sample theorems theoremdual (T1) X + 0 ≡ X(T1) d X ∙ 1 ≡ X (T2) X + 1 ≡ 1(T2) d X ∙ 0 ≡ 0 (T3) X + X ≡ X(T3) d XX ≡ X (T4) X + X΄ ≡ 1(T4) d XX ’ ≡ 0 (T5) (X΄)΄ ≡ X (T6) X + Y ≡Y + X(T6) d XY ≡ YX (T7) (X + Y)΄ ≡ (X΄ ∙ Y΄)(T7) d (XY)΄ ≡ (X΄ + Y΄) (T8) (X + Y) + Z ≡ X + (Y + Z)(T8) d (XY) Z X(YZ) (T9) XY + XZ ≡ X(Y + Z)(T9) d (X + Y) (X + Z) ≡ X + YZ (T10) X + XY≡ X(T10) d X(X + Y) ≡ X

Boolean Algebra Simplification (method 1) Fact about the theorems 1) 0 and 1 are constants that always take these values 2) AND can be implicit (as with multiplication in numerical algebra) 3) All equivalences can be proven with a truth table 4) Every theorem is accompanied by its dual obtained by switching all 0’s and 1’s and all ∙ ’s and + ’s. When these switches are made, a new valid theorem is obtained. 5) Every symbol in every identity can be systematically replaced by arbitrary expressions. 6) A number of theorems are identical to those of numerical algebra (e.g., (T8) and (T9), but not (T9) d )

Boolean Algebra Simplification (method 1) Example 1 stepjustification 1. PQ + PQ΄given 2. P(Q + Q΄)(T9) 3. P(1)(T4) 4. P(T1) d Example 2 stepjustification 1. P1P2 + P1΄P3 + P2P3given 2. P1P2 + P1΄P2 + P2P3(1)(T1) d 3. P1P2 + P1 ’ P3 + P2P3(P1 + P1΄)(T4) 4. P1P2 + P1΄P3 + P1P2P3 + P1΄P2P3(T9), (T6) d 5. P1P2 + P1P2P3 + P1΄P3 + P1΄P2P3(T6) 6. P1P2(1 + P3) + P1 ’ P3(1 + P2)(T9), two applications 7. P1P2(1) + P1΄P3(1)(T2) 8. P1P2 + P1΄P3(T1) Note: This simplification involves expansion before contraction

Boolean Algebra Simplification (method 2) Motivation Simplification with equivalence theorems is unsystematic (witness the 2nd example) Alternative Reduce function to sum of minterms (SOP) or product of maxterms (POS), then simplify on a Karnaugh map

Boolean Algebra Simplification (method 2) Minterms and Maxterms mintermproduct of variables with variable negated if corresponding value is 0 maxtermsum of variables with variable negated if corresponding value is 1 Minterms and maxterms for 4 variable functions #WXYZmintermmaxterm 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 00000000111111110000000011111111 00001111000011110000111100001111 00110011001100110011001100110011 01010101010101010101010101010101 W ΄ X ΄ Y ΄ Z ΄ W ΄ X ΄ Y ΄ Z W ΄ X ΄ YZ ΄ W ΄ X ΄ YZ W ΄ XY ΄ Z ΄ W ΄ XY ΄ Z W ΄ XYZ ΄ W ΄ XYZ WX ΄ Y ΄ Z ΄ WX ΄ Y ΄ Z WX ΄ YZ ΄ WX ΄ YZ WXY ΄ Z ΄ WXY ΄ Z WXYZ ΄ WXYZ W + X + Y + Z W + X + Y + Z ΄ W + X + Y ΄ + Z W + X + Y ΄ + Z ΄ W + X ΄ + Y + Z W + X ΄ + Y + Z ΄ W + X ΄ + Y ΄ + Z W + X ΄ + Y ΄ + Z ΄ W ΄ + X + Y + Z W ΄ + X + Y + Z ΄ W ΄ + X + Y ΄ + Z W ΄ + X + Y ΄ + Z ΄ W ΄ + X ΄ + Y + Z W ΄ + X ΄ + Y + Z ΄ W ΄ + X ΄ + Y ΄ + Z W ΄ + X ΄ + Y ΄ + Z ΄

Boolean Algebra Simplification (method 2) Theorem Every function can be rewritten as 1) Sum of the minterms where the function is 1 (SOP), or 2) Product of the maxterms where the function is 0 (POS) Example F = Y΄(X + W) + Z΄ SOP: F = W΄X΄Y΄Z΄ + W΄X΄YZ΄ + W΄XY΄Z΄ + W΄XY΄Z + W΄XYZ΄ + WX΄Y΄Z΄ + WX΄Y΄Z΄’ + WX΄YZ΄ + WXY΄Z’ + WXY΄Z + WXYZ΄, or F =  WXYZ (0,2,4,5,6,8,9,10,12,13,14). POS: F = (W + X + Y + Z΄)(W + X + Y΄ + Z΄)(W + X΄+Y’+ Z΄) (W΄ + X + Y΄ + Z΄) (W΄+ X΄ + Y΄ + Z΄), or F =  WXYZ (1,3,7,11,15). #WXYZ F = Y ΄ (X + W) + Z ΄ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 00000000111111110000000011111111 00001111000011110000111100001111 00110011001100110011001100110011 01010101010101010101010101010101 10101110111011101010111011101110

Boolean Algebra Simplification (method 2, aside) How many operators are necessary? AND, OR and NOT can be used to represent any SOP and therefore any function But, an SOP with only positive literals can be rendered with only NAND’s by replacing all operators with NAND Example AB + CD ≡ (A NAND B) NAND (C NAND D) And, can achieve NOT as follows: P’ ≡ P NAND P Therefore, NAND suffices to represent any function. Example AC’ + A’B + BC ≡ (A NAND (C NAND C)) NAND ((A NAND A) NAND B) NAND (B NAND C)

Boolean Algebra Simplification (method 2) Karnaugh maps Procedure 1) Enter the minterms for the function on the map. 2) Determine all the prime implicants of the function. 3) Determine the smallest subset of these prime implicants that cover all the prime implicants. 4) Name these implicants and construct the final expression.

Boolean Algebra Simplification (method 2) Karnaugh maps Step 1:Enter terms F = W΄XYZ + WXY΄ + WXY + X΄YZ + W΄X΄Y΄Z΄ =  WXYZ (0,7,8,9,12,13,14,15) Note: Gray code ordering on map

Boolean Algebra Simplification (method 2) Karnaugh maps Step 2: Determine prime implicants (PI’s) What is a PI? i. Consists of 2 n minterms, where n is an integer ii. It forms a continuous rectangle over the 3D torus formed by joining the ends of the map iii. It is not subsumed by a larger PI

Boolean Algebra Simplification (method 2) Karnaugh maps Step 2: Determine prime implicants (PI’s) Example

Boolean Algebra Simplification (method 2) Karnaugh maps Step 3: Find minimal set of PI’s i. Find all essential prime implicants (those that contain a minterm not covered by any other PI) ii. Cover rest of minterms with other PI’s Example All are necessary (all have distinguished minterms)

Boolean Algebra Simplification (method 2) Karnaugh maps Step 4: Name the PI’s in the minimal set Rule: The name of the PI will correspond to a product of the variables that don’t change, with the variable negated if it always 0, and not negated otherwise. Example (PI 1) WXY΄Z΄ + WXY΄Z + WXYZ΄ + WXY΄Z΄ ≡ WX(Y΄Z΄ + Y΄Z + YZ΄ + Y΄Z΄) ≡ WX(Y΄(Z΄ + Z) + Y(Z΄ + Z) ≡ WX(Y΄(1) + Y(1)) ≡ WX(Y΄ + Y) ≡ WX(1) ≡ WX

Boolean Algebra Simplification (method 2) Karnaugh maps Step 4: Name the PI’s in the minimal set. Full set of PI’s for this example: WX + WY΄ + X΄Y΄Z΄ + XYZ Comparison with original expression W΄XYZ + WXY΄ + WXY + X΄YZ + W΄X΄Y΄Z (5 product terms reduced to 4, 17 literals to 10)

Boolean Algebra Simplification (method 2) Karnaugh maps Another example  WXYZ (0,1,2,3,4,5,6,14,15) PI’s W΄X΄ comprising minterms 0,1,2,3 W΄Y΄ comprising minterms 0,1,4,5 W΄Z΄ comprising minterms 0,2,4,6 XYZ΄ comprising minterms 6,14  not essential WXY comprising minterms 14,15 Essential PI’s cover all minterms W΄X΄ + W΄Y΄ + W΄Z΄ + WXY

Boolean Algebra Simplification (method 2) Karnaugh maps, POS minimization  WXYZ (0,1,2,3,4,5,6,14,15) PI’s W΄ + X, comprising maxterms 8,9,10,11 W΄ + Y, comprising maxterms 8,9,12,13 W + X΄ + Y΄ + Z΄, comprising maxterm 7 Essential PI’s cover all minterms (W΄ + X)(W΄ + Y)(W + X΄ + Y΄ + Z΄)  slightly better than SOP minimization

Boolean Algebra Simplification (method 2) Karnaugh maps, a hard example SOP and POS minimization does not work But, if target representation is changed, a single term results! (W XOR X) XOR (Y XOR Z) Furthermore, a small counting machine covers minterms regardless of number of variables MORAL: Finding the optimal circuit is non-trivial. This makes Digital Design an art as well as an engineering task.

Boolean Algebra Simplification (method 2) Karnaugh maps Summary of minimization

Boolean Algebra Summary of topics Functions Truth tables Tautologies and equivalence Simplification with equivalence Simplification with Karnaugh maps minterms and maxterms Prime Implicants SOP and POS minimization Simplification depends on representation (the art of design)

Download ppt "Boolean Algebra Introduction Logical arguments are valid (or not) by virtue of their form, not content Example All men are mortal(premise 1) Harry is a."

Similar presentations