Pushdown Automata (PDA)

userNew picture userNew · Mar 13, 2015 · Viewed 11.8k times · Source

I'm trying to write a pda pushdown automata that accept a^2n b^n, n>0 but I'm not sure if the last part is correct

(p0, a, z0) = (p0, az0)
(p0, a, a) = (p0, aa)
(p0, b, a) = (p1, λ)
(p1, λ, b) = (p2, λ)   <=
(p2, 0, b) = (p1, λ)  <=
(p2, λ, z0) = (p3, λ)  <=

Answer

Omkar Pathak picture Omkar Pathak · Nov 25, 2016

As far as your answer is concerned, in your first two steps you are pushing a's in only one step. With the current design the machine would accept aaabb which is not in the form a^2nb^n. So it's better to divide it in two states separately. According to me the right answer might be something like:

  1. (p0, a, z0) = (p0, az0)
  2. (p0, a, a) = (p1, aa)
  3. (p1, a, a) = (p0, aa)
  4. (p1, b, a) = (p2, λ)