CSE 20 DISCRETE MATH Prof Shachar Lovett http

  • Slides: 22
Download presentation
CSE 20 DISCRETE MATH Prof. Shachar Lovett http: //cseweb. ucsd. edu/classes/wi 15/cse 20 -a/

CSE 20 DISCRETE MATH Prof. Shachar Lovett http: //cseweb. ucsd. edu/classes/wi 15/cse 20 -a/ Clicker frequency: CA

Todays topics • Boolean logic: simplifications, derivation rules • Sections 3. 2 -3. 4

Todays topics • Boolean logic: simplifications, derivation rules • Sections 3. 2 -3. 4 in Jenkyns, Stephenson

Simplifications Which of the following Boolean expressions is equivalent to A. B. C. D.

Simplifications Which of the following Boolean expressions is equivalent to A. B. C. D. E. None of the above / more than one of the above.

Simplifications Which of the following Boolean expressions is equivalent to A. B. C. D.

Simplifications Which of the following Boolean expressions is equivalent to A. B. C. D. E. None of the above / more than one of the above.

Simplifications • De. Morgan’s Laws • Identity • Idempotence • Commutativity • Distributivity •

Simplifications • De. Morgan’s Laws • Identity • Idempotence • Commutativity • Distributivity • Absorption

Negation

Negation

Conditional operator P Q T T F F F T T F F T

Conditional operator P Q T T F F F T T F F T JS p. 85

Conditional operator P Q T T F F F T T F F T

Conditional operator P Q T T F F F T T F F T ~(P ~Q) ~P v Q • Antecedent aka hypothesis or assumption or “given” • Consequent aka conclusion or goal

Contrapositive form • P Q is equivalent to ~Q ~P • How can we

Contrapositive form • P Q is equivalent to ~Q ~P • How can we prove it? A. Compare truth tables B. Derive one from the other using simplification rules C. Both D. Neither

Contrapositive form Proof sequence: Formulas are equivalent in consecutive steps 1. ~Q ~P 2.

Contrapositive form Proof sequence: Formulas are equivalent in consecutive steps 1. ~Q ~P 2. ~(~Q) (~P) 3. Q ~P 4. ~P Q 5. P Q (given) (definition of ) (double negation) (commutativity) (definition of )

Contrapositive form What’s the contrapositive of the statement “If you know Java, then you

Contrapositive form What’s the contrapositive of the statement “If you know Java, then you know a programming language? ” A. If you know a programming language, then you know Java. B. If you don’t know a programming language, then you don’t know Java. C. If you don’t know Java, then you don’t know a programming language. D. None of the above.

Implication JS p. 86 vs.

Implication JS p. 86 vs.

Implication JS p. 86 vs. What’s enough to make a conditional statement false? A.

Implication JS p. 86 vs. What’s enough to make a conditional statement false? A. B. C. D. E. P being false. Q being false. P and Q both false. Either P or Q (or both) false. None of the above / more than one of the above.

14 What does it mean: IMPLIES • Your roommate: “If you come to my

14 What does it mean: IMPLIES • Your roommate: “If you come to my party Friday, you will have fun” Under which of the following scenarios is your roommate a liar? A. You stayed home studying Friday and you did not have B. C. D. E. fun. You stayed home studying Friday and you had fun. You went to the party Friday and did not have fun. You went to the party Friday and you had fun None/More/Other

15 What does it mean: IMPLIES • Prof Lovett says: “If you win the

15 What does it mean: IMPLIES • Prof Lovett says: “If you win the CA state lottery between now and the end of quarter, you will get an A+ in this class. ” 4 months later… under which of the following scenarios is Prof. Lovett a liar? A. B. C. D. E. You won the lottery and got an A+ You won the lottery and got a B+ You did not win the lottery and got an A+ You did not win the lottery and got a B+ None/More/Other

Implication • Is P Q equivalent to Q P? A. Yes B. No

Implication • Is P Q equivalent to Q P? A. Yes B. No

Implication • Is P Q equivalent to Q P? A. Yes B. No P

Implication • Is P Q equivalent to Q P? A. Yes B. No P Q Q P T T T F F F T T

18 Converse error Here is an example with the same form: • If this

18 Converse error Here is an example with the same form: • If this shape is a square, then this shape is a rectangle. Therefore, if this shape is a rectangle, then this shape is a square. No! • p→ q and q→p are the converse of each other. • It is not safe to assume that if p→q is true, then q→p is also true! • The converse could be true though…as in the equal sides/square example. If both p→q and q→p are true, then we say p↔q (“p iff q”).

Converse error

Converse error

20 Converse error “If something is made out of wood, then it floats. Therefore,

20 Converse error “If something is made out of wood, then it floats. Therefore, if she floats, then she is made out of wood [and therefore a witch!]”

Contradictions • Recall definition of IMPLIES P Q T T F F F T

Contradictions • Recall definition of IMPLIES P Q T T F F F T T F F T • If P is false, then P Q is true, doesn’t matter what Q is • Example: • If pigs can fly, then hell freezes over • If 1+1=3 then 2+2=5

Next class • Sets • Read section 2. 1 in Jenkyns, Stephenson

Next class • Sets • Read section 2. 1 in Jenkyns, Stephenson