The Church-Turing Thesis Any intuitive algorithm can be simulated by a TM which halts on all inputs Intuitive algorithms = TM’s Any intuitively computable function can be computed by a TM Intuitive computability = TM computability
Universal Turing Machines Generic TM which can simulate all TM’s Ideas of universal TM construction Encode a TM using a string of characters Decode the string to obtain the encoded TM Simulate the computation of the encoded TM
Encode of a TM Let Fix such that and are smallest integers for the following Each state in K can be represented by q followed by a binary string of length i. Each symbol in can be represented by a followed a binary string of length j.
The Universal TM Simulate computation of a TM on input w Construction Current state of M Encode(M) Work on w Finite Control of the Universal TM
The New World r.e. complete sets r.e. sets recursive sets noncomputable sets
The Halting Problem The Halting Problem. Given any program P and any input x, decide whether P halts on x. The Languages
Non-Computable Language Theorem 5.3.1. The Languages and are not recursive. Remark: and are r.e. The theorem implies that the class of r.e. languages is strictly larger than the class of recursive languages
Proof. Of Theorem 5.3.1 Only need to show that is not recursive. To do so, only need to show that the following claim. Claim. is not r.e. Proof. By contradiction. Assume it is r.e. Then, there is a TM M’ such that Now we have
Theorem Theorem 5.3.2. The class of r.e. languages is not closed under complement. Proof. is r.e. However, is not r.e. r.e. sets recursive sets Sets that are not r.e.
Some Observation Every r.e. language is “reducible” to H. Can you see why? Let L be any r.e. language such that L=L(M) for some TM M. For any w, we have
Undecidable Problems about TM’s Known: The halting problem is not decidable. Want: More undecidable problems Reduction: Reduce a known non-decidable problem to the given problem
Reduction Definition. Let be languages. A reduction from to is a recursive function such that
Two Ways of Using a Reduction Theorem 5.4.1. A. If is not recursive, and there is a reduction from to then is not recursive. Proof. It follows from the fact that is reducible to we have Hence, if is recursive, so is yielding a contradiction.
Two Ways of Using a Reduction Theorem 5.4.1. A. If is recursive, and there is a reduction from to then is recursive. Proof. It follows from the fact that is reducible to we have Hence, if is recursive, so is
More Undecidable Problems Theorem 5.4.2. The following problems about TM’s are undecidable: (a) Given a TM M and an input w, does M halts on input w? (b) Given a TM M, does M halts on the empty tape? (c) Given a TM M, is there any string at all on which M halts? (d) Given a TM, does M halts on every input string? (e) Given two TM’s M1 and M2, do they halt on the same input string? (f) Given a TM M, is the language that M semidecides regular? Is it context-free? Is it recursive? (g) Furthermore, there is a certain fixed TM M, for which the following problem is undecidable: Given w, does M halt on w?
Proof of Theorem 5.4.2. (a). Proved. This is the halting problem. (b) Reduce H to this problem Reduction: For any w and M, construct a new TM M’. M’ starts with an empty and then writes w, and then simulate M on w. M halts w iff M’ halts on the empty tape (c) Reduce (b) to (c). Reduction: For any w and M, construct a new TM M’. M’ starts erasing w, and then simulate M on the empty tape. M halts on the empty tape iff M’ halts on some string (acutually, M’ halts on all strings)
Proof of Theorem 5.4.2. (d) Proof for (c) works here. Recall M’ for (c) halts on some string iff it halts on all strings. (e) Reduce (d) to (e). Reduction: Fix a TM X accepting all strings. For any TM M, we have M and X accept the same string iff M accepts all strings
Proof of Theorem 5.4.2. (f) Reduce (b) to (f). Reduction: For any TM M and any input w, construct M’. M’ simulate M on the empty tape first. If this halts, then M’ simulates M on w. If M halts on the empty tape, then L(M)= H. Recall H is not regular, nor context-free, nor recursive. If M does not halt on the empty tape, L(M’) is empty, hence regular, context-free, and recursive.
Proof of Theorem 5.4.2. (g) Consider the fixed universal TM U. Form any TM M and any input w, we have M halts on w iff U halts on encode(M)encode(w)
Unsolvable Problems about Unrestricted Grammars Theorem 5.5.1. The following problems are undecidable: (a) For a given grammar G and a string w, to determine whether w is in L(G)? (b) For a given grammar G, to determine whether e is in L(G)? (c) For two given grammars G1 and G2, to determine whether L(G1)=L(G2)? (d) For an arbitrary grammar G, to determine whether L(G) is empty? (e) Furthermore, there is a certain fixed grammar G’, such that it is undecidable to determine whether any given string w is in L(G’)?
Proof of Theorem 5.5.1. (a) Let M be the TM that semidecides H. Then, we have a grammar G to generate L(M)=H. Since H is not decidable, whether w is in L(G) or not is not decidable. Other proofs are similar.
More Undecidable Problems about Context-Free Grammars Theorem 5.5.2. Each of the following problems is undecidable: (a) Given a CF grammar G, is L(G)=∑* ? (b) Given two CF grammars G1 and G2, is L(G1)=L(G2) ? (c) Given pushdown automata M1 and M2, do they accept precisely the same language? Given a pushdown automaton, find an equivalent pushdown automaton as few states as possible. Proof.
Properties of Recursive Languages Theorem 5.7.1. A language is recursive iff both it and its complement are r.e. Proof. (Prove in class)
Turing Enumerable Definition. We say that a TM enumerates a language L iff for some fixed state q of M, Theorem 5.7.2. A language is r.e. iff it is Turing enumerable. Proof. (Prove in class.)
Lexicographically Enumerable Definition. Let M be a TM enumerating a language L. We say that M lexicographically enumerates L if the following is true, where q is a special “display” state: Wherever then w’ comes lexicographically after w. A language is lexicographically enumerable iff trhere is a TM that lexicographically enumerates it.
Recursive vs. Lexicographically Enumerable Theorem 5.7.3. A language is recursive iff it is lexicographically enumerable. Proof. (Prove in class.)
Rice Theorem Rice Theorem. Suppose that (1) C is nonempty (2) C is a proper subset of the class of all r.e. languages. Then the following is undecidable: Given a TM M, is L(M) in C? r.e. languagesC L2 L1
Proof of Rice Theorem Reduce the halting problem to the membership testing of C. Assume (If not, we consider ) Let Define We have
How to Use Rice Theorem? Define a class C for a given problem such that C is not empty C is a proper subset of all r.e. languages Solving the problem is equivalent to membership testing of C When the above three conditions are true, then by Rice theorem, the given problem is not decidable.
Applications of Rice Theorem Use Rice Theorem to the following problems are not decidable: Given a TM M, to determine whether L(M) is finite? Given a TM M, to determine whether L(M) is infinite? Given a TM M, to determine whether L(M) is context-free More …