Please solve this question Prove that it is possible to writ

Please solve this question.

Prove that it is possible to write a program P which: takes as input M, a java program runs forever, and prints out strings to the console for every x, if M(x) halts, then P(M) eventually prints out x for every x, if M(x) does NOT halt, then P(M) never prints out x

Solution

Starting out, Let S = {}

for i = 1 to infinity:

Let N_i = a new machine loaded with program M and input i

S = S +(N_i)

simulate every machine in S for 1 cycle

forall N_x in S that has halted:

print out x

remove N_x from S

Consider any x, such that M(x) halt after n steps.

For some k, at stage k, M(x) is added to S.

At stage k+n+1, M(x) halts and x is then printed out.

For any x where M(x) does not halt, x is never printed out.

Please solve this question. Prove that it is possible to write a program P which: takes as input M, a java program runs forever, and prints out strings to the c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site