简体   繁体   English

我可以将两个符号推入下推自动机的堆栈吗?

[英]can i push two symbols to the stack of a pushdown automata?

I would like to know if for a given pushdown automata, where the initial symbol or Z0 is y, can i stack two Xs when i read 'a' from chain of strings during a transition?我想知道对于给定的下推自动机,初始符号或 Z0 是 y,当我在转换期间从字符串链中读取“a”时,是否可以堆叠两个 X?

Say that i have a transition function as it follows: (s1, a, y) -> (s2, e, xxy).假设我有一个过渡 function,如下所示:(s1,a,y)->(s2,e,xxy)。 Is such transition valid?这样的过渡有效吗? Here's a paint image for better understanding in-case it's still not clear.这是一个油漆图像,可以更好地理解,以防它仍然不清楚。

在此处输入图像描述

where Z0 = Y其中 Z0 = Y

This is really a question of how you're defining PDAs - what conventions do you choose to use.这实际上是您如何定义 PDA 的问题——您选择使用什么约定。 Typically, I think the convention is that one transition pushes one symbol.通常,我认为惯例是一个过渡推动一个符号。 However, allowing arbitrary strings to be pushed adds no power to the PDA model (although it can reduce the number of required states).但是,允许推送任意字符串不会增加 PDA model 的功率(尽管它可以减少所需状态的数量)。 To see this, take any PDA that pushes strings of length greater than one onto the stack.要了解这一点,请使用任何将长度大于 1 的字符串压入堆栈的 PDA。 This PDA can be transformed into a PDA that pushes strings of length at most one onto the stack by introducing additional states with empty/lambda/epsilon transitions to push one symbol at a time.通过引入具有空/lambda/epsilon 转换的附加状态以一次推送一个符号,可以将此 PDA 转换为将长度最多为一个的字符串推送到堆栈上的 PDA。 This doesn't even turn DPDAs into NPDAs since there will still only be at most one transition possible at any given time in the new PDA if that was the case before the transformation.这甚至不会将 DPDA 转变为 NPDA,因为如果在转换之前是这种情况,那么在任何给定时间,在新 PDA 中最多只能进行一次转换。

In fact, the construction used to show PDAs can accept the languages of CFGs explicitly relies on being able to push strings of arbitrary length in one transition.事实上,用于显示 PDA 可以接受 CFG 语言的结构明确依赖于能够在一次转换中推送任意长度的字符串。 That construction works by pushing the start symbol and then nondeterministically pushing productions for nonterminals.该构造通过推动开始符号然后不确定地推动非终结符的产生来工作。 Since the RHS of productions are typically longer than one symbol, the construction would be much uglier if the resulting PDA had to have separate paths of states for every production.由于产生的 RHS 通常比一个符号长,如果生成的 PDA 必须为每个产生具有单独的状态路径,则结构会更加丑陋。 By allowing the pushing of strings of arbitrary length, the construction generates a two-state NPDA for any CFG.通过允许推送任意长度的字符串,该构造为任何 CFG 生成一个两态 NPDA。

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

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