2

Suppose $L \subseteq \mathbb N$ such that, for the purpose of Turing machine computation, numbers in $L$ are represented by strings over the alphabet $\{0, 1\}$ in the standard binary notation. Prove that $L$ is decidable if and only if $L$ is finite or $L$ is the image of some strictly increasing computable function $f : \mathbb N \to \mathbb N$. Such a function $f$ is strictly increasing if for all $n_1$, $n_2$ $∈$ $\mathbb N$, $n_2$ $>$ $n_1$ implies $f(n_2) > f(n_1)$.

My attempt for the backward direction:

  • $L$ decidable $\impliedby$ $L$ finite.

    If $L$ is finite we can simply check whether an input is in the set of finite words in $L$.

  • $L$ decidable $\impliedby$ $L$ is the image of $f$.

    If $L$ is the image of some strictly increasing computable function there's a 1-1 correspondence between the natural numbers and the words in $L$. Therefore consider a Turing machine where on input $x$, we start incrementing a counter $y$, which is initially at $0$ while $f(y)<x$.

    Once $y$ has finished incrementing, if $f(y)$ equals $x$ we accept else we reject. Since the number $y$ must be finite, the Turing machine always terminates. Therefore $L$ is decidable.

How can I proceed with the forward direction?

John L.
  • 39,205
  • 4
  • 34
  • 93
SVMteamsTool
  • 453
  • 2
  • 13

1 Answers1

2

"If $L$ is the image of some strictly increasing computable function there's a 1-1 correspondence between the natural numbers and the words in $L$". This is a key observation. You might have realized that given $L$, if $L$ is the image of some strictly increasing function $f:\mathbb N\to\mathbb N$, then $f$ is unique, since $f(n)$ must be the $n$-th smallest number in $L$.


Let us try constructing $f$ step by step.

What is $f(0)$? It is the smallest number in $L$.

  1. Is $0$ in $L$? If yes, $f(0)=0$.
  2. Otherwise, is $1$ in $L$? If yes, $f(0)=1$.
  3. Otherwise, is $2$ in $L$? If yes, $f(0)=2$.
  4. And so on.
  5. At last, after finitely many checks, we must get a "yes" since $f(0)$ is a natural number. Set $f(0)$ accordingly.

What is $f(1)$? $f(1)$ is the smallest number in $L$ that is greater than $f(0)$.

  1. Is $f(0) + 1$ in $L$? If yes, $f(1)=f(0)+1$.
  2. Otherwise, is $f(0)+2$ in $L$? If yes, $f(1)=f(0)+2$.
  3. Otherwise, is $f(0)+3$ in $L$? If yes, $f(1)=f(0)+3$.
  4. And so on.
  5. At last, after finitely many checks, we must get a "yes" since $f(1)$ is a natural number. Set $f(1)$ accordingly.

What is $f(2)$? You should be able to see the drill now.
And so on.


In summary, here is how $f(n)$ can be computed, assuming $L$ is infinite and decidable. Let $D$ be a decider for $L$.

  1. Let $result=0$
  2. Repeat:
    1. Apply $D$ to check whether $r\in L$.
    2. If $r\in L$:
      • If $n=0$, return $result$.
      • Decrease $n$ by one.
    3. Increase $result$ by 1.

The case when $L$ is finite is trivial.

John L.
  • 39,205
  • 4
  • 34
  • 93