In: Computer Science
Prove that finding whether there are any states which will never be entered on any given input is decidable in the case of a PDA, and, undecidable in case of a Turing machine.
Finding whether are any state in PDA which will never enter is a decidable problem because given the PDA with states and transition functions, there exist a deterministic algorithm to decide whether a particular state will be ever visited or not using following algorithm :-
1. Given the PDA with set of states Q and set of transitions functions , we can represent it as graph with set of states Q will be set of vertices and set of transitions of the form as the edge set.
2. Now to test whether any state q is every reachable in PDA, we have to check set of all possible path from state state to state q and what are the input requirement to reach at that state through a particular path.
3. Although there may be infinite number of path because of loops, still testing for reachability condition without going though loop will be sufficient to decide reachability of a particular state.
Since with finite numbers of trails, we can determine the reachability of state in PDA, hence this problem is decidable in PDA.
Same problem is undecidable in case of TM because if it were decidable that which state will be ever reachable and which state is not reachable, we could have solved halting problem which is one of the undecidable problem by performing below reduction.
Given the input <M,w> and we want to test whether M halts on w or not, we can create TM M1 which on input x performs as follows:-
1. If x != w, then go to state qreject and reject the input and halt.
2. If x = w, then M1 will perform exactly a M on w.
Hence now if we are able to know whether M1 ever reach to any of the halting state other than qreject will help to determine whether M halts on w on not, because M1 will go to any other state than qreject only on input w and if M1 go to some halting state on input x = w, this means M will also halt on w and hence we can decide whether <M,w> belongs to halting instance or not.
However since halting problem is undecidable and reducible to the problem of testing whether there is some state which is ever reachable or not in TM, hence this problem is also undecidable.
Please comment for any clarification.