lecture 4: unsolvable problems

89
Lecture 4: Unsolvable Problems 虞虞虞 虞虞虞虞虞虞虞 虞虞虞虞虞 虞虞虞

Upload: maylin

Post on 06-Jan-2016

31 views

Category:

Documents


0 download

DESCRIPTION

Lecture 4: Unsolvable Problems. 虞台文. 大同大學資工所 智慧型多媒體研究室. Content. Enumerable and Decidable Sets Algorithm Solvability Problem Reduction Diagonalization Method. Lecture 4: Unsolvable Problems. Enumerable and Decidable Sets. 大同大學資工所 智慧型多媒體研究室. Set Enumerability and Generability. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture 4: Unsolvable Problems

Lecture 4: Unsolvable Problems

虞台文大同大學資工所智慧型多媒體研究室

Page 2: Lecture 4: Unsolvable Problems

Content

Enumerable and Decidable SetsAlgorithm SolvabilityProblem ReductionDiagonalization Method

Page 3: Lecture 4: Unsolvable Problems

Lecture 4: Unsolvable Problems

Enumerable and Decidable Sets

大同大學資工所智慧型多媒體研究室

Page 4: Lecture 4: Unsolvable Problems

Set Enumerability and Generability

A * is enumerable (generable) if

computable function g: N* such that

( )g N AIf g is not totally defined, then D(g)={0, 1, …, k 1}.

Page 5: Lecture 4: Unsolvable Problems

The Generation Process(cf )gg N A

*A Enumerable (Generable)

(0)g A(1)g A(2)g A(3)g A

A:g N =

=

=

= Generate

Page 6: Lecture 4: Unsolvable Problems

The Enumeration Process(cf )gg N A

*A Enumerable (Generable)

(0)g A(1)g A(2)g A

A:g N =

=

=

A ?EnumerateEnumerate

Page 7: Lecture 4: Unsolvable Problems

The Enumeration Process(cf )gg N A

*A Enumerable (Generable)

(0)g A(1)g A(2)g A

A:g N =

=

=

A ?EnumerateEnumerate

Is such a process always

terminable?Is such a process always

terminable?

Page 8: Lecture 4: Unsolvable Problems

The Enumeration Process(cf )gg N A

*A Enumerable (Generable)

(0)g A(1)g A(2)g A

A:g N =

=

=

A ?EnumerateEnumerate

Page 9: Lecture 4: Unsolvable Problems

The Labeling Process(cf )gg N A

*A Enumerable (Generable)

(0)g A(1)g A(2)g A

A:g N =

=

=

LabelingLabeling

( )g ?

2

Page 10: Lecture 4: Unsolvable Problems

Exercises

1. Write two algorithms to enumerate (generate) the set of all even numbers of integer in different sequences.

2. What is difference between ‘countable’ (studied in discrete math) and `enumerable’?

Page 11: Lecture 4: Unsolvable Problems

The Countability of Real Number

Is R countable?

Is (0,1)R countable?

Page 12: Lecture 4: Unsolvable Problems

Prove (0,1)R is uncountable

Assume that (0, 1) is countable.

Suppose that it is counted as:

f0

f1

f2

f3

f4

d01 d02 d03 d04d00

d11 d12 d13 d14d10

d21 d22 d23 d24d20

d31 d32 d33 d34d30

d41 d42 d43 d44d40

0.

0.

0.

0.

0.

0 1 2 3 4

……………

… … … … … … ……

…{0,1, ,9}ijd

Page 13: Lecture 4: Unsolvable Problems

Prove (0,1)R is uncountable

Assume that (0, 1) is countable.

Suppose that it is counted as:

d00

d11

d22

d33

d44

f0

f1

f2

f3

f4

d01 d02 d03 d04

d12 d13 d14d10

d21 d23 d24d20

d31 d32 d34d30

d41 d42 d43d40

0.

0.

0.

0.

0.

0 1 2 3 4

……………

… … … … … ……

…{0,1, ,9}ijd

Consider the following number:

0 1 2 3 40. (0,1)v h h h h h

9 {0,1, ,9}i iih d

Page 14: Lecture 4: Unsolvable Problems

Prove (0,1)R is uncountable

Assume that (0, 1) is countable.

Suppose that it is counted as:

d00

d11

d22

d33

d44

f0

f1

f2

f3

f4

d01 d02 d03 d04

d12 d13 d14d10

d21 d23 d24d20

d31 d32 d34d30

d41 d42 d43d40

0.

0.

0.

0.

0.

0 1 2 3 4

……………

… … … … … ……

…{0,1, ,9}ijd

Consider the following number:

0 1 2 3 40. (0,1)v h h h h h

9 {0,1, ,9}i iih d

… … … … … ……

v=fk0. h0 h1 h2 h3 h4

Page 15: Lecture 4: Unsolvable Problems

Prove (0,1)R is uncountable

Assume that (0, 1) is countable.

Suppose that it is counted as:

d00

d11

d22

d33

d44

f0

f1

f2

f3

f4

d01 d02 d03 d04

d12 d13 d14d10

d21 d23 d24d20

d31 d32 d34d30

d41 d42 d43d40

0.

0.

0.

0.

0.

0 1 2 3 4

……………

… … … … … ……

…{0,1, ,9}ijd

Consider the following number:

0 1 2 3 40. (0,1)v h h h h h

9 {0,1, ,9}i iih d

… … … … … ……

v=fk0. h0 h1 h2 h3 h4

0 1 20.k k k k kkv f d d d d

kk kd h 9 kkd

4.5kkd

Page 16: Lecture 4: Unsolvable Problems

Prove (0,1)R is uncountable

Assume that (0, 1) is countable.

Suppose that it is counted as:

d00

d11

d22

d33

d44

f0

f1

f2

f3

f4

d01 d02 d03 d04

d12 d13 d14d10

d21 d23 d24d20

d31 d32 d34d30

d41 d42 d43d40

0.

0.

0.

0.

0.

0 1 2 3 4

……………

… … … … … ……

…{0,1, ,9}ijd

Consider the following number:

0 1 2 3 40. (0,1)v h h h h h

9 {0,1, ,9}i iih d

… … … … … ……

v=fk0. h0 h1 h2 h3 h4

0 1 20.k k k k kkv f d d d d

kk kd h 9 kkd

4.5kkd

Page 17: Lecture 4: Unsolvable Problems

Semidecidability

A * is semidecidable if there exists an algorithm which, when applying to any A, can decide that is in A, i.e., there exists an membership algorithm for A.

A A ?

A ?

True

False orNever Halt

Page 18: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

A is enumerable g: N* such that g(N)=A.

Hence, given any A, we generate strings

g(0)=0g(1)=1

. . . . . . . .

Then, we will finally reach g(k) = k = .This allows us to concludes that A.

Page 19: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”What do we know?

A is semidecidableThere exists an membership algorithm for A on TM such

that( ) iff TM true A

Thinking first.

How to prove? Find g such that ( )g N A

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

Page 20: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

Preliminaries 1 2 3 4 5 6 7 8 9 10123456789

10

Numbering the followingblack cells

Page 21: Lecture 4: Unsolvable Problems

1 2 3 4 5 6 7 8 9 10123456789

10

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

0

1

2 34

5

6

7

Preliminaries

Numbering the followingblack cells

= {0, 1}

* = {, 0, 1, 00, 01, 10, 11, 000, …} 0 1 2 3 4 5 6 7

Enumerable

Page 22: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

The algorithmto generate g(k):

Step 1. Set n = k + 1.

Step 2. List the first n strings 0 1 1, , , n

Step 3. Hand simulates n steps of on TM for each 0 1 1, , , n

Page 23: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

The algorithmto generate g(k):

Step 1. Set n = k + 1.

Step 2. List the first n strings 0 1 1, , , n

Step 3. Hand simulates n steps of on TM for each 0 1 1, , , n

0 1 2 3 4 5 6 7 8 9123456789

10

0

n St

eps

n1-

Terminating Record

Page 24: Lecture 4: Unsolvable Problems

Theorem 1

A is enumerable iff A is semidecidable.Pf) “”

( ) iff TM true A We have

Want ( )g N A

( ) ?g k 0,1,2,k

The algorithmto generate g(k):

Step 1. Set n = k + 1.

Step 2. List the first n strings 0 1 1, , , n

Step 3. Hand simulates n steps of on TM for each 0 1 1, , , n

0 1 2 3 4 5 6 7 8 9123456789

10

0

n St

eps

n1-

Step 4. Let m= #terminating computations.Step 5. if m < k + 1

n= n + 1; goto Step 2;else return the kth string.

k

Page 25: Lecture 4: Unsolvable Problems

Theorem 2

A is enumerable iff A is a domain of some computable functions.

Pf)

Exercise

Page 26: Lecture 4: Unsolvable Problems

Theorem 2

A is enumerable iff A is a domain of some computable functions.

How about if A is not enumerable?

How about if A is not enumerable?

Page 27: Lecture 4: Unsolvable Problems

Discussion

Program Computability Enumeration

Enumeration Membership Determination

(Some reformation may be required)

(Semidecidability)

Page 28: Lecture 4: Unsolvable Problems

Complement Set

* \A A

*, A

Page 29: Lecture 4: Unsolvable Problems

Decidable Set

A * is decidable if there exists an computable function, say, D such that

if :

if

true AD

false A

Page 30: Lecture 4: Unsolvable Problems

Theorem 3

A is decidable iff and are enumerable.A A

A is decidable iff and are semidecidable.A A

Page 31: Lecture 4: Unsolvable Problems

Theorem 3

A is decidable iff and areA A enumerable.semidecidable.

Pf) “” Fact: * can be enumerated as 0, 1, 2, …

Since A is decidable, a computable function D st.

The computable function g to enumerate A can be:

if :

if

true AD

false A

D: 0 1 2 3 4 . . .

t f t t f . . .

g(0) g(1) g(2) . . .

A is enumerable.g:

Show that A is enumerable as follows:

Page 32: Lecture 4: Unsolvable Problems

Theorem 3

A is decidable iff and areA A enumerable.semidecidable.

Pf) “” Fact: * can be enumerated as 0, 1, 2, …

Since A is decidable, a computable function D st.

The computable function h to enumerate can be:

if :

if

true AD

false A

D: 0 1 2 3 4 . . .

t f t t f . . .h:

Show that is enumerable as follows:A

is enumerable.A

A

h(0) . . .h(1)

Page 33: Lecture 4: Unsolvable Problems

Theorem 3

A is decidable iff and areA A enumerable.semidecidable.

Pf) “”

Suppose 1 semidecides A, 2 semidecides .

For any *, input it to 1 and 2 simultaneously.

If 1 terminates, return true.

If 2 terminates, return false.

A

Page 34: Lecture 4: Unsolvable Problems

Lecture 4: Unsolvable Problems

Algorithm Solvability

大同大學資工所智慧型多媒體研究室

Page 35: Lecture 4: Unsolvable Problems

Enumeration, Decidability and Solvability

Enumeration:

Decidability:

Solvability:

*N

* ,true false

(Semidecidability)

To deal with the existence of algorithm (program) to solve problems.

That is, given a problem, whether there exists a program to solve (any instance of) the problem.

Page 36: Lecture 4: Unsolvable Problems

1

2

Example

Problem (PE: Program Equivalence):q = “Are program 1 and program 2 equivalent?”

,true falseAny

Algorithm?

PE

Page 37: Lecture 4: Unsolvable Problems

Example

Problem (PE: Program Equivalence):q = “Are program 1 and program 2 equivalent?”

Solvable? Computable?

1

2

:

:

string to represent 1

string to represent 2

1 2 1 2| and are e$ quivalent A

Decidable?

PE

Page 38: Lecture 4: Unsolvable Problems

Example

Problem (PE: Program Equivalence):q = “Are program 1 and program 2 equivalent?”

Problem Reformulation

Solvable? Computable?

1

2

:

:

string to represent 1

string to represent 2

1 2 1 2| and are e$ quivalent A

Decidable?

Problem PE is solvable iff A is decidable (recursive).Problem PE is solvable iff A is decidable (recursive).

PE

Page 39: Lecture 4: Unsolvable Problems

Definitions

Semisolvable:

Solvable:

Totally Unsolvable:

algorithm if q is true, it answers ‘yes’.if q is false, it may not give answer (never halt).

:P a true/ f alse problemq P

algorithm if q is true, it answers ‘yes’.if q is false, it answers ‘no’.

not semisolvale.

Page 40: Lecture 4: Unsolvable Problems

Problem and Complement ProblemP P

Is true?qP

Is not true?P q

Page 41: Lecture 4: Unsolvable Problems

Problem and Complement ProblemP P

1 2

Is tru ?, , eTM k TM kPE

Example:

1 2

Is not tru, , e?TM k TM kPE

Turing Machine Version

Page 42: Lecture 4: Unsolvable Problems

Problem and Complement ProblemP P

( )Is tr) ue?(P x h xE g

Example:

( ) ( )Is not true?PE g x h x

Register Machine Version

Page 43: Lecture 4: Unsolvable Problems

Theorem 4

P is solvable iff and are semisolvable.P P

Is true?qP

Is not true?P q

Pf) “” P is solvable algorithm P such that

if q is true, it answers ‘yes’.if q is false, it answers ‘no’.To show that P is semisolvable,

we need to find a algorithm ’ such that

is true( )

is false

true qq

q

?

Page 44: Lecture 4: Unsolvable Problems

Theorem 4

P is solvable iff and are semisolvable.P P

Is true?qP

Is not true?P q

Pf) “” P is solvable algorithm P such that

if q is true, it answers ‘yes’.if q is false, it answers ‘no’.To show that P is semisolvable,

we need to find a algorithm ’ such that

START

P

TRUEHALT

truefalse

’:

( ) if return true

(

)

else .Pq q

is true( )

is false

true qq

q

It can be

q

Page 45: Lecture 4: Unsolvable Problems

Theorem 4

P is solvable iff and are semisolvable.P P

Is true?qP

Is not true?P q

Pf) “” P is solvable algorithm P such that

if q is true, it answers ‘yes’.if q is false, it answers ‘no’.

START

P

TRUEHALT

falsetrue

”:

( ) if return true

no ( )

else .

t Pq q

not is true( )

is true

true qq

q

It can be

q

To show that is semisolvable, we need to find a algorithm ” such that

P

Page 46: Lecture 4: Unsolvable Problems

Theorem 4

P is solvable iff and are semisolvable.P P

Pf) “”

To run ’ and ” alternatively,

if ’ answers ‘yes’, then ‘yes’;

if ” answers ‘yes’, then ‘no’.

Page 47: Lecture 4: Unsolvable Problems

Corollary

P is solvable iff and are semisolvable.P P

P is semisolvable but not solvable

Pis totally unsolvable.

Page 48: Lecture 4: Unsolvable Problems

The Halting Problem

Register Machine Version

Turing Machine Version

: an -progra( ) ?

m" "

: memory configurationm

mHP

MM

: a -program

" ": memory configurati

,o, n

?HP kk

MTM

T

More simple,

" " : register functio( ? n)HP g x g

Page 49: Lecture 4: Unsolvable Problems

START

HALT

Theorem 5

The HP (halting problem) is not solvable.

: a -program

" ": memory configurati

,o, n

?HP kk

MTM

T

?

S1 S2 Sk1 Sk Sk+1 Sn1 Sn… … Blank TapeBlank Tape

Head

We will prove a simpler version.

We will prove a simpler version.會停嗎 ?

Page 50: Lecture 4: Unsolvable Problems

START

HALT

Theorem 5

The HP (halting problem) is not solvable.

: a -program

" ": memory configuratio

,n

1 ?,1

HP

TM

TM

S1 S2 Sk1 Sk Sk+1 Sn1 Sn… … Blank TapeBlank Tape

Head

?會停嗎 ?

Page 51: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

: a -program

" ": memory configuratio

,n

1 ?,1

HP

TM

TM

Pf) Assume that HP is solvable.

algorithm, given and <, 1>, can tell whether will halt on <, 1>.

Define @ ,1A TM

We can have an algorithm, say, decide to decide the elements of A.

( ) q

decide qq

true A

false A

That is,

Page 52: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

Pf)

@ ,1A TM

( ) q

decide qq

true A

false A

Construct strange

by making use of decide

START

Duplicate as @

HALT

decide

true falseWhat are done by strange?

What are done by strange?

Page 53: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

Pf)

@ ,1A TM

( ) q

decide qq

true A

false A

START

Duplicate as @

HALT

decide

true false

,1

,1@ ,1strange TM iff ,1 TM

Construct strange

by making use of decide

Page 54: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

Pf)

@ ,1A TM

( ) q

decide qq

true A

false A

START

Duplicate as @

HALT

decide

true false

,1

,1@ ,1strange TM iff ,1 TM

Construct strange

by making use of decide

The input to strange is a program’s string, say, .

strange will never halt on

if and only if

program will halt on feeding its code as input

parameter.

The input to strange is a program’s string, say, .

strange will never halt on

if and only if

program will halt on feeding its code as input

parameter.

Page 55: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

Pf)

@ ,1A TM

( ) q

decide qq

true A

false A

,1strange TM iff ,1 TM

,1strange strange TM iff ,1

strange strange TM

Assume that HP is solvable.. . . . . . . . . . . . . . . .

Page 56: Lecture 4: Unsolvable Problems

Theorem 5

The HP (halting problem) is not solvable.

Pf)

@ ,1A TM

( ) q

decide qq

true A

false A

,1strange TM iff ,1 TM

,1strange strange TM iff ,1

strange strange TM

Assume that HP is solvable.. . . . . . . . . . . . . . . .

START

Duplicate as @

HALT

decide

true false

,1strange

@ ,1strange strange

Page 57: Lecture 4: Unsolvable Problems

Theorem 6

The HP (halting problem) is not solvable.

The HP (halting problem) is semisolvable.

Pf)

Trivial(Run it)

Page 58: Lecture 4: Unsolvable Problems

The Non-Halting Problem (NHP)

Register Machine Version

Turing Machine Version

: an -progra( ) ?

m" "

: memory configurationm

mHP

MM

: a -program

" ": memory configurati

,o, n

?HP kk

MTM

T

NHP HP

Page 59: Lecture 4: Unsolvable Problems

Theorem 7

The NHP is not semisolvable.

The NHP is totally unsolvable.

Page 60: Lecture 4: Unsolvable Problems

Lecture 4: Unsolvable Problems

Problem Reduction

大同大學資工所智慧型多媒體研究室

Page 61: Lecture 4: Unsolvable Problems

Is a Problem Solvable?

Methods to identify the problems’ solvability:

Problem Reduction Diagonalization method Rice’s Theorem

Page 62: Lecture 4: Unsolvable Problems

P

Problem Reduction

Pq qr:

Let P and P’ be two problems. If there is an algorithm (r) which will map any qP into q’P st.

q is true iff q’ is true.

Then, we say that problem P reduces to P’.

Page 63: Lecture 4: Unsolvable Problems

P

Problem Reduction

Pq qr:

Let P and P’ be two problems. If there is an algorithm (r) which will map any qP into q’P st.

q is true iff q’ is true.

Then, we say that problem P reduces to P’.

Conceptually, P’ is larger.

Page 64: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P’ issemisolvablesolvable How about P?

How about P?

Page 65: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P’ issemisolvablesolvable P is

semisolvablesolvable

Page 66: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P issemisolvablesolvable How about P’?

How about P’?

Page 67: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P issemisolvablesolvable P’ is ?????????

Page 68: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P’ isnot solvable

totallyunsolvable

How about P?How about P?

Page 69: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P’ isnot solvable

totallyunsolvable

P is ????????

Page 70: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P isnot solvable

totallyunsolvable

How about P’?How about P’?

Page 71: Lecture 4: Unsolvable Problems

P

Discussion

Pq qr:

q is true iff q’ is true.

If P isnot solvable

totallyunsolvable

P’ isnot solvable

totallyunsolvable

Page 72: Lecture 4: Unsolvable Problems

Discussion

PP

q qr:: an -program

" ": memory confi

(gura n

) ?tio

mm

HP

M MM

: a -program

" ": memory c

, ?, onfiguration

kk

HP

TM TMTM

HPM HPTM

HPTM HPM

Page 73: Lecture 4: Unsolvable Problems

Theorem 8

PP

q qr:: an -program

" ": memory confi

(gura n

) ?tio

mm

HP

M MM

: a -program

" ": memory c

, ?, onfiguration

kk

HP

TM TMTM

HPM HPTM

HPTM HPM

The halting-problems for TM(), R, SR, SR2,

… are semisolvable but not solvable.

The halting-problems for TM(), R, SR, SR2,

… are semisolvable but not solvable.

Page 74: Lecture 4: Unsolvable Problems

Theorem 9

The problem of TM equivalence (PE) is totally unsolvable.

" ?"PE TM TM

TM

TM ,true false

AnyAlgorithm?

Page 75: Lecture 4: Unsolvable Problems

Theorem 9

The problem of TM equivalence (PE) is totally unsolvable.

" ?"PE TM TM

Pf) Fact: NHP is totally unsolvable.

Method of problem reduction: Find r st.

: r NHP PE , ?k TM ? TM TM

true trueiff

How?

Page 76: Lecture 4: Unsolvable Problems

Theorem 9

The problem of TM equivalence (PE) is totally unsolvable.

Pf) Fact: NHP is totally unsolvable.

: r NHP PE , ?k TM ? TM TM

Input = <, k>?

START

HALT

true

false

?START

doesn’t halt on <k, 1>

Page 77: Lecture 4: Unsolvable Problems

Theorem 9

The problem of TM equivalence (PE) is totally unsolvable.

Pf) Fact: NHP is totally unsolvable.

: r NHP PE , ?k TM ? TM TM

Input = <, k>?

START

HALT

true

false

?START

doesn’t halt on <k, 1>

Page 78: Lecture 4: Unsolvable Problems

Lecture 4: Unsolvable Problems

Diagonalization Method

大同大學資工所智慧型多媒體研究室

Page 79: Lecture 4: Unsolvable Problems

Example Show that HP is not solvable using diagonalization method.

Fact: The set of all programs is enumerable. (why?) Let be the string representation of all

programs. Suppose that HP is solvable. Then, we can have the

following termination record: Construct strange such that:

0 1 2, , ,...

0

1

2

3...

001...

101...

000...

011...

0 0 1 1 …………. . .

0 1 2 3 …

1ji

0ji

,1 iff ,1strange j j j TM TM

Can you write such a

program?Can you write such a

program?

Page 80: Lecture 4: Unsolvable Problems

... ... ... ... ...k 1 0 1 0 …

Example Show that HP is not solvable using diagonalization method.

Fact: The set of all programs is enumerable. (why?) Let be the string representation of all

programs. Suppose that HP is solvable. Then, we can have the

following termination record: Construct strange such that:

0 1 2, , ,...

,1 iff ,1strange j j j TM TM

0

1

2

3...

001...

101...

000...

011...

0 0 1 1 …………. . .

0 1 2 3 …

Page 81: Lecture 4: Unsolvable Problems

... ... ... ... ...k 1 0 1 0 …

Example Show that HP is not solvable using diagonalization method.

Fact: The set of all programs is enumerable. (why?) Let be the string representation of all

programs. Suppose that HP is solvable. Then, we can have the

following termination record: Construct strange such that:

0 1 2, , ,...

,1 iff ,1strange j j j TM TM

0

1

2

3...

001...

101...

000...

011...

0 0 1 1 …………. . .

0 1 2 3 …

,1 iff ,1strange k k k TM TM

,1 iff ,1k k k k TM TM

Page 82: Lecture 4: Unsolvable Problems

Theorem 10

The total function problem is totally unsolvable.

Pf)

totally unsolvable not semisolvable

• Assume it is semisolvable.• Then, we can enumerate the all total function as:

0 1 2, , ,

• Let x1 be the input/output register.

• Then,0 0

1 1

1 2

:

:

:

f N N

f N N

f N N

Totally defined functions

Page 83: Lecture 4: Unsolvable Problems

Theorem 10

The total function problem is totally unsolvable.

Pf)

totally unsolvable not semisolvable

• Assume it is semisolvable.

0 0 0 0

1 1 1 1

2 2 2 2

3

0

1

3

2

33 3

(0)

(1)

0 1 2 3

(1) (2) (3)

(0) (2) (3)

( (2)

(3

0) (1) (3)

(0) (1) ) )(2

f f f f

f f f f

f

f

f

f f f

f

f

f f f f

. . . . . . . . . . . . . . . . . . . . .

• Define : ( ) 1ng n f n

• Clearly, g is total.

Page 84: Lecture 4: Unsolvable Problems

Theorem 10

The total function problem is totally unsolvable.

Pf)

totally unsolvable not semisolvable

• Assume it is semisolvable.

0 00

1

2

0 0

1 1 1 1

2 2 2 2

3 3 3 3 3

(0)

(1)

(2

0 1 2 3

(1) (2) (3)

(0) (2) (3)

(0) (1) (3)

(0) (1) (2)

)

(3)

(0) (1) (2) (3)i i i i i

f f f f

f f f f

f f f f

f f f f

f f f

f

f

f

f f

f

. . . . . . . . . . . . . . . . . . . . .

• Define : ( ) 1ng n f n

• Clearly, g is total.

g

Page 85: Lecture 4: Unsolvable Problems

Theorem 10

The total function problem is totally unsolvable.

Pf)

totally unsolvable not semisolvable

• Assume it is semisolvable.

0 00

1

2

0 0

1 1 1 1

2 2 2 2

3 3 3 3 3

(0)

(1)

(2

0 1 2 3

(1) (2) (3)

(0) (2) (3)

(0) (1) (3)

(0) (1) (2)

)

(3)

(0) (1) (2) (3)i i i i i

f f f f

f f f f

f f f f

f f f f

f f f

f

f

f

f f

f

. . . . . . . . . . . . . . . . . . . . .

• Define : ( ) 1ng n f n

• Clearly, g is total.

g

( ) ( )ig i f i ( ) 1if i

Page 86: Lecture 4: Unsolvable Problems

While programs

TotalFunctions

Theorem 11

There is a total function which is not the associate function of any count program.

Count programs

Page 87: Lecture 4: Unsolvable Problems

Exercises

1. Special halting problem (SHP) and general halting problem (GHP) are defined as follows:

Prove:a) If GHP is not solvable, then SHP is not solvable.b) If SHP is not solvable, then GHP is not solvable.

" ˆ ?"SHP TM

," ?"HP kG TM

Page 88: Lecture 4: Unsolvable Problems

Exercises

2. Special equivalence problem (SE) is defined as:

Show that SE is not solvable.

3. General equivalence problem (GE) is defined as:

Show that GE is not solvable.

" " : registe( ) 1 r fu ion? nctS ggE x

" " : register func) i( t? ong x yGE g

Page 89: Lecture 4: Unsolvable Problems

Exercises

4. Define

Show that MEMBER is not solvable.

: register function

" " : range of ? ff

f

MEMBER R f

z N

z R