100 likes | 182 Views
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.
E N D
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: ATM • 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 ATM is not even Turing recognizable.
Decidable? for n = 3 .. maxint: for each combo of (x, y, z) starting at 1: if (xn + yn == zn) 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 H • 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! Print “yes” program & input Print “no” H2 Print “yes” H2 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 <TM> recognizes a regular language. • We’ll use R to solve the ATM problem by creating a decider S. • In other words: Machine R solves REG -- which implies existence of …. Machine S which solves ATM. • Do we understand the I/O of R and S?
Regular, continued • Here is how to build machine S, which will “solve” ATM. • Input to S is <T, w>. • Create a new TM “M2” • M2 sees if its input, x, is of the form 0n1n. If so, M2 accepts x. • If x is not of the form 0n1n, • M2 runs T on w. • If T accepts w, M2 accepts x. • Thus, L(M2) is either Σ*, if T accepts w, or 0n1n. • 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 ATM. • (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 <T, w>. • 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 • ATM = the acceptance question for TM’s, already known to be undecidable • AD = a hypothetical decider for ATM • 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?