Pushdown Automata


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.