<<

Proof Methods

Methods of proof Direct Direct Contrapositive Contradiction pc p→ c ¬ p ∨ c ¬ c → ¬ pp ∧ ¬ c

TT T T T F Section 1.6 & 1.7 T F F F F T

FT T T T F

FF T T T F

MSU/CSE 260 Fall 2009 1 MSU/CSE 260 Fall 2009 2

How are these questions related? Proof Methods h1 ∧ h2 ∧ … ∧ hn ⇒ c ? 1. Does p logically imply c ? „ Let p = h ∧ h ∧ … ∧ h . The following 2. Is the proposition (p → c) a ? 1 2 n propositions are equivalent: 3. Is the proposition (¬ p ∨ c) is a tautology? 1. p ⇒ c 4. Is the proposition (¬ c → ¬ p) is a tautology? 2. (p → c) is a tautology. Direct 5. Is the proposition (p ∧ ¬ c) is a contradiction? 3. (¬ p ∨ c) is a tautology. Direct

4. (¬ c → ¬ p)is a tautology. Contrapositive

5. (p ∧ ¬ c) is a contradiction. Contradiction

MSU/CSE 260 Fall 2009 3 MSU/CSE 260 Fall 2009 4

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Formal Proofs

„ A proof is equivalent to establishing a logical „ To prove:

implication chain h1 ∧ h2 ∧ … ∧ hn ⇒ c p1 Premise p Tautology „ Given premises (hypotheses) h1 , h2 , … , hn and „ Produce a series of wffs, 2 conclusion c, to give a formal proof that the … . p1 , p2 , pn, c . p k, k’, Inf. Rule hypotheses imply the conclusion, entails such that each wff pr is: r . establishing ‰ one of the premises or . . ‰ a tautology, or pn ‰ _____ h1 ∧ h2 ∧ … ∧ hn ⇒ c an axiom/law of the domain (e.g., 1+3=4 or x > x+1 ) ∴ c

‰ justified by definition, or

‰ logically equivalent to or implied by

one or more propositions pk where 1 ≤ k < r. MSU/CSE 260 Fall 2009 5 MSU/CSE 260 Fall 2009 6

Example Example h c „ Prove the : „ Prove the theorem: “If integer n is odd, then n2 is odd.” “If integer n is odd, then n2 is odd.” „ Informal proof: „ Formal Proof: ‰ It is given that n is an odd integer. 1. n is odd Premise (h) 2. ∃ k (n = 2k + 1) Definition of “odd” (Universe is Integers) ‰ Thus n = 2k + 1, for some integer k. 3. n = 2c + 1, for some integer c Step 2, specialization ‰ Thus n2 = (2k + 1)2 = 4k2 + 4k + 1 4. (n = 2c + 1) → (n2 = (2c + 1)2) Laws of arithmetic = 2(2k2 + 2k) + 1 5. n2 = (2c + 1)2 Steps 3 & 4, 2 ‰ Therefore, n is odd. = 4c2 + 4c + 1 Laws of arithmetic = 2(2c2 + 2c) + 1 Laws of arithmetic 6. ∃ k (n2 = 2k + 1) Step 5, generalization 7. n2 is odd Definition of “odd” MSU/CSE 260 Fall 2009 7 MSU/CSE 260 Fall 2009 8

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Formal Proofs….. Does (p → q) ∧ (q → r) ∧ p ⇒ r ? Method „ Example:

Given: p → q, q → r, p. p q r p → q q → r p r Prove: r T T T T T T T We want to establish the logical implication: T T F T F T F (p → q) ∧ (q → r) ∧ p ⇒ r. T F T F T T T „ We can use either of the following approaches ‰ Truth Table T F F F T T F ‰ A chain of logical implications F T T T T F T „ Note that if A ⇒ B and B ⇒ C then A ⇒ C F T F T F F F F F T T T F T F F F T T F F MSU/CSE 260 Fall 2009 9 MSU/CSE 260 Fall 2009 10

Does (p → q) ∧ (q → r) ∧ p ⇒ r ? Example Chain Method „ Prove: If 2 is even and if 3 is even and if the

„ h1 =p→ q, h2 = q → r, h3 = p, c = r sum of any two even integers is even, then all We want to prove that h1 ∧ h2 ∧ h3 ⇒ c integers greater than 1 and less than 6 are even. 1. p Premise 2. p → q Premise 1. 2 is even Premise 2. 3 is even Premise 3. q Steps 1 & 2, modus ponens* 3. ∀n ∀m ((n is even) ∧ (n is even) → (n+m is even)) Premise 4. q → r Premise 4. (2 is even) ∧ (2 is even) → (4 is even) Specialization (twice), step 3, math 5. r Steps 3&4, modus ponens 5. (3 is even) ∧ (2 is even) → (5 is even) Specialization (twice), step 3, math 6. 4 is even Conj. & modus ponens, steps 1&4 7. 5 is even Conj. & modus ponens, steps 1,2,&5 *See Table 1, page 66 8. (2 is even) ∧ (3 is even) ∧ (4 is even) ∧ (5 is even) Conj.(many times), steps 1,2,6&7

So this is a bona fide theorem – the statement is true!

MSU/CSE 260 Fall 2009 11 MSU/CSE 260 Fall 2009 12

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Proving conclusions of the form p → q Example: Direct proof

„ Direct: Assume p, in addition to the given „ Prove hypothetical .

hypotheses, and conclude q. ‰ Prove: (p → q) ∧ (q → s) ⇒ (p → s) „ Contrapositive: Assume ¬ q, in addition to the given hypotheses, and conclude ¬ p. 1. p Assumption „ Contradiction: Assume both p and ¬ q, in 2. p → q Premise addition to the given hypotheses, and conclude False. 3. q 1, 2, modus ponens 4. q → s Premise „ Vacuous: Assume the given hypotheses, and conclude ¬ p. 5. s 3, 4, modus ponens „ Trivial: Assume the given hypotheses, and 6. p → s 1, 5, direct method of proof conclude q.

MSU/CSE 260 Fall 2009 13 MSU/CSE 260 Fall 2009 14

Example: Contrapositive proof Example: Contradiction proof „ Prove hypothetical syllogism. „ Prove hypothetical syllogism. ‰ Prove: (p → q) ∧ (q → s) ⇒ (p → s) ‰ Prove: (p → q) ∧ (q → s) ⇒ (p → s) 1. p Assumption 1. ¬ s Assumption 2. ¬ s Assumption 2. q → s Premise 3. q → s Premise 3. ¬ q 1, 2, 4. ¬ q 2, 3, modus tollens 4. p → q Premise 5. p → q Premise 5. ¬ p 3, 4, modus tollens 6. ¬ p 4, 5, modus tollens 6. p → s 1, 5, contrapositive method 7. p ∧ ¬ p 1, 6, conjunction 8. False 7, logical equivalence 9. p → s 1, 2, 8, contradiction method MSU/CSE 260 Fall 2009 15 MSU/CSE 260 Fall 2009 16

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Example: Vacuous proof Example: Trivial proof

„ Prove: If p → r and q →¬r, then p ∧ q → s „ Prove: If p → r and ¬ r, then q →¬p „ Equivalently, prove: „ Equivalently, prove: (p → r ) ∧ (q →¬r ) ⇒ (p ∧ q → s) (p → r ) ∧ ( ¬ r ) ⇒ ( q →¬p)

1. p → r Premise 1. p → r Premise 2. ¬ p ∨ r 1, Implication 2. ¬ r Premise 3. q →¬r Premise 3. ¬ p 1, 2, modus tollens 4. ¬ q ∨¬r 3, Implication 4. q →¬p 3, Trivially 5. ¬ p ∨¬q 2, 4, Resolution 6. ¬ (p ∧ q ) 5, DeMorgan 7. p ∧ q → s 6, Vacuously

MSU/CSE 260 Fall 2009 17 MSU/CSE 260 Fall 2009 18

Non‐examples: Vacuous, trivial proofs Example

„ Recall hypothetical syllogism. „ Let

‰ Prove: (p → q) ∧ (q → s) ⇒ (p → s) h1 =q∨ d h = (q ∨ d ) → ¬ p „ Why didn’t we give example vacuous or trivial 2 → ∧ proofs of hypothetical syllogism? h3 = ¬ p (a ¬ b) h4 = (a ∧ ¬ b) → (r ∨ s) c=r∨ s

we want to establish h1 ∧ h2 ∧ h3 ∧ h4 ⇒ c.

MSU/CSE 260 Fall 2009 19 MSU/CSE 260 Fall 2009 20

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Solution 1 Solution 2

„ Let „ Let h =q∨ dh= (q ∨ d ) → ¬ p 1 2 h1 =q∨ dh2 = (q ∨ d ) → ¬ p h = ¬ p → (a ∧ ¬ b) h = (a ∧ ¬ b) → (r ∨ s) 3 4 h3 = ¬ p → (a ∧ ¬ b) h4 = (a ∧ ¬ b) → (r ∨ s) c=r∨ s c=r∨ s, we want to establish h ∧ h ∧ h ∧ h ⇒ c. 1 2 3 4 we want to establish h1 ∧ h2 ∧ h3 ∧ h4 ⇒ c.

1. (q ∨ d ) → ¬ p Premise 1. q ∨ d Premise 2. ¬ p → (a ∧ ¬ b)Premise 2. (q ∨ d ) → ¬ p Premise 3. (q ∨ d ) → (a ∧ ¬ b)1&2, Hypothetical Syllogism 3. ¬ p 1&2, and modus ponens 4. (a ∧ ¬ b) → (r ∨ s)Premise 4. ¬ p → (a ∧ ¬ b)Premise 5. (q ∨ d ) → (r ∨ s)3&4, HS 5. (a ∧ ¬ b)3&4, modus ponens 6. q ∨ d Premise 6. (a ∧ ¬ b) → (r ∨ s) Premise 7. r ∨ s 5&6, Modus Ponens 7. r ∨ s 5&6, modus ponens

MSU/CSE 260 Fall 2009 21 MSU/CSE 260 Fall 2009 22

Example Is [(¬ (p ∧ q)) → (¬ p ∨ q)] ≡ (¬ p ∨ q) ? Truth Table Method

„ Question: Is [(¬ (p ∧ q)) → (¬ p ∨ q)] ≡ (¬ p ∨ q) ? pq¬(p ∧ q)(¬p ∨ q)LHSRHSAnswer „ Different ways to answer the above question 1. By means of the Truth Table. TT FTT T YES 2. By means of derivation.

3. By formulating it as logical equivalence, that is, as a TF TFF F YES “proof”.

FT TTT T YES

FF TTT T YES

MSU/CSE 260 Fall 2009 23 MSU/CSE 260 Fall 2009 24

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Is [(¬ (p ∧ q)) → (¬ p ∨ q)] ≡ (¬ p ∨ q) ? Is [ (¬ (p ∧ q)) → (¬ p ∨ q)] ≡ (¬ p ∨ q) ? Derivation Method Logical Equivalence Method

(¬ (p ∧ q)) → (¬ p ∨ q) ≡ ¬(¬(p ∧ q)) ∨ (¬ p ∨ q) To show S ≡ R: show that S ⇒ R and R ⇒ S ≡ (p ∧ q) ∨ (¬ p ∨ q) ≡ ((p ∧ q) ∨ ¬ p) ∨ q ) ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ≡ (¬ p ∨ (p ∧ q)) ∨ q In this case, we have ≡ ((¬ p ∨ p) ∧ (¬ p ∨ q)) ∨ q ≡ ((T) ∧ (¬ p ∨ q)) ∨q S = [¬ (p ∧ q)) → (¬ p ∨ q)] and ≡ (¬ p ∨ q) ∨q R = (¬ p ∨ q) ≡ (¬ p) ∨ (q ∨q ) ≡ (¬ p) ∨ (q) ≡ (¬ p ∨ q)

MSU/CSE 260 Fall 2009 25 MSU/CSE 260 Fall 2009 26

Prove [(¬ (p ∧ q)) → (¬ p ∨ q)] ⇒ (¬ p ∨ q) Example

1. (¬ (p ∧ q)) → (¬ p ∨ q) Premise „ Is the following reasoning logical? 2. (p ∧ q) ∨ (¬ p ∨ q)1, Implication & double neg. If you are poor then you have no money. If you have 3. (p ∨ (¬ p ∨ q)) ∧ (q ∨ (¬ p ∨ q)) 2, Distribution money then you are not poor. Therefore, being poor 4. ∨ ∧ ∨ (T q) (q ¬ p) 3, Comm., Assoc, Taut. & Idem. is the same as having no money! 5. T ∧ (q ∨ ¬ p) 4, Domination 6. ¬ p ∨ q 5, Identity, Commutative „ Define the following propositions: ‰ p = “you are poor” q = “you have no money”

Prove (¬ p ∨ q) ⇒ [(¬ (p ∧ q)) → (¬ p ∨ q)] ‰ Can we conclude that p ≡ q given that p → q and

1. ¬ p ∨ q Premise ¬q → ¬p. ‰ 2. (¬ (p ∧ q)) → (¬ p ∨ q) Trivially, from 1 In other words, can we prove that: [(p → q) ∧ (¬ q → ¬ p)]⇒ (p ↔ q) .

MSU/CSE 260 Fall 2009 27 MSU/CSE 260 Fall 2009 28

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Solution: More Example Does [(p → q) ∧ (¬ q → ¬ p)]≡ (p ↔ q) ? „ Let

pq p→ q ¬ q ¬ p ¬ q → ¬ pLSHp↔ q h1 =p→ (q → s) h2 = ¬ r ∨ p TT T FF T T T h3 = q c=r→ s

TF F TF F F F we want to establish h1 ∧ h2 ∧ h3 ⇒ c

F T T FT T T F

FF T TT T T T

There is a possibility of not being poor while having no money!

MSU/CSE 260 Fall 2009 29 MSU/CSE 260 Fall 2009 30

Does ( p → (q → s) ) ∧ (¬ r ∨ p) ∧ q ⇒ (r → s) ? General Proof by Contradiction

1. ¬ r ∨ p Premise „ Proof by contradiction is a general proof 2. r Assumption method (conclusion can be of any form) 3. ¬(¬r ) , 2 „ Method:

4. p Disj. syllogism, 1&3 ‰ To prove that h1 ∧ h2 ∧ … ∧ hn ⇒ c: Assume ¬ c, in addition to the hypotheses, and conclude False. 5. p → (q → s)Premise ‰ When c has the form p → q, we get the “specialized” 6. q → s Modus ponens, 4&5 version presented earlier. 7. q Premise 8. s Modus ponens, 6&7 9. r → s Direct proof, 2&8

MSU/CSE 260 Fall 2009 31 MSU/CSE 260 Fall 2009 32

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- ∧ ∧ ∧ ∧ ⇒ Example: h1 h2 h3 h4 ¬ c F (q ∨ d) ∧ ((q ∨ d ) → ¬ p ) ∧ (¬ p → (a ∧ ¬ b)) ∧ ((a ∧ ¬ b) → (r ∨ s)) ∧ ¬(r ∨ s) ⇒ F General Proof by Contradiction

„ Let 1. q ∨ d Premise h1 =q∨ d 2. (q ∨ d ) → ¬ p Premise ∨ → h2 = (q d ) ¬ p 3. ¬ p 1&2, and modus ponens → ∧ h3 = ¬ p (a ¬ b) 4. ¬ p → (a ∧ ¬ b) Premise h = (a ∧ ¬ b) → (r ∨ s) 4 5. (a ∧ ¬ b)3&4, modus ponens c=r∨ s, 6. (a ∧ ¬ b) → (r ∨ s) Premise Prove by contradiction that 7. r ∨ s 5&6, modus ponens

h1 ∧ h2 ∧ h3 ∧ h4 ⇒ c. 8. ¬(r ∨ s)Contrary Assumption 9. F

MSU/CSE 260 Fall 2009 33 MSU/CSE 260 Fall 2009 34

Rules of Inference for Predicates Other Facts

„ All the Propositional rules. „ ∃x (A(x) → B(x)) ≡ ∀xA(x) → ∃xB(x) „ The Universal Specification (US) rule: „ ∃xA(x) → ∀xB(x) ≡ ∀x (A(x) → B(x)) ∀xP(x) ⇒ P(y) for any y in the domain. The rule is also know as Instantiation rule „ ∃x (A(x) ∨ B(x)) ≡ ∃xA(x) ∨∃xB(x) „ The Existential Specification (ES) „ ∀x (A(x) ∧ B(x)) ≡ ∀xA(x) ∧∀xB(x) ∃xP(x) ⇒ P(y) for some y in the domain. „ The Existential Generalization (EG) P(y) ⇒∃xP(x)

MSU/CSE 260 Fall 2009 35 MSU/CSE 260 Fall 2009 36

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Prove that ∀x (H(x) → M(x)) ∧ H(s) M(s) Prove that ∀x (H(x) → M(x)) ∧ H(s) M(s)

„ This is the famous Socrates’s argument 1. ∀ → All men are mortal x (H(x) M(x)) Premise Socrates is a man 2. H(s) → M(s) 1, Universal Specification Therefore, Socrates is a mortal 3. H(s) Premise ‰ Let H(x) be “x is a man”, 4. M(s) 2&3 and MP ‰ Let M(x) be “x is a mortal” and ‰ Let s be “Socrates”.

MSU/CSE 260 Fall 2009 37 MSU/CSE 260 Fall 2009 38

Prove that ∀x (H(x) → M(x)) ∧∃xH(x) ⇒∃xM(x) Prove that ∃x (A(x) ∧ B(x)) ⇒∃xA(x) ∧∃xB(x)

1. ∃x (A(x) ∧ B(x)) Premise 1. ∃xH(x) Premise 2. A(y) ∧ B(y) 1, ES, y is fixed now. 2. H(y) Existential Specification, for some y 3. A(y) 2, Simplification 3. ∀x (H(x) → M(x)) Premise 4. B(y) 2, Simplification 4. H(y) → M(y) 3 & Universal Specification 5. ∃xA(x) 3, EG 5. M(y) 2&4, Modus Ponens 6. ∃xB(x) 4, EG 6. ∃xM(x) 5, Existential Generalization 7. ∃xA(x) ∧∃xB(x) 5&6, Conjunction

Question: Is the converse true?

MSU/CSE 260 Fall 2009 39 MSU/CSE 260 Fall 2009 40

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Does ∃xA(x) ∧∃xB(x) ⇒∃x (A(x) ∧ B(x)) ? Prove that ∀x (A(x) ∨ B(x)) ⇒∀xA(x) ∨∃xB(x)

1. ∃xA(x) Premise 1. ¬(∀xA(x) ∨∃xB(x)) Contrary Assumption 2. ¬ ∀xA(x) ∧ ¬ ∃xB(x) 1 & De Morgan’s 2. A(y) 1, ES, where y is fixed 3. ¬ ∀xA(x) 2 3. ∃xB(x) Premise, ES 4. ∃x ¬ A(x) 3 & De Morgan’s 4. B(y) 3, ES, where y is fixed 5. ¬ ∃xB(x) 2 6. ∀x ¬B(x) 5 & De Morgan’s 5. A(y) ∧ B(y) 2 and 4 7. ¬A(y) 4, ES, fixed y 6. ∃x (A(x) ∧ B(x)) 5, EG 8. ¬B(y) 6, US, free to choose y as in 7 9. ¬A(y) ∧ ¬B(y) 7 & 8 This proof is invalid. The “y”in step 2 and 4 10. ¬(A(y) ∨ B(y)) 9, De Morgan’s cannot be assumed to be the same! A new 11. ∀x (A(x) ∨ B(x)) Premise name must be used to denote a (fixed) y’such 12. A(y) ∨ B(y) 11, US, any y, same as in 9 13. Contradiction 10 & 12 that B(y’) in step 4.

MSU/CSE 260 Fall 2009 41 MSU/CSE 260 Fall 2009 42

Proofs, and Proof Methods, Proof Methods Summary & Recap „ Direct „ What is a logical argument? „ Contrapositive ‰ Logical Implication ( ) „ Contradiction „ When is a mathematical argument correct? „ Vacuous ‰ Need rules of inference „ Trivial „ To disprove, just need a “counterexample”

MSU/CSE 260 Fall 2009 43 MSU/CSE 260 Fall 2009 44

© 2006 by A-H. Esfahanian. All Rights Reserved. 1- Applications of Logic

„ Day‐to‐day conversation „ The equivalent Algebra (Boolean) for circuit design „ Program Correctness „ Complexity Theory

MSU/CSE 260 Fall 2009 45

© 2006 by A-H. Esfahanian. All Rights Reserved. 1-