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

Discussion

Consider the transition diagram of a PDA given below with input alphabet \(\Sigma = \{a, b\}\) and stack alphabet \(\Gamma = \{X, Z\}\). \(Z\) is the initial stack symbol. Let \(L\) denote the language accepted by the PDA.

PDA with three states. The start state is accepting and loops on a,X/XX and a,Z/XZ; on b,X/epsilon it moves to a second state, which loops on b,X/epsilon and moves on epsilon,Z/Z to a third, accepting state

Which one of the following is TRUE?

  • A.\(L = \{a^{n}b^{n} \mid n \ge 0\}\) and is not accepted by any finite automata
  • B.\(L = \{a^{n} \mid n \ge 0\} \cup \{a^{n}b^{n} \mid n \ge 0\}\) and is not accepted by any deterministic PDA
  • C.\(L\) is not accepted by any Turing machine that halts on every input
  • D.\(L = \{a^{n} \mid n \ge 0\} \cup \{a^{n}b^{n} \mid n \ge 0\}\) and is deterministic context-free

Answer: D

The true statement is \(L = \{a^{n} \mid n \ge 0\} \cup \{a^{n}b^{n} \mid n \ge 0\}\) and is deterministic context-free.

The start state is accepting and pushes one X for each a, so any string of a's alone, including the empty string, ends in an accepting state: that gives \(a^{n}\). On the first b the PDA pops an X and moves to the middle state, which pops one X per further b. When the stack is back to Z it takes the \(\varepsilon\) move to the final accepting state. So a's followed by an equal number of b's are accepted: \(a^{n}b^{n}\).

At every point there is at most one move for each combination of state, input and stack top, and the \(\varepsilon\) move on Z does not compete with any input move on Z. The PDA is deterministic, so \(L\) is deterministic context-free, which rules out the option saying no DPDA accepts it. \(L\) is not just \(\{a^{n}b^{n}\}\), since strings like aa are accepted, and every context-free language is decided by some halting Turing machine.

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

Post your comment

Please log in or register to post a comment.