Presentation is loading. Please wait.

Presentation is loading. Please wait.

Boolean Algebra Computer Science 1611. AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is.

Similar presentations


Presentation on theme: "Boolean Algebra Computer Science 1611. AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is."— Presentation transcript:

1 Boolean Algebra Computer Science 1611

2 AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is raining) (today is Friday) AND (it is not raining)

3 OR (today is Monday) OR (it is raining) (today is Monday) OR (it is not raining) (today is Friday) OR (it is raining) (today is Friday) OR (it is not raining)

4 NOT (today is Monday) OR NOT (it is raining) (today is Monday) OR (it is raining) (today is Friday) AND NOT(it is raining) (today is Friday) AND (it is raining) (today is Monday) AND NOT(it is raining) (today is Monday) AND (it is raining) (today is Friday) OR NOT (it is raining) (today is Friday) OR (it is raining)

5 IMPLIES (A  B) A  B is False only when A is True and B is False. In other words, A  B is True except when the premise (A) is True and the conclusion (B) is False. A  B is logically equivalent to (NOT A) OR B

6 Truth Table (AND, OR, NOT) MonrainNOT MNOT rM AND rM OR r TT TF FT FF

7 Truth Table (AND, OR, NOT) MonrainNOT MNOT rM AND rM OR r TTFF TFFT FTTF FFTT

8 Truth Table (AND, OR, NOT) MonrainNOT MNOT rM AND rM OR r TTFFT TFFTF FTTFF FFTTF

9 Truth Table (AND, OR, NOT) MonrainNOT MNOT rM AND rM OR r TTFFTT TFFTFT FTTFFT FFTTFF

10 Truth Tables A AND B is True only when both A and B are true. A OR B is always True unless both A and B are false. NOT A changes the value from True to False or False to True.

11 IMPLIES (A  B) ABNOT A(NOT A) OR B A  B TTFTT TFFFF FTTTF FFTTF

12 Writing AND, OR, NOT A AND B = A ^ B = AB A OR B = A V B = A+B NOT A = ~A = A’ TRUE = T = 1 FALSE = F = 0

13 Example Write the truth table for A(A’ + B) + AB’ (section 7.5, AE, p 308, exercise #3a)  First, write in words: A AND (NOT A OR B) OR (A AND NOT B)  Then do a truth table with the following columns: A, B, NOT A, NOT B, NOT A OR B, A AND NOT B, A AND (NOT A OR B), whole expression.

14 X = A (A’ + B) + AB’ ABNOT A NOT B NOT A OR B A AND NOT B A AND (A’+B) X TTFFTFTT TFFTFTFT FTTFTFFF FFTTTFFF

15 Exercise Write the truth table for (A + A’) B First, write in words. Then do a truth table.

16 Solution to (A + A’) B ABNOT AA OR NOT A (A OR NOT A) AND B TTFTT TFFTF FTTTT FFTTF

17 Boolean Algebra Boolean Algebra is made up of two constants (True and False) Several operators - AND, OR, NOT, XOR, NOR, NAND XOR = either a or b but not both NOR = NOT OR NAND = NOT AND

18 Boolean Algebra The = in Boolean Algebra means equivalent Two statements are equivalent if they have the same truth table. For example,  True = True,  a = a,

19 Boolean Algebra - Identities A OR True = True A OR False = A A OR A = A A OR B = B OR A (commutative) A AND True = A A AND False = False A AND A = A A AND B = B AND A (commutative)

20 Associative and Distributive Identities A AND (B AND C) = (A AND B) AND C A OR (B OR C) = (A OR B) OR C A OR (B AND C) = (A OR B) AND (A OR C) A AND (B OR C) = (A AND B) OR (A AND C) Exercise: using truth tables prove -  A AND (A OR B) = A

21 Solution: A AND (A OR B) = A ABA OR BA AND (A OR B) TTTT TFTT FTTF FFFF

22 Using Identities A OR (B AND C) = (A OR B) AND (A OR C) A AND (B OR C) = (A AND B) OR (A AND C) A AND (A OR B) = A A OR A = A Exercise - using identities prove:  A OR (A AND B) = A  = A AND (A OR B) = A  A OR (A AND B) = (A OR A) AND (A OR B)

23 Identities with NOT NOT (NOT A) = A A OR NOT A = True A AND NOT A = False On and on and on and on …

24 DeMorgan’s Laws NOT (A OR B) = NOT A AND NOT B ~ (A + B) = (~A) (~B) NOT (A AND B) = NOT A OR NOT B ~ (AB) = ~ A + ~ B Exercise - Simplify the following with identities NOT (NOT A AND B)

25 Solving a Truth Table 1. Select lines in the table for which the result is 1 (T) 2. For each of those a) Find the P, Q values b) Build an AND statement with the variable itself if its value is 1 (T), and with the negation of the variable if its value is 0 (F) 3. Use OR to connect the statements in step 2. Ref: AE Text, section 7.2, p. 281

26 Solving a Truth Table ABXWhen you see a True value in the X column, you must have a term in the expression. Each term consists of some combination of the variables AB. The A value will be NOT A when the truth value of A is False – the B value will be NOT B when the truth value of B is false. They will be connected by OR. TTT TFT FTF FFF For example, X = AB + AB’ = (A AND B) OR ( A AND NOT B)

27 Exercise 1: Solving a Truth Table ABXWhen you see a True value in the X column, you must have a term in the expression. Each term consists of some combination of the variables AB. The A value will be NOT A when the truth value of A is False – the B value will be NOT B when the truth value of B is false. They will be connected by OR. TTT TFF FTT FFF Solve the Truth Table given above.

28 Exercise1 : Solving a Truth Table ABXWhen you see a True value in the X column, you must have a term in the expression. Each term consists of some combination of the variables AB. The A value will be NOT A when the truth value of A is False – the B value will be NOT B when the truth value of B is false. They will be connected by OR. TTT TFF FTT FFF Solution is, X = AB + A’B = (A AND B) OR ( NOT A AND B)

29 Exercise2 : Solving a Truth Table ABXWhen you see a True value in the X column, you must have a term in the expression. Each term consists of some combination of the variables AB. The A value will be NOT A when the truth value of A is False – the B value will be NOT B when the truth value of B is false. They will be connected by OR. TTT TFT FTT FFF Solution is? (in-class exercise)


Download ppt "Boolean Algebra Computer Science 1611. AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is."

Similar presentations


Ads by Google