Discrete Mathematics Logics and Proofs Liangfeng Zhang School of Information Science and Technology ShanghaiTech University
Resolution Theorem: p q p r (q r) p q p r q r p q r p q p p r q r T T T T F T T T T T T F T F F F T T T F T T F T T T T T F F T F F F T T F T T T T T T T T F T F T T T T T T F F T T T T T T T F F F T T T T F T
Resolution 123 is either irrational or rational 123 is not irrational or even 123 is either rational or even. p: 123 is irrational q: 123 is rational r: 123 is even (p q) ( p r) q r 123 is either rational or even
Examples It is not sunny this afternoon and it is colder than yesterday, We will go swimming only if it is sunny, If we do not go swimming, then we will take a canoe trip, If we take a canoe trip, then we will be home by sunset Conclusion: We will be home by sunset. p: It is sunny this afternoon q: It is colder than yesterday r: We will go swimming s: We will take a canoe trip t: We will be home by sunset
Examples Premises: p q; r p; r s; s t Conclusion: t p q premise p simplification r p premise r modus tollens r s premise s modus ponens s t premise t modus ponens
Examples If you send me an e-mail message, then I will finish writing the program If you do not send me an e-mail message, then I will go to sleep early If I go to sleep early, then I will wake up feeling refreshed If I do not finish writing the program, then I will wake up feeling refreshed. p: You send me an e-mail message q: I will finish writing the program r: I will go to sleep early s: I will wake up feeling refreshed Premises: p q; p r; r s; Conclsion: q s p q + p r q r + q r s
Examples Premises: p q; p r; r s; Conclsion: q s p q premise q premise p modus tollens p r premise r modus ponens r s premise s modus ponens
Rule of Inference Universal instantiation: x P(x) P(c) Every rational number is equal to a/b for some integers a, b 1.23 is a rational number 1.23 is equal to a/b for some integers a, b. R(x): x is rational F(x): x is equal to a/b for some integers a, b. x(r(x) F(x)) Domain=real numbers R 1.23 F(1.23) universal instantiation R(1.23) premise F 1.23 Modus ponens
Rule of Inference Universal generalization: P(c) for an arbitrary c D x P(x) The sum of any two odd integers is even. Domain=integers O x : x is odd E x : x is even x y (O x O y E(x + y)) O x premise x = 2k + 1 for an integer k definition O(y) premise y = 2l + 1 definition x + y = 2(k + l + 1) property of identities E x + y definition x y (O x O y E(x + y)) UG
Existential instantiation: x P(x) P c for some c D Existential generalization: P(c) for some c D x P(x) Rule of Inference
Examples x (P x Q(x)) x (Q x R(x)) x (P x R(x)) x (P x Q(x)) premise P a Q a universal instantiation x (Q x R(x)) premise Q a R(a) universal instantiation P a R(a) hypothetical syllogism x (P x R(x)) universal generalization
Examples x P x x(p x Q x R(x)) x P(x) x y (R x R(y)) x P x x(p x Q x R(x)) premise P(x) premise x(p x Q x R(x)) modus ponens P(a) existential instantiation P a Q a R(a) universal instantiation P a Q(a) addition R(a) modus ponens x R(x) existential generalization y R(y) existential generalization x R x y R(y) conjunction x y (R x R(y))? Easy to prove
Rule of Inference Universal Modus Ponens x(p(x) Q(x)) P(a) Q(a) Universal Modus Tollens x(p(x) Q(x)) Q(a) P(a)
Examples For all positive integers n, if n > 4, then n 2 < 2 n. Show that 100 2 < 2 100 P n : n > 4 Q(n) n 2 < 2 n n(p (n) Q(n)) P(100) Q(100)
Notions Definition: axioms: the statements we assume to be true theorem: a statement that can be shown to be true propositions: less important theorems lemma: a less important theorem used to prove other results corollary: a theorem established directly from a proven theorem proof: a valid argument that establishes the truth of a theorem conjecture: a statement that is proposed to be true partial evidence, heuristic argument, intuition of an expert
Axioms Axiom of Choice: Given a family S of non-empty sets, there is a function f: S S S S such that f S S for every S S Well-Ordering Axiom: Every non-empty subset of {0,1, } has a least element
Theorem Division Algorithm: Let a, b > 0 be integers. Then there exist unique integers q, r [0, b) such that a = bq + r Greatest Common Divisor: Let a, b be integers. Then there exist an integer d > 0 such that d a, d b For every d s. t. d a, d b, it holds that d d
Corollary Number of Residue Classes: Let b > 0 be integers. Then there are b different remainders when integers are divided by b. Uniqueness of Greatest Common Divisor: Any two integers have a unique greatest common divisor.
Lemma Euclid s Lemma: If p ab and p a, then p b. Bézout s Lemma: Let a, b be integers. Then there exist integers s, t such that as + bt = gcd(a, b), the greatest common divisor of a and b.
Conjecture Goldbach's conjecture: Every even integer greater than 2 can be expressed as the sum of two primes. Fermat's Last Theorem: The equation x n + y n = z n has no solutions in positive integers as long as n 3.
Notions How to State Theorems A property holds for all elements in a domain, such as the integers or the real numbers. The statements used in a proof axioms; premises; previously proven theorems How to prove rules of inference definitions of terms conclusions from other assertions
Direct Proofs Strategy (of proving p q) The first step: assume that p is true The final step: q is true Intermediate steps: constructed using rules of inference If n is an odd integer, then n 2 is odd. P n : n is an odd integer Q n : n 2 is odd. n (P n Q(n)) P(n) premise n = 2k + 1 definition n 2 = 2 2k 2 + 2k + 1 property of identity Q(n) definition n (P n Q(n)) universal generalization
Direct Proofs if m and n are perfect squares, then nm is a perfect square P x : x is a perfect square m n (P m P n P(mn)) P m P(n) premise m = k 2 ; n = l 2 definition mn = kl 2 property of identity P(mn) definition m n (P m P n P(mn)) universal generalization
Proof by Contraposition Strategy: (of proving p q) p q ( q p) The first step: assume q is true The final step: conclude p is true Intermediate steps: axioms, definitions, proven theorems, rules of inference.
Proof by Contraposition if n is an integer and 3n + 2 is odd, then n is odd P n : 3n + 2 is odd Q n : n is odd n (P n Q(n)) Q(n) premise n = 2k definition 3n + 2 = 6k + 2 property of identity P(n) definition n ( Q n P(n)) universal generalization n (P n Q(n)) contraposition
Proof by Contraposition if n = ab, where a, b Z +, then a n or b n. P a, b, n : n = ab Q a, n : a n n a b (P a, b, n Q a, n Q(b, n)) Q a, n Q(b, n) a > n b > n ab > n P(a, b, n) n a b ( Q a, n Q b, n P a, b, n ) n a b (P a, b, n Q a, n Q(b, n))
Vacuous and Trivial Proof Vacuous Proof (of p q): Show that p is false P(n): If n > 1, then n 2 > n. Show that P(0) is true. p: 0 > 1 ; q: 0 2 > 0 Trivial Proof (of p q): Show that q is true without using p. P(n): If a, b and a b, then a n b n, Domain= N Show that P(0) is true. P 0 : If a, b and a b, then a 0 b 0
Proofs by Contradiction Proofs by Contradiction (of p) Show that p (r r) is true for some proposition r. p: 2 is irrational -- What is r? p 2 = a for two integers a, b s.t. gcd a, b = 1 b 2 = a2 b 2 a 2 = 2b 2 2 a a = 2k 4k 2 = 2b 2 2k 2 = b 2 2 b 2 gcd(a, b)
Proofs by Contradiction Proof by Contradiction (of p q): The first step: assume that q is true. The final step: a contradiction like r r The intermediate steps: based on premises and q. The proof by contraposition is also by contradiction. If 3n + 2 is odd, then n is odd. p: 3n + 2 is odd q: n is odd p q n = 2k 3n + 2 = 6k + 2 p
Proof of Equivalence Proof of Equivalence (p q) Show that p q and q p are both true. Prove Many Equivalences (p 1 p 2 p n ): Prove that p 1 p 2, p 2 p 3,, p n 1 p n, p n p 1 Show that p 1 p 2 p 3, where p 1 : n is even p 2 : n 1 is odd p 3 : n 2 is even
Proof of Equivalence p 1 p 2 p 1 n = 2k n 1 = 2k 1 p 2 p 2 p 3 p 2 n 1 = 2k 1 n = 2k n 2 = 4k 2 p 3 p 1 p 3 n 2 = 2k 2 n n = 2l p 1 p 3