There are problems a computer can't solve?

What is the decidability of the following problem?

Given input A A , which is an algorithm, determine whether it is true that " A A does not halt for any input".

To be more formal, let { a n } n = 0 \{a_n\}_{n=0}^\infty be a (computable) enumeration of all algorithms. Which of the options best describes the set { n : n N there doesn’t exist $x$ such that $a_n$ halts on input $x$ } \{n : n \in \mathbb{N} \wedge \text{there doesn't exist \$x\$ such that \$a\_n\$ halts on input \$x\$}\} ?

Details

  • The set of natural numbers is the set of non-negative integers, i.e. { 0 , 1 , 2 , 3 , } \{0,1,2,3,\ldots\} .
  • A subset of natural numbers L L is decidable if there is an algorithm, such that, when it receives input n n , it halts with output 1 1 if n L n \in L and halts with output 0 0 otherwise.
  • A subset of natural numbers L L is semi-decidable if there is an algorithm, such that, when it receives input n n , it halts if n L n \in L and doesn't halt otherwise.
Not decidable, semi-decidable Decidable, not semi-decidable Decidable, semi-decidable Not decidable, not semi-decidable

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Ivan Koswara
Oct 14, 2015

Let S S be the set described in the problem. If L L is a subset of natural numbers, denote its complement by L c L^c . Note the trivial identity ( L c ) c = L (L^c)^c = L .

If L L is a subset of natural numbers, we have the following results:

  1. S c S^c is semi-decidable but not decidable.
  2. If L L is decidable then L L is semi-decidable.
  3. If L , L c L, L^c are semi-decidable then L L is decidable.

We will first show that these results are sufficient.

Using Result 1, we know that S c S^c is semi-decidable, but not decidable. Using Result 3 with L = S c L = S^c , since S c S^c is not decidable, "both S c , ( S c ) c = S S^c, (S^c)^c = S are semi-decidable" must be wrong, so one of them must be not semi-decidable. However, S c S^c is semi-decidable, so the only option is for S S to be not semi-decidable. Using Result 2, since S S is not semi-decidable, S S is not decidable either. This gives the answer not decidable, not semi-decidable .

We will now prove the individual results. Before that, we have a few conventions, however.

  • We assume that the input to an algorithm is a natural number. (More commonly this input is a binary string, but simply tack on a 1 1 at the front and interpret it as a binary number (and subtract by 1 1 if you start counting from 0 0 ) to make it a natural number.)
  • Running an algorithm A A on input x x will be written as A ( x ) A(x) .
  • An algorithm A A decides a set L L if for every natural number x x , A ( x ) A(x) halts and outputs "yes" (or 1 1 ) if x L x \in L , while A ( x ) A(x) halts and outputs "no" (or 0 0 ) if x ∉ L x \not\in L . Note that there exists an algorithm that decides L L if and only if L L is decidable.
  • Likewise, an algorithm A A semi-decides a set L L if for every natural number x x , A ( x ) A(x) halts if x L x \in L (we don't care about the output), while A ( x ) A(x) doesn't halt if x ∉ L x \not\in L (and clearly cannot output anything). Note that there exists an algorithm that semi-decides L L if and only if L L is semi-decidable.

Result 1 : S c S^c is semi-decidable but not decidable.

To prove this, we return back to the algorithmic definition. Suppose A A is an algorithm, and we want to check whether A S c A \in S^c .

Checking that S c S^c is semi-decidable is quite simple. We require that for some input x x , A ( x ) A(x) halts. Thus we can simply simulate all the inputs; if any of them halts, we're done. The problem, however, lies in how we simulate them: if we simulate the input one by one, if we get to a non-halting input we can never know whether to stop simulating or to decide to move to the next input, while if we simulate all inputs simultaneously, this requires infinite memory.

A simple approach is thus to simulate A A on inputs 1 , 2 , , N 1, 2, \ldots, N for N N steps each; if none of them halts, increase N N and redo the whole thing. This guarantees that we will sooner or later stumble on a halting simulation, if there is any: if A A halts on input p p for q q steps, then when we arrive at N = max { p , q } N = \max \{p,q\} , we will find that one of our simulations halts and thus we get A S c A \in S^c . If A A never halts for any input, then no simulation will halt before N N steps for any N N , so A A will keep running by increasing N N larger and larger.

Proving that S c S^c is not decidable is similar to proving that halting problem is not decidable. Suppose there exists an algorithm B B that decides S c S^c . Construct an algorithm C C as follows:

  • Run B B with input C C .
  • If the result is "yes", then loop forever. If the result is "no", then halt.

Note that C C ignores the input, thus there are only two possible cases:

  • B ( C ) B(C) gives answer "yes". Since C C ignores its output, this means C C halts. But then C C will loop forever from the second step, contradiction.
  • B ( C ) B(C) gives answer "no". Again, since C C ignores its output, this means C C runs forever. But then C C will halt from the second step, contradiction as well.

This implies a contradiction, so such algorithm B B cannot exist. S c S^c is not decidable after all.

Result 2 : If L L is decidable then L L is semi-decidable.

Suppose an algorithm A A decides L L . Then construct algorithm B B simply by running A A (on the same input), and if the answer is "no", continuing by looping forever. This algorithm can be easily seen to semi-decide L L . If x L x \in L , A ( x ) A(x) returns "yes" and thus B ( x ) B(x) halts, while if x ∉ L x \not\in L , A ( x ) A(x) returns "no" and thus B ( x ) B(x) doesn't halt. Since there is an algorithm that semi-decides L L , this proves that L L is semi-decidable.

Result 3 : If L , L c L, L^c are semi-decidable then L L is decidable.

Since L , L c L, L^c are semi-decidable, there exist algorithms A , A A, A' where A A semi-decides L L and A A' semi-decides L c L^c . Now construct an algorithm B B that simulates both A A and A A' (on the same input given to B B ) together, one step by one step, alternately. (That is, for input x x to B B , run one step of A ( x ) A(x) , then one step of A ( x ) A'(x) , then another step of A ( x ) A(x) , then another step of A ( x ) A'(x) , and so on; both are run in separate "environments", of course.) When a simulation halts, note which of A ( x ) , A ( x ) A(x), A'(x) is the one that halts; if it's A ( x ) A(x) , then return "yes", otherwise return "no". Suppose x L x \in L . Then, since A A semi-decides L L and x L x \in L , we know that A ( x ) A(x) will halt. Likewise, since A A' semi-decides L c L^c and x ∉ L c x \not\in L^c , we know A ( x ) A'(x) will not halt. Thus B ( x ) B(x) will eventually halt (since it simulates A ( x ) A(x) wholly), and when it halts, it will return "yes" (since it's A ( x ) A(x) and not A c ( x ) A^c(x) that halts). A similar conclusion can be obtained when x ∉ L x \not\in L . This proves that B B decides L L , which means L L is decidable.

Since we have proven the three requisite results, the proof is now complete.

Moderator note:

Good explanation of these important results in halting theory.

When I first saw them, it took me a while to wrap my head around what is happening and why. Can you explain what the difference is between semi-decidable and decidable?

Good explanation of these important results in halting theory.

When I first saw them, it took me a while to wrap my head around what is happening and why. Can you explain what the difference is between semi-decidable and decidable?

Calvin Lin Staff - 5 years, 8 months ago

Log in to reply

Decidability means you can tell whether the input is in the language or not. Semi-decidability means you can tell if the input is in the language, but you can never be sure if the input is not.

If you have an algorithm that decides a language, it will halt no matter whether the input is in the language or not (with different outputs, of course). Thus you can just run it with a given input until it halts; this is guaranteed to happen, although you may never know when.

On the other hand, if you have an algorithm that semi-decides a language, it will halt precisely if the input is in the language. The problem is that you have only finite time. If you try running it with a given input and it halts, then it's good, you know it's in the language. However, if it doesn't halt up to a given time, you can't be sure whether that's because the algorithm indeed will never halt, or it simply will halt but at a later time. You can try continuing it, but you must again stop it at some point, because you have finite time.

Semi-decidability is a quite difficult concept.

Ivan Koswara - 5 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...