Consider the transition diagram of a PDA given below with input alphabet ∑ = {a, b} and stack alphabet Γ = {X, Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA. Which one of the following is TRUE?
Consider the transition diagram of a PDA given below with input alphabet ∑ = {a, b} and stack alphabet Γ = {X, Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA. Which one of the following is TRUE? Correct Answer L = { a<sup>n</sup>|n ≥ 0} ∪ {a<sup>n</sup>b<sup>n</sup>|n ≥ 0} and is deterministic context-free
Concept:
Acceptance of given string by a push down automata in two ways either by
- Acceptance by final state: if machine at the end of the string enters to one of the final states then string is accepted.
- Acceptance by Empty state: if at the end of the string, stack is empty then string is accepted.
Explanation:
In this PDA, initial state is also the final state it means null string is accepted by the given push down automata (PDA). Consider the states as q1, q2 and q3 where q1 is the final state.
Transition of given PDA are:
1) (q1, a, Z) => (q1, XZ)
2) (q1, a, X) => (q1, XX)
3) (q1, b, X) => (q2, ϵ)
4) (q2, b, X) => (q2, ϵ)
5) (q2, ϵ, Z) => (q3, Z)
First two transition show that after giving input a at transition state remains same. With every input ‘a’ we push X into stack. It means an is always accepted for n>= 0. Transition 3 and 4 shows that for every b input a X is popped out of the stack until stack symbol is Z and string becomes empty. It means ‘b’ occurred same number of times as ‘a’. It represents language of the form {anbn for n>=0 }. It is a DCFL.