Question

Consider the pushdown automaton (PDA) P below, which runs on the input alphabet {a,b}\{a, b\}, has stack alphabet {⊥,A}\{\bot, A\}, and has three states {s,p,q}\{s, p, q\}, with ss being the start state. A transition from state uu to state vv, labelled c/X/γc/X/\gamma, where cc is an input symbol or ϵ\epsilon, XX is a stack symbol, and γ\gamma is a string of stack symbols, represents the fact that in state uu, the PDA can read cc from the input, with XX on the top of its stack, pop XX from the stack, push in the string γ\gamma on the stack, and go to state vv. In the initial configuration, the stack has only the symbol ⊥\bot in it. The PDA accepts by empty stack.

Pushdown automaton P with states {s, p, q}, start state s, self-loop on s for a/bottom/A bottom and a/A/AA, transition s->p on b/A/epsilon, self-loop on p for b/A/epsilon, transitions s->q and p->q on epsilon/A/epsilon, and self-loop on q for epsilon/A/epsilon and epsilon/bottom/epsilon.

Which one of the following options correctly describes the language accepted by P?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2023 answer key

Solution

Trace stack pushes and pops for inputs aa and bb to determine the condition for empty-stack acceptance.

  1. The start state is ss with initial stack ⊥\bot.
  2. On reading input aa:
    • First aa: transition a/⊥/A⊥a/\bot/A\bot pushes AA on top of ⊥\bot.
    • Subsequent aa's: self-loop a/A/AAa/A/AA pushes another AA for each aa.
      So after reading ama^m (m≥1m \ge 1), the stack contains Am⊥A^m \bot.
  3. On reading input bb:
    • The PDA moves from ss to state pp via b/A/ϵb/A/\epsilon (consuming one bb and popping one AA).
    • Further bb's loop at pp via b/A/ϵb/A/\epsilon, each consuming a bb and popping an AA.
      So after reading bnb^n, the stack contains Am−n⊥A^{m-n} \bot.
  4. To reach empty stack:
    • From ss or pp, the PDA transitions on ϵ/A/ϵ\epsilon/A/\epsilon to state qq (requiring at least one AA to be left on the stack when switching to qq, meaning m>nm > n).
    • At state qq, the PDA pops all remaining AA's via ϵ/A/ϵ\epsilon/A/\epsilon and finally pops ⊥\bot via ϵ/⊥/ϵ\epsilon/\bot/\epsilon, leaving the stack empty.
  5. Therefore, the PDA requires at least one aa (m≥1m \ge 1) and strictly fewer bb's than aa's (n<mn < m).

Thus, L={ambn∣1≤m and n<m}L = \{a^m b^n \mid 1 \le m \text{ and } n < m\}.

Final answer

Option (A)

Common trap

Allowing n=mn = m, which prevents the ϵ/A/ϵ\epsilon/A/\epsilon transition to qq because no AA would remain to trigger it.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2023 Computer Science and Information Technology (CS)
Question
40 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.