930 likes | 1.37k Views
formal logic mathematical preliminaries. Chapter 3. Mathematical Reasoning. Transparency No. 3- 1. Contents. 1.5 and 3.1 Proofs ad proof methods 3.2 Mathematical Inductions 3.3 Recursive defined sets Recursive definitions Structural Induction 3.4 Recursive algorithms
E N D
formal logic mathematical preliminaries Chapter 3 Mathematical Reasoning Transparency No. 3-1
Contents 1.5 and 3.1 Proofs ad proof methods 3.2 Mathematical Inductions 3.3 Recursive defined sets Recursive definitions Structural Induction 3.4 Recursive algorithms 3.5 Program correctness
Proofs and proof methods • Nature and importance of proofs • Applications of proofs • Proof terminology • Inference rules • Some inference rules • Soundness of inference rules • Formal proofs • Formal proof examples • Inference rules for quantifiers • common fallacies • proof methods
Nature & Importance of Proofs • 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. • Why must the argument be correct & complete? • Correctnessprevents us from fooling ourselves. • Completenessallows anyone to verify the result. • [Discrete] Mathematics requires a very high standard for correctness and completeness of proofs.
Overview of §§1.5 & 3.1 • Methods of mathematical argument (i.e., proof methods) can be formalized in terms of rules of logical inference. • Mathematical proofs can themselves be represented formally as discrete structures. • Review both correct & fallacious inference rules, & several proof methods.
Applications of Proofs • Clear communication of logical arguments in any area of study. • Discovery and elucidation, through proofs, of interesting new mathematical theorems. • Theorem-proving has applications in program verification, computer security, automated reasoning systems, etc. • Proving a theorem allows us to rely upon on its correctness even in the most critical scenarios.
Proof Terminology • 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.
More Proof Terminology • 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.
… A proof The Axiomsof the Theory Various Theorems Graphical Visualization inference rule A Particular Theory
Inference Rules - General Form • Inference Rule– • Pattern establishing that if we know that a set of antecedent statements of certain forms are all true, then a certain related consequent statement is true. • antecedent 1 antecedent 2 … consequent“” means “therefore”
Inference Rules & Implications • Each logical inference rule corresponds to an implication that is a tautology. • antecedent 1 Inference rule antecedent 2 … consequent • Corresponding tautology: ((ante. 1) (ante. 2) …) consequent
Some Inference Rules • p Rule of Addition pq • pq Rule of Simplification p • p Rule of Conjunctionq pq
Modus Ponens & Tollens • p Rule of modus ponenspq(a.k.a. law of detachment)q • q pqRule of modus tollensp “the mode of affirming” “the mode of denying”
Syllogism Inference Rules • pq Rule of hypotheticalqr syllogismpr • p q Rule of disjunctive p syllogism q Aristotle(ca. 384-322 B.C.)
Formal Proofs • A formal proof of a conclusion C, given premises p1, p2,…,pnconsists of a sequence of steps, each of which applies some inference rule to premises or to previously-proven statements (as antecedents) to yield a new true statement (the consequent). • A proof demonstrates that if the premises are true, then the conclusion is true.
Formal Proof Example • 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 dance.”“If we dance, then we will be home early.” • Given these premises, prove the theorem“We will be home early” using inference rules.
Proof Example cont. • Let us adopt the following abbreviations: • sunny = “It is sunny”; cold = “It is cold”; swim = “We will swim”; dance= “We will dance”; early = “We will be home early”. • Then, the premises can be written as:(1) sunny cold (2) swim sunny(3) swim dance (4) dance early
Proof Example cont. StepProved by1. sunny cold Premise #1.2. sunny Simplification of 1.3. swimsunny Premise #2.4. swim Modus tollens on 2,3.5. swimdance Premise #3.6. dance Modus ponens on 4,5.7. danceearly Premise #4.8. early Modus ponens on 6,7.
What is a proof • what is a proof ? • ==> a sequence of formulas (I.e., statements or logical expressions) • A1, • ... • An [=A] generated according to some ( valid inference) rules
Inference rules • An inference rule is a pattern of formulas of the form: • P1,P2,...,Pm (m ³ 0) • ------------------------------ rule-name • C • Meaning that if P1,..,Pm have been produced (proved, generated, etc) before then we can add C to the proof sequence (now). • P1,..,Pm : premises of the rule; • C: Conclusion of the rule.
Formal definition of proofs • Ax: a set of axioms ; R: a set of inference rules • Let Th = Ax U R ; • Th is called an axiom system (or proof system) • A: a formula ; B = {B1,…,Bm } is a set of formulas. • A proof of A (according to axiom system Th) with B as premises is a nonempty sequence of formulas A1,A2,...,An s.t., • 1. An = A. • 2. For each Ai, i = 1,.., n • Either Ai is an axiom (i.e., a member of Ax) or a premise Bj, or • there is an inference rule r: P1,..,Pm / C in R s.t. 1. C = Ai 2. {p1,..,Pm} Í {A1,...,Ai-1}
More about proofs • Notes: • 1. We use B |-Th A (or B1,…,Bm |-Th A) • to mean the existence of a proof of A with B1,…,Bm as premises. (Th can be omitted if there is no worry of confusion) • 2. If {} |-Th A (or simply |-Th A) , we say A is a theorem and each Ai (i <n) is called a lemma. • 3. If B can be inferred from A directly, it is called a corollary of theorem A; both lemmas and corollaries are theorems.
Soundness of inference rules • An inference rule: P1,..,Pm // C is said to be sound(可靠) (or correct[正確], valid[有效]) iff • It is impossible that all premises are true while the conclusion is false. • I.e., If all premise are true then the conclusion must be true. • I.e., (P1/\P2/\…/\Pn ) C is a tautology. • I.e., C is a logical consequence of P1,P2,… and Pm. • I.e., P1,P2,…Pn |= C
Example sound rules • A, A->B -------------- ;Modus Ponens (->e) B • It is impossible that A and A->B are ture while B is false. • [A /\ (A->B)] -> B is a tautology • A/\ B // B ; /\e • It is impossible that A/\B is true while B is false. • A // A \/ B ; \/i • It is impossible that A is true but A\/B is false.
Fallacies • A fallacy is an inference rule which is not sound. (I.e., It is possible that all premises are true but the conclusion is false). Ex: 1. RainWet // ~Rain ~Wet. 2. A->B, ~A // ~B 3. A->B, B // A ; B true, A->B true, A false is possible.
Fact1 : If P1,..,Pm // C is sound, and all premises Pis hold for an interpretation I then so is the conclusion C. pf: By def. of soundness, P1,..,Pm // C implies P1,..,Pm |= C i.e., M M |= P1/\.../\Pm M |= C. Since now I |= P1/\.../\Pm, we have I |= C.
Soundness of a proof system Soundness theorem: If 1. there is a proof of C from a set of premises P= {P1,… Pn } (I.e., P1,…Pn |- C ), and 2. all inference rules used are sound, then the conclusion C must be a consequence of {P1,… Pn}. (i.e., P1,P2,…Pn |= C )
skipped pf: The proof is by ind. on the minimal length k of the proofs D witnessing P1,…Pn |- C. case 1: k = 1: The D = C is either an axioms or some premise Pj and we have P |= C. case 2: k = t + 1> 1: The D = Dt C for some shorter proof Dt. 2.1 If C is either a premise Pj or an axioms, the analysis is the same as case 1. 2.2 If C is obtained via rule Q1,…,Qn // C where assume Q1,…,Qn occurs at the last line of Dj1,…Djn , respectively. • By Ind.hyp., for all Qr , P |= Qr, • ( M M |= P M |= Q1/\…/\Qn and M M |= Q1/\…/\Qn M|= C) • M M |= P M |= C (i.e., P |= C.)
Corollary : If |-Th C, then |= C. I.e., Every theorem is valid). pf: |-Th C means {} |-Th C. Hence {} |= C. But all interpretations are model of {}, C thus is valid.
Example inference rules 1. Modus Ponus(MP) : AB, A // B 2. abduction (ABD) : AB, B // A 3. denying premise : AB, ~A // ~B 4. Math. ind.: (let P be any formula ) P(0) "x P(x) P(x +1) -------------------------- " x P(x) Notes: 1. rule 1 is correct. 2. rule 2,3 are in general not correct. 3. Rule 4 is correct for natural number(NT) theory, but not correct for integer theory(ZT) and real number theory(RT).
Some commonly used fallacies • Affirming the conclusion [abduction]: • From p->q, q infer p • Ex: Do all exercises => learn discrete math. Since have learned D.M., hence have done all exercises. • note: p is a possible reason (explanation) of q, instead of a (necessary) consequence of q. • Denying the hypothesis: • from ~p and p->q infer ~q. • Ex: rain => wet, since not rain, hence not wet. • Circular reasoning • Assume n2 is even. • n2 = 2k for some k. • Hence n2 is even Assume A … B -------------- I AB
Inference Rules for Quantifiers • xP(x) universal instantiation (e) P(t) (substitute any term t for x in P(-)) • Ex: from x x2 > 0 infer (y+2)2 > 0. • P(t)existential generalization (I) xP(x) (substitute a new var x for term t in P(-) ) • ex: from (y + 2 )2 > (y+2) • infer x x2 > (y+2) or x x2 > x. • Note: Term t is either a constant or a variable or function expression f(t1,…,tn)
Topic #3 – Predicate Logic Example • Definitions: s :≡Socrates (ancient Greek philosopher);H(x) :≡ “x is human”;M(x) :≡ “x is mortal”. • Premises:H(s) Socrates is human. xH(x)M(x) All humans are mortal. • Conclusion: M(s) Socrates is mortal.
Topic #3 – Predicate Logic The proof Some valid conclusions you can draw: H(s)M(s)[Instantiate universal.]If Socrates is human then he is mortal. H(s) M(s) Socrates is inhuman or mortal. H(s) (H(s) M(s)) Socrates is human, and also either inhuman or mortal. (H(s) H(s)) (H(s) M(s)) [Apply distributive law.] F (H(s) M(s)) [Trivial contradiction.] H(s) M(s) [Use identity law.] M(s) Socrates is mortal.
Topic #3 – Predicate Logic Another Example [skipped] • Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god” • Premises: • xH(x) M(x) (“Humans are mortal”) and • xG(x) M(x) (“Gods are immortal”). • Show that x (H(x) G(x)) (“No human is a god.”)
Topic #3 – Predicate Logic The Derivation[skipped] • xH(x)M(x) and xG(x)M(x). • xM(x)H(x)[Contrapositive.] • x [G(x)M(x)] [M(x)H(x)] • xG(x)H(x) [Transitivity of .] • x G(x) H(x) [Definition of .] • x (G(x) H(x)) [DeMorgan’s law.] • xG(x) H(x) [An equivalence law.] Rules used: where Q is either or , • QX A, A B // QX B. • QX ~A , // ~QX A. • X A, X B // X (A/\B).
More Inference Rules for Quantifiers • universal generalization(I) • P(g) • xP(x) • Existential instantiation (e) • xP(x)P(c) (substitute a new (Skolem) constantc ) • c is an object restricted to property P) (where g is a general (or universal) element of u.d. I.e., g cannot be restricted to any property except being an element of u.d.)
Example1 (universal genealization (I ) • The square of all odd numbers are odd. • x Odd(x) Odd(x2) pf: Let g be any number. // note: cannot assume additional property for g except for its being an integer; g is a universal constants. [Assume g is odd, then, g = 2k + 1 for some k, g2 = 4kk + 4k + 1 = 2(2kk + 2k) + 1, g2 is odd. ]// [ … ] is a subproof for => Odd(g) Odd(g2). => x Odd(x) Odd(x2).
Example2 • xy x < y. // no largest number pf: Let a be any number. =>a < a + 1 ( number property; true of all numbers) (but not a2 < a + 10 ; not a universal number prop ) => y a < y (I) => xy x < y (I) • xy x y //least number pf: Let a be any natural number. => 0 a ( property of natural numbers) => y 0 y (I) => xy x y (e)
a fallacy • Prove that xP(x) |- xP(x) • What’s wrong with the proof: ? • 1. xP(x) --- premise • 2. P(c) --- e, where c is a restricted object. • 3. xP(x) --- I (x) why? • Ans: c is not a general element! It requires to satisfy property P and thus is not a general element.
Techniques for proving implication theorems : pq • Different ways of proving a theorem: p implies q. • Vacuous proof: Prove that ~p. used rule : [ ~p //p->q ] • Trivial proof: Prove that q. [q // p->q ] • Direct proof: Prove that if p then q. [p |- q implies |-p->q] • suppose p, • ..., • conclude q • --------------------- (I) • hence pq • Indirect proof: (proof by contraposition) • Prove that "~q implies ~P" [~q->~p // p->q]
Proof by contradiction and proof by cases • Proof by contradiction: • To prove P, it suffices to show that • ~P -> F (false) • rules used: [~p ->F // p] • Proof by cases: • To prove that "p \/ q implies r " it suffices to show that • p->r and q -> r. • rules used: [p->r, q->r // (p\/ q) ->r.]
Direct Proof Example • Definition: An integer n is called odd iff n=2k+1 for some integer k; n is even iff n=2k for some k. • Axiom: Every integer is either odd or even. • Theorem: (For all numbers n) If n is an odd integer, then n2 is an odd integer. Proof: Let n be any integer. [Assume n is odd, then n = 2k+1 for some integer k. Thus, n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1. Therefore n2 is of the form 2j + 1 (with j the integer 2k2 + 2k), thus n2 is odd. ]
Indirect Proof Example • Theorem: (For all integers n) If 3n+2 is odd, then n is odd. • Proof: Suppose that the conclusion is false, i.e., that n is even. Then n=2k for some integer k. Then 3n+2 = 3(2k)+2 = 6k+2 = 2(3k+1). Thus 3n+2 is even, because it equals 2j for integer j = 3k+1. So 3n+2 is not odd. We have shown that ¬(n is odd)→¬(3n+2 is odd), thus its contra-positive (3n+2 is odd) → (n is odd) is also true. □
Vacuous Proof Example • Theorem: (For all n) If n is both odd and even, then n2 = n + n. • Proof: The statement “n is both odd and even” is necessarily false, since no number can be both odd and even. So, the theorem is vacuously true. □ lemma : n could not be both even and odd. pf: Suppose n is both odd and even, then n = 2k = 2m + 1 for some integer m and k. Then 2(k-m) = 1. Then k != m and hence 2 | 1. But this is impossible.
Trivial Proof Example • Theorem: (For integers n) If n is the sum of two prime numbers, then either n is odd or n is even. • Proof:Any integer n is either odd or even. So the conclusion of the implication is true regardless of the truth of the antecedent. Thus the implication is true trivially. □
Proving existence theorem Methods for proving $x p(x): • Constructive proof: find an object (or term) a, s.t. P(a). • rules used : [p(a) // $x p(x) ] • Nonconstructive proof: a proof of $x P(x) w/o knowing what object satisfies p. • ex:proof by contradiction: Show that ~$x p(x) ->F.
Example of existence proofs Ex 20: [constructive proof] Show that there are n consecutive composite integers for every integer n >0. (I.e. for all n $x (x+1,x+2,...x+n) are all composites. Sol: Let x = (n+1)! +1. => x+i = (n+1)! + (i+1) = (i+1)( (n+1)!/(i+1) +1) is composite for i = 1,..,n. QED. Ex 21: [nonconstructive proof] For all n >0 $ prime number > n. Sol: by contradiction. Assume $n s.t. all prime number < n. Let m = n! +1. ==> gcd(k, m) = 1 for all k ≤ n. => all primes cannot divide m => m is a prime > n => a contradiction. QED. Note: We cannot know a prime > n from the proof.