GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 13(b)

Explain the PDA stack behavior

Theory of Computation · Pushdown Automata · Full GATE CSE 1998 paper

GATE 1998, Q13(b) Descriptive
Report issue

Pushdown Automata

Question 13(b), GATE 1998: For the displayed PDA on states q0,q1, alphabet {0,1}, stack {Z0,X}, start (q0,Z0), and empty-store acceptance, describe its operation informally. Common transitions: (q0,1,Z0)→(q0,XZ0), (q0,ε,Z0)→(q0,ε), (q0,1,X)→(q0,XX), (q1,1,X)→(q1,ε). GFG has (q0,0,Z0)→(q1,X) and (q1,0,Z0)→(q0,Z0); GateForum instead has (q0,0,X)→(q1,X) and (q0,0,Z0)→(q0,Z0).
Question 13(b), GATE 1998: For the displayed PDA on states q0,q1, alphabet {0,1}, stack {Z0,X}, start (q0,Z0), and empty-store acceptance, describe its operation informally. Common transitions: (q0,1,Z0)→(q0,XZ0), (q0,ε,Z0)→(q0,ε), (q0,1,X)→(q0,XX), (q1,1,X)→(q1,ε). GFG has (q0,0,Z0)→(q1,X) and (q1,0,Z0)→(q0,Z0); GateForum instead has (q0,0,X)→(q1,X) and (q0,0,Z0)→(q0,Z0).
Tap to enlarge
Answer & solution

Answer: See the solution below (no official key was published)

A transition (q,a,T)→(p,γ) consumes a when a≠ε, changes state to p, and replaces the top stack symbol T by γ. Take the leftmost stack symbol as the top. Thus replacing X by XX pushes one extra counter symbol, while replacing X by ε pops one.

In the plausible reconstruction specified in part (a), q0 is a counting-up phase and q1 a counting-down phase. Start with Z0. Each leading 1 pushes one X. A 0 with X on top switches q0→q1 without changing the stack. Each following 1 in q1 pops one X. Once only Z0 remains, another 0 returns to q0 without removing Z0. The machine may process another block in the same way. Only at q0 with top Z0 may ε remove the bottom marker, accepting if input is exhausted.

For reconstructed input 110110, the configurations (state, unread input, stack) are
(q0,110110,Z0)
→(q0,10110,XZ0)
→(q0,0110,XXZ0)
→(q1,110,XXZ0)
→(q1,10,XZ0)
→(q1,0,Z0)
→(q0,ε,Z0)
→(q0,ε,ε).

An extra 1 in the popping phase has no transition once Z0 is reached; too few 1s leave X on top when the closing 0 is encountered, also blocking the run. These restrictions enforce equal positive counts within every block. The four-phase explanation applies only to the explicitly repaired transition set, not literally to both printed versions.

Literal machine the special input 01 instead replaces Z0 by X on its first step, then pops X, so that machine accepts only ε and 01. These observations explain why the attractive counting-machine interpretation cannot be presented without disclosing the source repairs. All unspecified transitions are treated as absent, not guessed.

Original paper, page 7