1 / 64

Explorations in Artificial Intelligence

Explorations in Artificial Intelligence. Prof. Carla P. Gomes gomes@cs.cornell.edu Module 3-1-4 Logic Based Reasoning Methods for Proving Theorems. Methods for Proving Theorems. Theorems, proofs, and Rules of Inference. When is a mathematical argument correct?

aidag
Download Presentation

Explorations in Artificial Intelligence

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. Explorations in Artificial Intelligence Prof. Carla P. Gomes gomes@cs.cornell.edu Module 3-1-4 Logic Based Reasoning Methods for Proving Theorems

  2. Methods for Proving Theorems

  3. Theorems, proofs, and Rules of Inference • When is a mathematical argument correct? • What techniques can we use o construct a mathematical argument? • Theorem – statement that can be shown to be true. • Axioms or postulates – statements which are given and assumed to be true. • Proof – sequence of statements, a valid argument, to show that a theorem is true. • Rules of Inference – rules used in a proof to draw conclusions from assertions known to be true. • Note: Lemma is a “pre-theorem” or a result that needs to be proved to prove the theorem; A corollary is a “post-theorem”, a result which follows directly the theorem that has been proved. Conjecture is a statement believed to be true but for which there is not a proof yet. If the conjecture is proved true it becomes a thereom. Fermat’s theorem was a conjecture for a long time.

  4. Valid Arguments (reminder) • Recall: • An argument is a sequence of propositions. The final proposition is called the conclusion of the argument while the other propositions are called the premises or hypotheses of the argument. • An argument is valid whenever the truth of all its premises implies the truth of its conclusion. • How to show that q logically follows from the hypotheses (p1 p2  …pn)? Show that (p1 p2  …pn)  q is a tautology One can use the rules of inference to show the validity of an argument. Vacuous proof - if one of the premises is false then (p1  p2  …pn)  q is vacuously True, since False implies anything.

  5. Methods of Proof • Direct Proof • Proof by Contraposition • Proof by Contradiction • Proof of Equivalences • Proof by Cases • Existence Proofs • Counterexamples • Induction

  6. Propositional logic: Rules of Inference or Method of Proof

  7. Direct Proof • Proof of a statementp  q • Assume p • From p derive q.

  8. ((M  C)  (A  C)  (A  S)  (M))  S ? Example - direct proof • Here’s what you know: Theorem: Mary is a Math major or a CS major. If Mary does not like AI, she is not a CS major. If Mary likes AI she is smart. Mary is not a math major. • Can you conclude Mary is smart? Let M - Mary is a Math major C – Mary is a CS major A – Mary likes AI S – Mary is smart • M  C • A  C • A  S • M

  9. ((M  C)  (A  C)  (A  S)  (M))  S ? Example - direct proof • In general, to prove p  q, assume p and show that q follows.

  10. 5. C • 6. A • 7. S Mary is smart! Example - direct proof • 1. M  C Given • 2. A  C Given • 3. A  S Given • 4. M Given • DS (1,4) • MT (2,5) • MP (3,6) QED

  11. Example 2: Direct Proof • Theorem: • If n is odd integer, then n2 is odd. • Definition: • The integer is even if there exists an integer k such that n = 2k, and n is • odd if there exists an integer k such that n = 2k+1. An integer is even or • odd; and no integer is both even and odd.

  12. Example 2: Direct Proof • Theorem: • (n) P(n)  Q(n), • where P(n) is “n is an odd integer” and Q(n) is “n2 is odd.” • We will show P(n)  Q(n)

  13. Example 2: Direct Proof • Theorem: • If n is odd integer, then n2 is odd. • Proof: • Let p --- “n is odd integer”; q --- “n2 is odd”; we want to show that p  q • Assume p, i.e., n is odd. • By definition n = 2k + 1, where k is some integer. • Therefore n2 = (2k + 1)2 = 4k2 + 4k + 1 = 2 (2k2 + 2k ) + 1=2k’+1, which is by • definition an odd number (k’ = (2k2 + 2k ) ). • QED

  14. Proof by Contraposition • Proof of a statementp  q • Use the equivalence to : • ¬q  ¬ p • From ¬q derive ¬ p.

  15. (a + b ≥ 15)  (a ≥ 8) v (b ≥ 8) Example 1: Proof by Contraposition • Again, p  q  q  p (the contrapositive) • So, we can prove the implication p  q by first assuming q, and showing that p follows. • Example: Prove that if a and b are integers, and a + b ≥ 15, then a ≥ 8 or b ≥ 8. • (Assume q) Suppose (a < 8)  (b < 8). • (Show p) Then (a ≤ 7)  (b ≤ 7), • and (a + b) ≤ 14, • and (a + b) < 15. QED

  16. Theorem • For n integer , • if 3n + 2 is odd, then n is odd. • I.e. For n integer, • 3n+2 is odd  n is odd • Proof by Contraposition: • Let p --- “3n + 2” is odd; q --- “n is odd”; we want to show that p  q • The contraposition of our theorem is ¬q  ¬p • n is even  3n + 2 is even • Now we can use a direct proof • Assume ¬q , i.e, n is even therefore n = 2 k for some k • Therefore 3 n + 2 = 3 (2k) + 2 = 6 k + 2 = 2 (3k + 1) which is even. • QED

  17. Proof by Contradiction • A – We want to prove p. • We show that: • ¬p  F; (i.e., F is a False statement , say r ¬r) • We conclude that ¬p is false since (1) is True, therefore p is True. • B – We want to show p  q • Assume the negation of the conclusion, i.e., ¬q • Use show that (p  ¬q )  F • Since ((p  ¬q )  F)  (p  q) (why?) we are done

  18. ((R  G)  (H  G)  (H  R))  H ? Example1: Proof by Contradiction • Example: • Rainy days make gardens grow. • Gardens don’t grow if it is not hot. • When it is cold outside, it rains. • Prove that it’s hot. Let R – Rainy day G – Garden grows H – It is hot • Given: R  G • H  G • H  R • Show: H

  19. H Example1: Proof by Contradiction(Case A) We want to prove p;We show that:¬p  F; • Given: R  G • H  G • H  R • Show: H • 1. R  G Given • 2. H  G Given • 3. H  R Given • 4. H assume to the contrary • 5. R MP (3,4) • 6. G MP (1,5) • 7. G MP (2,4) • 8. G  G contradiction

  20. Example 4: Proof by ContradictionWe want to prove pq;Assume the negation of the conclusion, Use show that (p  ¬q )  F • Theorem “If 3n+2 is odd, then n is odd” • Let p = “3n+2 is odd” and q = “n is odd” • 1 – assume p and ¬q i.e., 3n+2 is odd and n is not odd • 2 – because n is not odd, it is even • 3 – if n is even, n = 2k for some k, and therefore 3n+2 = 3 (2k) + 2 = 2 (3k + 1), which is even • 4 so we have a contradiction, 3n+2 is odd and 3n+2 is even therefore we conclude p  q, i.e., “If 3n+2 is odd, then n is odd” • Q.E.D.

  21. Proof of Equivalences • To prove p  q • show that p q • and q p. • The validity of this proof results from the fact that • (p  q)  [ (p q)  (q p)] is a tautology

  22. Counterexamples • Show that (x) P(x) is false • We need only to find a counterexample.

  23. Counterexample • Show that the following statement is false: • “Every day of the week is a weekday” • Proof: • Saturday and Sunday are weekend days. 

  24. Proof by Cases • To show • (p1 p2 … pn )  q • We use the tautology • [(p1 p2 … pn )  q ]  [(p1 q )  (p2 q) … (pn  q )] • A particular case of a proof by cases is an exhaustive proof in which all the cases are considered

  25. Theorem • “If n is an integer, then n2 ≥ n ” • Proof by cases • Case 1 n=0 00 = 0; • Case 2 n > 1 n2 ≥ n since we multiply both sides of the inequality by n, which is positive (n x n) ≥ (1 x n) • Case 3 n < -1 n2 ≥ n since we multiply both sides of the inequality by n, which is negative, we change the sign of the inequality, (n x n) ≥ (1 x n); n2 is positive and therefore n2 ≥ n

  26. Existence Proofs • Existence Proofs: • Constructive existence proofs • Example: “there is a positive integer that is the sum of cubes of positive integers in two different ways” • by brute force using a computer 1729 = 103 + 93 = 123 + 13 • Non-constructive existence proofs • Example: “n (integers), p so that p is prime, and p > n.” • very subtle in general…. • Uniqueness proofs • Involves: • Existence proof • Uniqueness proof

  27. NON-CONSTRUCTIVE Can it be 2? Can it be 3? Can it be 4? Can it be n? Example - Existence Proofs • n (integers), p so that p is prime, and p > n. • Proof: Let n be an arbitrary integer, and consider n! + 1. If (n! + 1) is prime, we are done since (n! + 1) > n. But what if (n! + 1) is composite? • If (n! + 1) is composite then it has a prime factorization, p1p2…pn = (n! + 1) • Consider the smallest pi, and call it p. How small can it be? (remainder of 1 for any number up to n) • So, p > n, and we are done. BUT WE DON’T KNOW WHAT p IS!!!

  28. Fallacies • Fallacies are incorrect inferences. Some common fallacies: • The Fallacy of Affirming the Consequent • The Fallacy of Denying the Antecedent • Begging the question or circular reasoning

  29. The Fallacy of Affirming the Consequent If the butler did it he has blood on his hands. The butler had blood on his hands. Therefore, the butler did it. This argument has the form PQ Q P or ((PQ)  Q)P which is not a tautology and therefore not a valid rule of inference

  30. The Fallacy of Denying the Antecedent • If the butler is nervous, he did it. • The butler is really mellow. • Therefore, the butler didn't do it. This argument has the form PQ ¬P ¬Q or ((PQ)  ¬P) ¬Qwhich is not a tautology and therefore not a valid rule of inference

  31. Begging the question or circular reasoning • This occurs when we use the truth of the statement being proved (or • something equivalent) in the proof itself. • Example: • Conjecture: if n2 is even then n is even. • Proof: If n2 is even then n2 = 2k for some k. Let n = 2l for some l. Hence, x must be even. • Note that the statement n = 2l is introduced without any argument showing it.

  32. Additional Proof Methods • Induction Proofs • Combinatorial proofs

  33. Induction Proofs

  34. What’s is Induction About? • Many statements assert that a property is an universal true – i.e., all the elements of the universe exhibit that property; • Examples: • For every positive integer n: n! ≤ nn • For every set with n elements, the cardinality of its power set is 2n. • Induction is one of the most important techniques for proving statements about universal properties.

  35. We can reach every step of an infinite ladder! • We know that: • We can reach the first rung of this ladder; • If we can reach a particular rung of the ladder, • then we can reach the next rung of the ladder. • Can we reach every step of this infinite ladder? • Yes, using Mathematical Induction which is • a rule of inference that tells us: • P(1) • k (P(k)  P(k+1)) • -------------------------- •  n (P(n)

  36. Principle of Mathematical Induction • Hypothesis: P(n) is true for all integers nb • To prove that P(n) is true for all integers nb (*), where P(n) is a propositional function, follow the steps: • Basic Step or Base Case: Verify that P(b) is true; • Inductive Hypothesis: assume P(n) is true for some k>b; • Inductive Step: Show that the conditional statement P(k) P(k+1) is true for all integers k>b. This can be done by showing that under the inductive hypothesis that P(k) is true, P(k+1) must also be true. (*) quite often b=1, but b can be any integer number.

  37. Writing a Proof by Induction • State the hypothesis very clearly: • P(n) is true for all integers nb – state the property P in English • Identify the the base case • P(b) holds because … • Inductive Hypothesis • Assume P(k) • Inductive Step - Assuming the inductive hypothesis P(k), prove that P(k+1) holds; i.e., P(k)  P(k+1) • Conclusion • By induction we have shown that P(k) holds for all k>b (b is what was used for the base case).

  38. Prove a base case (n=1) Prove P(k)P(k+1) Inductive hypothesis By inductive hypothesis p(k) Mathematical Induction • Use induction to prove that the sum of the first n odd integers is n2. What’s the hypothesis? 1 – Hypothesis: P(n) – sum of first n odd integers = n2. • 2 - Base case (n=1): the sum of the first 1 odd integer is 12. • Since 1 = 12  • 3 - Assume P(k): the sum of the first k odd ints is k2. • 1 + 3 + … + (2k - 1) = k2 • 4 – Inductive Step: show that (k) P(k)  P(k+1), assuming P(k). • How? • P(k+1)= 1 + 3 + … + (2k-1) + (2k+1) = • k2 + (2k + 1) • = (k+1)2 QED

  39. not n=1! The base case can be negative, zero, or positive Prove a base case (n=?) Prove P(k)P(k+1) Inductive hypothesis Mathematical Induction • Use induction to prove that the 1 + 2 + 22 + … + 2n = 2n+1 - 1 for all non-negative integers n. • 1 – Hypothesis? P(n) = 1 + 2 + 22 + … + 2n = 2 n+1 – 1 for all non-negative integers n. • 2 - Base case? n = 0 10 = 21-1. • 3 – Inductive Hypothesis • Assume P(k) = 1 + 2 + 22 + … + 2k = 2 k+1 – 1

  40. By inductive hypothesis p(k) Mathematical Induction • 4 – Inductive Step: show that (k) P(k)  P(k+1), assuming P(k). • How? • P(k+1)= 1 + 2 + 22 + … + 2k+ 2k+1 = (2k+1 – 1) + 2k+1 = 22k+1 - 1 P(k+1) = 2k+2 - 1 = 2(k+1)+1 - 1 QED

  41. Inductive hypothesis Mathematical Induction • 1 – Hypothesis P(n) = 11! + 22! + … + nn! = (n+1)! - 1,  positive integers • Prove that 11! + 22! + … + nn! = (n+1)! - 1,  positive integers • 2 - Base case (n=1): 11! = (1+1)! - 1? 11! = 1 and 2! - 1 = 1 • 3 - Assume P(k): 11! + 22! + … + kk! = (k+1)! - 1 • 4 – Inductive Step - show that (k) P(k)  P(k+1), assuming P(k). • I.e, prove that 11! + … + kk! + (k+1)(k+1)! = (k+2)! – 1, assuming P(k) • (k+1)! - 1 + (k+1)(k+1)! • 11! + … + kk! + (k+1)(k+1)! = • = (1 + (k+1))(k+1)! - 1 • = (k+2)(k+1)! - 1 QED • = (k+2)! - 1

  42. Inductive hypothesis Mathematical Induction Prove that a set with n elements has 2n subsets. • 1-Hypothesis: set with n elements has 2n subsets • 2- Base case (n=0): S=ø, P(S) = {ø} and |P(S)| = 1 = 20 • 3- Inductive Hypothesis - P(k): given |S| = k, |P(S)| = 2k • 4- Inductive Step: (k) P(k)  P(k+1), assuming P(k). i.e, • Prove that if |T| = k+1, then |P(T)| = 2k+1, given that P(k)=2k

  43. Generating subsets of a set T with k+1 elements from a set S with K elements • Inductive Step: Prove that if |T| = k+1, then |P(T)| = 2k+1 assuming P(k) is true. • T = S U {a} for some S  T with |S| = k, and a  T • How to obtain the subsets of T? For each subset X of S there are exactly two subsets of T, namely X and X U {a} • Because there are 2k subsets of S (inductive hypothesis), there are 2  2k subsets of T. QED

  44. 2n 2n Deficient Tiling • A 2n x 2n sized grid is deficient if all but one cell is tiled.

  45. Mathematical Induction - a cool example • Hypothesis: • P(n) - We want to show that all 2n x 2n sized deficient grids can be tiled with right triominoes, which are pieces that cover three squares at a time, like this:

  46. YES  Mathematical Induction - a cool example • Base Case: • P(1) - Is it true for 21 x 21 grids?

  47. Mathematical Induction - a cool example • Inductive Hypothesis: • We can tile a 2k x 2k deficient board using our designer tiles. • Inductive Step: • Use this to prove that we can tile a 2k+1 x 2k+1 deficient board using our designer tiles.

  48. 2k 2k ? ? 2k ? 2k 2k+1 OK!! (by IH)

  49. 2k 2k 2k 2k OK!! (by IH) OK!! (by IH) 2k+1 OK!! (by IH) OK!! (by IH)

More Related