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

Discussion

For which context free languages below, we can construct an equivalent PDA with one (1) stack :

(i) \(L = \{a^{n}b^{n}c^{n} / n \ge 1\}\)
(ii) \(L = \{a^{n}b^{n} / n \ge 1\}\)
(iii) \(L = \{a^{n}b^{2n} / n \ge 1\}\)

  • A.(i) and (ii) only
  • B.(ii) and (iii) only
  • C.(i) and (iii) only
  • D.(i), (ii) and (iii) only

Answer: B

A single-stack PDA exists for (ii) and (iii) only.

For \(a^{n}b^{n}\), the PDA pushes a symbol for each a and pops one for each b, accepting when the stack empties as the input ends. For \(a^{n}b^{2n}\), it pushes two symbols for each a (or pops one for every two bs) in the same way. Both are context-free.

\(a^{n}b^{n}c^{n}\) is the standard example of a language that is not context-free: after the stack has been used to match the as against the bs, nothing remains to check the cs. The pumping lemma for context-free languages proves this, so no PDA with one stack accepts it, and options including (i) are wrong.

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

Post your comment

Please log in or register to post a comment.