I'm struggling to understand the notation of push down automata's when pushing and popping items on and off of stacks.
I understand that the stack must be empty for the string to be accepted.
Here is my PDA:
If I create a transition diagram for say input 0011 i would do it like this:
State Input Stack
q0 0011 ɛ
q0 011 0
q0 11 00
q0 1 100
q0 ɛ 1100
Since the input is empty and the stack is not empty, this is not accepted?
So if i put input like well thats the thing... I'm pretty sure this is wrong because if i put any string into the PDA it won't accept.
I guess to sum up my actual question, is the notation for the first non-terminal (0,ɛ/0)(1,ɛ\1) Does this mean to under input 0 add 0 to the stack (same for input 1, doing the opposite)?
For the second terminal does it mean under... Well this is what is confusing me (do i take strings out of the stack or the input?) I imagine i have to remove items from the stack?
So does this mean the language accepted by this PDA is the empty set? If not can you explain where i'm going wrong?
答案 0 :(得分:0)
有不同的约定,但有一个共同的约定是你接受:
实际上,您可以使用这些规则的多个子集,并使用其他规则集,并获得也适用于无上下文语言的系统。机器在这些系统中会有不同的解释,但表达能力是相同的。
正如Welbog指出的那样,假设上面的三点系统,这个PDA接受字母{0, 1}
上的偶数长度的回文语言。让我们谈谈每个州的所作所为。
q0
读取0
或1
并分别将0
或1
推送到堆栈上,一遍又一遍如你所愿。如果您读取字符串x
,则将字符串x
推入堆栈。
q1
读取0
或1
,如果您在堆栈顶部有符号,则将其弹出,只要您想要一次又一次地获取。如果您阅读字符串x
,则会从堆栈中弹出x^R
。
如果我们使q1
成为接受状态,并且在输入用完时要求堆栈为空,则表示:
x^R
内读取了x
,我们会弹出q1
。x^R
中阅读x^R
,则堆栈包含q0
。x^R
然后x
并接受,因此我们只接受x^R x
等字符串,即偶数长度的回文q0
|x|/2
个输入符号,过渡到q1
并阅读剩下的|x|/2
。由于PDA是不确定的,这足以说明字符串被接受了。