Pergunta

Lets consider the class of "simple" LOOP-Programs.

A LOOP-Program P is inducively defined as:

$P_1: x_i = x_j$ and $P_2:x_i = x_i +1$ are LOOP-Programs. We also define a length property $l(P)$ where $l(P_1) = l(P_2) = 1$

P: $P_1;P_2$ is also LOOP. (sequential execution of statements). The length of these programs is $l(P) = l(P_1)+l(P_2)$

P: $LOOP\ \ x_I \ \ DO \ \ P_1 \ \ END $ (execute P a fixed amount of times, this program will execute P exactly $x_i$ times.) The length of this program is $l(P) = l(P_1)+1 $

The input of a LOOP-Program is passed as as $f(n_1 \cdots n_k) \rightarrow x_1 \cdots x_k$ and the output is alsways stored in $x_0$

Lets further consider $S(n)$ the function which computes the maximum value of a simple LOOP-Program of maximum length $n$ with input $n$.

It is known that $S(n)$ is not LOOP-computable. ( can write proof if needed)

The question stands wether $S(n)$ is Turing-computable.

First we can note down the following theorems:

  • a LOOP-Program always halts after a finite amount of steps.

  • a function is turing-computable if a Turingmachine $M$ exists which computes $S(n)$ given the input $n$ after a finite amout of steps.

My solution to the question wether $S(n)$ is turing-computable is:

We construct a TM $M$ which enumerates all LOOP-Programs of length $n$ onto the tape.:

We know this is possible because there is only a finite amount of LOOP-Programs of length $n$ using the variables $x_1 \cdots x_{2n}$. We will use a suitable encoding method which encodes a LOOP-Program syntactically onto the tape.

This step of the algorithm will halt after a finite amount of steps.

Then we simulate the LOOP-Programs on the tape and write the results onto the tape. This step also terminates after a finite amount of steps.

We then have the output of every single LOOP-program of length $n$ with input $n$ on the tape and we know we can find the largest value in a finite amount of steps.

Thus $S(n)$ is computable.


My question is: does my answer hold up and can one poke any holes in this logic ?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top