Presentation on theme: "CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but."— Presentation transcript:
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but the set of all languages is uncountable Undecidability –We have seen that ATM is undecidable. –Let’s look at some more undecidable problems.
TM properties 2 kinds of TMs 2 kinds of languages. –Turing-recognizable (a.k.a. recursively enumerable) Example: A TM –Decidable (a.k.a. recursive) Example: 0* If L is decidable, then L’ is decidable. If L and L’ are both Turing-recognizable, then L is decidable. (since either L or L’ must accept) Therefore, the complement of A TM is not even Turing recognizable.
Decidable? for n = 3.. maxint: for each combo of (x, y, z) starting at 1: if (x n + y n == z n ) print (“hello, world”); Are we able to tell if this program will print “ hello, world ” or not? –Only since 1993. For 300 years we didn’t know. –Solving this problem in general (for any program) must be hard… but what if it could be done?
“hello, world” tester Suppose H can decide the question. Then we can create similar algorithm H2. –Returns “hello, world” instead of “no”. –Let’s run H2 on itself! H program & input Print “yes” Print “no” H2 Print “yes” Print “hello, world”
Regular? REG = “Is there an algorithm to determine if a TM recognizes a regular language?” Proof by contradiction, p. 191 Assume REG is decidable. –Then, TM “R” that can tell if an input recognizes a regular language. –We’ll use R to solve the A TM problem by creating a decider S. –In other words: Machine R solves REG -- which implies existence of …. Machine S which solves A TM. –Do we understand the I/O of R and S?
Regular, continued Here is how to build machine S, which will “solve” A TM. Input to S is. Create a new TM “M2” –M2 sees if its input, x, is of the form 0 n 1 n. If so, M2 accepts x. –If x is not of the form 0 n 1 n, M2 runs T on w. If T accepts w, M2 accepts x. –Thus, L(M2) is either Σ*, if T accepts w, or 0 n 1 n. –The only way for M2 to accept Σ* is for T to accept w. Feed M2 into R. –If R says that M2 accepts a regular language, we can conclude T accepts w, so S can say “yes”, i.e. accept. Otherwise S rejects. –But S can’t exist. So we have a contradiction. REG undecidable.
Rice’s Theorem Any question Q about a TM language is undecidable. Proof by contradiction: Assume Q is decidable. Then TM “QD” that –always halts, and –answers Q for any input TM it receives. Using QD, we can build a machine AD to decide A TM. (But we know that AD can’t exist, therefore QD can’t exist. That is the contradiction.)
Building TM “AD” AD will do the following: –Its input is. –Build a TM “Q1” that satisfies Q. –Build a TM “M2” whose input is x. M2 runs T on w. If T loops/rejects, M2 will loop/reject. If T accepts w, next run Q1 on x. M2 accepts if Q1 accepts. Note that L(M2) = L(Q1) if T accepts w. L(M2) = if T does not accept w. In other words, if T accepts, then M2 satisfies Q. –Feed M2 into QD. If QD accepts, AD accepts. Otherwise AD rejects. Thus: QD is a decider AD is a decider.
Glossary to proof Q = some question or property about a TM language QD = a TM that can decide Q Q1 = a TM for which Q is true, built inside AD A TM = the acceptance question for TM’s, already known to be undecidable AD = a hypothetical decider for A TM T = the TM input to AD w = the corresponding word also input to AD M2 = a second TM built inside AD Rice’s theorem is a little complex because 5 TM’s!
Examples Let Q = “Is the language infinite?” or …. “Does the language include 001?” “Is the language finite?” “Is the language nonregular?” Can also prove by contradiction: –Is it decidable to determine if one TM language is the subset of another?