I have been working on this problem for few hours, but haven't been able to come up with a solution : Is the following problem decidable? Given a TM M, whether there is a w such that M enters each of its states during the computation on w.
I tried to use reduction to show that it's not, but couldn't come up with anything. I also thought in the direction that it's decidable, but there wasn't any finite number of configuration from which I could give the time bound.
Any help will be appreciated.
No, it isn't decidable. I think that probably follows from Rice's theorem, but it's possible to build a proof without it.
Shannon proves that for every Turing machine there is a two-state Turing machine which simulates it. By adding a couple of characters to the alphabet and a couple of setup states which guarantee that they will be on the tape, we can ensure that the two "core" states are both visited before the calculation proper begins. We can then add a "Halt" state and replace halt transitions in the "core" two-state machine with transitions to the "Halt" state. Thus our constructed machine visits each of its states iff the original machine halts.
Suppose that we can decide whether there exists an input $w$ on which a TM $M$ halts. Then we can decide the halting problem: given TM $M'$ and input $w'$ and asked whether $M'$ halts on input $w'$ we can build a machine $M$ which discards its input, sets up $w'$ on the tape, and simulates $M'$.