cpsc 121 models of computation 2018s
play

CPSC 121: Models of Computation 2018S Proof (First Visit) Meghan - PowerPoint PPT Presentation

CPSC 121: Models of Computation 2018S Proof (First Visit) Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others 1 This work is licensed under a Creative Commons Attribution 3.0 Unported License. Outline Prereqs,


  1. CPSC 121: Models of Computation 2018S Proof (First Visit) Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others 1 This work is licensed under a Creative 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 2

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

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

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

  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 -> Boolean (define (rearrange-cond? a b c d e) (cond [a b] [c d] [else e])) Prove that the following function also produces true: ;; Boolean Boolean Boolean Boolean Boolean -> Boolean (define (rearrange-cond? a b c d e) (cond [c d] (Reality check: you must be [a b] able to do formal proofs. But , [else e])) as with using equivalence laws to reorganize code, in practice But first, prove these handy “lemmas”: you’ll often reason using proof 1. p → (q ∧ r) ≡ (p → q) ∧ (p → r) techniques but without a formal 2. p → (q → r) ≡ q → (p → r) proof.) 6

  7. Quiz 4 Notes (“lining up”) a → b ..what must we replace b b → c with? ∴ a → c a. p b. q c. (q ∨ r) To apply this to: d. Something else p → (q ∨ r) e. We cannot apply it q → s Next set of quiz notes will come much later! 7

  8. NOT a Quiz Note ~p ∴ ~(p v q) a. This is valid by generalization (p ⇒ p v q). b. This is valid because anytime ~p is true, ~(p v q) is also true. c. This is invalid by generalization (p ⇒ p v q). d. This is invalid because when p = F and q = T, ~p is true but ~(p v q) is false. e. None of these. 8

  9. What does this mean? We can always substitute something equivalent for a subexpression of 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

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

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

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

  13. Problem: Meaning of Proof Let’s say you prove the following: Premise 1 Premise 2 ⁞ Premise n ∴ Conclusion Can one of the premises be false? a. No, proofs may not use false premises b. No, the proof shows that the premises are true c. Yes, but then the conclusion is false d. Yes, but then we know nothing about the conclusion e. Yes, but we still know the conclusion is true 13

  14. Tasting Powerful Proof: Some Things We Might Prove • We can build a “light that changes state when a switch is flipped” 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 2 nd and the remainder when dividing the 1 st by the 2 nd . • Is there any fair way to run elections? • Are there problems that no program can solve? Meanwhile... 14

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

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

  17. Prop Logic Proof Problem To prove: ~(q ∨ r) (u ∧ q) ↔ s ~s → ~p___ ∴ ~p 17

  18. “Prove Your Own Adventure” Which step is the easiest to fill in? To prove: ~(q ∨ r) 1. ~(q ∨ r) Premise (u ∧ q) ↔ s 2. (u ∧ q) ↔ s Premise ~s → ~p___ 3. ~s → ~p Premise [STEP A: near the start] ∴ ~p [STEP B: in the middle] [STEP C: near the end] [STEP D: last step] 18

  19. D: Last Step To prove: ~(q ∨ r) 1. ~(q ∨ r) Premise (u ∧ q) ↔ s 2. (u ∧ q) ↔ s Premise 3. ~s → ~p ~s → ~p___ Premise ... ∴ ~p ~q ∧ ~r De Morgan’s (1) Why do we want to put ~p at the end? ~q Specialization (?) ... a. ~p is the proof’s conclusion ((u ∧ q) → s) ∧ Bicond (2) b. ~p is the end of the last premise (s → (u ∧ q)) c. every proof ends with ~p ... d. None of these but some other reason e. None of these because we don’t ~s want it there ~p Modus ponens (3,?) 19

  20. C: Near the End To prove: ~(q ∨ r) 1. ~(q ∨ r) Premise (u ∧ q) ↔ s 2. (u ∧ q) ↔ s Premise 3. ~s → ~p Premise ~s → ~p___ ... ∴ ~p ~q ∧ ~r De Morgan’s (1) ~q Specialization (?) Why do we want to put the blue ... line/justification at the end? ((u ∧ q) → s) ∧ Bicond (2) ~s → ~p is the last premise a. (s → (u ∧ q)) ~s → ~p is the only premise that b. ... mentions ~s ~s → ~p is the only premise that ~s c. ~p Modus ponens (3,?) mentions p d. None of these but some other reason e. None of these b/c we don’t want it there 20

  21. A: Near the Start To prove: ~(q ∨ r) 1. ~(q ∨ r) Premise (u ∧ q) ↔ s 2. (u ∧ q) ↔ s Premise ~s → ~p___ 3. ~s → ~p Premise ... ∴ ~p ~q ∧ ~r De Morgan’s (1) Why do we want the blue ~q Specialization (?) lines/justifications? ... ((u ∧ q) → s) ∧ Bicond (2) ~(q ∨ r) is the first premise a. (s → (u ∧ q)) ~(q ∨ r) is a useless premise b. ... c. We can’t work directly with a premise with a negation “on the outside” ~s d. Neither the conclusion nor another ~p Modus ponens (3,?) premise mentions r e. None of these 21

  22. B: In the Middle To prove: ~(q ∨ r) 1. ~(q ∨ r) Premise (u ∧ q) ↔ s 2. (u ∧ q) ↔ s Premise ~s → ~p___ 3. ~s → ~p Premise ... ∴ ~p ~q ∧ ~r De Morgan’s (1) Why do we want the blue ~q Specialization (?) line/justification? ... (u ∧ q) ↔ s is the only premise left ((u ∧ q) → s) ∧ Bicond (2) a. (u ∧ q) ↔ s is the only premise that b. (s → (u ∧ q)) mentions u ... (u ∧ q) ↔ s is the only premise that c. ~s mentions s without a negation ~p Modus ponens (3,?) d. We have no rule to get directly from one side of a biconditional to the other e. None of these 22

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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend