Search code examples
automatastate-machineformal-languagespushdown-automaton

NPDA with exactly 2 states that might need 3 transitions to final state


enter image description here

Let's say we want to draw the transition graph with two states of a NPDA that accepts that language L. And let's also say that this NPDA will have exactly 2 states. My thinking on this would be to do everything in the first state then use the second state as the grand finale. Like so:

enter image description here

But I'm not sure that the lambda transitions will result in q1 or if there is a better way to do this, which there likely is a better way since I'm trying to teach this to myself. Perhaps someone can get me back on track here?


Solution

  • You almost got it. You just missed the n>=1 requirement, since your current NPDA will also accept "acb". And you don't need (b,4)/5, since stack symbol 5 won't be used anyway.

    So you need another stack symbol between 1 and 2 to denote whether we have seen "b" before "c".

    q0-q0         q0-q1
    (a,Z)/1Z     (b,3)/λ
    (b,1)/2      (b,4)/λ
    (b,2)/2      (b,5)/λ
    (c,2)/3
    (b,3)/4
    (b,4)/5