Is this function computable and total?

198 Views Asked by At

I'm trying to solve this problem, but I'm a bit confused:

\begin{align*} f(x) = \left\{ \begin{array}{l l} \mathrm{1}\ \ \text{ } & \quad \text{if $\exists n:\ M_n(x) \downarrow$}\\ \uparrow & \quad \text{otherwise} \end{array} \right. \end{align*}

My question is if $f$ is computable, total and what is its image. I think that $f$ is computable and total, but I don't know how to prove it.

Thank you

2

There are 2 best solutions below

0
On BEST ANSWER

Your function is the constant function $1$, hence total and computable (by the algorithm "ignore input and print $1$"). The reason is that, for every $x$, there is a Turing machine $M_n$ that halts on input $x$, for example, the machine "ignore input and print $17$".

0
On

You can calculate all the steps of the turing machines in a diagonal manner. So first do the first step of $M_1$, then the second and first step of $M_1$ and $M_2$, then the third, second and first step of $M_1,M_2,M_3$, etc.

Once one of the $M_i$'s halts you return one, otherwise you carry on.

For totality you only have to show that for every $x$ there is a turing machine that halts on that input.