Friday Jan 25, 2008 * Undecidability using computation histories -- ALL_CFG is undecidable * Post's Correspondence Problem E_CFG = {G: G is a CFG and L(G) = empty} ALL_CFG {G: G is a CFG and L(G) = Sigma^*} E_CFG is decidable. Given G, can determine for each variable whether that variable generates any string. In each iteration, if a variable has a rule such that all of the variables on the right hand side generate a string, then the variable generates a string. Repeat this iteration until no new variable generates a string. If at the end S generates a string, we accept; otherwise, reject. Theorem: ALL_CFG is undecidable. Proof: The same idea as above clearly will not work since we cannot verify whether all strings can be generated. We will show ALL_CFG is undecidable using a reduction from A_TM. What do we need to do? For a given , we will construct a CFG G such that M accepts w iff G generates (or does not generate) Sigma^*. It will be more convenient to show that M accepts w iff G does not generate some string -- which will be the proof of M's acceptance of w. A computation history of M on w is a sequence #C_1#C_2#...#C_k#, where C_1 is the start configuration of M on w -- q_0w, C_i is the ith configuration and yields C_{i+1}, and C_k is an accepting configuration. Instead of constructing a CFG G, we will construct a PDA P, which we can always convert to G. Given a computation history, P needs to do three checks: -- C_1 is the start configuration. This is easy. Since w and q_0 can be both embodied in the states of P. -- C_i yields C_{i+1}. Given the string C_i#C_{i+1}, the PDA pushes the first portion into the stack, and then compares the characters of C_i one by one with C_{i+1}, keeping memory of the last two characters. When it encounters a state, it checks whether the change in C_{i+1} in this portion of the string corresponds to a state change in M. For this to work, C_i should be in reverse order of C_{i+1}. -- C_k is accepting configuration. This is easy. All we need to do is whether the state in the configuration is an accepting state. And check there is no configuration after this. Checking each of these can be done by a deterministic PDA. In fact, checking whether a given computation history (with successive configurations in reverse order) is accepting can be checked with a deterministic PDA. A nondeterministic PDA can choose to accept if any of these are violated. Such a PDA will accept all strings other than the unique accepting computation history. Thus, given M and w, we have a PDA that does not accept the computation history iff M accepts w. ALL_CFG is undecidable End Proof. Question: Is ALL_CFG Turing-recognizable? Question: Is COMP(ALL_CFG) Turing-recognizable? COMP(ALL_CFG) = {G: G is not a CFG or L(G) is not Sigma^*} Theorem: COMP(ALL_CFG) is Turing-recognizable. Proof: Here is a TM that recognizes the language. On input G: 1. If G is not a CFG, accept. 2. Convert G into CNF. 3. Use CNF to generate all strings of length 1, all strings to length 2, ... 4. If at any time, a string of length i not generated, accept. End Proof Corollary: ALL_CFG is not Turing-recognizable.