Question:

Consider the pushdown automaton (PDA) \(P\) over input alphabet \(\{a,b\}\) and stack alphabet \(\{\perp, A\}\) with start state \(s\) and acceptance by empty stack.
The transition sketch shows:
- In \(s\) on each \(a\) it pushes one \(A\) (i.e., \(a/\perp \to A\perp\) and \(a/A \to AA\)).
- On the first \(b\) it goes to \(p\) with \(b/A \to \epsilon\) and stays in \(p\) popping one \(A\) per \(b\) (\(b/A \to \epsilon\)).
- From \(p\) it may go to \(q\) by \(\epsilon/A \to \epsilon\), and in \(q\) it can keep popping \(A\)’s and finally pop \(\perp\) by \(\epsilon/\perp \to \epsilon\).
Question: Which option describes \(L(P)\)? IMAGE8

Show Hint

For PDAs that accept by empty stack, check where} the $\epsilon/\perp$ pop is available. If reaching that state requires a nonempty stack (e.g., an $\epsilon/A$ edge), equal counts (here $n=m$) often get blocked from emptying the stack.
Updated On: Aug 26, 2025
  • $\{a^m b^n \mid 1 \le m \text{ and } n<m\}$
  • $\{a^m b^n \mid 0 \le n \le m\}$
  • $\{a^m b^n \mid 0 \le m \text{ and } 0 \le n\}$
  • $\{a^m \mid 0 \le m\} \;\cup\; \{b^n \mid 0 \le n\}$
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Effect of the $a$-loop at $s$.
While reading $a$’s in state $s$, the PDA pushes exactly one $A$ per $a$ ($a/\perp \mapsto A\perp$ and $a/A \mapsto AA$).
Hence, after $m \ge 1$ $a$’s, the stack is $A^m\perp$.

Step 2: Switching to $b$’s and popping in $p$.
On the first $b$, the PDA must move $s \to p$ with $b/A \mapsto \epsilon$, and in $p$ it keeps popping one $A$ per $b$ ($b/A \mapsto \epsilon$).
Thus after reading $n$ $b$’s in $p$, $n$ $A$’s are popped, leaving $A^{m-n}\perp$.

Step 3: Empty-stack acceptance via $q$.
From $p$ there is an $\epsilon$-move that requires an $A$ on top: $\epsilon/A \mapsto \epsilon$ to enter $q$, and in $q$ the PDA can pop the remaining $A$’s and finally pop $\perp$ by $\epsilon/\perp \mapsto \epsilon$, achieving empty stack.
Therefore the PDA can accept only if after consuming the input we still have at least one $A$ left (so we can take the $\epsilon/A$ move to $q$), i.e., when $m-n \ge 1 \;\Rightarrow\; n < m$.

Step 4: Excluding the boundary cases.
If $n=m$, then after all $b$’s the stack is just $\perp$; there is no $\epsilon/\perp$ transition from $p$ to empty the stack, because the move to $q$ needs an $A$ on top. Hence $n=m$ is rejected.
If $n > m$, at some $b$ the top is $\perp$ and $b/\perp$ is undefined, so the input is rejected.

Hence the language is exactly:
\[ L(P)=\{\,a^m b^n \mid 1 \le m \text{ and } n<m\,\}, \] which matches option (A).

\[ \boxed{L(P)=\{a^m b^n \mid 1 \le m,\; n<m\}} \]
Was this answer helpful?
0
0

Questions Asked in GATE CS exam

View More Questions