Explorations in Artificial Intelligence

Slides:



Advertisements
Similar presentations
Methods of Proof. Methods of Proof The Vicky Pollard Proof Technique Prove that when n is even n2 is even. Assume n is 0, then n2 is 0, and that is.
Advertisements

Introduction to Proofs
Induction and recursion
CSE115/ENGR160 Discrete Mathematics 01/31/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/01/11
Discrete Structures CS 2800
1 Discrete Structures CS 2800 Prof. Bart Selman Module Logic (part proof methods)
Discrete Structures CS 23022
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
Fall 2002CMSC Discrete Structures1 Let’s proceed to… Mathematical Reasoning.
Mathematical Induction
Methods of Proof & Proof Strategies
Induction and recursion
Introduction to Proofs
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Proofs1 Advanced Discrete Mathematics Jim Skon. Proofs2  Definition: A theorem is a valid logical assertion which can be proved using other theorems.
Discrete Structures (DS)
Chap 3 –A theorem is a statement that can be shown to be true –A proof is a sequence of statements to show that a theorem is true –Axioms: statements which.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
CSci 2011 Discrete Mathematics Lecture 4 CSci 2011.
Mathematical Induction
CS104:Discrete Structures Chapter 2: Proof Techniques.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Chapter 1, Part III: Proofs With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Chapter 1 Logic and proofs
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
CS151: Mathematical Foundations of Computing Mathematical Induction.
Chapter 1 Logic and Proof.
Chapter 1 Logic and Proof.
The Foundations: Logic and Proofs
CSE15 Discrete Mathematics 02/01/17
CSE15 Discrete Mathematics 03/22/17
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
Advanced Algorithms Analysis and Design
Methods of Proof CS 202 Epp, chapter 3.
Induction and recursion
Predicate Calculus Validity
Proof Techniques.
Methods of Proof A mathematical theorem is usually of the form pq
Chapter 5 Induction and Recursion
Module #10: Proof Strategies
Discrete Structures CSC 281
The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
CS201: Data Structures and Discrete Mathematics I
Mathematical Reasoning
Induction and recursion
Methods of Proof. Methods of Proof Definitions A theorem is a valid logical assertion which can be proved using Axioms: statements which are given.
Week #6 – 30 September / 2/4 October 2002 Prof. Marie desJardins
Applied Discrete Mathematics Week 1: Logic
Inference Rules: Tautologies
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept 24, 25.
Module #10: Proof Strategies
September 9, 2004 Prof. Marie desJardins (for Prof. Matt Gaston)
Foundations of Discrete Mathematics
Prof. Johnnie Baker Module Induction
Advanced Analysis of Algorithms
Mathematical Reasoning
Mathematical Induction
Introduction to Proofs
CS201: Data Structures and Discrete Mathematics I
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept, 2019.
Presentation transcript:

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

Valid Arguments (reminder) Show that 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.

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

Propositional logic: Rules of Inference or Method of Proof Rule of Inference Tautology (Deduction Theorem) Name P  P  Q P  (P  Q) Addition P  Q  P (P  Q)  P Simplification Q  P  Q [(P)  (Q)]  (P  Q) Conjunction PQ  Q [(P)  (P Q)]  (P  Q) Modus Ponens  Q P  Q  P [(Q)  (P Q)]  P Modus Tollens Q  R  P R [(PQ)  (Q  R)]  (PR) Hypothetical Syllogism (“chaining”) P  Q P [(P  Q)  (P)]  Q Disjunctive syllogism P  R  Q  R [(P  Q)  (P  R)]  (Q  R) Resolution

Direct Proof Proof of a statement p  q Assume p From p derive q.

((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 ((M  C)  (A  C)  (A  S)  (M))  S ?

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

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

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.

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)

Example 2: Direct Proof Theorem: If n is odd integer, then n2 is odd. 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

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

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. (a + b ≥ 15)  (a ≥ 8) v (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

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

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

Example1: Proof by Contradiction 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 ((R  G)  (H  G)  (H  R))  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 H

Example 4: Proof by Contradiction We 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.

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

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

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

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

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

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

Example - Existence Proofs NON-CONSTRUCTIVE 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? Can it be 2? (remainder of 1 for any number up to n) Can it be 3? Can it be 4? So, p > n, and we are done. BUT WE DON’T KNOW WHAT p IS!!! Can it be n?

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

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

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) ¬Q which is not a tautology and therefore not a valid rule of inference

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.

Additional Proof Methods Induction Proofs Combinatorial proofs

Induction Proofs

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.

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)

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.

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

Mathematical Induction Prove a base case (n=1) Prove P(k)P(k+1) 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  Inductive hypothesis 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? By inductive hypothesis p(k) P(k+1)= 1 + 3 + … + (2k-1) + (2k+1) = k2 + (2k + 1) = (k+1)2 QED

Mathematical Induction Prove a base case (n=?) Prove P(k)P(k+1) 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. not n=1! The base case can be negative, zero, or positive Inductive hypothesis 3 – Inductive Hypothesis Assume P(k) = 1 + 2 + 22 + … + 2k = 2 k+1 – 1

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

Mathematical Induction Prove that 11! + 22! + … + nn! = (n+1)! - 1,  positive integers 1 – Hypothesis P(n) = 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 Inductive hypothesis 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

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 Inductive hypothesis 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

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} Generating subsets of a set T with k+1 elements from a set S with K elements Because there are 2k subsets of S (inductive hypothesis), there are 2  2k subsets of T. QED

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

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:

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

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.

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

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

So, we can tile a 2k x 2k deficient board using our designer tiles. What does this mean for 22k mod 3? = 1 (also do direct proof by induction)

Mathematical Induction - why does it work? Definition: A set S is “well-ordered” if every non-empty subset of S has a least element. Given (we take as an axiom): the set of natural numbers (N) is well-ordered. Is the set of integers (Z) well ordered? No. { x  Z : x < 0 } has no least element.

Mathematical Induction - why does it work? Is the set of non-negative reals (R) well ordered? No. { x  R : x > 1 } has no least element.

Mathematical Induction - why does it work? Proof of Mathematical Induction: We prove that (P(0)  (k P(k)  P(k+1)))  (n P(n)) Proof by contradiction. Assume P(0) k P(k)  P(k+1) n P(n) n P(n)

Mathematical Induction - why does it work? Assume P(0) n P(n)  P(n+1) n P(n) n P(n) Since N is well ordered, S has a least element. Call it k. Let S = { n : P(n) } What do we know? P(k) is false because it’s in S. k  0 because P(0) is true. P(k-1) is true because P(k) is the least element in S. But by (2), P(k-1)  P(k). Contradicts P(k-1) true, P(k) false. Done.

Strong Induction State the hypothesis very clearly: P(n) is true for all integers nb – state the property P is English Identify the the base case P(b) holds because … Inductive Hypothesis (P(b)  P(b+1)  …  P(k) 4 . Inductive Step - Assuming P(k) is true for all positive integers not exceeding k (inductive hypothesis), prove that P(k+1) holds; i.e., (P(b)  P(b+1)  …  P(k)  P(k+1)

Strong Mathematical Induction If P(0) and n0 (P(0)  P(1)  …  P(k))  P(k+1) Then n0 P(n) In our proofs, to show P(k+1), our inductive hypothesis assures that ALL of P(b), P(b+1), … P(k) are true, so we can use ANY of them to make the inference.

Strong Induction vs. Induction Sometimes strong induction is easier to use. It can be shown that strong induction and induction are equivalent: - any proof by induction is also a proof by strong induction (why?) - any proof by strong induction can be converted into a proof by induction (more later) Strong induction also referred to as complete induction; in this context induction is referred to as incomplete induction.

Strong Induction Show that if n is an integer greater than 1, then n can be written as the product of primes. 1 - Hypothesis P(n) - n can be written as the product of primes. 2 – Base case – P(2) 2 can be written a 2 (the product of itself) 3 – Inductive Hypothesis - P(j) is true for  2 ≤j ≤k, j integer. 4 – Inductive step? a) k+1 is prime – in this case it’s the product of itself; b) k+1 is a composite number and it can be written as the product of two positive integers a and b, with 2 ≤a ≤ b ≤ k+1. By the inductive hypothesis, a and b can be written as the product of primes, and so does k+1 QED

Strong Mathematical Induction An example. Given n blue points and n orange points in a plane with no 3 collinear, prove there is a way to match them, blue to orange, so that none of the segments between the pairs intersect.

Strong Mathematical Induction Base case (n=1): Assume any matching problem of size less than (k+1) can be solved. Show that we can match (k+1) pairs.

Strong Mathematical Induction Show that we can match (k+1) pairs. Suppose there is a line partitioning the group into a smaller one of j blues and j oranges, and another smaller one of (k+1)-j blues and (k+1)-j oranges. OK!! (by IH) OK!! (by IH)

Strong Mathematical Induction How do we know such a line always exists? Consider the convex hull of the points: OK!! (by IH) If there is an alternating pair of colors on the hull, we’re done! OK!! (by IH)

Strong Mathematical Induction If there is no alternating pair, all points on hull are the same color.  Notice that any sweep of the hull hits an orange point first and also last. We sweep on some slope not given by a pair of points. Keep score of # of each color seen. Orange gets the early lead, and then comes from behind to tie at the end. OK!! (by IH) OK!! (by IH) There must be a tie along the way