1 / 60

CPSC 121: Models of Computation 2009 Winter Term 1

CPSC 121: Models of Computation 2009 Winter Term 1. Proof (First Visit) Steve Wolfman, based on notes by Patrice Belleville, Meghan Allen and others. Outline. Prereqs, Learning Goals, and Quiz Notes Prelude: What Is Proof? Problems and Discussion “Prove Your Own Adventure”

Download Presentation

CPSC 121: Models of Computation 2009 Winter Term 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 121: Models of Computation2009 Winter Term 1 Proof (First Visit) Steve Wolfman, based on notes by Patrice Belleville, Meghan Allen and others

  2. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata, Explore and Critique • Next Lecture Notes

  3. Lecture Prerequisites Read Section 1.3. Solve problems like Exercise Set 1.3, #1, 3, 4, 6-32, 36-44. Of these, we’re especially concerned about problems like 12-13 and 39-44. Many of these problems go beyond the pre-class learning goals into the in-class goals, but they’re the tightest fit in the text. Complete the open-book, untimed quiz on WebCT that was due before class.

  4. Learning Goals: Pre-Class By the start of class, you should be able to: • Use truth tables to establish or refute the validity of a rule of inference. • Given a rule of inference and propositional logic statements that correspond to the rule’s premises, apply the rule to infer a new statement implied by the original statements. Discuss point of learning goals.

  5. Learning Goals: In-Class By the end of this unit, you should be able to: • Explore the consequences of a set of propositional logic statements by application of equivalence and inference rules, especially in order to massage statements into a desired form. • Critique a propositional logic proof, identifying flaws in its reasoning and application. • Devise and attempt multiple different, appropriate strategies for proving a propositional logic statement follows from a list of premises. Discuss point of learning goals.

  6. Quiz 4 Notes (1 of 2) Applying a rule: a  b, b  c  a  c p  (q  r), q  s  ? Validity of a rule: p  ~p  ? Second set of quiz notes will come much later!

  7. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata, Explore and Critique • Next Lecture Notes

  8. What is Proof? A rigorous formal argument that unequivocally demonstrates the truth of a proposition, given the truth of the proof’s premises. that! Adapted from MathWorld: http://mathworld.wolfram.com/Proof.html

  9. Problem: Meaning of Proof Let’s say you prove the following: Premise 1 Premise 2 ⁞ Premise n Conclusion • What does this mean? • Premises 1 to n are true • Conclusion is true • Premises 1 to ncan be true • Conclusioncan be true • None of the above

  10. Tasting Powerful Proof: Some Things We Might Prove • We can build a “three-way switch” system with any number of switches.  • We can build a combinational circuit matching any truth table.  • We can build any digital logic circuit using nothing but NAND gates. • We can sort a list by breaking it in half, and then sorting and merging the halves. • We can find the GCD of two numbers by finding the GCD of the 2nd and the remainder when dividing the 1st by the 2nd. • There’s (sort of) no fair way to run elections. • There are problems no program can solve. Meanwhile...

  11. What Is a Propositional Logic Proof? An argument in which (1) each line is a propositional logic statement, (2) each statement is a premise or follows unequivocally by a previously established rule of inference from the truth of previous statements, and (3) the last statement is the conclusion. A very constrained form of proof, but a good starting point.Interesting proofs will usually come in less structured packages than propositional logic proofs.

  12. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata, Explore and Critique • Next Lecture Notes

  13. Prop Logic Proof Problem To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p

  14. “Prove Your Own Adventure” Which step is the easiest to fill in? 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise [STEP A: near the start] [STEP B: in the middle] [STEP C: near the end] [STEP D: last step] To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p

  15. D: Last Step 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise ... ~q  ~r De Morgan’s (1) ~q Specialization (?) ... ((u  q)  s)  Bicond (2) (s  (u  q)) ... ~s ~p Modus ponens (3,?) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p • How do we know to put ~p at the end? • ~p is the proof’s conclusion • ~p is the end of the last premise • every proof ends with ~p • None of these but some other reason • None of these because we don’t know

  16. C: Near the End 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise ... ~q  ~r De Morgan’s (1) ~q Specialization (?) ... ((u  q)  s)  Bicond (2) (s  (u  q)) ... ~s ~p Modus ponens (3,?) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p • How do we know to put the blue line/justification at the end? • ~s  ~p is the last premise • ~s  ~p is the only premise that mentions ~s • ~s  ~p is the only premise that mentions p • None of these but some other reason • None of these because we don’t know

  17. A: Near the Start 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise ... ~q  ~r De Morgan’s (1) ~q Specialization (?) ... ((u  q)  s)  Bicond (2) (s  (u  q)) ... ~s ~p Modus ponens (3,?) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p • How do we know to put the blue lines/justifications in? • ~(q  r) is the first premise • ~(q  r) is a useless premise • We can’t work directly with a premise with a negation “on the outside” • Neither the conclusion nor another premise mentions r • None of these

  18. B: In the Middle 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise ... ~q  ~r De Morgan’s (1) ~q Specialization (?) ... ((u  q)  s)  Bicond (2) (s  (u  q)) ... ~s ~p Modus ponens (3,?) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p • How do we know to put the blue lines/justifications in? • (u  q)  s is the only premise left • (u  q)  s is the only premise that mentions u • (u  q)  s is the only premise that mentions s without a negation • We have no rule to get directly from one side of a biconditional to the other • None of these

  19. Prop Logic Proof Strategies • Work backwards from the end • Play with alternate forms of premises • Identify and eliminate irrelevant information • Identify and focus on critical information • Alter statements’ forms so they’re easier to work with • “Step back” from the problem frequently to think about assumptions you might have wrong or other approaches you could take And, if you don’t know that what you’re trying to prove follows...switch from proving to disproving and back now and then.

  20. Continuing From There 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise 4. ~q  ~r De Morgan’s (1) 5. ~q Specialization (4) 6. ((u  q)  s)  Bicond (2) (s  (u  q)) 7. ?????? Specialization (6) ... ~s ~p Modus ponens (3,?) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p • Which direction of  goes in step 7? • (u  q)  s because the simple part is on the right • (u  q)  s because the other direction can’t establish ~s • s  (u  q) because the simple part is on the left • s  (u  q) because the other direction can’t establish ~s • None of these

  21. Finishing Up (1 of 3) 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise 4. ~q  ~r De Morgan’s (1) 5. ~q Specialization (4) 6. ((u  q)  s)  Bicond (2) (s  (u  q)) 7. s  (u  q) Specialization (6) 8. ???? ???? 9. ~(u  q) ???? 10. ~s Modus tollens (7, 9) 11. ~p Modus ponens (3,10) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p We know we needed ~(u  q) on line 9 because that’s what we created line 7 for! Now, how do we get ~(u  q)? Working forward is tricky. Let’s work backward. What is ~(u  q) equivalent to?

  22. Finishing Up (2 of 3) 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise 4. ~q  ~r De Morgan’s (1) 5. ~q Specialization (4) 6. ((u  q)  s)  Bicond (2) (s  (u  q)) 7. s  (u  q) Specialization (6) 8. ~u  ~q ???? 9. ~(u  q) De Morgan’s (8) 10. ~s Modus tollens (7, 9) 11. ~p Modus ponens (3,10) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p All that’s left is to get to ~u  ~q. How do we do it?

  23. Finishing Up (3 of 3) 1. ~(q  r) Premise 2. (u  q)  s Premise 3. ~s  ~p Premise 4. ~q  ~r De Morgan’s (1) 5. ~q Specialization (4) 6. ((u  q)  s)  Bicond (2) (s  (u  q)) 7. s  (u  q) Specialization (6) 8. ~u  ~q Generalization (5) 9. ~(u  q) De Morgan’s (8) 10. ~s Modus tollens (7, 9) 11. ~p Modus ponens (3,10) To prove: ~(q  r) (u  q)  s ~s  ~p___  ~p As usual in our slides, we made no mistakes and reached no dead ends. That’s not the way things really go on difficult proofs! Mistakes and dead ends are part of the discovery process! So, step back now and then and reconsider your assumptions and approach!

  24. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata, Explore and Critique • Next Lecture Notes

  25. Limitations of Truth Tables Why not just use truth tables to prove propositional logic theorems? • No reason; truth tables are enough. • Truth tables scale poorly to large problems. • Rules of inference and equivalence rules can prove theorems that cannot be proven with truth tables. • Truth tables require insight to use, while rules of inference can be applied mechanically.

  26. Limitations of Logical Equivalences Why not use logical equivalences to prove that the conclusions follow from the premises? • No reason; logical equivalences are enough. • Logical equivalences scale poorly to large problems. • Rules of inference and truth tables can prove theorems that cannot be proven with logical equivalences. • Logical equivalences require insight to use, while rules of inference can be applied mechanically.

  27. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata: Explore and Critique • Next Lecture Notes

  28. Problem: Onnagata Problem: Critique the following argument. Premise 1: If women are too close to femininity to portray women then men must be too close to masculinity to play men, and vice versa. Premise 2: And yet, if the onnagata are correct, women are too close to femininity to portray women and yet men are not too close to masculinity to play men. Conclusion: Therefore, the onnagata are incorrect, and women are not too close to femininity to portray women.

  29. Quiz 4 Notes (2 of 2) Approaches: • Use our model! • Prove with a truth table • Trace the argument • Build a new argument and see where it leads • Assume the opposite of the conclusion and see what happens • Question the premises

  30. Contradictory Premises? Do premises #1 and #2 contradict each other (i.e., is premise1 AND premise2 logically equivalent to F)? a. Yes b. No c. Not enough information to tell.

  31. Defining the Problem Which definitions should we use? a. w = women, m = men, f = femininity, m = masculinity, o = onnagata, c = correct b. w = women are too close to femininity, m = men are too close to masculinity, pw = women portray women, pm = men portray men, o = onnagata are correct c. w = women are too close to femininity to portray women, m = men are too close to masculinity to portray men, o = onnagata are correct d. None of these, but another set of definitions works well. e. None of these, and this problem cannot be modeled well with propositional logic.

  32. Translating the Statements Which of these is not an accurate translation of one of the statements? • w  m • (w  m)  (m  w) • o  w  ~m • ~o  ~w • All of these are accurate translations.

  33. Problem: Now, Explore! Critique the argument by either: • Proving it correct (and commenting on how good the propositional logic model’s fit to the context is).How do we prove prop logic statements? • Showing that it is an invalid argument.How do we show an argument is invalid? (Hint: think back to the quiz!)

  34. Outline • Prereqs, Learning Goals, and Quiz Notes • Prelude: What Is Proof? • Problems and Discussion • “Prove Your Own Adventure” • Why rules of inference? (advantages + tradeoffs) • Onnagata, Explore and Critique • Next Lecture Notes

  35. Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: • Evaluate the truth of predicates applied to particular values. • Show predicate logic statements are true by enumerating examples (i.e., all examples in the domain for a universal or one for an existential). • Show predicate logic statements are false by enumerating counterexamples (i.e., one counterexample for universals or all in the domain for existentials). • Translate between statements in formal predicate logic notation and equivalent statements in closely matching informal language (i.e., informal statements with clear and explicitly stated quantifiers). Discuss point of learning goals.

  36. Next Lecture Prerequisites Review Chapter 1 and be able to solve any Chapter 1 exercise. Read Sections 2.1 and 2.3 (skipping the “Negation” sections in 2.3 on pages 102-104) Solve problems like Exercise Set 2.1 #1-24 and Set 2.3 #1-12, part (a) of 14-19, 21-22, 30-31, part (a) of 32-38, 39, parts (a) and (b) of 45-52, and 53-56. You should have completed the open-book, untimed quiz on Vista that was due before this class. update to current lecture.

  37. More problems to solve... (on your own or if we have time)

  38. Problem:Who put the cat in the piano? Hercule Poirot has been asked by Lord Martin to find out who closed the lid of his piano after dumping the cat inside. Poirot interrogates two of the servants, Akilna and Eiluj. One and only one of them put the cat in the piano. Plus, one always lies and one never lies. Akilna says: • Eiluj did it. • Urquhart paid her $50 to help him study. Eiluj says: • I did not put the cat in the piano. • Urquhart gave me less than $60 to help him study. Problem: Whodunit?

  39. Problem: Automating Proof Given: p  q p  ~q  r (r  ~p)  s  ~p ~r Problem: What’s everything you can prove?

  40. Problem: Canonical Form A common form for propositional logic expressions, called “disjunctive normal form” or “sum of products form”, looks like this: (a  ~b  d)  (~c)  (~a  ~d)  (b  c  d  e)  ... In other words, each clause is built up of simple propositions or their negations, ANDed together, and all the clauses are ORed together.

  41. Problem: Canonical Form Problem: Prove that any propositional logic statement can be expressed in disjunctive normal form.

  42. Mystery #1 Theorem: p  q q  (r  s) ~r  (~t  u) p  t  u Is this argument valid or invalid? Is whatever u means true?

  43. Mystery #2 Theorem: p p  r p  (q  ~r) ~q  ~s  s Ack! We proved ~s. What happened? Perhaps the theorem is false. Perhaps premises are contradictory (and so we can conclude anything by the paradox of material implication!) Which one is it? Is this argument valid or invalid? Is whatever s means true?

  44. Mystery #3 Theorem: q p  m q  (r  m) m  q  p Ack! We proved ~s. What happened? Perhaps the theorem is false. Perhaps premises are contradictory (and so we can conclude anything by the paradox of material implication!) Which one is it? Is this argument valid or invalid? Is whatever p means true?

  45. Practice Problem (for you!) Prove (with truth tables) that hypothetical syllogism is a valid rule of inference: p  q q  r  p  r

  46. Practice Problem (for you!) Prove (with truth tables) whether this is a valid rule of inference: q p  q  p

  47. Practice Problem (for you!) Are the following arguments valid? This apple is green. If an apple is green, it is sour.  This apple is sour. Sam is not barking. If Sam is barking, then Sam is a dog.  Sam is not a dog.

  48. Practice Problem (for you!) Are the following arguments valid? This shirt is comfortable. If a shirt is comfortable, it’s chartreuse.  This shirt is chartreuse. It’s not cold. If it’s January, it’s cold.  It’s not January. Is valid (as a term) the same as true or correct (as English ideas)?

  49. More Practice Meghan is rich. If Meghan is rich, she will pay your tuition.  Meghan will pay your tuition. Is this argument valid? Should you bother sending in a check for your tuition, or is Meghan going to do it?

  50. Problem: Equivalent Java Programs Problem: How many valid Java programs are there that do exactly the same thing?

More Related