6

Can anyone explain why can't we use a Turing machine's transition diagram? For e.g. The definition of a USELESSTM is as follow:

A useless state in a TM is one that is never entered on any input string.

USELESSTM = { ⟨ M, q⟩ ∣ q is a useless state in M }

I know this problem can be proved to be undecidable by reducing ETM to it, but I want to know why can't we do a breadth first search of the Turing machine's state diagram to find states that are unreachable. Then based on whether or not we found any unreachable states, we can say that there are or there are not any useless states.

Raphael
  • 73,212
  • 30
  • 182
  • 400
Shashank
  • 63
  • 4

2 Answers2

7

Your proposed algorithm finds some useless state, but not all of them.

Remember that you have tape content to deal with. Say, for instance, a state is reachable when there's a symbol 2 on the tape. It is reachable in the state graph, but if the TM gets only binary input (and never write a 2 itself) it will never be attained by the machine.

The proof you have tells you that there is no way to fix this.

Note that this problem is similar to detecting dead code; maybe this metaphor works better for you.

Raphael
  • 73,212
  • 30
  • 182
  • 400
2

A state $q$ in a Turing machine $M$ with start state $q_0$ is useless if there exists no input $w$ and no configuration $u_1qau_2$ such that we can reach $u_1qau_2$ when starting in configuration $q_0w$.

Intuitively, to find a useless state, we would need to explore not the finite transition diagram of $M$ but all possible computations of $M$ that begin with a starting configuration $q_0w$.

More precisely, we can reduce the emptiness problem for Turing machines to that of asking if a given state is useless. To do this, given a machine description $\langle M \rangle$, we simply ask if the state $q_{\mathrm{accept}}$ is useless for $M$. This is the case iff $L(M) = \emptyset$. Since the emptiness problem is not Turing-recognizable, neither is the useless-state problem.

Hans Hüttel
  • 2,536
  • 11
  • 17