Explorations in Artificial Intelligence - PowerPoint PPT Presentation

1 / 64
About This Presentation
Title:

Explorations in Artificial Intelligence

Description:

Methods for Proving Theorems. 3. 3. Theorems, proofs, and Rules of Inference ... Vacuous proof - if one of the premises is false then (p1 p2 ... pn) q ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 65
Provided by: csCor
Category:

less

Transcript and Presenter's Notes

Title: Explorations in Artificial Intelligence


1
Explorations in Artificial Intelligence
  • Prof. Carla P. Gomes
  • gomes_at_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. Fermats 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
  • Note Many theorems involve statements for
    universally quantified variables
  • e.g.
  • If xgty, where x and y are positive real numbers,
    then x2 gt y2
  • Quite often, when it is clear from the context,
    theorems are proved without explicitly using the
    laws of universal instantiation and universal
    generalization.

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

7
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
P Q ? P ? Q (P) ? (Q) ? (P ? Q) Conjunction
P P?Q ? Q (P) ? (P? Q) ? (P ? Q) Modus Ponens
? Q P ? Q ? ?P (?Q) ? (P? Q) ? ?P Modus Tollens
P ? Q Q ? R ? P? R (P?Q) ? (Q ? R) ? (P?R) Hypothetical Syllogism (chaining)
P ? Q ?P ? Q (P ? Q) ? (?P) ? Q Disjunctive syllogism
P ? Q ?P ? R ? Q ? R (P ? Q) ? (?P ? R) ? (Q ? R) Resolution
8
Direct Proof
  • Proof of a statement p ? q
  • Assume p
  • From p derive q.

9
Example - direct proof
  • Heres 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
10
Example - direct proof
  • In general, to prove p ? q, assume p and show
    that q follows.

11
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
12
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
    2k1. An integer is even or
  • odd and no integer is both even and odd.

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

14
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 ) 12k1, which is by
  • definition an odd number (k (2k2 2k )
    ).
  • QED

15
Proof by Contraposition
  • Proof of a statement p ? q
  • Use the equivalence to
  • q ? p
  • From q derive p.

16
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 lt 8) ? (b lt
8). (Show ?p) Then (a 7) ? (b 7), and (a
b) 14, and (a b) lt 15.
QED
17
  • Theorem
  • For n integer ,
  • if 3n 2 is odd, then n is odd.
  • I.e. For n integer,
  • 3n2 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

18
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

19
Example1 Proof by Contradiction
  • Example
  • Rainy days make gardens grow.
  • Gardens dont grow if it is not hot.
  • When it is cold outside, it rains.
  • Prove that its hot.

Let R Rainy day G Garden grows H It is hot
Given R ? G ?H ? ?G ?H ? R Show H
20
Example1 Proof by Contradiction(Case A) We
want to prove pWe show thatp ? 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
21
Example2 Proof by Contradiction
  • Classic proof that ?2 is irrational.
  • Suppose ?2 is rational. Then ?2 a/b for some
    integers a and b (relatively prime).

?2 a/b implies
2 a2/b2
2b2 a2
a2 is even, and so a is even (a 2k for some k)
2b2 (2k)2 4k2
b2 2k2
b2 is even, and so b is even (b 2k for some k)
22
Example2 Proof by Contradiction
  • Youre going to let me get away with that?

a2 is even, and so a is even (a 2k for some k)??
Suppose to the contrary that a is not even.
Then a 2k 1 for some integer k
Then a2 (2k 1)(2k 1) 4k2 4k 1
and a2 is odd.
So a really is even.
23
Example 3 Proof by Contradiction
  • Theorem
  • There are infinitely many prime numbers
  • Proof by contradiction
  • Let P There are infinitely many primes
  • Assume P, i.e., there is a finite number of
    primes , call largest p_r.
  • Lets define R the product of all the primes,
    i.e, R p_1 x p_2 x x p_r.
  • Consider R 1.
  • Now, R1 is either prime or not
  • If its prime, we have prime larger than p_r.
  • If its not prime, let p be a prime dividing
    (R1). But p cannot be any of p_1, p_2, p_r
    (remainder 1 after division) so, p not among
    initial list and thus p is larger than p_r.
  • This contradicts our assumption that there is a
    finite set of primes, and therefore such an
    assumption has to be false which means that there
    are infinitely many primes.

(Euclids proof, c 300 BC)


See e.g. http//odin.mdacc.tmc.edu/krc/numbers/in
fitude.html http//primes.utm.edu/notes/proofs/inf
inite/euclids.html
24
Example 4 Proof by ContradictionWe want to
prove p?qAssume the negation of the conclusion,
Use show that (p ? q ) ? F
  • Theorem If 3n2 is odd, then n is odd
  • Let p 3n2 is odd and q n is odd
  • 1 assume p and q i.e., 3n2 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 3n2 3 (2k) 2 2 (3k 1), which
    is even
  • 4 so we have a contradiction, 3n2 is odd and
    3n2 is even therefore we conclude p ? q, i.e.,
    If 3n2 is odd, then n is odd
  • Q.E.D.

25
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

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

27
Counterexample
  • Show that the following statement is false
  • Every day of the week is a weekday
  • Proof
  • Saturday and Sunday are weekend days.

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

29
  • Theorem
  • If n is an integer, then n2 n
  • Proof by cases
  • Case 1 n0 00 0
  • Case 2 n gt 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 lt -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

30
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 gt n.
  • very subtle in general.
  • Uniqueness proofs
  • Involves
  • Existence proof
  • Uniqueness proof

31
Example - Existence Proofs
  • ?n (integers), ?p so that p is prime, and p gt n.
  • Proof Let n be an arbitrary integer, and
    consider n! 1. If (n! 1) is prime, we are
    done since (n! 1) gt n. But what if (n! 1) is
    composite?

If (n! 1) is composite then it has a prime
factorization, p1p2pn (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 gt n, and we are done. BUT WE DONT KNOW
WHAT p IS!!!
32
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

33
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
34
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
35
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.

36
Additional Proof Methods
  • Induction Proofs
  • Combinatorial proofs

37
Induction Proofs
38
Whats 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.

39
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(k1))
  • --------------------------
  • ? ?n (P(n)

40
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 kgtb
  • Inductive Step Show that the conditional
    statement P(k) ?P(k1) is true for all integers
    kgtb. This can be done by showing that under the
    inductive hypothesis that P(k) is true, P(k1)
    must also be true.

() quite often b1, but b can be any integer
number.
41
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(k1) holds i.e.,
  • P(k) ? P(k1)
  • Conclusion
  • By induction we have shown that P(k) holds
    for all kgtb (b is what was used for the base
    case).

42
Mathematical Induction
  • Use induction to prove that the sum of the first
    n odd integers is n2. Whats the hypothesis?

1 Hypothesis P(n) sum of first n odd
integers n2.
2 - Base case (n1) 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(k1), assuming P(k). How?
P(k1) 1 3 (2k-1) (2k1)
k2 (2k 1)
(k1)2
QED
43
Mathematical Induction
  • Use induction to prove that the 1 2 22
    2n 2n1 - 1 for all non-negative integers n.
  • 1 Hypothesis?

P(n) 1 2 22 2n 2 n1 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 k1 1
44
Mathematical Induction
4 Inductive Step show that ?(k) P(k) ?
P(k1), assuming P(k). How?
P(k1) 1 2 22 2k 2k1 (2k1 1)
2k1
2 2k1 - 1
P(k1) 2k2 - 1
2(k1)1 - 1
QED
45
Mathematical Induction
  • Prove that 1?1! 2?2! n?n! (n1)! - 1,
    ? positive integers

1 Hypothesis P(n) 1?1! 2?2! n?n!
(n1)! - 1, ? positive integers
2 - Base case (n1) 1?1! (11)! - 1? 1?1! 1
and 2! - 1 1
3 - Assume P(k) 1?1! 2?2! k?k! (k1)!
- 1
4 Inductive Step - show that ?(k) P(k) ?
P(k1), assuming P(k). I.e, prove that 1?1!
k?k! (k1)(k1)! (k2)! 1, assuming P(k)
(k1)! - 1 (k1)(k1)!
1?1! k?k! (k1)(k1)!
(1 (k1))(k1)! - 1
(k2)(k1)! - 1
QED
(k2)! - 1
46
Mathematical Induction
Prove that a set with n elements has 2n subsets.
  • 1-Hypothesis set with n elements has 2n subsets

2- Base case (n0) 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(k1), assuming
P(k). i.e, Prove that if T k1, then P(T)
2k1, given that P(k)2k
47
Inductive Step Prove that if T k1, then
P(T) 2k1 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
48
Deficient Tiling
  • A 2n x 2n sized grid is deficient if all but one
    cell is tiled.

49
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
50
Mathematical Induction - a cool example
  • Base Case

P(1) - Is it true for 21 x 21 grids?
51
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 2k1 x 2k1
    deficient board using our designer tiles.

52
2k1
OK!! (by IH)
53
OK!! (by IH)
OK!! (by IH)
2k1
OK!! (by IH)
OK!! (by IH)
54
(No Transcript)
55
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)
56
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?

57
Mathematical Induction - why does it work?
  • Is the set of non-negative reals (R) well ordered?

58
Mathematical Induction - why does it work?
  • Proof of Mathematical Induction
  • We prove that
  • (P(0) ? (?k P(k) ? P(k1))) ? (?n P(n))
  • Assume
  • P(0)
  • ?k P(k) ? P(k1)
  • ??n P(n)

59
Mathematical Induction - why does it work?
  • Assume
  • P(0)
  • ?n P(n) ? P(n1)
  • ??n P(n)

Let S n ?P(n)
What do we know? P(k) is false because its in
S. k ? 0 because P(0) is true. P(k-1) is true
because P(k) is the least element in S.
60
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(b1) ? ? P(k)
  • 4 . Inductive Step - Assuming P(k) is true for
    all positive integers not exceeding k (inductive
    hypothesis), prove that P(k1) holds i.e.,
  • (P(b) ? P(b1) ? ? P(k) ? P(k1)

61
Strong Mathematical Induction
  • If
  • P(0) and
  • ?n?0 (P(0) ? P(1) ? ? P(k)) ? P(k1)
  • Then
  • ?n?0 P(n)

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

63
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) k1 is prime in this case its the product
of itself b) k1 is a composite number and it
can be written as the product of two positive
integers a and b, with 2 a b k1. By the
inductive hypothesis, a and b can be written as
the product of primes, and so does k1
QED
64
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.

65
Strong Mathematical Induction
  • Base case (n1)
  • Assume any matching problem of size less than
    (k1) can be solved.
  • Show that we can match (k1) pairs.

66
Strong Mathematical Induction
  • Show that we can match (k1) pairs.
  • Suppose there is a line partitioning the group
    into a smaller one of j blues and j oranges, and
    another smaller one of (k1)-j blues and (k1)-j
    oranges.

OK!! (by IH)
OK!! (by IH)
67
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, were done!
OK!! (by IH)
68
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)
Write a Comment
User Comments (0)
About PowerShow.com