1 / 92

CPSC 121: Models of Computation 2012 Summer Term 2

CPSC 121: Models of Computation 2012 Summer Term 2. Proof (First Visit) Steve Wolfman, based on notes by Patrice Belleville, Meghan Allen and others. This work is licensed under a Creative Commons Attribution 3.0 Unported License. Outline. Prereqs, Learning Goals, and Quiz Notes

russ
Download Presentation

CPSC 121: Models of Computation 2012 Summer Term 2

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 Computation2012 Summer Term 2 Proof (First Visit) Steve Wolfman, based on notes by Patrice Belleville, Meghan Allen and others This work is licensed under aCreative Commons Attribution 3.0 Unported License.

  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. 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.

  4. 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; that is, determine whether or not is valid (and explain why) and judge the applicability of its result to a specific context. • Devise and attempt multiple different, appropriate strategies for proving a propositional logic statement follows from a list of premises. Discuss point of learning goals.

  5. Where We Are inThe Big Stories Theory Hardware How do we build devices to compute? Now: Taking a bit of a vacation in lecture! How do we model computational systems? Now: Continuing to build the foundation for our proofs. (We’ll get to the level of proof we really need starting with the next unit.)

  6. Motivating Problem:Changing cond Branches Assuming that a and c cannot both be true and that this function produces true: ;; Boolean Boolean Boolean Boolean -> Boolean (define (rearrange-cond? a b c d) (cond [a b] [c d] [else e])) Prove that the following function also produces true: ;; Boolean Boolean Boolean Boolean -> Boolean (define (rearrange-cond? a b c d) (cond [c d] [a b] [else e])) (Reality check: you must be able to do formal proofs. But, as with using equivalence laws to reorganize code, in practice you’ll often reason using proof techniques but without a formal proof.) • But first, prove these handy “lemmas”: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  7. NOT a Quiz Note ~p • ~(p v q) • This is valid by generalization (p  p v q). • This is valid because anytime ~p is true, ~(p v q) is also true. • This is invalid by generalization (p  p v q). • This is invalid because when p = F and q = T, ~p is true but ~(p v q) is false. • None of these.

  8. What does this mean? We can always substitute something equivalent for a subexpressionof a logical expression. We cannot always apply a rule of inference to just a part of a logical statement. Therefore, we will only apply rules of inference to complete statements, no matter what!

  9. 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

  10. 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

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

  12. 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

  13. 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 NOR 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. • Is there any fair way to run elections? • Are there problems that no program can solve? Meanwhile...

  14. 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.

  15. 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

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

  17. “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

  18. 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 • Why do we want 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 want it there

  19. 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 • Why do we want 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 b/c we don’t want it there

  20. 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 • Why do we want the blue lines/justifications? • ~(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

  21. 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 • Why do we want the blue line/justification? • (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

  22. 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.

  23. 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

  24. Aside: What does it mean to “work backward”? Take the conclusion of the proof. Use a rule in reverse to generate something closer to a statement you already have (like a premise).

  25. 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! Side Note: Can we work directly with a statement with a negation “on the outside”?

  26. 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?

  27. 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?

  28. 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!

  29. 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

  30. 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.

  31. 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.

  32. 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

  33. Preparatory Comments When we apply logic to a domain, we give interpretations for the logical symbols. That interpretation is where we can argue things like “meaning”, “values”, and “moral right”. Within the logical context, we argue purely on the basis of structure and irrefutable manipulations of that structure. And… statements contradict each other when, taken together, they are logically equivalent to F. There is no way for them to be simultaneously true.

  34. 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.

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

  36. 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.

  37. 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.

  38. Contradictory Premises? So premises #1 and #2 are w  m and o  (w  ~m). Do premises #1 and #2 contradict each other (i.e., is (premise1  premise2) logically equivalent to F)? a. Yes b. No c. Not enough information to tell.

  39. 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? (Remember the quiz!)

  40. 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

  41. Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: • Evaluate the truth of statements that include 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.

  42. Next Lecture Prerequisites Review (Epp 4th ed) Chapter 2 and be able to solve any Chapter 2 exercise. Read Sections 3.1 and 3.3 (skipping the “Negation” sections in 3.3) Complete the open-book, untimed quiz on Vista. update to current lecture.

  43. Motivating Problem:Changing cond Branches Assuming that a and c cannot both be true and that this function produces true: ;; Boolean Boolean Boolean Boolean -> Boolean (define (rearrange-cond? a b c d) (cond [a b] [c d] [else e])) Prove that the following function also produces true: ;; Boolean Boolean Boolean Boolean -> Boolean (define (rearrange-cond? a b c d) (cond [c d] [a b] [else e])) • First, prove these handy “lemmas”: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  44. Motivating Problem:Changing cond Branches Assuming that a and c cannot both be true, andthat this function produces true: ;; Boolean BooleanBooleanBoolean -> Boolean (define (rearrange-cond? a b c d) (cond [a b] [c d] [else e])) We leave the lemmas as an exercise: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r) In prop logic: • ~(a  b) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • … • (c  d)  (~c  ((a  b)  (~a  e))) target conclusion We’ll use our “heuristics” to work forward and backward until we solve the problem.

  45. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • … • (c  d) “subgoal” • (~c  ((a  b)  (~a  e))) “subgoal” • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 4, 5 We start by working backward; how de we prove x  y? Well, one way is to prove x and also prove y. We’ll break those into two separate subproblems! Side note: we’ll use the two statements you proved as exercises as “lemmas”: rules we proved for use in this proof. (Want to use them on an assignment / exam? Prove them there!) • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  46. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • … • (c  d) “subgoal” • (~c  (a  b))  (~c  (~a  e))) “subgoal” • (~c  ((a  b)  (~a  e))) Lemma 1 on 5 • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 4, 6 The second of these subgoals is still huge. We decided to break it into two pieces (and that’s why we went off and proved Lemma 1). • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  47. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • … • (c  d) “subgoal” • ~c  (a  b) “subgoal” • ~c  (~a  e) “subgoal” • (~c  (a  b))  (~c  (~a  e))) by CONJ on 5, 6 • (~c  ((a  b)  (~a  e))) Lemma 1 on 7 • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 4, 8 Now, we can attack those two pieces separately (which feels like it might be the wrong approach to me… but worth a try!) • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  48. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • ~a  ~c by DM on 1 • … • (c  d) “subgoal” • ~c  (a  b) “subgoal” • ~c  (~a  e) “subgoal” • (~c  (a  b))  (~c  (~a  e))) by CONJ on 6, 7 • (~c  ((a  b)  (~a  e))) Lemma 1 on 8 • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 5, 9 I’m out of ideas at the end. I switch to the beginning and play around with premises. (Foreshadowing: I didn’t figure out what to do with this premise until near the end.) • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  49. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • ~a  ~c by DM on 1 • a  b by SPEC on 2 • … • (c  d) “subgoal” • ~c  (a  b) “subgoal” • ~c  (~a  e) “subgoal” • (~c  (a  b))  (~c  (~a  e))) by CONJ on 7, 8 • (~c  ((a  b)  (~a  e))) Lemma 1 on 9 • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 6, 10 Let’s try the other premise. • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

  50. Motivating Problem:Changing cond Branches In prop logic: • ~(a  c) premise • (a  b)  (~a  ((c  d)  (~c  e))) premise • ~a  ~c by DM on 1 • a  b by SPEC on 2 • ~a  ((c  d)  (~c  e)) by SPEC on 2 • … • (c  d) “subgoal” • ~c  (a  b) “subgoal” • ~c  (~a  e) “subgoal” • (~c  (a  b))  (~c  (~a  e))) by CONJ on 8, 9 • (~c  ((a  b)  (~a  e))) Lemma 1 on 10 • (c  d)  (~c  ((a  b)  (~a  e))) by CONJ on 7, 11 Continuing with that premise… Hey! We can use our Lemma again! • Lemmas: • p  (q  r)  (p  q)  (p  r) • p  (q  r)  q  (p  r)

More Related