180 likes | 922 Views
The Halting Problem – Undecidable Languages. Lecture 31 Section 4.2 Wed, Oct 31, 2007. The Acceptance Problem for Turing Machines. The Acceptance Problem for Turing Machines : Given a Turing machine M and a string w , does M accept w ? The language is
E N D
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007
The Acceptance Problem for Turing Machines • The Acceptance Problem for Turing Machines: Given a Turing machine M and a string w, does M accept w? • The language is ATM = {M, w | M accepts w)}.
ATM is Turing-Recognizable • Theorem: ATM is Turing-recognizable. • Proof: • Build a Turing machine U that will read a representation of M and simulate it on the input w.
ATM is Turing-Recognizable • If U halts in the accept state, then accept M, w. • If U halts in the reject state, then reject M, w. • The problem is that U may run forever. • That is why U is only a recognizer, not a decider.
Universal Turing Machines • A universal Turing machine is a Turing machine that can read a description of any Turing machine and simulate it. • Do universal Turing machines really exist?
Universal Turing Machines • Yes. (We call them programmablecomputers.) • They read a description of a Turing machine. (We call the description a program.) • Then they simulate the Turing machine. (We say they execute the program.)
Turing-Unrecognizable Languages • Theorem: There exist Turing-unrecognizable languages. • Lemma: The set of all Turing machines is a countably infinite set. • Proof of the Lemma: • Each Turing machine has a finite description: (Q, , , , q0, qacc, qrej).
Turing-Unrecognizable Languages • Express each description in binary, perhaps by using ASCII. • Thus, the set of all Turing machines is represented by a set of finite binary strings. • We already know that every set of finite binary strings is countable. • (They can be arranged in lexicographical order.)
Turing-Unrecognizable Languages • Lemma: The set of infinite binary strings is uncountable. • Proof of the Lemma: • We need to use a diagonalization argument, which is based on proof by contradiction.
Turing-Unrecognizable Languages • Suppose the set is countable. • Then the set of all infinite binary strings can be listed w1, w2, w3, and so on. • Create a binary array that is infinite to the right and down by letting row i be the bits in wi, for i = 1, 2, 3, …
Turing-Unrecognizable Languages • Define an infinite binary string w as follows. • If the ith bit in row i is 0, set the ith bit of w to 1. • If the ith bit in row i is 1, set the ith bit of w to 0.
Turing-Unrecognizable Languages • Certainly, w is an infinite binary string. • But w cannot be in the list of all infinite binary strings because it disagrees with every wi in the list. • This is a contradiction. • Therefore, the set must be uncountable.
Turing-Unrecognizable Languages • Proof of the Theorem: • Suppose that every language is recognizable. • Then for every language L, there is a Turing machine M that recognizes it. • That is, L(M) = L.
Turing-Unrecognizable Languages • For any language L, create an infinite binary string s as follows. • Make a list of all binary strings and order it lexicographically. • For the ith word wi in the list, if wi is in L, then the ith bit of s is 1. • If wi is not in L, then the ith bit of s is 0.
Turing-Unrecognizable Languages • This is a one-to-one correspondence between the set of all languages and the set of all infinite binary strings. • Thus, the set of all languages is uncountable.
Turing-Unrecognizable Languages • But for every language, there is (supposedly) a Turing machine that accepts it. • That would require uncountably many Turing machines. • This is a contradiction. • Thus, there exist languages that are not Turing-recognizable.