CSI 2101 Rules of Inference 1 5 n

  • Slides: 61
Download presentation
CSI 2101 / Rules of Inference (§ 1. 5) n n Introduction n what

CSI 2101 / Rules of Inference (§ 1. 5) n n Introduction n what is a proof? Valid arguments in Propositional Logic n equivalence of quantified expressions Rules of Inference in Propositional Logic n the rules n using rules of inference to build arguments n common fallacies Rules of Inference for Quantified Statements Dr. Zaguia-CSI 2101 -W 08 1

Proof? n In mathematics, a proof is a correct (well- reasoned, logically valid) and

Proof? n In mathematics, a proof is a correct (well- reasoned, logically valid) and complete (clear, detailed) argument that rigorously & undeniably establishes the truth of a mathematical statement. n Why must the argument be correct & complete? n n Correctness prevents us from fooling ourselves. Completeness allows anyone to verify the result. Dr. Zaguia-CSI 2101 -W 08 2

Proof? Applications of Proofs n An exercise in clear communication of logical arguments in

Proof? Applications of Proofs n An exercise in clear communication of logical arguments in any area of study. n The fundamental activity of mathematics is the discovery and elucidation, through proofs, of interesting new theorems. n Theorem-proving has applications in program verification, computer security, automated reasoning systems, etc. n Proving a theorem allows us to rely upon on its correctness even in the most critical scenarios. Dr. Zaguia-CSI 2101 -W 08 3

Terminology n n n n Theorem: A statement that has been proven to be

Terminology n n n n Theorem: A statement that has been proven to be true. Axioms, postulates, hypotheses, premises: Assumptions (often unproven) defining the structures about which we are reasoning. Rules of inference: Patterns of logically valid deductions from hypotheses to conclusions. Lemma: A minor theorem used as a stepping-stone to proving a major theorem. Corollary: A minor theorem proved as an easy consequence of a major theorem. Conjecture: A statement whose truth value has not been proven. (A conjecture may be widely believed to be true, regardless. ) Theory: The set of all theorems that can be proven from a given set of axioms. Dr. Zaguia-CSI 2101 -W 08 4

Graphical Visualization A Particular Theory A proof The Axioms of the Theory … Various

Graphical Visualization A Particular Theory A proof The Axioms of the Theory … Various Theorems Dr. Zaguia-CSI 2101 -W 08 5

How to prove something? Consider the statements: • If you did not sleep last

How to prove something? Consider the statements: • If you did not sleep last night, you will sleep during the lecture. • You did not sleep last night We can conclude that you will sleep during the lecture. Let P be “you did not sleep last night” and Q be “you will sleep during the lecture” The form of our argument is: which reflects tautology: ((p q) p) q Dr. Zaguia-CSI 2101 -W 08 P Q P -----Q 6

Rules of Inference Any valid argument form can be used • there are infinitely

Rules of Inference Any valid argument form can be used • there are infinitely many of them, based on different tautologies • validity of an argument form can be verified e. g. using truth tables There are simple, commonly used and useful argument forms • when writing proofs for humans, it is good to use well known argument forms • so that the reader can follow • complex argument forms can be derived from simpler ones Although the original idea was to have a mechanical approach to proofs Dr. Zaguia-CSI 2101 -W 08 7

Rules of Inference n n An Inference Rule is n A pattern establishing that

Rules of Inference n n An Inference Rule is n A pattern establishing that if we know that a set of antecedent statements of certain forms are all true, then we can validly deduce that a certain related consequent statement is true. antecedent 1 antecedent 2 … consequent “ ” means “therefore” Each valid logical inference rule corresponds to an implication that is a tautology. Corresponding tautology: ((ante. 1) (ante. 2) …) consequent Dr. Zaguia-CSI 2101 -W 08 8

Some Inference Rules n n n p p q p p q Rule of

Some Inference Rules n n n p p q p p q Rule of Addition Rule of Simplification Rule of Conjunction Dr. Zaguia-CSI 2101 -W 08 9

Modus Ponens & Tollens n p p q q n q p q p

Modus Ponens & Tollens n p p q q n q p q p Rule of modus ponens (a. k. a. law of detachment) “the mode of affirming” “the mode of denying” Rule of modus tollens Dr. Zaguia-CSI 2101 -W 08 10

Syllogism & Resolution Inference Rules p q q r p q p q p

Syllogism & Resolution Inference Rules p q q r p q p q p r q r Rule of hypothetical syllogism Rule of disjunctive syllogism Rule of Resolution Dr. Zaguia-CSI 2101 -W 08 11

Formal Proofs n n A formal proof of a conclusion C, given premises p

Formal Proofs n n A formal proof of a conclusion C, given premises p 1, p 2, …, pn consists of a sequence of steps, each of which applies some inference rule to premises or previously-proven statements (antecedents) to yield a new true statement (the consequent). A proof demonstrates that if the premises are true, then the conclusion is true. Dr. Zaguia-CSI 2101 -W 08 12

Formal Proof Example n n Suppose we have the following premises: “It is not

Formal Proof Example n n Suppose we have the following premises: “It is not sunny and it is cold. ” “We will swim only if it is sunny. ” “If we do not swim, then we will canoe. ” “If we canoe, then we will be home early. ” Given these premises, prove theorem “We will be home early” using inference rules. Dr. Zaguia-CSI 2101 -W 08 13

Proof Example cont. Let us adopt the following abbreviations: n n n sunny =

Proof Example cont. Let us adopt the following abbreviations: n n n sunny = “It is sunny”; cold = “It is cold”; swim = “We will swim”; canoe = “We will canoe”; early = “We will be home early”. Then, the premises can be written as: (1) sunny cold (2) swim sunny (3) swim canoe (4) canoe early Dr. Zaguia-CSI 2101 -W 08 14

Proof Example cont. Step 1. sunny cold 2. sunny 3. swim sunny 4. swim

Proof Example cont. Step 1. sunny cold 2. sunny 3. swim sunny 4. swim 5. swim canoe 6. canoe 7. canoe early 8. early Proved by Premise #1. Simplification of 1. Premise #2. Modus tollens on 2, 3. Premise #3. Modus ponens on 4, 5. Premise #4. Modus ponens on 6, 7. Dr. Zaguia-CSI 2101 -W 08 15

Exercises Which rules of inference are used in: • It is snowing or it

Exercises Which rules of inference are used in: • It is snowing or it is raining. It is not snowing, therefore it is raining. • If there is snow I will go snowboarding. If I go snowboarding, I will skip the class. There is snow, therefore I will skip the class. • I am rich or I have to work. I am not rich or I like playing hockey. Therefore I have to work or I like playing hockey. • I you are blonde then you are smart. You are smart therefore you are blonde. S R S S B R WRONG B K R W R H B S S K W H B S Dr. Zaguia-CSI 2101 -W 08 16

Using rules of inference to build arguments Show that: “If it does not rain

Using rules of inference to build arguments Show that: “If it does not rain or if is not foggy, then the sailing race will be held and the lifesaving demonstration will go on. If the sailing race is held, then the trophy will be awarded. The trophy was not awarded. ” implies “It rained” # Proposition Rule 1 ( R F) (S L) hypothesis 2 S T hypothesis 3 T hypothesis 4 S modus tollens 2 & 3 5 S L addition to 4 6 R F modus tollens 1 & 5 7 R simplification of 6 Dr. Zaguia-CSI 2101 -W 08 17

Examples What can be concluded from: n “I am either clever or lucky. I

Examples What can be concluded from: n “I am either clever or lucky. I am not lucky. If I am lucky I will win the lottery. ” C L L L T ? ? ? n “All rodents gnaw their food. Mice are rodents. Rabbits do not gnaw their food. Bats are not rodents. ” R G R “rodent” G “Gnaw their food” B “Rabit” M “Mousse” T “Bat” Dr. Zaguia-CSI 2101 -W 08 M R B G T R ? ? ? 18

Resolution The rule p q p r ------ q r is called resolution and

Resolution The rule p q p r ------ q r is called resolution and is used in computer (automatic) theorem proving/reasoning • also basis of logical programming languages like Prolog If all hypotheses and the conclusion are expressed as clauses (disjunction of variables or their negations), we can use resolution as the only rule of inference. Dr. Zaguia-CSI 2101 -W 08 19

Resolution Express as a (list of) clause(s): • p (q r) (p q) (p

Resolution Express as a (list of) clause(s): • p (q r) (p q) (p r) • (p q) ( p) (q) • p q ( p q) • (p q) (( p q) ( q p)) = ( p q) ( q p) = (p q) ( p q) = ((p q) ( p)) ((p q)) = ( q p) (p q) Use the rule of resolution to show that (p q) ( p q) is not certifiable (q q) = F Dr. Zaguia-CSI 2101 -W 08 20

Rules of Inference for Quantified Statements ( x) P(c) Universal Instantiation P(c) for an

Rules of Inference for Quantified Statements ( x) P(c) Universal Instantiation P(c) for an arbitrary c ( x) P(x) P(x) Universal Generalization Existential Instantiation P(c) for some element c (x) P(x) Existential Generalization Dr. Zaguia-CSI 2101 -W 08 21

Review Commonly used argument forms of propositional logic • modus ponens, modus tollens, hypothetical

Review Commonly used argument forms of propositional logic • modus ponens, modus tollens, hypothetical syllogism (transitivity of implication), disjunctive syllogism, addition, simplification, conjunction, resolution Rules of inference for quantified statements • universal instantiation, universal generalization • existential instantiation, existential generalization Resolution and logical programming • have everything expressed as clauses • it is enough to use only resolution Dr. Zaguia-CSI 2101 -W 08 22

Combining Rules of Inference x (P(x) Q(x)) P(a) ------- Q(a) Universal modus ponens x

Combining Rules of Inference x (P(x) Q(x)) P(a) ------- Q(a) Universal modus ponens x (P(x) Q(x)) Q(a) ------- P(a) Universal modus tollens # Statement Rule 1 x (P(x) Q(x)) hypothesis 2 P(a) hypothesis 3 P(a) Q(a) universal instantiation 4 Q(a) modus ponens 2 & 3 Dr. Zaguia-CSI 2101 -W 08 23

Examples/exercises Use rules of inference to show that if x (P(x) Q(x)) x( Q(x)

Examples/exercises Use rules of inference to show that if x (P(x) Q(x)) x( Q(x) S(x)) x (R(x) S(x) and x P(x) are true, then also x R(x) is true x (P(x) Q(x)) and x( Q(x) S(x)) implies x(P(x) S(x)) x (R(x) S(x) is equivalent to x( S(x) R(x)) Therefore x(P(x) R(x)) Since x P(x) is true. Thus P(a) for some a in the domain. Since P(a) R(a) must be true. Conclusion R(a) is true and so x R(x) is true Dr. Zaguia-CSI 2101 -W 08 24

Examples/exercises What is wrong in this argument, “proving” that • x. P(x) x. Q(x)

Examples/exercises What is wrong in this argument, “proving” that • x. P(x) x. Q(x) implies x(P(x) Q(x)) 1. x. P(x) x. Q(x) premise 2. x. P(x) simplification from 1. 3. P(c) universal instantiation from 2. 4. x. Q(x) simplification from 1. 5. Q(c) 6. P(c) Q(c) conjunction from 3. and 5. 7. x (P(x) Q(x)) existential generalization c? ? universal instantiation from 4 Dr. Zaguia-CSI 2101 -W 08 25

Examples/exercises Is the following argument valid? If Superman were able and willing to prevent

Examples/exercises Is the following argument valid? If Superman were able and willing to prevent evil, he would do so. Is Superman were unable to prevent evil, he would be impotent; if he were unwilling to prevent evil, he would be malevolent. Superman does not prevent evil. If Superman exists, he is neither impotent nor malevolent. Therefore, Superman does not exist. From A W P and P we deduce (A W). A W (1) A I thus A I (2) W M thus W M (3) (4)=(1)&(2) I W (1) & (4) A I , , , , , Dr. Zaguia-CSI 2101 -W 08 A W P A I W M P E I M E 26

OK so what is a proof? Formal proof • sequence of statements, ending in

OK so what is a proof? Formal proof • sequence of statements, ending in conclusion • statements preceding the conclusion are called premises • each statement is either an axiom, or is derived from previous premises using a rule of inference Informal proof • formal proofs are too tedious to read • humans don’t need that much detail, obvious/easy steps are skipped/grouped together • some axioms may be skipped (implicitly assumed) • we will now talk about how to write informal proofs • which are still formal and precise enough Dr. Zaguia-CSI 2101 -W 08 27

Terminology n n n n Theorem: A statement that has been proven to be

Terminology n n n n Theorem: A statement that has been proven to be true. Axioms, postulates, hypotheses, premises: Assumptions (often unproven) defining the structures about which we are reasoning. Rules of inference: Patterns of logically valid deductions from hypotheses to conclusions. Lemma: A minor theorem used as a stepping-stone to proving a major theorem. Corollary: A minor theorem proved as an easy consequence of a major theorem. Conjecture: A statement whose truth value has not been proven. (A conjecture may be widely believed to be true, regardless. ) Theory: The set of all theorems that can be proven from a given set of axioms. Dr. Zaguia-CSI 2101 -W 08 28

OK so how to prove a theorem? Depends on how theorem looks like •

OK so how to prove a theorem? Depends on how theorem looks like • A simple case – proving existential statements x P(x): There is an even integer that can be written in two ways as a sum of two prime numbers How to prove this proposition? • find such x and the four prime numbers “ 10 = 5+5 = 3+7” DONE For every integer x there is another integer y such that y > x. x y: y>x • Enough to show to find such y for every integer x: • just take y = x+1 Both are constructive proofs of existence There exist also non-constructive proofs • but constructive are more useful Dr. Zaguia-CSI 2101 -W 08 29

Proving by Counterexample Another simple case disproving the negation of existential statements: x P(x)

Proving by Counterexample Another simple case disproving the negation of existential statements: x P(x) disproving universal statements • by giving an counterexample Examples: Disprove: For all real numbers a and b, if a 2 = b 2 then a = b Disprove: There are no integers x such that x 2 = x. These are constructive proofs • yes, you can also have non-constructive ones Dr. Zaguia-CSI 2101 -W 08 30

How to disprove an existential theorem? By proving the negation, which is a universal

How to disprove an existential theorem? By proving the negation, which is a universal statement. Example: Disprove: There is a positive integer such that n 2+3 n+2 is prime We are going to prove: For every positive integer n, n 2+3 n+2 is not prime. Proof: Suppose n is any positive integer. We can factor n 2+3 n+2 to obtain n 2+3 n+2 = (n+1)(n+2). Since n 1 therefore n+1>1 and n+2>1. Both n+1 and n+2 are integers, because they are sums of integers. As n 2+3 n+2 is a product of two integers larger than 1, it cannot be prime. Dr. Zaguia-CSI 2101 -W 08 31

How to prove a universal theorem? Most theorems are universal of the form x

How to prove a universal theorem? Most theorems are universal of the form x P(x) Q(x) by exhaustion • if the domain is finite • or the number of x for which P(x) holds is finite Example: x x is even integer such that 4 x 16, x can be written as a sum of two prime numbers • 4=2+2, 6=3+3, 8=3+5, 10=5+5, 12 = 5+7, 14 = 7+7, 16 = 3+13 Exhaustion does not work when the domain is infinite, or even very large • you don’t want to prove that the multiplication circuit in the CPU is correct for every input by going over all possible inputs Dr. Zaguia-CSI 2101 -W 08 32

How to prove a universal theorem? Most theorems are universal of the form x

How to prove a universal theorem? Most theorems are universal of the form x P(x) Q(x) How to prove that? • generalizing from the generic particular • Let x be a particular, but arbitrarily chosen element from the domain, show that if x satisfies P then it also must satisfy Q • the showing is done as discussed in the last lecture • using definitions, previously established results and rules of inference • it is important to use only properties that apply to all elements of the domain This way (assume P(x) and derive Q(x) of proving a statement is called a direct proof Dr. Zaguia-CSI 2101 -W 08 33

Example 1: Direct Proof Theorem: If n is odd integer, then n 2 is

Example 1: Direct Proof Theorem: If n is odd integer, then n 2 is odd. Definition: The integer is even if there exists an integer k such that n = 2 k, and n is odd if there exists an integer k such that n = 2 k+1. An integer is even or odd; and no integer is both even and odd. Theorem: (n) P(n) Q(n), where P(n) is “n is an odd integer” and Q(n) is “n 2 is odd. ” We will show P(n) Q(n) Dr. Zaguia-CSI 2101 -W 08 34

Example 1: Direct Proof Theorem: If n is odd integer, then n 2 is

Example 1: Direct Proof Theorem: If n is odd integer, then n 2 is odd. Proof: Let p --- “n is odd integer”; q --- “n 2 is odd”; we want to show that p q. Assume p, i. e. , n is odd. By definition n = 2 k + 1, where k is some integer. Therefore n 2 = (2 k + 1)2 = 4 k 2 + 4 k + 1 = 2 (2 k 2 + 2 k ) + 1, which is by definition an odd number (k’ = (2 k 2 + 2 k ) ). QED Dr. Zaguia-CSI 2101 -W 08 35

Example 2: Direct Proof Theorem: The sum of two even integers is even. •

Example 2: Direct Proof Theorem: The sum of two even integers is even. • Starting point: let m and n be arbitrary even integers • To show: n+m is even Proof: Let m and n be arbitrary even integers. Then, by definition of even, m=2 r and n=2 s for some integers r and s. Then m+n = 2 r+2 s (by substitution) = 2(r+s) (by factoring out 2) Let k = r+s. Since r and s are integers, therefore also k is an integer. Hence, m+n = 2 k, where k is an integer. If follows by definition of even that m+n is even. Dr. Zaguia-CSI 2101 -W 08 36

Directions for writing proofs • be clean and complete • state theorem to be

Directions for writing proofs • be clean and complete • state theorem to be proven • clearly mark the beginning of the proof (i. e. Proof: ) • make the proof self-contained: introduce/identify all variables • “Let m and n be arbitrary even numbers” • “… for some integers r and s” • write in full sentences “Then m+n = 2 r+2 s = 2(r+s). ” • give a reason for each assertion • by hypothesis, by definition of even, by substitution • use the connecting little words to make the logic of the argument clear • The, Thus, Hence, Therefore, Observe that, Note that, Let Dr. Zaguia-CSI 2101 -W 08 37

Examples/exercises Theorem: The square of an even number is divisible by 4. Theorem: The

Examples/exercises Theorem: The square of an even number is divisible by 4. Theorem: The product of any three consecutive integers is divisible by 6. Dr. Zaguia-CSI 2101 -W 08 38

Very Basics of Number Theory Definition: An integer n is even iff integer k

Very Basics of Number Theory Definition: An integer n is even iff integer k such that n = 2 k Definition: An integer n is odd iff integer k such that n = 2 k+1 Definition: Let k and n be integers. We say that k divides n (and write k | n) if and only if there exists an integer a such that n = ka. Definition: An integer n is prime if and only if n>1 and for all positive integers r and s, if n = rs, then r=1 or s = 1. Definition: A real number r is rational if and only if integers a and b such that r= a/b and b 0. So, which of these numbers are rational? • 7/13 0. 3 3. 142857 • 3. 142857142857142857… • 3/4+5/7 Dr. Zaguia-CSI 2101 -W 08 39

Examples/exercises Theorem: The square of an even number is divisible by 4. Proof: Let

Examples/exercises Theorem: The square of an even number is divisible by 4. Proof: Let n be arbitrary even integer. Then, by definition of even, m=2 r for some integers r. Then n 2 = (2 r)2= 4 r 2. Therefore and by definition n 2 is divisible by 4. Dr. Zaguia-CSI 2101 -W 08 40

Examples/exercises Theorem: The product of any three consecutive integers is divisible by 6. I

Examples/exercises Theorem: The product of any three consecutive integers is divisible by 6. I knew how to prove this, because I had some knowledge of number theory. Definition: Let k and n be integers. We say that k divides n (and write k | n) if and only if there exists an integer a such that n = ka. Lemma 1: integers k, n, a: k | n k | an Lemma 2: Out of k consecutive integers, exactly one is divisible by k. Lemma 3: x: 2| x 3| x 6| x (a special case of a more general theorem) x, y, z: y | x z|x yz/GCD(y, z) | x (will prove Proposition 2 and Lemma 3 afterward, when we know more about number theory) Dr. Zaguia-CSI 2101 -W 08 41

Proof of Theorem: The product of any three consecutive integers is divisible by 6.

Proof of Theorem: The product of any three consecutive integers is divisible by 6. Proof: Let n be an arbitrary integer. From Lemma 2 it follows that either 2|n or 2|(n+1). Combining with Lemma 1 we deduce that 2|n(n+1) and therefore (applying Lemma 1 once more) also 2|n(n+1)(n+2). By Lemma 2 it follows that 3|n or 3|(n+1) or 3|(n+2). Applying Lemma 1 twice we obtain 3|n(n+1)(n+2). Therefore 2 | n(n+1)(n+2) and 3 | n(n+1). According to Lemma 1 it follows that 6=2*3 | n(n+1)(n+2) Dr. Zaguia-CSI 2101 -W 08 42

Proof by Contradiction A – We want to prove p. We show that: (1)

Proof by Contradiction A – We want to prove p. We show that: (1) ¬p F; (i. e. , a False statement) (2) We conclude that ¬p is false since (1) is True and therefore p is True. B – We want to show p q (1) Assume the negation of the conclusion, i. e. , ¬q (2) Use show that (p ¬q ) F (3) Since ((p ¬q ) F) (p q) (why? ) we are done Dr. Zaguia-CSI 2101 -W 08 43

Example 1: Proof by Contradiction Theorem “If 3 n+2 is odd, then n is

Example 1: Proof by Contradiction Theorem “If 3 n+2 is odd, then n is odd” Let p = “ 3 n+2 is odd” and q = “n is odd” 1 – assume p and ¬q i. e. , 3 n+2 is odd and n is not odd 2 – because n is not odd, it is even 3 – if n is even, n = 2 k for some k, and therefore 3 n+2 = 3 (2 k) + 2 = 2 (3 k + 1), which is even 4 so we have a contradiction, 3 n+2 is odd and 3 n+2 is even therefore we conclude p q, i. e. , “If 3 n+2 is odd, then n is odd” Q. E. D. Dr. Zaguia-CSI 2101 -W 08 44

Example 2: Proof by Contradiction Classic proof that 2 is irrational. • • •

Example 2: 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). Thus 2 = a 2/b 2 and then 2 b 2 = a 2. Therefore a 2 is even and so a is even, that is (a=2 k for some k). We deduce that 2 b 2 = (2 k)2 = 4 k 2 and so b 2 = 2 k 2 Therefore b 2 is even, and so b is even (b = 2 k for some k contradiction But if a and b are both even, then they are not relatively prime! Dr. Zaguia-CSI 2101 -W 08 45

Example 2: Proof by Contradiction You’re going to let me get away with that?

Example 2: Proof by Contradiction You’re going to let me get away with that? • a 2 is even, and so a is even (a = 2 k for some k)? ? • Suppose to the contrary that a is not even. • • Then a = 2 k + 1 for some integer k • Then a 2 = (2 k + 1) = 4 k 2 + 4 k + 1 • Therefore a 2 is odd. contradiction So a really is even. Dr. Zaguia-CSI 2101 -W 08 46

More examples/exercises Examples: • there is no greatest integer • Proposition 2: Out of

More examples/exercises Examples: • there is no greatest integer • Proposition 2: Out of k consecutive integers, exactly one is divisible by k. • there is no greatest prime number OK, we know what is an irrational number, and we know there is one 2 • the sum of an irrational number and an rational number is irrational • there exist irrational numbers a and b such that ab is rational • non-constructive existential proof Dr. Zaguia-CSI 2101 -W 08 47

Proof by contraposition • we want to prove x (P(x) Q(x)) • rewrite as

Proof by contraposition • we want to prove x (P(x) Q(x)) • rewrite as x ( Q(x) P(x)) (contrapositive of the original) • prove the contrapositive using direct proof: • let x is an arbitrary element of the domain such that Q(x) is false • show that P(x) is true Dr. Zaguia-CSI 2101 -W 08 48

Example 1: Proof by Contraposition Proof of a statement p q Use the equivalence

Example 1: Proof by Contraposition Proof of a statement p q Use the equivalence to : ¬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) (Show p) Suppose (a < 8) (b < 8). Then (a ≤ 7) (b ≤ 7). Therefore (a + b) ≤ 14. Thus (a + b) < 15. Dr. Zaguia-CSI 2101 -W 08 QED 49

Example 2: Proof by Contraposition Theorem: For n integer , if 3 n +

Example 2: Proof by Contraposition Theorem: For n integer , if 3 n + 2 is odd, then n is odd. I. e. For n integer, 3 n+2 is odd n is odd Proof by Contraposition: Let p --- “ 3 n + 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 3 n + 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 (2 k) + 2 = 6 k + 2 = 2 (3 k + 1) which is even. QED Dr. Zaguia-CSI 2101 -W 08 50

Contradiction vs Contraposition Can we convert every proof by contraposition into proof by contradiction?

Contradiction vs Contraposition Can we convert every proof by contraposition into proof by contradiction? Proof of x (P(x) Q(x)) by contraposition: Let c is an arbitrary element such that Q(c) is false … (sequence of steps) P(c) Proof of x (P(x) Q(x)) by contradiction: Let x such that P(x) and Q(x) then Q(c) // existential instantiation … same sequence of steps Contradiction: P(c) and P(c) Dr. Zaguia-CSI 2101 -W 08 51

Contradiction vs Contraposition So, which one to use? Contraposition advantage: • you don’t have

Contradiction vs Contraposition So, which one to use? Contraposition advantage: • you don’t have to make potentially error-prone negation of the statement • you know what you want to prove Contraposition disadvantage: • usable only for statements that are universal and conditional Dr. Zaguia-CSI 2101 -W 08 52

Proof Strategy Statement: For all elements in the domain, if P(x) then Q(x) Imagine

Proof Strategy Statement: For all elements in the domain, if P(x) then Q(x) Imagine elements which satisfy P(x). Ask yourself “Must they satisfy Q(x)? ” • if you feel “yes”, use the reasons why you feel so as a basis of direct proof • if it is not clear that “yes” is the answer, think why you think so, maybe that will guide you to find a counterexample • if you can’t find a counterexample, try to think/observe why • maybe from assuming that P(x) Q(x) you can derive contradiction • maybe from assuming that P(x) Q(x) you can derive P(x) There are no easy ‘cookbooks’ for proofs • but seeing many different proofs (and yourself proving statements) you learn many useful techniques and tricks that might be applicable Dr. Zaguia-CSI 2101 -W 08 53

More examples/exercises Prove that there are no integer solutions for x 2+3 y 2=8

More examples/exercises Prove that there are no integer solutions for x 2+3 y 2=8 Prove that there are no integer solutions for x 2 -y 2 = 14 Prove there is a winning strategy for the first player in the Chomp game Prove that a chessboard can be tiled by dominoes. Prove that a chessboard without a corner cannot be tiled by dominoes. Prove that a chessboard with diagonal corners removed cannot be tiled by dominoes. Dr. Zaguia-CSI 2101 -W 08 54

More examples/exercises Prove that xn+yn = zn has no integers solutions with xyz 0

More examples/exercises Prove that xn+yn = zn has no integers solutions with xyz 0 for n>2. Fermat’s last theorem (took hundreds of years to prove, the proof is hundreds of pages) The 3 x+1 conjecture: Does this program terminate for every integer i? while(i>1) { if (even(x)) x = x/2; else x = 3 x+1; } Dr. Zaguia-CSI 2101 -W 08 55

Common Mistakes • arguing from examples • we notice that 3, 5, 7, 11,

Common Mistakes • arguing from examples • we notice that 3, 5, 7, 11, 13, 17, 19 are prime, we therefore conclude that all odd numbers are prime? ? ? • the code produces correct output for the test cases, therefore it will always produce correct output • using the same letter to mean two different things • x. P(x) x. Q(x) does not imply there is c such that (P(c) Q(c)) Dr. Zaguia-CSI 2101 -W 08 56

Common Mistakes Some other common mistakes: 1. 2. 3. The mistake of Affirming the

Common Mistakes Some other common mistakes: 1. 2. 3. The mistake of Affirming the Consequent The mistake of Denying the Antecedent Begging the question or circular reasoning Dr. Zaguia-CSI 2101 -W 08 57

The Mistake of Affirming the Consequent If the butler did it he has blood

The Mistake 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) P which is not a tautology and therefore not a valid rule of inference Dr. Zaguia-CSI 2101 -W 08 58

The Mistake of Denying the Antecedent If the butler is nervous, he did it.

The Mistake 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 Dr. Zaguia-CSI 2101 -W 08 59

Begging the question or circular reasoning n This occurs when we use the truth

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

Methods of Proof n n n n Direct Proof by Contraposition Proof by Contradiction

Methods of Proof n n n n Direct Proof by Contraposition Proof by Contradiction Proof of Equivalences Proof by Cases Existence Proofs Counterexamples Dr. Zaguia-CSI 2101 -W 08 61