An undecidable problem and a non-semidecidable one

computabilitycomputational mathematicscomputer sciencedecidabilitylogic

Prove that the decision problem "Does $f$ match this behaviour?" is undecidable (assume the behaviour is nontrivial) and that the problem "Is $h(x)$ undefined?" is not semi-decidable without using any reductions.

I'm not sure how to go about doing this. I think I may need to arrive at a contradiction by assuming that the problems are decidable (i.e. there is an algorithm for it that exactly determines when $f$ matches the given behaviour and otherwise outputs "no" or false) and semi-decidable (i.e. there is an algorithm for it that exactly determines when $f$ matches the given behaviour and otherwise outputs "no" or is undefined) respectively. It makes sense that the problem "Does $f$ match this behaviour" is undecidable because it is even more general than the Halting problem, which I know how to prove is undecidable. For the proof, I think it might be similar to the proof that the Halting problem is undecidable.

To show that "Is $h(x)$ undefined?" is not semi-decidable, it also seems similar to the halting problem as no algorithm can determine whether $h(x)$ is undefined; $h(x)$ may loop forever. However, I do not believe this justification is good enough.

Best Answer

For the first question, I'll give a proof with about the same level of rigor as the notion of "behavior" of a computable function. Without a slightly firmer definition, there's not much more to be done. Indeed, as Noah pointed out in the comments, for sufficiently loose definitions of "behavior", the theorem becomes false. This sounds like rice's theorem, and so I will basically reproduce a proof of that.

As you've noticed, behavior is a more general condition than halting. So we want to imitate the proof that $\mathsf{Halts}$ is undecidable and see what happens. The biggest issue is that we cannot directly plug our function into itself for a contradiction. We will need the following fact:

Enumerate the turing machines as $\mathsf{TM}_n$. For every computable $Q(x,y)$, there is an $e$ so that $\mathsf{TM}_e(y) = Q(e,y)$.

That is, the $e$th turing machine is the same as $Q(e,-)$. This theorem is commonly used in diagonalization arguments with turing machines, and it's a good one to have in your back pocket.


Let $f$ be a computable function, and $b$ be a behavior that we want it to have. We claim there is no function $B$ so that $B(f) = 1$ if and only if $f$ behaves like $b$.

Indeed, towards a contradiction say $B$ exists. We will assume the behavior is nontrivial. That is, we can find functions $f$ and $g$ which do, and don't, satisfy the behavior. Then we can define a new function $\mathsf{UhOh}$ as follows:

$$\mathsf{UhOh}(x,y) = \begin{cases} g(y) & B(\mathsf{TM}_x) \\ f(y) & \lnot B(\mathsf{TM_x}) \end{cases}$$

Note, as in the solution to the halting problem, that $\mathsf{UhOh}$ does the opposite of its input. That is, $$B(\mathsf{UhOh}(x,-)) \iff \lnot B(\mathsf{TM}_x).$$

Do you see contradiction around the bend? Let's use the theorem cited above! We know there is some $e$ so that $\mathsf{TM}_e(y) = \mathsf{UhOh}(e,y)$. Now, we ask the question: $B(\mathsf{TM_e})$?

$$B(\mathsf{TM_e}) \iff B(\mathsf{UhOh}(e,-)) \iff \lnot B(\mathsf{TM}_e)$$

UhOh indeed.


Thankfully, the second question is much easier. We want to know that "$h(x)$ is undefined" is not a semidecidable thing to check.

Recall that "$h(x)$ is defined" is a semidecidable thing to check. This is because if $h(x)$ is defined, then its computation will halt in say, $N$ steps. Then by waiting long enough we can check that $h(x)$ is defined.

Now we remember the following fact: Whenever $P$ and $\lnot P$ are semidecidable, they must both be decidable. This is because we can run our semideciders for $P$ and $\lnot P$ in parallel, and we know that one of them will give us an answer. But once we've answered, one, we've answered both!

So if "$h(x)$ is undefined" were semidecidable, then "$h(x)$ is defined" would be decidable. But this is obviously false (cf. the halting problem).

(Notice that while we contradict by using the halting problem, this is not a reduction to $\mathsf{Halts}$.)


I hope this helps ^_^