Presentation is loading. Please wait.

Presentation is loading. Please wait.

Explorations in Artificial Intelligence

Similar presentations


Presentation on theme: "Explorations in Artificial Intelligence"— Presentation transcript:

1 Explorations in Artificial Intelligence
Prof. Carla P. Gomes 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) 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.

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

7 Direct Proof Proof of a statement p  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 ((M  C)  (A  C)  (A  S)  (M))  S ?

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

10 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

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.
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 statement p  q Use the equivalence to : ¬q  ¬ p From ¬q derive ¬ p.

15 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

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

19 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

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

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 < 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 = = 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 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! 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?

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) ¬Q which 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 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. … + (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)= … + (2k-1) + (2k+1) = k2 + (2k + 1) = (k+1)2 QED

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

40 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)= … + 2k+ 2k+1 = (2k+1 – 1) + 2k+1 = 2 2k+1 - 1 P(k+1) = 2k+2 - 1 = 2(k+1)+1 - 1 QED

41 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)! (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 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

43 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

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

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 Mathematical Induction - a cool example
Base Case: P(1) - Is it true for 21 x 21 grids? YES 

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+1 OK!! (by IH)

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

50

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

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

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

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

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

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

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

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

59 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

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

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

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

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

64 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


Download ppt "Explorations in Artificial Intelligence"

Similar presentations


Ads by Google