computation-theoryautomata-theorydecidable

Whether a context free language is deterministic context free language


Let L(G) be the language generated by a context free grammar G. Is the following decision problem decidable ?
Whether L(G) is deterministic context free language ?

I understood why the above problem is undecidable from this link, but I had a doubt.
We know that CFL's and PDA's are equivalent (reference), i.e. for every CFL, G, there is a PDA M such that L(G) = L(M) and vice versa.
A context free language is deterministic if it can be accepted by a DPDA.
A deterministic PDA is one in which there is at most one possible transition from any state based on the current input.

Since we can create a PDA for every CFL and distinguish between PDA's being deterministic or not, could we say that the problem of whether L(G) is deterministic context free language is decidable ? Or am I missing something ?


Solution

  • You are missing something. You say:

    A context free language is deterministic if it can be accepted by a DPDA.

    and

    we can create a PDA for every CFL

    and

    [we can] distinguish between PDA's being deterministic or not

    The problem is that the PDA you get for the CFL might be nondeterministic even if the language is deterministic. While it's true that every deterministic CFL has a DPDA that accepts it, is is NOT true that every deterministic CFL is accepted ONLY by DPDAs. Indeed, every deterministic CFL is accepted by many nondeterministic PDAs... it's not hard to see that any DPDA can be transformed into an equivalent nondeterministic PDA by adding new states and branches that don't lead to accepting anything.