2

For a fixed $k\geq 0$, let $X_k = \{\langle M\rangle\mid |L(M)|=k\}$, where $\langle M\rangle$ is the encoding of a Turing machine $M$ and $L(M)$ is the language $M$ accepts. Is $X_k$ recursive, recursively enumerable or neither?

I think $X_k$ is NOT recursively enumerable because even if you generate every possible string, and test each one, if you find $k$ strings that M accepts, you still have to check every other string (in case $M$ accepts more than $k$ strings), which means your machine will loop indefinitely, and never find a yes-instance. However I'm not sure how you would show this, initially I thought I could reduce the NHP (Not Halting Problem) to L but that didn't go too well. Any ideas?

David Richerby
  • 81,689
  • 26
  • 141
  • 235
user50777
  • 21
  • 1
  • 2

2 Answers2

1

Hint: to decide whether $M$ halts on input $w$, consider a new machine $M'$ that rejects every input except $w$ and simulates $M$, otherwise. That's not quite the answer but it should get you close enough.

David Richerby
  • 81,689
  • 26
  • 141
  • 235
0

Please see a related question. Proving a language is neither Recursively Enumerable nor co-Recursively Enumerable

Though the question talks about $|L(M)| = 1$ the solution is general enough for any $|L(M)|$.

We can show $L_u \leq X_k$ as following. We reduce $\langle M,w\rangle$ to a Turing machine $M'$ as follows: $M'$ rejects all inputs other than $w$ and some other $k-1$ distinct strings. $M'$ accepts the other $k-1$ distinct strings as mentioned before. If the input is $w$ then it runs as Turing Machine $M$ on $w$. This gives us $\langle M,w\rangle \in L_u$ iff $M' = f(\langle M,w\rangle) \in L$.

In fact we can prove that $X_k$ is neither RE nor co-RE. This can be done by taking $k$ other distinct strings than $w$ in the above reduction.

Sarvottamananda
  • 4,817
  • 1
  • 13
  • 19