* Decidable languages * Undecidability * The Halting Problem DECIDABLE PROBLEMS CONCERNING REGULAR AND CF LANGUAGES A_DFA = {: B is a DFA that accepts input string w} Theorem: A_DFA is decidable. Proof: Simply simulate the actions of B on w. Initially the TM is in the start state of B. When TM's head is at a symbol, it follows the transition function of B to determine the next state of B, and moves its head one cell to the right. If the state of B reached at the end is an accept state for B, then TM moves to accept state; otherwise TM moves to reject state. Clearly TM accepts iff B accepts w. Since B always halts, TM always halts, and hence A_DFA is decidable. More details? The description of consists of the description of the 5-tuple of B, followed by w, as a string with appropriate delimiters. The TM for A_DFA uses a marker to keep track of where B is with respect to w. The TM also uses a marker to keep track of the current state of B. On reading the next symbol of w, it goes to the transition function portion of the string and locates the place where the next transition is specified -- by comparing against the current state and the current symbol (note that this may require several back-and-forth steps). Then, it determines the new state, marks it in the state list, moves to the next symbol, and so on. When it has reached the end of the string w (reached a blank symbol), it goes back to the current state, checks whether this state lies in the final accept states of B, and moves to q_a if it is, and q_r otherwise. Question: Does the number of states of TM exceed that of B? End Proof E_DFA = {: A is a DFA and L(A) = empty} Theorem: E_DFA is decidable. Proof: One attempt would be to simulate A on strings in a lexicographic order. A always halts on every string, so will not loop on any string. But if L(A) is really empty, this process would never stop. Another way to solve this problem is to check whether the accept state q_a of A is ever reachable from the start state via a sequence of transitions. This can be done by applying a "transitive closure" of the state transition diagram. We set the start state q_0 to be reachable and include it into a "reachability" set R. Repeatedly, we compute: For every state q that can be reached from a state in R with one transition, add q to R. Repeat the above for n steps, where n is the number of states, or if R does not change. If R ever includes the accept state, then reject -- L(A) is not empty; otherwise accept. End Proof A_CFG = {: G is a CFG that generates w} Theorem: A_CFG is decidable. Proof: Simulating a PDA would not work since if w is not generated, then the PDA may not halt. Neither would an attempt to try all possible rules. We use Chomsky Normal Forms. There is a deterministic way of converting any CFG into CNF. One nice thing about CNFs is that every string of length n that is generated requires exactly 2n-1 applications of rules. The TM for A_CFG enumerates all the at most |R|^{2n-1} possible derivations in a lexicographic order. For each derivation, it checks whether the resulting string equals w. If it is true for any one, then moves to q_a, else moves to q_r. End Proof Theorem: Every CFG is decidable. Proof: The TM for given CFG grammar C takes input string w, runs TM for A_CFG on w and C and accepts if the TM accepts, rejects otherwise. End Proof UNRECOGNIZABILITY Theorem: There exists a Turing-unrecognizable language