4.2 An Undecidable Language Perhaps the only unsolvable problems are strange problems that have no practical use? Are there any unsolvable problems you would like to be able to solve? What's the Halting Problem for Turing Machines? Does TM M halt on the input w? What's the Membership Problem for Turing Machines? Does TM M halt and accept the input w? What's the language that represents the problem? A[TM] = { | M is a TM and M accepts w } Show that A[TM] is Turing-Recognizable. TM U recognizes A[TM] U = "on input , where M is a TM and w is a string: 1. simulate M on input w 2. if M accepts, accept if M rejects, reject # if M loops, loop" How do you encode a Turing Machine as a string? Can you simulate the execution of one TM on another TM? What's a Universal Turing Machine? a TM that reads a TM encoded as a string and simulates it TM U is a universal Turing machine Is A[TM] Decidable? Why can't TM U decide A[TM]? How does the class of Decidable Languages compare to the class of Recognizable Languages? How do you show that A[TM] is Undecidable? first assume that A[TM] is Decidable then show the assumption results in a contradiction What can you conclude from the assumption that A[TM] is Decidable? some TM H is a decider for A[TM] What does TM H do when given a TM M and a string w as input? H = "on input , where M is a TM and w is a string: # if M accepts w, halt and accept # if M rejects or loops on w, halt and reject" Suppose that you use TM H to build another TM D. D = "on input , where M is a TM: 1. run H on input > 2. if H accepts (M accepts ), reject if H rejects (M rejects ), accept" What happens when you run TM D with as input? if M accepts , D rejects if M rejects , D accepts What happens when you run TM D with as input? (running code with itself as input could happen with compilers) if D accepts , D rejects if D rejects , D accepts What's wrong with the statement? if D accepts , D rejects What do you conclude about TM D, TM H, and A[TM]? TM D cannot exist TM H cannot exist A[TM] is Undecidable An Unrecognizable Language What do you know at this point? A[TM] is Undecidable A[TM] is Recognizable there are languages that are not Recognizable Can you describe a language that is not Recognizable? Suppose you have a recognizer M1 for a language A and you also have a recognizer M2 for the complement of the language A. How can you use M1 and M2 to build a decider M for the language A? M = "on input w: 1. run both M1 and M2 on input w in parallel 2. if M1 accepts, accept if M2 accepts, reject" What does it mean to run both M1 and M2 in parallel? M has two tapes, one for M1 and one for M2 M takes turns running one step on each machine To be a decider, M must halt on any input. How do you know that M will halt on any input? every string w is in either A or the complement of A so either M1 or M2 must accept w M will halt when either M1 or M2 accepts What do you conclude about languages where both the language and its complement are Recognizable? if both a language and its complement are Recognizable, the language is Decidable If a language is Decidable, is the language also Recognizable? yes, a TM that always halts is a TM that either halts or loops If a language is Decidable, is its complement also Decidable? yes, since the TM always halts you can swap accept and reject If a language is Decidable, is its complement Recognizable? What do you conclude about a language and its complement when the language is Decidable? if a language is Decidable, both the language and its complement are Recognizable How do you put these two statements together? if both a language and its complement are Recognizable, the language is Decidable if a language is Decidable, both the language and its complement are Recognizable If a language is Undecidable, what do you know about either the language or its complement? If a language is Recognizable and Undecidable, what do you know about the complement of the language? Since A[TM] is Recognizable and also Undecidable, what specific language is not Recognizable?