两个自动机之间的等价

发布于 2024-11-27 09:44:56 字数 106 浏览 4 评论 0原文

确定两个自动机之间的等价性的最佳或最简单的方法是什么?

即,如果给定两个有限自动机 A 和 B,我如何确定两者是否识别相同的语言?

它们都是确定性的或都是非确定性的。

Which is the best or easiest method for determining equivalence between two automata?

I.e., if given two finite automata A and B, how can I determine whether both recognize the same language?

They are both deterministic or both nondeterministic.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温柔女人霸气范 2024-12-04 09:44:56

一种不同的、更简单的方法是对自动机进行补充和交叉。自动机 A 等价于 B 当且仅当 L(A) 包含在 L(B) 中,反之亦然这是当且仅当 L(B)L(A) 的补集之间的交集为空,反之亦然。

以下是检查 L(A) 是否包含在 L(B) 中的算法:

  1. 补码:首先,使用子集构造确定 B 。然后,使每个接受状态都拒绝,每个拒绝状态都接受。您将获得一个可识别 L(B) 补集的自动机。
  2. 交集:构造一个自动机,该自动机可识别作为 L(B)L(A) 的补集的交集的语言。即,为步骤 1 中的自动机和 A 的交集构造一个自动机。要使两个自动机 UV 相交,您可以构造一个状态为 U x V 的自动机。自动机从状态 (u,v) 移动到 (u',v'),且字母为 a,前提是存在转换 u --a--> U 中的 u'v --a--> V 中的 v'。接受状态是状态 (u,v),其中 uU 中接受,而 v 在 <代码>V。
  3. 在步骤 2 中构建自动机后,所需要做的就是检查是否为空。即,是否有一个自动机接受的词。这是最简单的部分——使用 BFS 算法在自动机中找到从初始状态到接受状态的路径。

如果L(A)包含在L(B)中,我们需要运行相同的算法来检查L(B)是否包含在L(A)

A different, simpler approach is to complement and intersect the automata. An automaton A is equivalent to B iff L(A) is contained in L(B) and vice versa which is iff the intersection between the complement of L(B) and L(A) is empty and vice versa.

Here is the algorithm for checking if L(A) is contained in L(B):

  1. Complementation: First, determinize B using the subset construction. Then, make every accepting state rejecting and every rejecting state accepting. You get an automaton that recognizes the complement of L(B).
  2. Intersection: Construct an automaton that recognizes the language that is the intersection of the complement of L(B) and L(A). I.e., construct an automaton for the intersection of the automaton from step 1 and A. To intersect two automata U and V you construct an automaton with the states U x V. The automaton moves from state (u,v) to (u',v') with letter a iff there are transitions u --a--> u' in U and v --a--> v' in V. The accepting states are states (u,v) where u is accepting in U and v is accepting in V.
  3. After constructing the automaton in step 2, all that is needed is to check emptiness. I.e., is there a word that the automaton accepts. That's the easiest part -- find a path in the automaton from the initial state to an accepting state using the BFS algorithm.

If L(A) is contained in L(B) we need to run the same algorithm to check if L(B) is contained in L(A).

柒夜笙歌凉 2024-12-04 09:44:56

如果两个非确定性有限自动机 (NFA) 接受相同的语言,那么它们是等价的。

为了确定它们是否接受相同的语言,我们会考虑每个 NFA 都有一个最小的 DFA,其中没有两个状态是相同的。最小的 DFA 也是独一无二的。因此,给定两个 NFA,如果发现它们对应的最小 DFA 是等价的,那么这两个 NFA 也一定是等价的。

要深入研究该主题,我强烈建议您阅读形式化简介语言和自动机

Two nondeterministic finite automota (NFA's) are equivalent if they accept the same language.

To determine whether they accept the same language, we look at the fact that every NFA has a minimal DFA, where no two states are identical. A minimal DFA is also unique. Thus, given two NFA's, if you find that their corresponding minimal DFA's are equivalent, then the two NFA's must also be equivalent.

For an in-depth study on this topic, I highly recommend that you read An Introduction to Formal Language and Automata.

野味少女 2024-12-04 09:44:56

我只是改写 @Guy 的答案。

为了比较两者都接受的语言,我们必须弄清楚L(A)是否等于L(B)

因此,您必须确定 L(A)-L(B) 和 L(B)-L(A) 是否为空集。 (原因 1)

第 1 部分:

为了找出这一点,我们从 NFA A 和 NFA B 构造 NFA X,

如果 X 为空集,则 L(A) = L(B),否则 L(A) != L(B)。 (原因2)

第二部分:

现在,我们必须找到一种有效的方法来证明或反驳X是空集。当 DFA 或 NFA 时 X 何时为空?答案:当没有从X的起始状态到任何最终状态的路径时,X将为空。我们可以使用BFS或DFS来实现这一点。


原因1:如果两者都设置为空,则L(A) = L(B)

原因2:我们可以证明正则语言集合在交集和并集下是闭集。这样我们就能够高效地创建 NFA X。

对于集合:

I am just rephrasing answer by @Guy.

To compare languages accepted by both we have to figure out if L(A) is equal to L(B) or not.

Thus, you have to find out if L(A)-L(B) and L(B)-L(A) is null set or not. (Reason1)

Part1:

To find this out, we construct NFA X from NFA A and NFA B, .

If X is empty set then L(A) = L(B) else L(A) != L(B). (Reason2)

Part2:

Now, we have to find out an efficient way of proving or disproving X is empty set. When will be X empty as DFA or NFA? Answer: X will be empty when there is no path leading from starting state to any of the final state of X. We can use BFS or DFS for this.


Reason1: If both are null set then L(A) = L(B).

Reason2: We can prove that set of regular languages is closed under intersection and union. Thus we will able to create NFA X efficiently.

and for sets:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文