* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Introduction to the Theory of Computation
Survey
Document related concepts
Georg Cantor's first set theory article wikipedia , lookup
Foundations of mathematics wikipedia , lookup
Wiles's proof of Fermat's Last Theorem wikipedia , lookup
Elementary mathematics wikipedia , lookup
List of first-order theories wikipedia , lookup
Non-standard analysis wikipedia , lookup
Fundamental theorem of algebra wikipedia , lookup
Novum Organum wikipedia , lookup
Peano axioms wikipedia , lookup
Brouwer–Hilbert controversy wikipedia , lookup
Transcript
Introduction to the Theory of Computation AZADEH FARZAN WINTER 2010 Monday, January 11, 2010 PROOFS Proof by Contradiction Proof by Construction Jack sees Jill, who has just come in from outdoors Proof by Induction dry. Jack knows that it is not raining. For any n, there exist n consecutive composite integers. His proof: if it were raining (assuming the statement Proof: here Jill are the n be consecutive composite integers is false), woud wet (contradiction, or false for any n: consequence). Therefore, it must not be raining. (n+1)!+2, (n+1)!+3, ..., (n+1)!+n+1 Monday, January 11, 2010 INDUCTION A method used to show that all elements of an infinite set have a specific property. Example: an arithmetic expression computes a desired quantity for every assignment to its variables. Example: program works correctly at all steps or for all input. Every proof induction consists of two parts: The basis. The induction step. Monday, January 11, 2010 IDEA Let’s take the infinite set to be N = {1, 2, 3, . . . }. Let’s call the property P. The goal is to prove that P(k) is true for each natural number k. The basis: P(1) is true. The induction step: if P(i) is true, then P(i + 1) is true as well. P(1) ⇒ P(2) ⇒ P(3) ⇒ . . . P(i) ⇒ . . . Monday, January 11, 2010 Mathematical Induction is a way to show that for eac we could eventually prove that P (n) is true. FORMALLY: MATHEMATICAL INDUCTION PRINCIPLE Definition 44 Principle of Mathematical Induction: Let P () be a predicate defined on N. Then if (1) P (0) 1 is true, and (2) ∀n ∈ N [P (n) → P (n + 1)], ntroduction to the Theory ∀n ∈ N P (n) is true. of Computation then 7.1 Why it works Suppose (1)AZADEH and (2) hold. Then FARZAN Monday, January 11, 2010 WINTER 2010 73 EXAMPLE Prove �n i=1 i = n(n + 1)/2. Proof by induction: The basis (n=1): holds since 1 = 1 ×2/2. �m The induction step: if i=1 i = m(m + 1)/2, then �m+1 i=1 i = (m + 1)(m + 2)/2. m+1 � i = i=1 i + (m + 1) i=1 = = Monday, January 11, 2010 m � m(m + 1)/2 + (m + 1) [m(m + 1) + 2(m + 1)] /2 = (m + 1)(m + 2)/2 LET’S FORMALIZE ! Monday, January 11, 2010 WELL-ORDERING Principle of Well-ordering: Any non-empty subset of N has minimum element. ∀A ⊆ N, s.t. A �= ∅, [∃a ∈ A s.t. (∀b ∈ A, a ≤ b)]. Is the principle true for Z? Is the principle true for rational numbers in (0, 1)? Monday, January 11, 2010 WHAT IS THE RELATION BETWEEN WELL-ORDERING AND INDUCTION? Monday, January 11, 2010 Induction works as a proof method since: Principle of well-ordering implies principle of mathematical induction. proof on the board! Monday, January 11, 2010 SIMPLE INDUCTION Principle of Simple Induction: Let A be a set that satisfies the following properties: (i) 0 is in A; (ii) for any i ∈ N, if i ∈ A, then i + 1 ∈ A. Then N ⊆ A. 0 ∈ A ⇒ 1 ∈ A ⇒ 2 ∈ A ⇒ 3 ∈ A... Monday, January 11, 2010 Problem: prove that every natural number greater than 1 can be written as a product of prime numbers. LET’S LOOK AT A SLIGHTLY DIFFERENT KIND OF INDUCTION. Monday, January 11, 2010 7.3 Strong Mathematical Induction FORMALLY: STRONG INDUCTION PRINCIPLE Definition 46 Strong Mathematical Induction Principle If P (0) and ∀n ≥ 0 [(P (0) ∧ P (1) ∧ . . . ∧ P (n)) → P (n + 1)] then ∀n P (n). Using the above (stronger) principle, to prove P (n + 1) we can rely on inductive hypothesis that all of P (0), P (1), . . . , P (n) are true. The reason this principle works, and the proof that it does (based on wellordering principle) is identical to the weak induction. EXAMPLE ! Given n black points and n white points in the plane, no three WAIT, WHY of them on a line, proveDOES that thereTHIS exists aONE way toWORK? match them one-to-one, such that the line segments between the matched pairs do not intersect. Proof. Base Case. n = 1. Just join them together; there is only one segment so clearly it doesn’t intersect Monday, Januaryany 11, 2010others. COMPLETE INDUCTION Principle of Complete Induction: Let A be a set that satisfies the following properties: (*) for any i ∈ N, if ∀j < i, j ∈ A, then i ∈ A. Then N ⊆ A. , 1∈A ⇒ , 2∈A⇒ , 3 ∈ A ⇒ ... 0∈A ⇒ Monday, January 11, 2010 THREE EQUIVALENT NOTIONS Theorem. The principles of (a) well-ordering, (b) simple induction, and (c) complete induction are equivalent. Monday, January 11, 2010 ALL DEFINITIONS Principle of Well-ordering: Any non-empty subset of N has minimum element. Principle of Simple Induction: Let A be a set that satisfies the following properties: (i) 0 is in A; (ii) for any i ∈ N, if i ∈ A, then i + 1 ∈ A. Then N ⊆ A. Principle of Complete Induction: Let A be a set that satisfies the following properties: (*) for any i ∈ N, if ∀j < i, j ∈ A, then i ∈ A. Then N ⊆ A. Monday, January 11, 2010 EXAMPLE For every natural number n, the power set of a set with n elements has 2n elements. Basis: The power set of ∅ (with 0 elements) has 20 = 1 element (∅ itself). Induction step: if n element sets have 2n subsets, then n + 1 element sets have 2n+1 subsets. Let |X| = n + 1 and x ∈ X and let Y = X − {x}. Then |Y | = n. |X| has two types of subsets: (i) those which contain x, and (ii) those which do not. • Subsets of type (i) are subsets of Y as well, and there are 2n of them by IH. • Subsets of type (ii) are subsets of Y if we remove x from them, and there are 2n of them by IH. Total number of subsets: 2n + 2n = 2n+1 . Monday, January 11, 2010 NON-ZERO BASES For all n ≥ 6, we have 2n > 10n. Basis: n = 6, clearly 26 = 64 > 10.6 = 60. Induction Step: For an arbitrary i ≥ 6, 2i > 10i ⇒ 2i+1 > 10(i + 1). 2 i+1 = 2.2 i > 2.10i = 10i + 10i > 10i + 10 = 10(i + 1) Monday, January 11, 2010 A VARIATION Sometimes it is easier to have an explicit basis for complete induction. Basis: Prove that P(0) is true. Induction Step: Prove that , for each natural number i > 0, if P(j) holds for all natural numbers j < i, then P(i) holds as well. Monday, January 11, 2010 EXAMPLE P(n): If a full binary tree has n nodes, then n is an odd number. Prove P(n) is true for all n ≥ 1. Basis: n = 1. A full binary tree with one node, and one is odd. Induction Hypothesis: Assume we have a binary tree with n > 1 nodes. If T1 is the left subtree and T2 is the right subtree of our full binary tree T , then we have: nodes(T )=nodes(T1 )+nodes(T2 )+1 Monday, January 11, 2010 READING Chapter 0: to remind yourself of the basic notions and definitions. Chapters 1 for this week’s discussions on induction. Monday, January 11, 2010