Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,

Slides:



Advertisements
Similar presentations
With examples from Number Theory
Advertisements

Discrete Math Methods of proof 1.
Introduction to Proofs
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Elementary Number Theory and Methods of Proof
Copyright © Cengage Learning. All rights reserved.
Induction and recursion
Logic and Proof. Argument An argument is a sequence of statements. All statements but the first one are called assumptions or hypothesis. The final statement.
CSE115/ENGR160 Discrete Mathematics 02/07/12
CSE115/ENGR160 Discrete Mathematics 01/31/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/01/11
Logic: Connectives AND OR NOT P Q (P ^ Q) T F P Q (P v Q) T F P ~P T F
So far we have learned about:
Copyright © Zeph Grunschlag,
First Order Logic (chapter 2 of the book) Lecture 3: Sep 14.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Introduction to Proofs ch. 1.6, pg. 87,93 Muhammad Arief download dari
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
C OURSE : D ISCRETE STRUCTURE CODE : ICS 252 Lecturer: Shamiel Hashim 1 lecturer:Shamiel Hashim second semester Prepared by: amani Omer.
Methods of Proof & Proof Strategies
Introduction to Proofs
MATH 224 – Discrete Mathematics
1 Methods of Proof CS/APMA 202 Epp, chapter 3 Aaron Bloomfield.
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
Review I Rosen , 3.1 Know your definitions!
Methods of Proofs PREDICATE LOGIC The “Quantifiers” and are known as predicate quantifiers. " means for all and means there exists. Example 1: If we.
1 Methods of Proof. 2 Consider (p  (p→q)) → q pqp→q p  (p→q)) (p  (p→q)) → q TTTTT TFFFT FTTFT FFTFT.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
Chapter 1 Logic Section 1-1 Statements Open your book to page 1 and read the section titled “To the Student” Now turn to page 3 where we will read the.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Chapter 5 Existence and Proof by contradiction
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Copyright © Cengage Learning. All rights reserved. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS THE LOGIC OF QUANTIFIED STATEMENTS.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
Proofs, Induction and Recursion Basic Proof Techniques Mathematical Induction Recursive Functions and Recurrence Relations.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
CS104:Discrete Structures Chapter 2: Proof Techniques.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
Introduction to Proofs
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Section 1.7. Definitions A theorem is a statement that can be shown to be true using: definitions other theorems axioms (statements which are given as.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
1 Introduction to Abstract Mathematics Proof Methods , , ~, ,  Instructor: Hayk Melikya Purpose of Section:Most theorems in mathematics.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Chapter 1 Logic and proofs
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Proof And Strategies Chapter 2. Lecturer: Amani Mahajoub Omer Department of Computer Science and Software Engineering Discrete Structures Definition Discrete.
Proof Techniques CS160/CS122 Rosen: 1.5, 1.6, 1.7.
Lecture 2: Proofs and Recursion. Lecture 2-1: Proof Techniques Proof methods : –Inductive reasoning Lecture 2-2 –Deductive reasoning Using counterexample.
Chapter 1 Logic and Proof.
Chapter 1 Logic and Proof.
The Foundations: Logic and Proofs
Methods of Proof CS 202 Epp, chapter 3.
Induction and recursion
The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
Induction and recursion
CS 220: Discrete Structures and their Applications
First Order Logic Rosen Lecture 3: Sept 11, 12.
Section 2.1 Proof Techniques Introduce proof techniques:   o        Exhaustive Proof: to prove all possible cases, Only if it is about a.
Copyright © Cengage Learning. All rights reserved.
Introduction to Proofs
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Presentation transcript:

Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs, Recursion and Analysis of Algorithms

Section 2.1Proof Techniques1 Section 2.1: Proof Techniques Chapter 1: formal proofs The problem: show the validity of theorems represented in the form P  Q, where P and Q may be compound statements. Validity proof: Given a set of hypotheses (the antecedent of the implication) and using equivalence rules and rules of inference from predicate logic, show that Q follows logically from P. Validity of the implication is based on its structure so if a proof is valid it is universally valid, regardless of the semantics of the individual components of the antecedent and the consequent. For example, it was shown that if (P  Q)  (Q  R), then (P  R) This is valid regardless of what P, Q, and R represent. (Remember, we say if the antecedent is true then the consequent is true.)

Section 2.1Proof Techniques2 Section 2.1: Proof Techniques In Chapter 2, we deal with proofs for things that aren’t universally true but only apply within a certain context – graph theory, number theory, the animal kingdom, etc. To prove theorems of this sort we can add facts from the context that act as hypotheses. For example, if the context is number theory, and we are asked to prove that the product of two even integers is also even, we can use knowledge about number theory. In particular, we could use the fact that an even integer is divisible by 2, or that an even integer m can be rewritten as 2k for some integer k. In this example, P(x, y) : x is an even integer  y is an even integer Q(x, y): xy is an even integer It can be proven that P(x,y)  Q(x, y), but this is true only for the domain of integers. Proofs of this sort are often presented in a more informal manner, and don’t rely solely on rules of inference and equivalences.

Section 2.1Proof Techniques3 A few terms to remember: Axioms: Statements that are assumed true. Example: Given two distinct points, there is exactly one line that contains them. Axioms can be used as hypotheses in proofs Definitions: Used to create new concepts in terms of existing ones. Theorem: A proposition that has been proven to be true. Conjecture: an opinion based on incomplete information. In order to turn a conjecture into a theorem, we must find a way to prove it. Or, by disproving it, show that no proof exists Definitions and axioms can be used in the proof process..

Section 2.1Proof Techniques4 Inductive reasoning versus deductive reasoning Inductive reasoning is drawing conclusions based on experience A way of developing conjectures Not a proof Deductive reasoning: determines the truth or falsity of a conjecture through proofs or counter examples Informal proof methods : Proof by exhaustive enumeration Direct proof Proof by contraposition Proof by contradiction Serendipity (not really a proof technique)

Section 2.1Proof Techniques5 Deductive Reasoning: Using Counterexamples Inductive reasoning: Drawing a conclusion from a hypothesis based on experience. Usually, deductive reasoning is also applied to the same conjecture to ensure that it is indeed correct. Deductive reasoning may start by looking for a counterexample that disproves the conjecture, i.e. a case when P is true but Q is false. Example: Prove that “For every positive integer n, n!  n 2.” Start testing some cases say, n = 1, 2, 3 etc. This is true for some cases but now let n = 4. We get n! = 24 and n 2 = 16; a counterexample for this conjecture. Note that finding a single case that doesn’t satisfy the condition is enough to disprove the theorem, because formally our conjecture states  (x) P(x)  Q(x) On the other hand, finding a single example where the conjecture is true (or even many examples) is not enough to prove it is true.

Section 2.1Proof Techniques6 Counterexample Practice: Find a counterexample for each of the following conjectures: All animals living in the ocean are fish. Everyone in this class is a computer engineer. Disproof by counterexample: relatively common Proof by example: not so much. Works only if you are able to consider every case that the conjecture applies to. This leads to the following definition: Exhaustive enumeration (proof by exhaustion) is a proof technique that can be applied to conjectures that are applied to a finite set of objects.

Section 2.1Proof Techniques7 Exhaustive Proof In a finite domain in which the conjecture is to be proven valid, then to use the exhaustive proof technique, you must try all possible cases for each member of the domain. Final result of this exercise: you prove or disprove the theorem but you could be definitely exhausted. Example: For any non-negative integer less than or equal to 5, the square of the integer is less than or equal to the sum of 10 plus 5 times the integer. nn2n2 10+5nn 2 < 10+5n 0010yes 1115yes 2420yes 3925yes 41630yes 52535yes

Section 2.1Proof Techniques8 Example: Exhaustive Proof Example : If an integer between 1 and 20 is divisible by 6, then it is also divisible by 3. See the proof in Table 2.1, page 91 Example: Prove the conjecture “It is not possible to trace all the lines in Figure 2.1 without lifting your pencil and without retracing any lines” Tedious, but possible, to enumerate and try all possible cases The number of theorems that are proven using proof by exhaustion is relatively small.

Section 2.1Proof Techniques9 Direct Proof Proof methods: Proof by exhaustive enumeration Direct proof Proof by contraposition Proof by contradiction Serendipity (not really a proof technique) and disproof by counterexample Direct Proof: Used when exhaustive proof/disproof by counterexample don’t work. Using the rules of propositional and predicate logic, prove P  Q. Hence, assume the hypothesis P and prove Q. Hence, a formal proof would consist of a proof sequence to go from P to Q. Consider the conjecture x is an even integer Λ y is an even integer  the product xy is an even integer. A formal direct proof would start by listing the hypotheses and then applying inference rules and equivalence rules to (hopefully) produce the desired result.

Section 2.1Proof Techniques10 Direct Proof For example (see pages for complete proof sequence) 1. x is an even integer Λ y is an even integer hyp 2. (  x)[x is even integer  (  k)(k is an integer Λ x = 2k)] number fact (definition of even integer) 3. x is even integer  (  k)(k is an integer Λ x = 2k) 2,ui 4. y is even integer  (  k)(k is an integer Λ y = 2k) 2,ui 5. x is an even integer 1,sim 6. (  k)(k is an integer Λ x = 2k) 3,5,mp 7. m is an integer Λ x = 2m 6, ei 8. y is an even integer 1,sim …. xy is an even integer 19, 21, mp Note That in step 2, a fact has been introduced that is unique to the domain of integers. The use of new inference rules: ui = universal instantiation, and ei = existential instantiation

Section 2.1Proof Techniques11 Informal Direct Proof Informal direct proofs simplify the process of writing out a proof but they do not skip any essential steps – they are just as complete in terms of rigor and correctness. Example: a theorem might be stated as P(x)  Q(x). If the proof is made for an arbitrary element of the domain, we can safely generalize to the more formal statement  (x) P(x)  Q(x). Informal proof that the product of two even integers, x & y, is also even: (page 93) Let x = 2m and y = 2n, where m & n are integers Then xy = (2m)(2n) = 2(2mn). Thus the product xy has the form 2k, where k is an integer. The proof doesn’t explicitly state the hypothesis, (that x and y are even) or the definition of even integer, which is used in the first step. Nevertheless it is clear about each step and doesn’t leave out any important information. There are times, even in an informal proof, when it is useful to explain the reason for a step in the proof. It’s better to be too complete than to leave out something significant.

Section 2.1Proof Techniques12 Proof by Contraposition Sometimes you aren’t successful generating a direct proof of P  Q. In this case, consider using one of the inference rules of propositional logic, known as contraposition (termed “cont” in short). See Table 1.14 (page 133). It states that (Q  P)  (P  Q) (a Tautology). Remember that a tautology is a wff that is true in every case, regardless of the truth values assigned to the individual components. Q  P is the contrapositive of P  Q. Hence, proving the contrapositive proves the conjecture.

Proof by Contraposition Example: Prove that if the square of an integer is odd, then the integer must be odd Hence, prove n 2 odd  n odd To do a proof by contraposition prove n even  n 2 even If n is even, then it can be written as 2m where m is an integer, i.e. even/odd. Then, n 2 = 4m 2 which is always even no matter what m 2 is because of the factor 4. We’ve proved that if the square of an integer is even, then the integer is even. Since this is the contrapositive of what we set out to prove, we have also proven our original conjecture. Section 2.1Proof Techniques13

If and Only If Theorems A theorem that states “Q is true if and only if P is true” means that you must prove both P → Q and Q → P Q → P is the converse of P → Q Example 9 (p. 94): xy is odd if and only if both x and y are odd integers. Assume both are odd. Then x = 2n +1, y = 2m +1 xy = (2n + 1)(2m +1) = 2(wnm + m + n) + 1 or 2k +1 We’ve proven the “if” part – now the “only if”. i.e., if xy is odd then both x and y are odd – or, easier, prove the contrapositive: (x odd and y odd) → (xy even) Use DeMorgan’s law, rewrite as x even or y even → xy even There are then three cases, based on the possible values of x and y Section 2.1Proof Techniques14

Section 2.1Proof Techniques15 Proof by Contradiction Derived from the definition of contradiction which says P Λ Q  0 Hence, (P Λ Q  0)  (P  Q) is a tautology. In a proof by contradiction, one assumes that the hypothesis is true, the negation of the conclusion is true, and that these assumptions lead to a contradiction. Example 1: Prove that “If a number added to itself gives itself, then the number is 0.” The hypothesis (P) is x + x = x and the conclusion (Q) is x = 0. Hence, the hypotheses for the proof by contradiction are: x + x = x and x  0 (the negation of the conclusion) Then 2x = x and x  0, hence dividing both sides by x, the result is 2 = 1, which is a contradiction. Hence, (x + x = x)  (x = 0).

Section 2.1Proof Techniques16 Proof by Contradiction Example 2: Prove “For all real numbers x and y, if x + y  2, then either x  1 or y  1.” Proof: Say the conclusion is false, i.e. x < 1 and y < 1. (Note: or becomes and in negation.) Adding the two conditions, the result is x + y < 2. At this point, this condition is P if P = x + y  2, hence, P Λ P which is a contradiction. Hence, the statement above is true. Example 3: The sum of even integers is even. Proof: Let x = 2m, y = 2n for integers m and n and assume that x + y is odd. Then x + y = 2m + 2n = 2k + 1 for some integer k. Hence, 2*(m + n - k) = 1, where m + n - k is some integer. This is a contradiction since 1 is not even.

Section 2.1Proof Techniques17 Serendipity Serendipity: Fortuitous happening or something by chance or good luck. Not a formal proof technique. Interesting proofs provided by this method although other methods can be used as well. Example: 342 players in a tennis tournament. One winner in the end. Each match is between two players with exactly one winner and the loser gets eliminated. Prove the total number of matches played in the tournament are 341. Solution: Only one champion at the end of the tournament, hence ???

Section 2.1Proof Techniques18 Summarizing Proof techniques Proof Technique Approach to prove P  Q Remarks Exhaustive Proof Demonstrate P  Q for all cases May only be used for finite number of cases Direct ProofAssume P, deduce QThe standard approach- usually the thing to try Proof by Contraposition Assume Q, derive PUse this Q if as a hypothesis seems to give more ammunition then P would Proof by Contradiction Assume P Λ Q, deduce a contradiction Use this when Q says something is not true SerendipityNot really a proof technique Try thinking outside the box

Section 2.1Proof Techniques19 Class Exercise 1. Product of any 2 consecutive integers is even. 2. Product of 3 consecutive integers is even. 3. The square of an odd integer equals 8k+1 for some integer k. 4. The sum of two rational numbers is rational. 5. For some positive integer x, x + 1/x ≥ 2.