简体   繁体   English

为什么不是CFG?

[英]Why is this not CFG?

Though this is a repitition of this , I talking in terms of designing a PDA. 尽管这是重新定义, 我还是在设计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? 现在,我知道我错了,因为这是一个广为人知的示例,但是下面的PDA设计在哪里出错呢?

I want to accept language {a^nb^nc^n: n>=0} 我想接受语言{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. 每次遇到a ,我将两个1推入堆栈,将b弹出一个,将c弹出一个,然后检查是否有空堆栈。 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? 此PDA不接受这种语言吗?

Your PDA accepts the language: 您的PDA接受以下语言:

{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 . 与上述语言的子集{a^nb^nc^n: n>=0} ,特别是当i = nj = n

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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