650 likes | 939 Views
Proof Methods . May 15. 1. Logical Implication . ?. #1. #2. Recall: (#1 ⇒ #2) precisely if (#1 #2 ) is a tautology . 2. Proof: ( p q ) ( q r ) p ⇒ r ?. 3. Formal Proof.
E N D
Proof Methods May 15 1
Logical Implication ? #1 #2 Recall: (#1 ⇒ #2) precisely if (#1#2) is a tautology 2 PROOF METHODS
Proof: (p q) (q r)p⇒r ? 3 PROOF METHODS
Formal Proof • A formal proof that a given set of premises (hypotheses) h1 ,h2 ,…,hnimply some conclusion c entails establishing the logical implication h1 h2 …hn ⇒c • Presenting a direct proof entails: giving a finite list of wffs f1 ,f2 ,…,c such that each fris: • Rule I: one of the premises or a tautology, or • Rule II: logically implied by the conjunction of one or more fkwhere1 ≤k < r. • And giving the justification for each wff. 4 PROOF METHODS
Example Given the following premises (hypotheses): h1:p q,h2:q r,h3: p Formally prove the conclusion: c: r In other words, prove:( (p q) (q r)p ) ⇒r. Proof: Justification: • p q Rule I: premise h1 • p Rule I: premiseh3 • q Rule II: #1 #2 ⇒ #3 • q r Rule I: premiseh2 • r Rule II: #3 #4 ⇒ #5 How do we know these? PROOF METHODS
Rules of Inference: h1 h2 . . . hn ______ ∴ c • A rule of inference represents how a conclusion is drawn from a set of premises in an argument. • Read as: From the hypotheses h1, h2, …, hn, we conclude c. • This rule is: • Valid if c is true whenever h1, h2, …, hn are all true—i.e., if h1 h2 …hn⇒c (i.e., h1 h2 …hn→cis a tautology) • Invalid (a fallacy), otherwise. Premises Conclusion 6 PROOF METHODS
Example Inference Rule • Example:pp q q • Read as: From premises p and p q, conclude q • Exercise: Is this rule valid? • Yes, because [p (p q)] ⇒q (i.e., because [p (p q)] q is a tautology) • This rule iscalled modus ponens (MP) 7 PROOF METHODS
Example: Valid arguments The following are applications of MP: “If (2)½ > 3/2, then ((2)½ )2 > (3/2)2. Since (2)½ > 3/2, we therefore conclude that ((2)½ )2 > (3/2)2, or that 2 > 9/4.” “-2 > -1 because, (-2)2 > (-1)2 and, if (-2)2 > (-1)2 then ((-2)2)½ > ((-1)2)½.” We are concerned with whether the conclusion logically follows from the premises, not with whether the conclusion is actually true or false PROOF METHODS
Example Inference Rule • Example:qp q p • Read as: From premises q and p q, conclude p • Exercise: Is this rule valid? • No, because [q (p q)] ⇒p (e.g., consider case where q is T and p isF) • This rule represents a common fallacy, called affirming the conclusion. 9 PROOF METHODS
Example: Fallacy The following affirm the consequent: “If (2)½ is an even integer, then 2 is even. Since 2 is even, it follows that (2)½ is an even integer.” “If you work every problem in Rosen, you will get a 4.0. You received a 4.0. Ergo, you worked every problem in Rosen. We are concerned with whether the conclusion logically follows from the premises, not with whether the conclusion is actually true or false PROOF METHODS
Some Rules of Inference 11 PROOF METHODS
Revisit: (p q) (q r)p⇒r Given the following premises:p q,q r,p Formally prove:r • pPremise • p qPremise • qModus ponens (#1&2) • q rPremise • rModus ponens (#3&4) 12 PROOF METHODS
More Useful Rules of Inference 13 PROOF METHODS
Example • Given the following premises:d (q d ) ¬ p¬ p (a ¬b)(a ¬b) (r s) • Formally prove the conclusion:r s. • (q d ) ¬ pPremise • ¬ p (a ¬b)Premise • (q d ) (a ¬b) Hypothetical Syllogism (#1&2) • (a ¬b) (r s) Premise • (q d ) (r s)Hypothetical Syllogism (#3&4) • dPremise • q dAddition • r sModus Ponens (#5&7) 14 PROOF METHODS
Justification by “Assumption” [ h⇒(p q) ] ≡ [ (h p)⇒q) ] • Intuition: If p is false, then there is nothing to prove. • So, to prove h⇒(p q), you mayassume, not just h, but also p, and then formally prove the q. [ h⇒(p q) ] ≡ [ (h¬p)⇒q) ] • Intuition: If p is true, then there is nothing to prove. • So, to prove h⇒(pq), you mayassume, not just h, but also p, and then formally prove the q. 16 PROOF METHODS
Example p → q q → s p → s • Given the following premises: p q, q s • Formally prove: p s • pAssumption (NTP) • p qPremise • qModus ponens (#1&2) • q sPremise • sModus ponens (#3&4) Proving:(p q) (q s) p ⇒ s Or, equivalently: (p q) (q s)⇒ (p s) 17 PROOF METHODS
Example Given the premises:p (q s),¬ r p, q Formally prove: ¬ r s • ¬ r p Premise • r Assume (NTP) • p Disjunctive syllogism (#1&2 ) • p (q s) Premise • q s Modus ponens (#3&4) • q Premise • s Modus ponens (#5&6) Proving: (p (q s)) (¬ r p) q ⇒ ¬r s 18 PROOF METHODS
Rules of Inference for Quantifications 19 PROOF METHODS
Example • Prove the theorem: “The square of an odd integer is odd.” • In predicate logic: x ( n (x = 2n + 1) m (x2 = 2m + 1) ) where x, n, and m range over the integers. 20 PROOF METHODS
Example Formal Predicate Logic Proof • Prove : x ( n (x = 2n + 1) m (x2 = 2m + 1) ) • Many implicit premises, for example: • x y z (x = y y = z x = z) • x y (x = y x2 = y2) • etc. Properties ofintegers (POIs) x0 is an integer Assume (NTP) n (x0 = 2n + 1) Assume (NTP) (x0 = 2n0 + 1), ES (#2) for some integer (x0 = (2n0 + 1)) US & POI (x02 = (2n0 + 1) 2) (x02 = (2n0 + 1) 2) MP (#3&4) ((2n0 + 1) 2 = US & POI 2(n0 2 + 2n0) + 1) [x02 = (2n0 + 1) 2 (2n0 + 1) 2 = 2(n0 2 + 2n0) + 1] x02 = 2(n0 2 + 2n0) + 1US & POI x02 = 2(n0 2 + 2n0) + 1 MP (#5,6,7) m (x02 = 2m + 1) EG (#8) (n (x0 = 2n + 1)) Assumption m (x02 = 2m + 1)) (#2&9) x ( n (x = 2n + 1) m (x2 = 2m + 1) ) UG (#1&10) PROOF METHODS
Example x0 is an integer Assume (NTP) n (x0 = 2n + 1) Assume (NTP) • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1. In other words, x2 is odd. Thus, if x is odd, then x2 is also. 22 PROOF METHODS
Example • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1. In other words, x2 is odd. Thus, if x is odd, then x2 is also. (x0 = 2n0 + 1), ES (#2) for some integer n0 23 PROOF METHODS
Example (x0 = (2n0 + 1)) US & POI (x02 = (2n0 + 1) 2) (x02 = (2n0 + 1) 2) MP (#3&4) ((2n0 + 1) 2 = US & POI 2(n0 2 + 2n0) + 1) [x02 = (2n0 + 1) 2 (2n0 + 1) 2 = 2(n0 2 + 2n0) + 1] x02 = 2(n0 2 + 2n0) + 1 US & POI x02 = 2(n0 2 + 2n0) + 1 MP (#5,6,7) • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1, which implies x2 is odd. Thus, if x is odd, then x2 is also. 24 PROOF METHODS
Example • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1, which implies x2 is odd. Thus, if x is odd, then x2 is also. m (x02 = 2m + 1) EG (#8) 25 PROOF METHODS
Example • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1, which implies x2 is odd. Thus, if x is odd, then x2 is also. (n (x0 = 2n + 1)) Assumption m (x02 = 2m + 1)) (#2&9) x ( n (x = 2n + 1) m (x2 = 2m + 1) ) UG (#1&10) 26 PROOF METHODS
Example • Prove the theorem: “The square of an odd integer is odd.” • Proof: Assume that x is an odd integer. Let n be the integer such that x = 2n + 1. Then x2 = (2n + 1)2 = 4n2 + 4n + 1 = 2(2n2 + 2n) + 1 Letting m = 2n2 + 2n, we conclude x2 = 2m + 1, which implies x2 is odd. Thus, if x is odd, then x2 is also. 27 PROOF METHODS
Multiple Basic Proof Techniques • Prove: [(¬ (p q)) (¬ p q)]≡(¬ p q) • Different ways to do so: • By means of the Truth Table. • By means of a derivation. • By formulating it as a logical implication, i.e., as a “formal proof”. 28 PROOF METHODS
Prove: [(¬ (p q)) (¬ p q)]≡(¬ p q) Truth Table Method 29 PROOF METHODS
Prove [(¬ (p q)) (¬ p q)]≡(¬ p q) ?Derivation Method (¬ (p q)) (¬ p q)) ≡ ¬(¬ (p q)) (¬ p q) ≡ (p q) (¬ p q) ≡ ((p q) ¬ p) q ≡ (¬ p (p q)) q ≡ ((¬ p p)(¬ p q)) q ≡ (T(¬ p q)) q ≡ (¬ p q) q ≡ (¬ p (q q ) ) ≡ (¬ p q) Exercise: at each step of this derivation, indicate theequivalence rule that is used. 30 PROOF METHODS
Prove: [ (¬ (p q)) (¬ p q)]≡(¬ p q) Logical Implication Method Let S and R be wffs. To show that S≡ Rwe must show that S ⇒R and R⇒S -------------------------------------------------- In this case, we must show[¬ (p q)) (¬ p q)] ⇒(¬ p q)and (¬ p q)⇒ [¬ (p q)) (¬ p q)] 31 PROOF METHODS
Proof that [¬ (p q) (¬ p q)]⇒(¬ p q) • pAssumption (NTP) • ¬ (p q) (¬ p q) Premise • ¬ q qSubst. & simpl. (#1&2) • q Simplification (#3) Proving: (p (¬ (p q) (¬ p q))) ⇒ q Equivalently: (¬ (p q) (¬ p q)) ⇒ ¬ p q If p is false, then ¬(pq)is vacuously true. So assume p is true. In this case, premise ¬ (p q) (¬ p q) reduces to ¬ q q. But this latter condition is equivalent to q. Thus, together, ¬ (p q) (¬ p q) and p imply q; or, equivalently, ¬ (p q) (¬ p q) implies ¬ p q. 32 PROOF METHODS
Proof that (¬ p q) ⇒ [¬ (p q) (¬ p q)] • (¬ p q)Premise • ¬ (p q) (¬ p q) Trivial (#1) Proving: (¬ p q) ⇒ (¬ (p q) (¬ p q)) We are given that ¬ pqis true as a premise. Since ¬ pqis true, it follows that ¬ (p q) (¬ p q) is trivially true. 33 PROOF METHODS
Exercise • Is the following reasoning valid? • If you are poor then you have no money. Also, if you have money then you are not poor. Therefore, being poor is the same as having no money. • Let: • p: “you are poor” m: “you have money” • Reformulate the argument in predicate logic:Given premises: p ¬ mandm ¬pCan you conclude:p ¬ m • This reasoning is not valid because, ifp and m are both false, then the conclusion is false, although the premises are both be true. 34 PROOF METHODS
Solution: Does [(p q) (¬ q ¬ p)]⇒ (pq) ? There is a possibility of not being poor while having no money! 35 PROOF METHODS
Proofs of Mathematical Statements • A proof is a valid argument that establishes the truth of a statement. • In math, CS, and other disciplines, informal proofs which are generally shorter, are generally used. • Easier to understand and to explain to other people. • But it is also easier to introduce errors. • Proofs have many practical applications: • Verification of programs, algorithms, etc. • System security (OS, DB, networking, …) • Making inferences for AI • Comparing efficiency of algorithms
Terminology • A theorem is a statement that has been shown to be true using: • definitions • other theorems • axioms (statements which are given as true) • rules of inference • A lemma is a ‘helper theorem.’ • A corollary is a result which follows directly from a theorem. • A conjecture is a statement that we think may be true. (It may turn out to be false.)
How are these questions related? • Doesp⇒ c ? • Is the proposition(p c) a tautology? • Is the proposition (¬ c ¬p)is a tautology? • Is the proposition (p ¬c) is a contradiction? 38
Proof Methods: Does p⇒c ? • The following are necessary and sufficient: • p c is a tautology. • ¬ c ¬ pis a tautology. • p ¬c is a contradiction. Direct Proof Indirect Proof(Contrapositive) Indirect Proof (Contradiction) 39
Proof Methods: Does p⇒c ? • The following are sufficient: • pis false • cis true Vacuous Proof Trivial Proof 40 PROOF METHODS
Example: What are you asked to prove? • Prove: The product of two rational numbers is a rational number. • In other words: If x is rational andy is rational, then xyis rational. • Recall the definition of rational number: A rational number is a fraction—i.e. a number of the form n/d, where n & d are integers and d ≠ 0. • In predicate logic, we need to prove: Arbitrary x and y specific nx, dx, ny, dy, nz, dz Premises Conclusion 41
Proving Theorems • Many theorems have the form: • To prove them, we show, where c, d, … are arbitrary elements of their respective domains. • By universal generalization the truth of the original formula follows. • So, we must prove something of the form:
Direct proof of p⇒c • Direct Proof: Assume that p is true. Use rules of inference, axioms, and logical equivalences to show thatcmust also be true.
Example: Direct proof Prove: The product of two rational numbers is a rational number. Assume x andy are (arbitrary) rational numbers. Then x = nx /dx and y = ny /dy for some integers nx,dx, ny,dy. where dx and dy are non-zero. Using these equalities and properties of integers, we have: xy = (nx /dx)(ny /dy) = (nxny)/(dxdy) Thus, if we let nz = (nxny) and dz = (dxdy), then xy = nz /dz. Moreover, nz and dz are integers and dz is non-zero (by properties of integers). We therefore conclude that xy is rational.
Indirect: Contraposition proof of p⇒c • Contraposition Proof: Assume that c is false. Use rules of inference, axioms, and logical equivalences to show thatpmust also be false.
Example Contraposition Proof Prove: If n is an integer and 3n+2is odd, then n is odd. Suppose, to the contrary, that n is not odd. Thenn = 2k, for some integer k. Using properties of integers, we have: 3n+2 = 3(2k) + 2 = 2(3k + 1). Because 3k + 1 is an integer, this means that 3n+2 is even. Hence, if nis even then3n+2 is also even. It follows that, if3n+2 is odd, thennis also odd.
Indirect: Contradiction proof of p⇒c • Contradiction Proof: Assume that p is true and c is false, and derive a contradiction (i.e., show thatp and c logically imply false). • More generally, to prove a proposition q is true: Assume q is not true, and derive a contradiction.
Example Contradiction Proof Prove: If you make 22 appointments for next week, at least 4 must fall on the same day. Assume you make 22 appointments for next week, but no more than 3 of them fall on the same day. Because there are 7 days of the week, you could have at most 21 appointments. But this contradicts the assumption that you have made 22 appointments. Thus, our starting assumption (that no more than 3 of the 22 appointments falls on the same day of the week) must be false.
Example General Proof by Contradiction Prove: is irrational. Suppose is rational. Then there exist integers n and d such that and . Moreover, n and d can be chosen such that they have no common factors. Squaring both sides of this equation, we reason that 2 = n2/d2 , and so that n2 = 2d2 is even. But n2 is even iffn is even (exercise). Thus, there is some integer k such that n = 2k. These last two equations imply (2k)2= 2d2, and so d2 = 2k2 is also even. But d2 is even iffd is even. Thus, 2 must divide both d and n, contradicting the assumption that they have no common factors. Hence cannot be rational.
Example General Proof by Contradiction Prove: is irrational. Suppose is rational. Then there exist integers n and d such that and . Moreover, n and d can be chosen such that they have no common factors. Squaring both sides of this equation, we reason that 2 = n2/d2 , and so that n2 = 2d2 is even. But n2 is even iffn is even (exercise). Thus, there is some integer k such that n = 2k. These last two equations imply (2k)2= 2d2, and so d2 = 2k2 is also even. But d2 is even iffd is even. Thus, 2 must divide both d and n, contradicting the assumption that they have no common factors. Hence cannot be rational.
Example General Proof by Contradiction Prove: is irrational. Suppose is rational. Then there exist integers n and d such that and . Moreover, n and d can be chosen such that they have no common factors. Squaring both sides of this equation, we reason that 2 = n2/d2 , and so thatn2 = 2d2 is even. But n2 is even iff n is even (exercise). Thus, there is some integer k such that n = 2k. These last two equations imply (2k)2= 2d2, and so d2 = 2k2 is also even. But d2 is even iff d is even. Thus, 2 must divide both d and n, contradicting the assumption that they have no common factors. Hence cannot be rational.