- 2074 Asoj
PDA for aⁿb^(2n+1)
Short answer
Push two A's per a. On first b, transition without popping (the +1). Then pop one A per remaining b. For aabbbbb, n=2 pushes 4 A's, skips one b, pops 4 A's, accepted.
Design a PDA that accepts L = {aⁿb^(2n+1), n ≥ 0}. Check it for aabbbbb.
L = { aⁿ b^(2n+1) : n ≥ 0 }.
Idea: push two A's for each a. After the a's, read one extra b without popping, then pop one A for each remaining b. Accept when the stack shows Z0.
M = ({q0, q1, qf}, {a, b}, {A, Z0}, δ, q0, Z0, {qf})
| # | Transition | Meaning |
|---|---|---|
| 1 | δ(q0, a, Z0) = {(q0, AAZ0)} | push 2 A's |
| 2 | δ(q0, a, A) = {(q0, AAA)} | push 2 more A's |
| 3 | δ(q0, b, Z0) = {(q1, Z0)} | the "+1" b (also case n = 0) |
| 4 | δ(q0, b, A) = {(q1, A)} | the "+1" b, stack unchanged |
| 5 | δ(q1, b, A) = {(q1, ε)} | each b pops one A |
| 6 | δ(q1, ε, Z0) = {(qf, Z0)} | accept |
a,Z0/AAZ0 b,Z0/Z0 b,A/ε
a,A/AAA b,A/A ↺
↺
──► (q0) ────────────────► (q1) ──ε,Z0/Z0──► ((qf))
For n = 0 the machine reads just "b": q0 → q1 → qf. For other strings the extra b is read once, then the number of remaining b's must equal 2n.
Check aabbbbb (n = 2, 5 b's)
(q0, aabbbbb, Z0)
⊢ (q0, abbbbb, AAZ0)
⊢ (q0, bbbbb, AAAAZ0) after both a's: 4 A's
⊢ (q1, bbbb, AAAAZ0) extra b, no pop
⊢ (q1, bbb, AAAZ0)
⊢ (q1, bb, AAZ0)
⊢ (q1, b, AZ0)
⊢ (q1, ε, Z0)
⊢ (qf, ε, Z0) accept
aabbbbb is accepted (2 a's, 5 = 2·2 + 1 b's).
✓ 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ⁿb^(3n) · 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 palindromes over {a,b} · Theory of Computation, chapter 3
- PDA for wwᴿ; accept abbbba · Theory of Computation, chapter 3
- Journal bearing design with film thickness check · Machine Design I, chapter 7
- Short note: check list methodology · Information System, chapter 5
- Check column 600x400 with 8-28 mm bars · Design of RCC Structure, chapter 10
- Footing with load transfer check, 1000 kN · Design of RCC Structure, chapter 11