Machine-translated by Google. Questions are authored in English.
Top

Discussion

Let \(G_{1}\), \(G_{2}\) be Context Free Grammars (CFGs) and \(R\) be a regular expression. For a grammar \(G\), let \(L(G)\) denote the language generated by \(G\).

Which ONE among the following questions is decidable?

  • A.Is \(L(G_{1}) = L(G_{2})\)?
  • B.Is \(L(G_{1}) \cap L(G_{2}) = \emptyset\)?
  • C.Is \(L(G_{1}) = L(R)\)?
  • D.Is \(L(G_{1}) = \emptyset\)?

Answer: D

The decidable question is: Is \(L(G_{1}) = \emptyset\)?

Emptiness of a context-free grammar is decidable: mark every terminal as generating, then repeatedly mark a variable as generating if some production rewrites it into generating symbols only. The language is empty exactly when the start symbol is never marked. This runs in polynomial time.

The other three are undecidable. Equivalence of two CFGs, emptiness of the intersection of two context-free languages, and whether a CFG generates the same language as a given regular expression (which includes the undecidable question of whether a CFG generates everything, Σ*) are classic undecidable problems, proved by reduction from the Post correspondence problem.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.