可计算性:接收 P 中偶数长度单词的 DFA 语言是吗?
我已经在这个问题上苦苦挣扎了一段时间,但无法想出任何办法。任何指点将非常感激。
问题是:给定所有仅接收偶数长度单词的 DFA 的语言,证明它是否在 P 中。
我考虑过制作一台图灵机,用 BFS/Dijkstra 算法之类的算法遍历给定的 DFA,以便找到从起始状态到接受状态的所有路径,但不知道如何处理循环?
谢谢!
I've been struggling with this one for a while and am not able to come up with anything. Any pointers would be really appreciated.
The problem is: given the language of all DFAs that receive only words of even-length, prove whether it is in P or not.
I've considered making a turing machine that goes over the given DFA in something like BFS/Dijkstra's algorithm in order to find all the paths from the starting state to the accepting one, but have no idea how to handle loops?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为它在 P 中,最坏的是二次。 DFA 的每个状态可以有四个
将所有状态标记为未访问,将起始状态放入队列中(FIFO、优先级等),将其奇偶校验状态设置为 2。
除非我忽略了某些内容,否则每个 DFA 状态都会被处理最多两次,每次最多检查
size
个子项是否需要执行操作。I think it's in P, at worst quadratic. Each state of the DFA can have four parity states
Mark all states as unvisited, put the starting state in a queue (FIFO, priority, whatever), set its parity state to 2.
Unless I'm overlooking something, each DFA state is treated at most twice, each time checking at most
size
children for required action.看起来这只需要两个状态。
您的输入状态将是空字符串,并且也将是接受状态。将任何内容添加到字符串中都会将其移动到下一个状态,我们可以将其称为“奇数”状态,而不是使其成为接受状态。添加另一个字符串会让我们回到原始状态。
我想我不再确定术语是否属于 P 语言,所以如果你给我一个定义,我可以告诉你这是否合适,但这是最简单的 DFA 之一......
It would seem this only requires two states.
Your entry state would be empty string, and would also be an accept state. Adding anythign to the string would move it to the next state, which we can call the 'odd' state, and not make it an accept state. Adding another string puts us back to the original state.
I guess I'm not sure on the terminology anymore of whether a language is in P or not, so if you gave me a definition there I could tell you if this fits it, but this is one of the simplest DFA's around...