The Halting Problem - H-SC

Download Report

Transcript The Halting Problem - H-SC

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 M accept w and a string ?

w , does The language is A TM = {

M , w

| M accepts w )}.

A TM is Turing Recognizable • • Theorem : A TM recognizable.

is Turing Proof : • Build a Turing machine read a representation of simulate it on the input U w M .

that will and

A TM 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 forever.

U may run That is why U not a decider.

is only a recognizer,

Universal Turing Machines • • A universal Turing machine Turing machine that can read a description of any Turing machine and simulate it.

is a Do universal Turing machines really exist?

Universal Turing Machines • • • Yes. (We call them programmable computers .) 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 set.

: The set of all Turing machines is a countably infinite Proof of the Lemma : • Each Turing machine has a finite description: ( Q ,

,

,

, q 0 , q acc , q rej ).

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 and so on.

w 1 , w 2 , w 3 , i Create a binary array that is infinite to the right and down by letting row i = 1, 2, 3, … be the bits in w i , for

Turing-Unrecognizable Languages • Define an infinite binary string follows.

w • If the of w i th bit in row to 1.

i • If the of w i th bit in row to 0.

i is 0, set the i th is 1, set the i th as bit bit

w i

  0   1 if

w ii

if

w ii

 1  0

Turing-Unrecognizable Languages • • • • Certainly, string.

w is an infinite binary But w cannot be in the list of all infinite binary strings because it disagrees with every w This is a contradiction.

i in the list.

Therefore, the set must be uncountable.

Turing-Unrecognizable Languages • Proof of the Theorem : • • • Suppose that every language is recognizable.

Then for every language a Turing machine recognizes it.

M that L , there is 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 i th L word , then the i th w i in the list, if bit of s is 1.

w i • If 0.

w i is not in L , then the i th bit of s is in is

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.