I am attempting to prove the following problem is undecidable. Given a Turing machine $M$ and input $x$, does $M$ visit infinitely many tape cells on input $x$?
I am considering a reduction from the halting problem. Is this the right approach?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityI am attempting to prove the following problem is undecidable. Given a Turing machine $M$ and input $x$, does $M$ visit infinitely many tape cells on input $x$?
I am considering a reduction from the halting problem. Is this the right approach?
Based on my comments, I might as well make this an answer, and let the community decide whether it's right or not.
Suppose you could decide whether a TM visits an infinite number of cells on an input. Here's how to solve the Halting problem given this information:
Halts(TM, input)
1. if the TM visits an infinite number of cells for the input then return false
2. configurations = {}
3. while(true)
4. configurations.add(non-blank tape area, TM head position, state)
5. let the TM execute one step
6. if state is halt accept or halt reject, return true
7. if configurations.contains(non-blank tape area, TM head position, state) then return false
8. loop
This works because, if the TM doesn't visit an infinite number of cells, it visits some finite number of cells, $n$. The number of distinct configurations is therefore $|\Sigma|^n \times n \times |Q|$, and configurations.size()
will never be bigger than this. By the pigeonhole principle, we must satisfy at least condition #7 in a finite number of moves. If none of the reached configurations enters a halting state, we never will; so we have to halt before we see the same configuration twice.
Yes this approach is correct. Try to visit a new blank cell between two computation steps by e.g. using some markers.