- 2071 Chaitra
PDA for aⁿb^(3n)
Short answer
The PDA pushes three A's for each a, then pops one A per b. For abbb, it pushes AAA, then pops three A's, reaching the final state with empty stack, so it is accepted.
Design a PDA that accepts the language L = {aⁿb^(3n) : n ≥ 1}. Test your design for the string abbb. [Printed test string reads "aabbb" in the scan, but the worked trace uses abbb.]
Idea: for each a read, push three A's. Then for every b, pop one A. Accept when the stack is back to Z0.
M = ({q0, q1, qf}, {a, b}, {A, Z0}, δ, q0, Z0, {qf})
| # | Transition | Meaning |
|---|---|---|
| 1 | δ(q0, a, Z0) = {(q0, AAAZ0)} | first a: push 3 A's |
| 2 | δ(q0, a, A) = {(q0, AAAA)} | each further a: push 3 more |
| 3 | δ(q0, b, A) = {(q1, ε)} | first b: pop one A |
| 4 | δ(q1, b, A) = {(q1, ε)} | each b pops one A |
| 5 | δ(q1, ε, Z0) = {(qf, Z0)} | stack empty: accept |
a,Z0/AAAZ0 b,A/ε
a,A/AAAA ↺
↺ b,A/ε
──► (q0) ─────────────► (q1) ──ε,Z0/Z0──► ((qf))
Because rules 3 and 4 are the only moves on b and no move on a exists in q1, all a's come before all b's. Since n ≥ 1, at least one a is read, so the string cannot be empty.
Test for abbb (n = 1)
(q0, abbb, Z0)
⊢ (q0, bbb, AAAZ0) push 3 A's for a
⊢ (q1, bb, AAZ0) b: pop
⊢ (q1, b, AZ0) b: pop
⊢ (q1, ε, Z0) b: pop
⊢ (qf, ε, Z0) accept
abbb is accepted. (The printed string aabbb has 2 a's but only 3 b's; it needs 6 b's, so the machine gets stuck with AAA on the stack and rejects it, which is correct since aabbb ∉ L.)
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- PDA configuration; PDA for a^(3n)b^n · Theory of Computation, chapter 3
- PDA for a^n b^(n+m) c^m · Theory of Computation, chapter 3
- PDA for aⁱbʲcᵏ with i = j + k · Theory of Computation, chapter 3
- PDA for aⁿb^(2n+1) · Theory of Computation, chapter 3
- PDA for palindromes over {a,b} · Theory of Computation, chapter 3
- PDA for wwᴿ; accept abbbba · Theory of Computation, chapter 3
- Construct FSA accepting reverse language · Discrete Structure, chapter 2
- Language of grammar; grammar for strings not ending in ab · Discrete Structure, chapter 2
- Insulator discs per string, 180 MW over 200 km · Transmission and Distribution System Design, chapter 3