Review Objective Unsolvable Solvable

advertisement

IN210 − lecture 3

Review

Objective

techniques — how to prove that a problem is unsolvable insights — what sort of problems are unsolvable

Unsolvable

Solvable

unsolvable

(by algorithms) problems

; undecidable languages solvable problems

; decidable languages

Autumn 1999 1 of 13

IN210 − lecture 3

Meaning

• All algorithms in the world live in the basket

• Infinitely many of them — most of them are unknown to us

• Meaning of unsolvability: No algorithm in the basket solves the problem (decides L)

• Meaning of solvability: There is an algorithm in the basket that solves the problem (but we don’t necessarily know what the algorithm looks like)

Autumn 1999 2 of 13

IN210 − lecture 3

Techniques

To prove that

• L is solvable: Show an algorithm

• L is unsolvable: Difficulty: Cannot check all the algorithms in the basket. Cannot even see most of them, because they have not yet been constructed . . .

Strategy

1. Show L

H

(H ALTING problem) undecidable using diagonalisation .

L

H

2. Show another langauge L undecidable by reduction : If L kan be solved, so can L

H

.

L

L

H

Autumn 1999 3 of 13

IN210 − lecture 3

Lemma 1 L decidable ⇒

L acceptable

Lemma 2 L decidable ⇒

L c decidable

We proved lemma 1 and 2 last week. We continue today with some more lemmas and the main theorem.

Lemma 3 If both L and its complement L c acceptable then L is decidable.

are

Proof: Given Turing machines M and M

0 which accept L and L c construct a machine M respectively we can

00 which decides L as follows: input halts

M

M’ halts

YES

NO

M’’

Autumn 1999 4 of 13

IN210 − lecture 3

Lemma 4 L

H

=

{

( M, x )

|

M halts on input x

} is

Turing acceptable

Proof: The universal Turing machine M u accepts L

H

.

M u works like an ordinary computer: It takes a code (program) M and a string x as input and simulates (runs) M on input x .

M u exists by Church’s thesis.

• To prove existence of M u we must construct it. Here is a 3-tape M u

:

...

b b

0 1 0 b ...

tape of M

finite control

...

(s,0) (q

1

,b, R) ...

rules of M

...

state=s

q

1

counters

...

Autumn 1999 5 of 13

IN210 − lecture 3

Lemma 5 L d

=

{

M

|

M does not halt given its own code as input } is not Turing acceptable.

Proof: Suppose there exists M d which accepts

L d

. Does M d accept its own code?

• If yes — it accepts a string which is not in

L d

.

• If no — it fails to accept a string which is in

L d

.

So in either case it fails, hence a contradiction .

Note: L d is the diagonal language — a special version of L

H c .

Autumn 1999 6 of 13

IN210 − lecture 3

Alternative proof of lemma 5:

0 1 00 01 10 11 000 · · ·

11

000

...

0

1

00 1 0 0 10 0 1 0 0

01 0 1 0 1 01 1 1 0

10

• We have strings as column labels

• We have Turing machine (codes) as row labels

• The 1’s in each row define the set of strings each TM accepts.

• After flipping the diagonal elements, the 1’s on the diagonal represents those machines which don’t accept their own code as input

• No Turing machine can possibly accept that diagonal language!

Autumn 1999 7 of 13

IN210 − lecture 3

Theorem 1 L

H is undecidable.

Proof: Suppose Turing machine M

H decides

L

H

. Then the following machine M

L d c :

0 decides m

M copy m,m

M

H

YES YES

NO NO

M’

• By Lemma 2 L d is also decidable.

• Then Lemma 1 gives that L d is acceptable.

• We have arrived at a contradiction since by

Lemma 5 we know that L d is not acceptable.

Autumn 1999 8 of 13

IN210 − lecture 3

Conclusion

L d

not acceptable

L d c

L

H

undecidable but acceptable decidable languages

(computable functions)

All languages ⊃ Turing acceptable languages

⊃ Turing decidable languages

Autumn 1999 9 of 13

IN210 − lecture 3

Meaning

An example with Π = 3 .

14159265359 . . .

:

L

1

=

{

X

|

X is a substring of the decimal expansion of Π

}

L

2

=

{

K

| There are K consecutive zeros in the decimal expansion of Π

}

Classify L

1

, L

2 as

• not acceptable

• acceptable but not decidable

• decidable

Note: Only problems which take an infinite number of different inputs can possibly be unsolvable.

Autumn 1999 10 of 13

IN210 − lecture 3

Reductions

input

(M,x)

M

R

M

H

M

L

YES

NO

Meaning of a reduction

Image: You meet an old friend with a brand new M

$

-machine under his shoulder.

Without even looking at the machine you say:

“It is fake!”

How the reduction goes

Image (an old riddle): You are standing at a crossroad deep in the forest. One way leads to the hungry crocodiles, the other way to the castle with the huge piles of gold. In front of you stands one of the two twin brothers. One of them always lies, the other always tells the truth. You can ask one question. What do you say?

Autumn 1999 11 of 13

IN210 − lecture 3

A typical reduction

L

$

=

{

M

|

M (eventually) writes a $ when started with a blank tape }

Claim: L

$ is undecidable

Proof:

(M,x)

M

R

M’

YES

M

$

NO

M

H

YES

NO

M’:

Simulate M on input x;

IF M halts THEN write a $;

Important points:

M

0 must not write a $ during the simulation of M !

• ’Write a $’ is quite an arbitrarly chosen action!

Autumn 1999 12 of 13

IN210 − lecture 3

M

R

:

Output the M u code modified as follows:

Instead of reading its input M and x , the modified M u has them stored in its finite control and it writes them on its tape. After that the modified M u proceeds as the ordinary M u untill the simulation is finished.

Then it writes a $.

Reduction as mathematical function

Given a reduction from L

1 to L

2

. Then M

R computes a function

X f

R

:

X

∗ which is such that x

L

1 x

6∈

L

1

⇒ f

R

⇒ f

R

( x )

L

2

( x )

6∈

L

2

L

1

Σ

*

Autumn 1999

L

2

Σ

*

13 of 13

Download