cpsc 121 models of computation
play

CPSC 121: Models of Computation Instructor: Bob Woodham - PowerPoint PPT Presentation

CPSC 121: Models of Computation Instructor: Bob Woodham woodham@cs.ubc.ca Department of Computer Science University of British Columbia Lecture Notes 2008/2009, Section 203 CPSC 121: Models of Computation Menu January 19, 2009 Topics:


  1. CPSC 121: Models of Computation Instructor: Bob Woodham woodham@cs.ubc.ca Department of Computer Science University of British Columbia Lecture Notes 2008/2009, Section 203 CPSC 121: Models of Computation

  2. Menu January 19, 2009 Topics: Proofs (in Propositional Logic) Rules of Inference Reading: Today: Epp 1.3 Next: Epp 2.1, 2.3 Reminders: On-line Quiz 5 deadline 9:00pm January 22 Assignment 1 due Friday, January 30, 17:00 READ the WebCT Vista course announcements board WebCT Vista: http://www.vista.ubc.ca www: http://www.ugrad.cs.ubc.ca/~cs121/ CPSC 121: Models of Computation

  3. What is a Proof? A proof is a method to determine “truth.” There are many approaches. . . Justice System: Proof “beyond a reasonable doubt” 1 (criminal) or on the “preponderance of the evidence” (civil) as determined by a jury of 12 people selected at random Religion: Truth revealed by “God,” perhaps via a third party 2 Authority: Truth obtained from someone with whom it is 3 unwise to disagree Experimental Science: Truth is guessed and hypotheses 4 are confirmed or refuted by experiment Sampling: Truth by statistical analysis. For example, public 5 opinion determined by polling a representative sample Democracy: Truth obtained by vote 6 CPSC 121: Models of Computation

  4. Mathematical Proof Mathematics has a specific notion of “proof” Definition: A mathematical proof of a proposition is a chain of logical deductions leading to the proposition from a base set of axioms Definition: An axiom is a proposition that is assumed to be true Definition. A set of axioms is consistent if no proposition can be proven to be both true and false Definition. A set of axioms is complete if it can be used to prove or disprove every proposition Definition: Logical deductions (aka inference rules) are used to combine axioms and true propositions to construct more true propositions. CPSC 121: Models of Computation

  5. Terminology Definition: A theorem is a proposition that has been proven to be true ASIDE: A proposition remains a conjecture if not yet proven to be true (and not yet known to be false) Definition: A lemma is a theorem that may not be too interesting in its own right but that is useful in proving another theorem Definition: A corollary is a theorem that follows easily from another theorem Definition: Logic is that branch of the study of knowledge that deals with the structure of arguments CPSC 121: Models of Computation

  6. Example 1: Ethan’s Argument Consider the following sequence of propositions: Ethan is reading The Paper Bag Princess If Ethan is reading The Paper Bag Princess then he is not practising the piano If Ethan is not practising the piano then the TV will be “broken” tomorrow If we assume that these propositions (or “premises”) are true, it is reasonable to conclude Therefore, the TV will be “broken” tomorrow The process of inferring a conclusion from a sequence of propositions (or premises) is called deductive reasoning CPSC 121: Models of Computation

  7. Deductive Argument In general, we can summarize the form of a deductive argument as P 1 P 2 P 3 · · · P n ∴ q where the P i , i = 1 , 2 , 3 , . . . , n are premises and q is the conclusion CPSC 121: Models of Computation

  8. Deductive Argument (cont’d) An argument is valid if the conclusion follows logically from the premises. In other words, An argument is valid if and only if ( P 1 ∧ P 2 ∧ . . . ∧ P n ) → q is a tautology CPSC 121: Models of Computation

  9. Deductive Argument (cont’d) Note: We conclude q if and only if the argument is valid 1 the premises are proven true 2 CAUTION: In order to validate an argument we often assume the premises to be true. This is not the same as having proven the premises to be true CPSC 121: Models of Computation

  10. Deductive Argument (cont’d) A valid argument does not say the conclusion is true A valid argument says that if you grant the premises then you also must grant the conclusion If one or more of the premises is false then the argument is vacuous. It says nothing about the truth of the conclusion CPSC 121: Models of Computation

  11. Ethan’s Argument Re-Visited Let’s determine the validity of Ethan’s argument We translate into propositional logic. Let r : Ethan is reading The Paper Bag Princess p : Ethan is practising the piano t : the TV will work tomorrow Ethan’s argument is: r r → p p → t ∴ t CPSC 121: Models of Computation

  12. Ethan’s Argument Re-Visited Let’s validate Ethan’s argument 1. r premise 2. premise r → p 3. p modus ponens 1 2 4. premise p → t 5. ∴ t modus ponens 3 4 CPSC 121: Models of Computation

  13. Ethan’s Argument Re-Visited Let’s validate Ethan’s argument another way 1. r → p premise 2. premise p → t 3. r → t hypothetical syllogism 1 2 4. premise r 5. ∴ t modus ponens 3 4 CPSC 121: Models of Computation

  14. Example 2: Establish the validity of: p → q q → ( r ∧ s ) r ∨ ( t ∨ u ) p ∧ t ∴ u CPSC 121: Models of Computation

  15. Example 2: (cont’d) Here’s the deductive argument: step reason 1. p → q premise 2. premise q → ( r ∧ s ) 3. p → ( r ∧ s ) hypothetical syllogism 1 2 4. premise p ∧ t 5. p simplification 4 6. modus ponens 3 5 ( r ∧ s ) 7. r simplification 6 8. r ∨ ( t ∨ u ) premise 9. disjunctive syllogism 7 8 t ∨ u 10. t simplification 4 11. ∴ u disjunctive syllogism 9 10 CPSC 121: Models of Computation

  16. Example 3: Establish the validity of: p p → r p → ( q ∨ r ) q ∨ s ∴ s CPSC 121: Models of Computation

  17. Example 3: (cont’d) Here’s the deductive argument: step reason 1. p premise 2. p → r premise 3. modus ponens 1 2 r 4. p → ( q ∨ r ) premise 5. modus ponens 1 4 q ∨ r 6. q disjunctive syllogism 3 5 7. premise q ∨ s 8. disjunctive syllogism 6 7 ∴ s CPSC 121: Models of Computation

  18. Example 3: (cont’d) p p → r p → ( q ∨ r ) q ∨ s ∴ s Question: Can we conclude that the argument is a fallacy (i.e., invalid)? CPSC 121: Models of Computation

  19. Example 3: (cont’d) p p → r p → ( q ∨ r ) q ∨ s ∴ s Question: Can we conclude that the argument is a fallacy (i.e., invalid)? Answer: Not yet! A contradiction in the premises can be used to deduce any conclusion desired (and such an argument remains valid) CPSC 121: Models of Computation

  20. Example 3: (cont’d) If we suspect a fallacy, we should search for a contradiction. That is, we show that [ p ∧ ( p → r ) ∧ ( p → ( q ∨ r )) ∧ ( q ∨ s )] → s is not a tautology Let s = F , p = T , r = T and q = T . In this case, the conjunction of the premises is true and the conclusion is false Thus, we do not have a tautology and the original argument is therefore invalid CPSC 121: Models of Computation

  21. Rules of Inference Rule Tautology Name p p → ( p ∨ q ) Addition ∴ p ∨ q p ∧ q ( p ∧ q ) → p Simplification ∴ p p q (( p ) ∧ ( q )) → p ∧ q Conjunction ∴ p ∧ q p p → q ( p ∧ ( p → q )) → q Modus ponens ∴ q ¬ q p → q ( ¬ q ∧ ( p → q )) → ¬ p Modus tollens ∴ ¬ p CPSC 121: Models of Computation

  22. Rules of Inference Rule Tautology Name p → q (( p → q ) ∧ ( q → r )) q → r Hypothetical syllogism → ( p → r ) ∴ p → r p ∨ q ¬ p (( p ∨ q ) ∧ ¬ p ) → q Disjunctive syllogism ∴ q p ∨ q (( p ∨ q ) ∧ ( ¬ p ∨ r )) ¬ p ∨ r Resolution → ( q ∨ r ) ∴ ( q ∨ r ) p → r (( p → r ) ∧ ( q → r )) q → r Proof by cases → (( p ∨ q ) → r ) ∴ ( p ∨ q ) → r CPSC 121: Models of Computation

  23. Digression: Logic Programming Logic programming uses proof as the framework for computing A logic program consists of a set of rules (including simple facts) together with input (consisting of additional facts and a desired conclusion) Evaluation consists of a demonstration that the desired conclusion does (or does not) follow from the given rules and facts CPSC 121: Models of Computation

  24. Digression: Logic Programming One can build an evaluator for logic programming based on a specific proof method Consider two proof methods (and hence two evaluators): Forward chaining starts with the original facts and rules 1 and works towards the desired conclusion. At each step, new facts are derived. We stop when the conclusion is known to be a fact (or when no new facts can be derived) Backward chaining starts with the conclusion and works 2 backwards to try to find facts and rules that derive it CPSC 121: Models of Computation

  25. Example 4: I want to be happy if I had $1M then I would be happy if I had a good job then I could earn $1M if I had a B.Sc in CPSC then I could get a good job if I pass CPSC 121 then I can get a B.Sc in CPSC Question: Is this example forward chaining or backward chaining? CPSC 121: Models of Computation

  26. Example 4: I want to be happy if I had $1M then I would be happy if I had a good job then I could earn $1M if I had a B.Sc in CPSC then I could get a good job if I pass CPSC 121 then I can get a B.Sc in CPSC Question: Is this example forward chaining or backward chaining? Answer: It is backward chaining. We reason backwards from a conclusion “to be happy” finding facts and rules that derive it CPSC 121: Models of Computation

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