Download
section 14 1 computability some problems cannot n.
Skip this Video
Loading SlideShow in 5 Seconds..
Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. PowerPoint Presentation
Download Presentation
Section 14.1 Computability Some problems cannot be solved by any machine/algorithm.

Section 14.1 Computability Some problems cannot be solved by any machine/algorithm.

0 Vues Download Presentation
Télécharger la présentation

Section 14.1 Computability Some problems cannot be solved by any machine/algorithm.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible algorithms. Example (Turing machines). Associate a Turing machine with each nN as follows: n b(n) (the binary representation of n) a(b(n)) (b(n) split into 7-bit ASCII blocks, with leading zeros if needed)  ifa(b(n)) is the syntax of a TM thena(b(n)) else (0, a, a, S, halt) fi. So we can effectively describe all possible Turing machines: T0, T1, T2, … Of course we could use the same technique to list all possible instances of any computational model. For example, we can effectively list all possible simple programs and we can effectively list all possible partial recursive functions. If we want to use the Church-Turing thesis, then we can effectively list all possible solutions (e.g., Turing machines) to every intuitively computable problem. Decision Problems A decision problem is a problem can be phrased as a yes/no question. Such a problem is decidable if an algorithm exists to answer yes or no to each instance of the problem. Otherwise it is called undecidable. A decision problem is partially decidableif an algorithm exists to halt with the answer yes to yes-instances of the problem, but may run forever if the answer is no.

  2. Examples. 1. Is an arbitrary propositional wff a tautology? Decidable. 2. Is an arbitrary first-order wff valid? Undecidable and partially decidable. 3. Does a DFA accept infinitely many strings? Decidable. 4. Does a PDA accept a string s? Decidable. The Halting Problem The halting problem asks the following question. Does an arbitrary program halt on an arbitrary input? The halting problem is partially decidable: Just execute the program on the input. If the program halts, output yes. The halting problem is undecidable. To prove this, we’ll prove the following form for computable functions. Is there a computable function that can decide whether an arbitrary computable function halts on an arbitrary input? Proof: Assume, BWOC, that the halting problem is decidable. We’ll use the following effective listing of all computable functions of a single variable. ƒ0, ƒ1, ƒ2, … Define the partial function g by g(n) = if ƒn(n) halts then loop forever else 0 fi. Observe that g is computable because “ƒn(n) halts” is computable by assumption. So there is some k such that g = ƒk. Now apply g to k to obtain a contradiction: g(k) halts iff g(k) does not halt. Therefore the halting problem is undecidable. QED.

  3. Example/Quiz. Given the following effective listing of all Turing machines. T0, T1, T2, … Is it decidable whether Tn halts on some input string of a’s within k steps? Answer: Yes. Perform the following algorithm. l := 0; (l represents the length of an input string of a’s. So the tape is initially empty.) whilel ≤ kdo Execute Tn for k steps or until the halt state is reached, whichever comes first; If the halt state was reached, stop and output the answer YES; l := l + 1 (Reset the tape with one more a) od; Output the answer NO. Notice: If the while loop terminates without stopping with a YES-answer, then l > k. In this case Tn will take more than k steps to process l cells with a’s. So the answer is NO. Some Total Problems There is no effective listing of the total computable functions. Proof: To see this for total computable functions of a single variable, assume, BWOC, that we have the following effective listing of these functions. ƒ0, ƒ1, ƒ2, … Define g(n) = ƒn(n) + 1. Since ƒn is total, it follows that g is total too. Therefore g must be somewhere in the list. So there is some k such that g = ƒk. But then ƒk(k) = g(k) = ƒk(k) + 1, which is a contradiction. QED.

  4. The total problem asks whether an arbitrary computable function is total. The total problem is undecidable. Proof: Assume, BWOC, that the total problem is decidable. We’ll use the effective listing of all computable functions of a single variable ƒ0, ƒ1, ƒ2, … . Now define the function T(n) = if ƒn is total then 1 else 0 fi. Since “ƒn is total” is computable by assumption, it follows that T is total too. But now we can effectively list all the total computable functions from the given list as follows: Let g0 be the smallest k such that T(k) = 1; Let g1 be the smallest k > g0 such that T(k) = 1; … Let g(n +1) be the smallest k > gn such that T(k) = 1. Continue in this manner to construct the list ƒg0, ƒg1, …, ƒgn, … of all total computable functions of a single variable. But this contradicts the fact that it can’t be done. QED. Example/Quiz. Show that we can’t effectively list the total computable functions that have finite ranges. For example, ƒ(n) = n mod 4 has range {0, 1, 2, 3}. Proof: Suppose, BWOC, that ƒ0, ƒ1, ƒ2, … is an effective listing of the single-variable computable functions with finite range. Now define the function g(n) = if ƒn(n) ≤ 25 then ƒn(n) + 1 else 25 fi. Observe that g is total, computable, and has finite range. So there is some k such that g = ƒk. Quiz: What is the contradiction? Answer: If ƒk(k) ≤ 25 then ƒk(k) = ƒk(k) + 1. If ƒk(k) > 25 then ƒk(k) = 25. QED.

  5. Post Correspondence Problem (PCP) Given an arbitrary finite sequence (s1, t1), …, (sn, tn) of pairs of strings, does there exist a sequence of indices i1, …, ik, with repetitions allowed, such that si1…sik = ti1…tik? Example/Quiz. Does the following instance of the PCP have a solution? (ab, b), (b, a), (a, ab), (ba, b). Answer: Yes. If the pairs are labeled 1, 2, 3, 4, then the sequence 3, 2, 1 gives the equation abab = abab. Quiz. Does the following instance of the PCP have a solution? (a, aa), (aaaa, a). Answer: Yes. If the pairs are labeled 1, 2, then the sequence 1, 1, 1, 2 gives the equation aaaaaaa = aaaaaaa. The Post correspondence problem is undecidable for alphabets of size 2 or more. The proof involves reducing the problem to the halting problem. The PCP is also used in proving that it is undecidable to tell whether a context-free grammar over an alphabet of size 4 or more is ambiguous. Details of these two proofs can be found in: Harrison, Introduction to Formal Language Theory, Addison Wesley, 1981.