简体   繁体   English

使用传递闭包方法将 DFA 转换为正则表达式

[英]converting DFA to regular expression using Transitive closure method

The following example shows a simple DFA with one accepting state q2:以下示例显示了一个简单的 DFA,其中一个接受 state q2:

Based on the R(i,j,k) Algorithm shown above i want to convert this DFA to regular expression, unfortunately i can't find a good definition of the K. My question is what does the K mean?基于上面显示的 R(i,j,k) 算法,我想将此 DFA 转换为正则表达式,不幸的是我找不到 K 的良好定义。我的问题是 K 是什么意思? is it the number of states (in this case 3) or something else?是状态数(在这种情况下为 3)还是其他?

Then, we solve those equations to get the equation for qi in terms of α ij and that expression is the required solution, where qi is a final state.然后,我们求解这些方程以得到 qi 的方程,以 α ij 表示,该表达式是所需的解,其中 qi 是最终的 state。 It is shown below −如下所示 -

q 1= qa + q3a + € ( € move is because q1is the initial state) q 1= qa + q3a + €(€移动是因为q1是初始状态)

q2 = q1b + q2b + q3b q2 = q1b + q2b + q3b

q3 = q2a q3 = q2a

Now, we will solve these equations, as shown below−现在,我们将求解这些方程,如下所示 -

. . q2 = q1b + q2b + q3b q2 = q1b + q2b + q3b

= q1b + q2b + (q2a)b (Substituting value of q3) = q1b + q2b + (q2a)b (替换 q3 的值)

= q1b + q2(b + ab) = q1b + q2(b + ab)

= q1b (b + ab) * (Applying Arden's Theorem) = q1b (b + ab) *(应用 Arden 定理)

. . q1 = q1a + q3a + € q1 = q1a + q3a + €

= q1a + q2aa + € (Substituting value of q3) = q1a + q2aa + €(替换 q3 的值)

= q1a + q1b(b + ab*)aa + € (Substituting value of q2) = q1a + q1b(b + ab*)aa + € (替换 q2 的值)

= q1(a + b(b + ab) *aa) + € = q1(a + b(b + ab) *aa) + €

= € (a+ b(b + ab) *aa) * = € (a+ b(b + ab) *aa) *

= (a + b(b + ab) *aa) * = (a + b(b + ab) *aa) *

Hence, the regular expression is (a + b(b + ab) *aa) *.因此,正则表达式是 (a + b(b + ab) *aa) *。

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

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