← RGPV CS-501 Theory of Computation May 2023 Solved Paper
Question
Design a PDA for aⁿb³ⁿ, n≥1.
Asked in: CS-501 | May 2023 | 7(i)
Answer
Use stack bottom Z and marker X. On each a, push three X symbols. On each b, pop one X. Switch irreversibly to the b phase on the first b. Accept only when input is exhausted and Z is exposed in the b phase.
Transitions (input, top → replacement): q0→qA on a,Z→XXXZ; qA→qA on a,X→XXXX; qA→qB on b,X→ε; qB→qB on b,X→ε; qB→qF on ε,Z→Z. All other transitions are undefined. The leftmost replacement symbol is the stack top.
For abbb the stack evolves Z, XXXZ, XXZ, XZ, Z. The machine accepts. For abb the stack still contains X, and for abbbb the extra b cannot be consumed. The initial state requires at least one a. The stack invariant after n a symbols and k b symbols is X^(3n−k)Z.

Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion