Inference Proof

Inference Proof
Slide Note
Embed
Share

Abstract reasoning in computer science involves inference proofs where facts are combined to derive new information. The process is formal yet flexible, allowing for complex proofs to be verified with precision. Understanding and utilizing inference rules expand the boundaries of provable statements in computational logic.

  • Inference Proofs
  • Abstract Reasoning
  • Computer Science
  • Validating Claims
  • Computational Logic

Uploaded on Feb 18, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Inference Proof CSE 311 Fall 23 Lecture 9

  2. A Brief Return to Training Wheels For about 1.5 lectures, we re going to study inference proofs The rules for these proofs are 1. Strict enough that computers can check them (there are languages designed to do that!) 2. More general than the simplification rules we ve seen so far. You ll still use the simplification rules! But you ll find we can prove more things (at least without significant difficulty). 3. More similar to the proofs we spend most of the quarter writing.

  3. A Brief Return to Training Wheels The claims and proofs are quite abstract! Why spend time here? Some computer scientists use the fully formal (computer-checkable) version of the rules. Our PL group here contains experts in these topics! We want your takeaways to be In principle, any proof we write in this class could be made fully formal and checked. But it can be a lot of work, so we usually think and communicate in English. We re people after all!

  4. Inference Proofs A new way of thinking of proofs: Here s one way to get an iron-clad guarantee: 1. Write down all the facts we know. 2. Combine the things we know to derive new facts. 3. Continue until what we want to show is a fact.

  5. Drawing Conclusions You know If it is raining, then I have my umbrella And It is raining You should conclude . I have my umbrella! For whatever you conclude, convert the statement to propositional logic will your statement hold for any propositions, or is it specific to raining and umbrellas? I know (? ?) and ?, I can conclude ? Or said another way: ? ? ? ?

  6. Modus Ponens The inference from the last slide is always valid. I.e. ? ? ? ? Has only True rows in its truth table (it s a tautology)

  7. Modus Ponens a formal proof ? ? ? ? [ ? ? ?] ? ? ? ? F ? ? ? ? ? ? ? ? [ ? ?] ? [? ?] ? T T Law of Implication Commutativity Distributivity Negation Commutativity Identity Law of Implication DeMorgan s Law Associativity Commutativity Negation Domination ? ? ? ? ? ? ? ? ? F ? ? ? ? ?

  8. Modus Ponens The inference from the last slide is always valid. I.e. ? ? ? ? T We use that inference A LOT So often people gave it a name ( Modus Ponens ) So often we don t have time to repeat that 12 line proof EVERY TIME. Let s make this another law we can apply in a single step. Just like refactoring a method in code.

  9. Notation Laws of Inference We re using the symbol A LOT. Too much Some new notation to make our lives easier. If we know both both ? and ? ?,? We can conclude any (or all) of ?,? ?,? means therefore I knew ?,? therefore I can conclude ?,?. ? ?,? Modus Ponens, i.e. ? ? ? ?), in our new notation. ?

  10. Another Proof Let s keep going. I know If it is raining then I have my umbrella and I do not have my umbrella I can conclude It is not raining! What s the general form? How do you think the proof will go? If you had to convince a friend of this claim in English, how would you do it? [(? ?) ?] ?

  11. A proof! We know ? ? and ?; we want to conclude ?. Let s try to prove it. Our goal is to list facts until our goal becomes a fact. We ll number our facts, and put a justification for each new one.

  12. A proof! We know ? ? and ?; we want to conclude ?. Let s try to prove it. Our goal is to list facts until our goal becomes a fact. We ll number our facts, and put a justification for each new one. Given Given Contrapositive of 1. Modus Ponens on 3,2. 1. ? ? 2. ? 3. ? ? 4. ?

  13. Try it yourselves Suppose you know ? ?, ? ?,and ?. Give an argument to conclude ?. Pollev.com/robbie Help me adjust my explanation!

  14. Try it yourselves Suppose you know ? ?, ? ?,and ?. Give an argument to conclude ?. Given Given Given Modus Ponens 1,3 Contrapositive of 2 Modus Ponens 5,4 1. ? ? 2. ? ? 3. ? 4. ? 5. ? ? 6. ?

  15. That was abstract! Imagine that instead someone had said: If next is null, then we go down the else-branch If the input list is non-empty, then we don t go down the else-branch. This test uses a non-empty list as input. Can you conclude anything?

  16. Sowhy do the abstract proof? Mostly to practice Though sometimes it s helpful to make things abstract. The more general you make a claim The more abstract it is, and therefore more difficult to understand on the surface But the more different contexts it can be used in.

  17. More Inference Rules We need a couple more inference rules. These rules set us up to get facts in exactly the right form to apply the really useful rules. A lot like commutativity and associativity in the propositional logic rules. I know the fact ? ? ? ? Eliminate I can conclude ? is a fact and ? is a fact separately separately. ?,?

  18. More Inference Rules In total, we have two for and two for , one to create the connector, and one to remove it. ? ? Eliminate ?,? Intro ? ? ?,? ? ? ?, ? Intro Eliminate ? ?,? ? ? None of these rules are surprising, but they are useful.

  19. Direct Proof Rule

  20. The Direct Proof Rule We ve been implicitly using another rule in our English proofs, the direct proof rule Write a proof given ? conclude ? ? ? Direct Proof rule ? ? ? ? This rule is different from the others ? ?is not a single fact. It s an observation that we ve done a proof. (i.e. that we showed fact ? starting from ?.) We will get a lot of mileage out of this rule.

  21. Inference Rules ? ? ? ? Eliminate Direct Proof rule ?,? ? ? ? ?, ? ? ?,? Eliminate Modus Ponens ? ? ?,? Intro You can still use all the propositional logic equivalences too! ? ? ? Intro ? ?,? ?

  22. The Direct Proof Rule We ve been implicitly using another rule today, the direct proof rule Write a proof given ? conclude ? ? ? Direct Proof rule ? ? ? ? This rule is different from the others ? ?is not a single fact. It s an observation that we ve done a proof. (i.e. that we showed fact ? starting from ?.) We will get a lot of mileage out of this rule starting right now.

  23. How would you argue Let s say you have a piece of code. And you think if if the code gets null input then be thrown. How would you convince your friend? then a nullPointerExecption will You d probably trace the code, assuming you would get null input. The code was your given given The null input is an assumption The null input is an assumption

  24. In general How do you convince someone that ? ? is true given some surrounding context/some surrounding givens? You suppose ? is true (you assume ?) And then you ll show ? must also be true. Just from ? and the Given information.

  25. The Direct Proof Rule Write a proof assume ? conclude ? ? ? Direct Proof rule ? ? ? ? This rule is different from the others ? ?is not a single fact. It s an observation that we ve done a proof. (i.e. that we showed fact ? starting from ?.) We will get a lot of mileage out of this rule starting today!

  26. Given: ((? ?) (? ?)) Show: (? ?) Here s an incorrect proof. Given Eliminate (1) Eliminate (1) Given??? Modus Ponens 4,2 Modus Ponens 5,3 Direct Proof Rule 1. ? ? ? ? 2. ? ? 3. ? ? 4. ? 5. ? 6. ? 7. ? ?

  27. Given: ((? ?) (? ?)) Show: (? ?) Here s an incorrect proof. Given Eliminate 1 Eliminate (1) Given ???? Modus Ponens 4,2 Modus Ponens 5,3 Direct Proof Rule Proofs are supposed to be lists of facts. Some of these facts aren t really facts 1. ? ? ? ? 2. ? ? 3. ? ? 4. ? These facts depend on ?. But ?isn t known generally. It was assumed for the purpose of proving ? ?. 5. ? 6. ? 7. ? ?

  28. Given: ((? ?) (? ?)) Show: (? ?) Here s an incorrect proof. Given Eliminate 1 Eliminate (1) Given ???? Modus Ponens 4,2 Modus Ponens 5,3 Direct Proof Rule Proofs are supposed to be lists of facts. Some of these facts aren t really facts 1. ? ? ? ? 2. ? ? 3. ? ? 4. ? These facts depend on ?. But ?isn t known generally. It was assumed for the purpose of proving ? ?. 5. ? 6. ? 7. ? ?

  29. Given: ((? ?) (? ?)) Show: (? ?) Here s a corrected version of the proof. Given Eliminate 1 Eliminate 1 Assumption Modus Ponens 4.1,2 Modus Ponens 4.2,3 1. ? ? ? ? When introducing an assumption to prove an implication: Indent, and change numbering. 2. ? ? 3. ? ? 4.1 ? 4.2 ? 4.3 ? When reached your conclusion, use the Direct Proof Rule to observe the implication is a fact. Direct Proof Rule 5. ? ? The conclusion is an unconditional fact (doesn t depend on ?) so it goes back up a level

  30. Try it! Given: ? ?, ? ? ?, ?. Show: ? ?

  31. Try it! Given: ? ?, ? ? ?, ?. Show: ? ? 1. ? ? 2. ? ? ? 3. ? 4.1 ? 4.2 ? ? 4.3 ? 4.4 ? ? 4.5 ? 5. ? ? Given Given Given Assumption Intro (3,4.1) Modus Ponens (2, 4.2) Commutativity (1) Eliminate (4.4, 4.3) Direct Proof Rule

  32. Inference Proofs in Predicate Logic

  33. Proofs with Quantifiers We ve done symbolic proofs with propositional logic. To include predicate logic, we ll need some rules about how to use quantifiers. ? ?(?) Eliminate ?(?) for some ? Intro ? ?(?) ? ? for any ? ? ? ;? is arbitrary arbitrary ??(?) Eliminate Intro ?(?) for a fresh fresh ? ? ?(?) Let s see a good example, then come back to those arbitrary and fresh conditions.

  34. Proof Using Quantifiers Suppose we know ??(?) and ?[ ? ? ? ? ]. Conclude ??(?). ?(?) for some ? ? ?(?) Intro Eliminate ? ?(?) ? ? for any ? ? ? ;? is arbitrary arbitrary ??(?) Eliminate Intro ?(?) for a fresh fresh ? ? ?(?)

  35. Proof Using Quantifiers Suppose we know ??(?) and ?[ ? ? ? ? ]. Conclude ??(?). ?(?) for some ? Intro ? ?(?) ??(?) Eliminate ?(?) for a fresh fresh ? ? ?(?) Eliminate ? ? for any ? ? ? ;? is arbitrary arbitrary Intro ? ?(?)

  36. Proof Using Quantifiers Suppose we know ??(?) and ?[ ? ? ? ? ]. Conclude ??(?). ?(?) for some ? Given Eliminate 1 Given Eliminate 3 Modus Ponens 2,4 Intro 5 1. ??(?) 2. ?(?) 3. ?[? ? ? ? ] 4. ? ? ?(?) 5. ?(?) 6. ??(?) Intro ? ?(?) ??(?) Eliminate ?(?) for a fresh fresh ? ? ?(?) Eliminate ? ? for any ? ? ? ;? is arbitrary arbitrary Intro ? ?(?)

  37. Proofs with Quantifiers We ve done symbolic proofs with propositional logic. To include predicate logic, we ll need some rules about how to use quantifiers. ? ?(?) Eliminate ?(?) for some ? Intro ? ?(?) ? ? for any ? ? ? ;? is arbitrary arbitrary ??(?) Eliminate Intro ?(?) for a fresh fresh ? ? ?(?) arbitrary means ?is just a variable in our domain. It doesn t depend on any other variables and wasn t introduced with other information.

  38. Proofs with Quantifiers We ve done symbolic proofs with propositional logic. To include predicate logic, we ll need some rules about how to use quantifiers. ? ?(?) Eliminate ?(?) for some ? Intro ? ?(?) ? ? for any ? ? ? ;? is arbitrary arbitrary ??(?) Eliminate Intro ?(?) for a fresh fresh ? ? ?(?) fresh means ?is a new symbol (there isn t another ? somewhere else in our proof).

  39. Fresh and Arbitrary Suppose we know ?? ? . Can we conclude ?? ? ? ?(?) for some ? Given Eliminate (1) Intro (2) Intro 1. ? ? ? ? ?(?) 2. ?(?) ??(?) 3. ? ?(?) Eliminate ?(?) for a fresh fresh ? This proof is definitely (take ?(?)to be is a prime number ) definitely wrong. ? ?(?) Eliminate ? ? for any ? ?wasn t arbitrary. arbitrary. We knew something about it it s the ? that exists to make ? ? true. ? ? ;? is arbitrary arbitrary Intro ? ?(?)

  40. Fresh and Arbitrary ? ? ;? is arbitrary arbitrary ??(?) Eliminate Intro ?(?) for a fresh fresh ? ? ?(?) You can trust a variable to be arbitrary If you eliminated a to create a variable, that variable is arbitrary. Otherwise it s not arbitrary it depends on something. arbitrary if you introduce it as such. You can trust a variable to be fresh anywhere else (i.e. just use a new letter) fresh if the variable doesn t appear

  41. Fresh and Arbitrary ?(?) for some ? ? ?(?) Intro Eliminate ? ?(?) ? ? for any ? There are no similar concerns with these two rules. Want to reuse a variable when you eliminate ? Go ahead. Have a ? that depends on many other variables, and want to intro ? Also not a problem.

  42. Arbitrary In section, you said: ? ? ? ?,? [ ? ? ? ?,? ]. Let s prove it!!

  43. Arbitrary In section, you said: ? ? ? ?,? [ ? ? ? ?,? ]. Let s prove it!! 1.1 ? ? ? ?,? 1.2 ? ? ?,? 1.3 Let ? be arbitrary. 1.4 ?(?,?) 1.5 ? ? ?,? 1.6 ? ? ?(?,?) 2. ? ? ? ?,? Assumption Elim (1.1) -- Elim (1.2) Intro (1.4) Intro (1.5) Direct Proof Rule [ ? ? ?(?,?)]

  44. Arbitrary In section, you said: ? ? ? ?,? [ ? ? ? ?,? ]. Let s prove it!! 1.1 ? ? ? ?,? 1.2 ? ? ?,? 1.4 ?(?,?) 1.5 ? ? ?,? 1.6 ? ? ?(?,?) 2. ? ? ? ?,? Assumption Elim (1.1) It is not required to have variable is arbitrary as a step before using it. But many people (including Robbie) find it helpful. Elim (1.2) Intro (1.4) Intro (1.5) Direct Proof Rule [ ? ? ?(?,?)]

  45. Find The Bug Let your domain of discourse be integers. We claim that given ? ?Greater ?,? , we can conclude ? ?Greater(?,?) Where Greater(?,?) means ? > ? Given -- Elim (1) Elim (2) Intro (4) Intro (5) 1. ? ? Greater ?,? 2. Let ? be an arbitrary integer 3. ?Greater(?,?) 4. Greater(?,?) 5. ? Greater(?,?) 6. ? ? Greater(?,?)

  46. Find The Bug Given -- Elim (1) Elim (2) Intro (4) Intro (5) 1. ? ? Greater ?,? 2. Let ? be an arbitrary integer 3. ?Greater(?,?) 4. Greater(?,?) 5. ? Greater(?,?) 6. ? ? Greater(?,?) ? is not a single number! The variable ? depends on ?.You can t get rid of ? while ? is still around. What is ?? It s probably something like ? + 1.

  47. Bug Found There s one other hidden requirement to introduce . No other variable in the statement can depend on the variable to be generalized Think of it like this -- ? was probably ? + 1 in that example. You wouldn t have generalized from Greater(? + 1,?) To ?Greater(? + 1,?). There s still an ?, you d have replaced all the ? s. ? depends on ? if ? is in a statement when ? is introduced. This issue is much clearer in English proofs, which we ll start next time.

  48. Extra Practice

  49. Caution Be careful! Logical inference rules can only be applied to entire They cannot be applied to portions of a statement (the way our propositional rules could). Why not? Suppose we know ? ?, ?. Can we conclude ?? Given Given Introduce (1) Introduce (2) Modus Ponens 3,4. entire facts. 1. ? ? ? Intro 2. ? ? ?,? ? 3. ? ? ? 4. ? ? 5. ?

  50. One more Proof Show if we know: ?,?, ? ? ? ? ,? ? we can conclude ?.

More Related Content