Is this modified characteristic function computable?

112 Views Asked by At

Let $P(n,k)$ be decidable and define

$$f(n)=\begin{cases}1&\text{if there are exactly two }k\text{ with }P(n,k),\\ \text{undefined}&\text{otherwise}.\end{cases}$$

I wonder if this function is computable, not matter what the defining $P$ is. It does not really make sense conceptually for me if it would be as no program could ever decide when to stop searching after having found two solutions to verify that there is no third.

I tried to reduce this to the existence of a decidable $P(n,k)$ such that $\exists k P(n,k)$ is undecidable. It is easy to construct a decidable $P'(n,k)$ such that $P'(n,k)$ has exactly two solutions $k$ if and only if $P(n,k)$ has at least one solution $k$ but computability of $f$ does not immediately yield decidability of $P'$ and hence a contradiction as we have this undefined clause.

2

There are 2 best solutions below

0
On BEST ANSWER

In general no. For example, consider the relation $P(n,k)$ defined by "$k=0$ or $k=1$ or $n$ has entered the halting problem by stage $k$." Then $f^{-1}(1)$ defines the complement of the halting problem; since that isn't computably enumerable, $f$ can't be (partial) computable as the partial computable preimage of a c.e. set is always c.e.

0
On

This is certainly not true in general.

Let $P(n, k)$ be the statement "Either $k = 0$, $k = 1$, or $n$ is the Godel number of a pair $(T, s)$, where $T$ is a Turing machine, $s$ is a string, and $T$ halts when given input $s$ in at most $k$ steps."

Clearly, $P(n, k)$ is decidable. Note that $P(n, 0)$ and $P(n, 1)$ always hold.

Note that for $n$ the Godel number of $(T, s)$, there is other $k > 1$ such that $P(n, k)$ holds if, and only if, $T$ called on input $s$ eventually halts.

If we had such an $f$, we could semi-decide whether $T$ runs forever when called on input $s$. But this is well-known not to be semidecidable.