设计一个下推自动机来计算字符数
字母表:a、b、c 我正在尝试定义一个PDA,它接受
a^n b^m c^p : n + p = 2k for some integer k, m = k, and n, m, p, k >= 0
我认为可以接受的一些字符串是:#abc#; #aabbcc#; #aaabbbccc#; #abbccc#; #aaabbc#等 a、b、c的数量不一定相等。
从最右边的黑色空间开始下推自动机的头部。
通常我将我的 PDA 写在列中:
State: Symbol Read: Next State: Head Instruction:
s # r1 Left
r1 c r2 #
等等......
The Alphabet: a, b, c
I'm trying to define a PDA which accepts
a^n b^m c^p : n + p = 2k for some integer k, m = k, and n, m, p, k >= 0
I think some strings that would be accepted are: #abc#; #aabbcc#; #aaabbbccc#; #abbccc#; #aaabbc# etc
The number of a's, b's and c's are not necessarily equal.
Start the head of the push down automata on the black space that is right most.
Usually I write my PDAs in columns:
State: Symbol Read: Next State: Head Instruction:
s # r1 Left
r1 c r2 #
and so on...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你描述的语言不是上下文无关的,因此不能
用 PDA 识别。问题是你需要强制执行约束
(n+p = 2m) 跨越任意长的子串,但不允许“泵送”(当
尝试使用上下文无关语言的泵引理构建证明)。
I think the language you describe is not context-free, and therefore cannot be
recognized with a PDA. The problem is that you need to enforce a constraint
(n+p = 2m) that spans an arbitrarily long substring, yet is not allowed to "pump" (when
attempting to construct a proof using the pumping lemma for context-free languages).