SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
Proofs, Recursion and Analysis of
                       Algorithms



           Mathematical Structures
            for Computer Science
                   Chapter 2	





Copyright © 2006 W.H. Freeman & Co.   MSCS Slides   Proofs, Recursion and Analysis of Algorithms
Proof Techniques
     ●        Informal proof methods :	

               ■    Inductive reasoning	

               ■    Deductive reasoning	

               ■    Proof by exhaustion	

               ■    Direct proof	

               ■    Proof by contraposition	

               ■    Serendipity	

     ●        A few terms to remember:	

               ■    Axioms: Statements that are assumed true.	

                     •  Example: Given two distinct points, there is exactly one line that
                        contains them.	

               ■    Definitions: Used to create new concepts in terms of existing ones.	

               ■    Theorem: A proposition that has been proved to be true.	

                     •  Two special kinds of theorems: Lemma and Corollary.	

                     •  Lemma: A theorem that is usually not too interesting in its own right
                        but is useful in proving another theorem.	

                     •  Corollary: A theorem that follows quickly from another theorem.	


Section 2.1                                         Proof Techniques                            1
Deductive Reasoning: Counter Example
     ●        Inductive Reasoning: Drawing a conclusion from a hypothesis
              based on experience. Hence the more cases you find where P
              follows from Q, the more confident you are about the conjecture
              P → Q.	

     ●        Usually, deductive reasoning is also applied to the same
              conjecture to ensure that it is indeed valid. 	

     ●        Deductive reasoning either looks for a counterexample that
              disproves the conjecture (i.e. a case when P is true but Q is
              false) or a to construct a proof (theorem).	

     ●        Example: Prove that “For every positive integer n, n! ≤ n2.”	

               ■    Start testing some cases say, n = 1, 2, 3 etc.	

               ■    It might seem like it is true for some cases but how far do you test,
                    say n = 4.	

               ■    We get n! = 24 and n2 = 16 which is a counter example for this
                    theorem. Hence,even finding a single case that doesn’t satisfy the
                    condition is enough to disprove the theorem.	



Section 2.1                                      Proof Techniques                           2
Counterexample
     ●        More examples of counterexample:	

              ■    All animals living in the ocean are fish.	

              ■    Every integer less than 10 is bigger than 5.	


     ●        Counter example is not trivial for all cases, so we have
              to use other proof methods.	





Section 2.1                                  Proof Techniques            3
Exhaustive Proof
     ●        If dealing with a finite domain in which the proof is to be shown to be
              valid, then using the exhaustive proof technique, one can go over all
              the possible cases for each member of the finite domain. 	

     ●        Final result of this exercise: you prove or disprove the theorem but you
              could be definitely exhausted.	

     ●        Example: For any positive 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.	


                               n	

   n2	

   10+5n	

       n2 < 10+5n	

                               0	

    0	

     10	

              yes	

                               1	

    1	

     15	

              yes	

                               2	

    4	

     20	

              yes	

                               3	

    9	

     25	

              yes	

                               4	

   16	

     30	

              yes	

                               5	

   25	

     35	

              yes	


Section 2.1                                             Proof Techniques                 4
Example: Exhaustive Proof
     ●        Example 1: If an integer between 1 and 20 is divisible by 6, then
              it is also divisible by 3.	





Section 2.1                                 Proof Techniques                      5
Direct Proof
     ●           Direct Proof:	

     ●           Used when exhaustive proof doesn’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 complete formal proof sequence might look like the following: 	

               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 	



Section 2.1                                           Proof Techniques                                 6
Direct Proof Example (contd.)
     9.       (∃k)(k is an integer Λ y = 2k)     	

       	

          	

            	

4,8,mp 	

     10.      n is an integer and y = 2n         	

       	

          	

            	

9, ei 	

     11.      x = 2m          	

      	

       	

       	

          	

            	

7,sim 	

     12.      y = 2n          	

      	

       	

       	

          	

            	

10, sim 	

     13.      xy = (2m)(2n) 	

        	

       	

       	

11, 12, substitution of equals 	

     14.      xy = 2(2mn) 	

          	

       	

       	

          	

13, multiplication fact 	

     15.      m is an integer          	

       	

       	

          	

            	

7,sim "
     16.      n is an integer 	

      	

       	

       	

          	

10, sim 	

     17.      2mn is an integer        	

       	

       	

          	

15, 16, number fact 	

     18.      xy = 2(2mn) Λ 2mn is an integer 	

          	

          	

            	

14, 17, con 	

     19.      (∃k)(k is an integer Λ xy = 2k)    	

       	

          	

            	

18,eg 	

     20.      (∀x)((∃k)(k is an integer Λ x = 2k) → x is even integer)                 	

number fact
                   	

        	

      	

       	

       	

(definition of even integer) 	

     21.      (∃k)(k an integer Λ xy = 2k) → xy is even integer         	

            	

20, ui 	

     22.      xy is an even integer       	

        	

                	

   	

       	

19, 21, mp



Section 2.1                                                Proof Techniques                                 7
Indirect Proof: 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 of contradiction, one assumes that the hypothesis and
              the negation of the conclusion are true and then to deduce some
              contradiction from these assumptions.	

     ●        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.1                                     Proof Techniques                           8
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 + k - n) = 1, where m + n - k is some integer.	

               ■       This is a contradiction since 1 is not even.	





Section 2.1                                        Proof Techniques                         9
Proof by Contraposition
     ●        Use the variants of P → Q to prove the conjecture. From the
              inference rules of propositional logic, we know a rule called
              contraposition (termed “cont” in short). 	

     ●        It states that (Qʹ′ → Pʹ′) → (P → Q) (a Tautology).	

     ●        Qʹ′ → Pʹ′ is the contrapositive of P → Q. 	

     ●        Hence, proving the contrapositive implies proving the
              conjecture.	


     ●        Example: Prove that if the square of an integer is odd, then the
              integer must be odd	

               ■    Hence, prove n2 odd → n odd	

               ■    To do a proof by contraposition prove n even → n2 even	

               ■    If n is even, then it can be written as 2m where m is an integer, i.e.
                    even/odd.	

               ■    Then, n2 = 4m2 which is always even no matter what m2 is because
                    of the factor 4.	


Section 2.1                                       Proof Techniques                           10
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
                    341 losers at the end, hence 341 matches should have been played
                    to have 341 losers.	





Section 2.1                                     Proof Techniques                       11
Summarizing Proof techniques


              Proof Technique	

 Approach to prove P → Q 	

                Remarks	


              Exhaustive Proof	

      Demonstrate P → Q 	

         May only be used for
                                          for all cases	

           finite number of cases	

                Direct Proof	

        Assume P, deduce Q	

         The standard approach-
                                                                     usually the thing to try	

                  Proof by             Assume Qʹ′, derive Pʹ′	

       Use this Qʹ′ if as a
                 Contraposition	

                                    hypothesis seems to
                                                                     give more ammunition
                                                                          then P would	

                 Proof by            Assume P Λ Qʹ′ , deduce a        Use this when Q says
               Contradiction	

           contradiction	

            something is not true	

                 Serendipity	

          Not really a proof                Fun to know	

                                            technique	





Section 2.1                                       Proof Techniques                                 12
Class Exercise

     1.       Product of any 2 consecutive integers is even.	

     2.       The sum of 3 consecutive integers is even.	

     3.       Product of 3 consecutive integers is even.	

     4.       The square of an odd integer equals 8k+1 for some
              integer k.	

     5.       The sum of two rational numbers is rational.	

     6.       For some positive integer x, x + 1/x ≥ 2.	





Section 2.1                           Proof Techniques            13

Contenu connexe

En vedette

Inference rulesproofmethods
Inference rulesproofmethodsInference rulesproofmethods
Inference rulesproofmethodsRajendran
 
Logical Inference in RTE
Logical Inference in RTELogical Inference in RTE
Logical Inference in RTEKilian Evang
 
Expert system (unit 1 &amp; 2)
Expert system (unit 1 &amp; 2)Expert system (unit 1 &amp; 2)
Expert system (unit 1 &amp; 2)Lakshya Gupta
 
Bca ii dfs u-3 tree and graph
Bca  ii dfs u-3 tree and graphBca  ii dfs u-3 tree and graph
Bca ii dfs u-3 tree and graphRai University
 
Mayo aug1, jsm slides (3)
Mayo aug1, jsm slides (3)Mayo aug1, jsm slides (3)
Mayo aug1, jsm slides (3)jemille6
 
Logical Abduction and an Application on Business Rules Management
Logical Abduction and an Application on Business Rules ManagementLogical Abduction and an Application on Business Rules Management
Logical Abduction and an Application on Business Rules ManagementTobias Trapp
 
Proofs by contraposition
Proofs by contrapositionProofs by contraposition
Proofs by contrapositionAbdur Rehman
 
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node System
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node SystemNUMA-optimized Parallel Breadth-first Search on Multicore Single-node System
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node SystemYuichiro Yasui
 
Valid &amp; invalid arguments
Valid &amp; invalid argumentsValid &amp; invalid arguments
Valid &amp; invalid argumentsAbdur Rehman
 
Legal Reasoning & Problem Solving
Legal Reasoning & Problem SolvingLegal Reasoning & Problem Solving
Legal Reasoning & Problem SolvingAlex Olteanu
 
10a chaptertenpowerpoint new
10a chaptertenpowerpoint new10a chaptertenpowerpoint new
10a chaptertenpowerpoint newsagebennet
 
Expert systems in artificial intelegence
Expert systems in artificial intelegenceExpert systems in artificial intelegence
Expert systems in artificial intelegenceAnna Aquarian
 
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...Andreas Christofi
 

En vedette (20)

Lecture5
Lecture5Lecture5
Lecture5
 
Inference rulesproofmethods
Inference rulesproofmethodsInference rulesproofmethods
Inference rulesproofmethods
 
Logical Inference in RTE
Logical Inference in RTELogical Inference in RTE
Logical Inference in RTE
 
Expert system (unit 1 &amp; 2)
Expert system (unit 1 &amp; 2)Expert system (unit 1 &amp; 2)
Expert system (unit 1 &amp; 2)
 
Bca ii dfs u-3 tree and graph
Bca  ii dfs u-3 tree and graphBca  ii dfs u-3 tree and graph
Bca ii dfs u-3 tree and graph
 
Mayo aug1, jsm slides (3)
Mayo aug1, jsm slides (3)Mayo aug1, jsm slides (3)
Mayo aug1, jsm slides (3)
 
Logical Abduction and an Application on Business Rules Management
Logical Abduction and an Application on Business Rules ManagementLogical Abduction and an Application on Business Rules Management
Logical Abduction and an Application on Business Rules Management
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Proofs by contraposition
Proofs by contrapositionProofs by contraposition
Proofs by contraposition
 
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node System
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node SystemNUMA-optimized Parallel Breadth-first Search on Multicore Single-node System
NUMA-optimized Parallel Breadth-first Search on Multicore Single-node System
 
Ai 2
Ai 2Ai 2
Ai 2
 
Expert System
Expert SystemExpert System
Expert System
 
Expert Systems
Expert SystemsExpert Systems
Expert Systems
 
Valid &amp; invalid arguments
Valid &amp; invalid argumentsValid &amp; invalid arguments
Valid &amp; invalid arguments
 
Kinds of Eductive Inference
Kinds of Eductive InferenceKinds of Eductive Inference
Kinds of Eductive Inference
 
Legal Reasoning & Problem Solving
Legal Reasoning & Problem SolvingLegal Reasoning & Problem Solving
Legal Reasoning & Problem Solving
 
10a chaptertenpowerpoint new
10a chaptertenpowerpoint new10a chaptertenpowerpoint new
10a chaptertenpowerpoint new
 
Expert systems in artificial intelegence
Expert systems in artificial intelegenceExpert systems in artificial intelegence
Expert systems in artificial intelegence
 
Expert Systems
Expert SystemsExpert Systems
Expert Systems
 
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...
Business Vs Creative Thinking, Abductive Reasoning and Design Strategy (Case ...
 

Similaire à CPSC 125 Ch 2 Sec 1

CPSC 125 Ch 2 Sec 2
CPSC 125 Ch 2 Sec 2CPSC 125 Ch 2 Sec 2
CPSC 125 Ch 2 Sec 2David Wood
 
Mcs lecture19.methods ofproof(1)
Mcs lecture19.methods ofproof(1)Mcs lecture19.methods ofproof(1)
Mcs lecture19.methods ofproof(1)kevinwu1994
 
CMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and StrategyCMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and Strategyallyn joy calcaben
 
Chapter 4 dis 2011
Chapter 4 dis 2011Chapter 4 dis 2011
Chapter 4 dis 2011noraidawati
 
Aa - Module 1 Fundamentals_2.pdf
Aa  - Module 1  Fundamentals_2.pdfAa  - Module 1  Fundamentals_2.pdf
Aa - Module 1 Fundamentals_2.pdfAayushSharma261
 
Method of direct proof
Method of direct proofMethod of direct proof
Method of direct proofAbdur Rehman
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsWongyos Keardsri
 
Proving existential statements
Proving existential statementsProving existential statements
Proving existential statementsAbdur Rehman
 
Interactive Proof Systems and An Introduction to PCP
Interactive Proof Systems and An Introduction to PCPInteractive Proof Systems and An Introduction to PCP
Interactive Proof Systems and An Introduction to PCPReza Rahimi
 
mathematicalinductionanddivisibilityrules-160711105713.pdf
mathematicalinductionanddivisibilityrules-160711105713.pdfmathematicalinductionanddivisibilityrules-160711105713.pdf
mathematicalinductionanddivisibilityrules-160711105713.pdfBhanuCharan9
 
Mathematical induction and divisibility rules
Mathematical induction and divisibility rulesMathematical induction and divisibility rules
Mathematical induction and divisibility rulesDawood Faheem Abbasi
 

Similaire à CPSC 125 Ch 2 Sec 1 (20)

CPSC 125 Ch 2 Sec 2
CPSC 125 Ch 2 Sec 2CPSC 125 Ch 2 Sec 2
CPSC 125 Ch 2 Sec 2
 
Mcs lecture19.methods ofproof(1)
Mcs lecture19.methods ofproof(1)Mcs lecture19.methods ofproof(1)
Mcs lecture19.methods ofproof(1)
 
Discrete Math Lecture 03: Methods of Proof
Discrete Math Lecture 03: Methods of ProofDiscrete Math Lecture 03: Methods of Proof
Discrete Math Lecture 03: Methods of Proof
 
CMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and StrategyCMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and Strategy
 
Chapter 4 dis 2011
Chapter 4 dis 2011Chapter 4 dis 2011
Chapter 4 dis 2011
 
Aa - Module 1 Fundamentals_2.pdf
Aa  - Module 1  Fundamentals_2.pdfAa  - Module 1  Fundamentals_2.pdf
Aa - Module 1 Fundamentals_2.pdf
 
Method of direct proof
Method of direct proofMethod of direct proof
Method of direct proof
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
Induction.pdf
Induction.pdfInduction.pdf
Induction.pdf
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and Proofs
 
Proving existential statements
Proving existential statementsProving existential statements
Proving existential statements
 
Interactive Proof Systems and An Introduction to PCP
Interactive Proof Systems and An Introduction to PCPInteractive Proof Systems and An Introduction to PCP
Interactive Proof Systems and An Introduction to PCP
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 
Proof by contradiction
Proof by contradictionProof by contradiction
Proof by contradiction
 
PROOF TECHNIQUES
PROOF TECHNIQUESPROOF TECHNIQUES
PROOF TECHNIQUES
 
2.4 edited1
2.4 edited12.4 edited1
2.4 edited1
 
mathematicalinductionanddivisibilityrules-160711105713.pdf
mathematicalinductionanddivisibilityrules-160711105713.pdfmathematicalinductionanddivisibilityrules-160711105713.pdf
mathematicalinductionanddivisibilityrules-160711105713.pdf
 
Mathematical induction and divisibility rules
Mathematical induction and divisibility rulesMathematical induction and divisibility rules
Mathematical induction and divisibility rules
 
Proof By Contradictions
Proof By ContradictionsProof By Contradictions
Proof By Contradictions
 
Crt
CrtCrt
Crt
 

Plus de David Wood

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainDavid Wood
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?David Wood
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...David Wood
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 KeynoteDavid Wood
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221David Wood
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart CityDavid Wood
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software DevelopmentDavid Wood
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsDavid Wood
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelDavid Wood
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301David Wood
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601David Wood
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors KillDavid Wood
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in AustraliaDavid Wood
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsDavid Wood
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social mediaDavid Wood
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's JourneyDavid Wood
 
Open by Default
Open by DefaultOpen by Default
Open by DefaultDavid Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926David Wood
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 

Plus de David Wood (20)

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchain
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

Dernier

TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 

Dernier (20)

TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 

CPSC 125 Ch 2 Sec 1

  • 1. Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co. MSCS Slides Proofs, Recursion and Analysis of Algorithms
  • 2. Proof Techniques ●  Informal proof methods : ■  Inductive reasoning ■  Deductive reasoning ■  Proof by exhaustion ■  Direct proof ■  Proof by contraposition ■  Serendipity ●  A few terms to remember: ■  Axioms: Statements that are assumed true. •  Example: Given two distinct points, there is exactly one line that contains them. ■  Definitions: Used to create new concepts in terms of existing ones. ■  Theorem: A proposition that has been proved to be true. •  Two special kinds of theorems: Lemma and Corollary. •  Lemma: A theorem that is usually not too interesting in its own right but is useful in proving another theorem. •  Corollary: A theorem that follows quickly from another theorem. Section 2.1 Proof Techniques 1
  • 3. Deductive Reasoning: Counter Example ●  Inductive Reasoning: Drawing a conclusion from a hypothesis based on experience. Hence the more cases you find where P follows from Q, the more confident you are about the conjecture P → Q. ●  Usually, deductive reasoning is also applied to the same conjecture to ensure that it is indeed valid. ●  Deductive reasoning either looks for a counterexample that disproves the conjecture (i.e. a case when P is true but Q is false) or a to construct a proof (theorem). ●  Example: Prove that “For every positive integer n, n! ≤ n2.” ■  Start testing some cases say, n = 1, 2, 3 etc. ■  It might seem like it is true for some cases but how far do you test, say n = 4. ■  We get n! = 24 and n2 = 16 which is a counter example for this theorem. Hence,even finding a single case that doesn’t satisfy the condition is enough to disprove the theorem. Section 2.1 Proof Techniques 2
  • 4. Counterexample ●  More examples of counterexample: ■  All animals living in the ocean are fish. ■  Every integer less than 10 is bigger than 5. ●  Counter example is not trivial for all cases, so we have to use other proof methods. Section 2.1 Proof Techniques 3
  • 5. Exhaustive Proof ●  If dealing with a finite domain in which the proof is to be shown to be valid, then using the exhaustive proof technique, one can go over all the possible cases for each member of the finite domain. ●  Final result of this exercise: you prove or disprove the theorem but you could be definitely exhausted. ●  Example: For any positive 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. n n2 10+5n n2 < 10+5n 0 0 10 yes 1 1 15 yes 2 4 20 yes 3 9 25 yes 4 16 30 yes 5 25 35 yes Section 2.1 Proof Techniques 4
  • 6. Example: Exhaustive Proof ●  Example 1: If an integer between 1 and 20 is divisible by 6, then it is also divisible by 3. Section 2.1 Proof Techniques 5
  • 7. Direct Proof ●  Direct Proof: ●  Used when exhaustive proof doesn’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 complete formal proof sequence might look like the following: 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 Section 2.1 Proof Techniques 6
  • 8. Direct Proof Example (contd.) 9.  (∃k)(k is an integer Λ y = 2k) 4,8,mp 10.  n is an integer and y = 2n 9, ei 11.  x = 2m 7,sim 12.  y = 2n 10, sim 13.  xy = (2m)(2n) 11, 12, substitution of equals 14.  xy = 2(2mn) 13, multiplication fact 15.  m is an integer 7,sim " 16.  n is an integer 10, sim 17.  2mn is an integer 15, 16, number fact 18.  xy = 2(2mn) Λ 2mn is an integer 14, 17, con 19.  (∃k)(k is an integer Λ xy = 2k) 18,eg 20.  (∀x)((∃k)(k is an integer Λ x = 2k) → x is even integer) number fact (definition of even integer) 21.  (∃k)(k an integer Λ xy = 2k) → xy is even integer 20, ui 22.  xy is an even integer 19, 21, mp Section 2.1 Proof Techniques 7
  • 9. Indirect Proof: 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 of contradiction, one assumes that the hypothesis and the negation of the conclusion are true and then to deduce some contradiction from these assumptions. ●  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.1 Proof Techniques 8
  • 10. 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 + k - n) = 1, where m + n - k is some integer. ■  This is a contradiction since 1 is not even. Section 2.1 Proof Techniques 9
  • 11. Proof by Contraposition ●  Use the variants of P → Q to prove the conjecture. From the inference rules of propositional logic, we know a rule called contraposition (termed “cont” in short). ●  It states that (Qʹ′ → Pʹ′) → (P → Q) (a Tautology). ●  Qʹ′ → Pʹ′ is the contrapositive of P → Q. ●  Hence, proving the contrapositive implies proving the conjecture. ●  Example: Prove that if the square of an integer is odd, then the integer must be odd ■  Hence, prove n2 odd → n odd ■  To do a proof by contraposition prove n even → n2 even ■  If n is even, then it can be written as 2m where m is an integer, i.e. even/odd. ■  Then, n2 = 4m2 which is always even no matter what m2 is because of the factor 4. Section 2.1 Proof Techniques 10
  • 12. 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 341 losers at the end, hence 341 matches should have been played to have 341 losers. Section 2.1 Proof Techniques 11
  • 13. Summarizing Proof techniques Proof Technique Approach to prove P → Q Remarks Exhaustive Proof Demonstrate P → Q May only be used for for all cases finite number of cases Direct Proof Assume P, deduce Q The standard approach- usually the thing to try Proof by Assume Qʹ′, derive Pʹ′ Use this Qʹ′ if as a Contraposition hypothesis seems to give more ammunition then P would Proof by Assume P Λ Qʹ′ , deduce a Use this when Q says Contradiction contradiction something is not true Serendipity Not really a proof Fun to know technique Section 2.1 Proof Techniques 12
  • 14. Class Exercise 1.  Product of any 2 consecutive integers is even. 2.  The sum of 3 consecutive integers is even. 3.  Product of 3 consecutive integers is even. 4.  The square of an odd integer equals 8k+1 for some integer k. 5.  The sum of two rational numbers is rational. 6.  For some positive integer x, x + 1/x ≥ 2. Section 2.1 Proof Techniques 13