Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.

Similar presentations


Presentation on theme: "CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American."— Presentation transcript:

1 CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American

2 Chapter Five Undecidability

3 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

4 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

5 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.

6 Encode of a TM Special Symbols The start state

7 Encode of a TM Encode transitions Encode String of a TM M  Assume M has transitions  Then the encode is

8 Remark: How to encode halting states  Indirect way: States not in the first component of any transition  Direct way: Use a special symbol and use the usual state encoding scheme

9 Examples Ex. i=2, j=3.

10 Examples EncodingEncode(M)= State/symbol Code

11 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

12 The New World r.e. complete sets r.e. sets recursive sets noncomputable sets

13 The Halting Problem The Halting Problem. Given any program P and any input x, decide whether P halts on x. The Languages 

14 Non-Computable Language Theorem 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

15 Proof. Of Theorem 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

16 Theorem Theorem 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.

17 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

18 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

19 Reduction Definition. Let be languages. A reduction from to is a recursive function  such that 

20 Two Ways of Using a Reduction Theorem 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.

21 Two Ways of Using a Reduction Theorem 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

22 More Undecidable Problems Theorem 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?

23 Proof of Theorem (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)

24 Proof of Theorem (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

25 Proof of Theorem (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.

26 Proof of Theorem (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)

27 Unsolvable Problems about Unrestricted Grammars Theorem 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’)?

28 Proof of Theorem (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.

29 More Undecidable Problems about Context-Free Grammars Theorem 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.

30 Properties of Recursive Languages Theorem A language is recursive iff both it and its complement are r.e. Proof. (Prove in class)

31 Turing Enumerable Definition. We say that a TM enumerates a language L iff for some fixed state q of M,  Theorem A language is r.e. iff it is Turing enumerable. Proof. (Prove in class.)

32 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.

33 Recursive vs. Lexicographically Enumerable Theorem A language is recursive iff it is lexicographically enumerable. Proof. (Prove in class.)

34 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

35 Proof of Rice Theorem Reduce the halting problem to the membership testing of C. Assume (If not, we consider ) Let Define We have

36 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.

37 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 …


Download ppt "CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American."

Similar presentations


Ads by Google