简体   繁体   中英

Why is this not CFG?

Though this is a repitition of this , I talking in terms of designing a PDA.

Now, I know I'm wrong, because this is a well publicised example, but where did I go wrong in the PDA design below?

I want to accept language {a^nb^nc^n: n>=0}

I push two 1 's on the stack every time I encounter an a , pop one for b and pop one for c and check if I have an empty stack. I defined the transition functions (minimal) as:

(q0, a, Z) = (q0, 11Z)
(q0, a, 1) = (q0, 111)
(q0, b, 1) = (q1, delta)
(q1, c, 1) = (q2, delta)
(q2, delta, Z) = (q-Final, Z) (epsilon move)

Z is empty stack

Doesn't this PDA accept such a language?

Your PDA accepts the language:

{a^n b^i c^j; n >= 0 and i + j = 2n}

Which is not the same as {a^nb^nc^n: n>=0} , a subset of the above language, specifically when i = n and j = n .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM