简体   繁体   English

这个确定性有限自动机的语言是什么?

[英]What is the language of this deterministic finite automata?

Given:鉴于:

在此处输入图片说明

I have no idea what the accepted language is.我不知道接受的语言是什么。

From looking at it you can get several end results:通过查看它,您可以获得几个最终结果:

1.) bb
2.) ab(a,b)
3.) bbab(a, b)
4.) bbaaa

How to write regular expression for a DFA如何为 DFA 编写正则表达式

In any automata, the purpose of state is like memory element.在任何自动机中,状态的目的就像记忆元素。 A state stores some information in automate like ON-OFF fan switch.状态自动存储一些信息,如 ON-OFF 风扇开关。
A Deterministic-Finite-Automata(DFA) called finite automata because finite amount of memory present in the form of states.确定性有限自动机 (DFA) 称为有限自动机,因为以状态形式存在的内存量是有限的。 For any Regular Language(RL) a DFA is always possible.对于任何正则语言 (RL),DFA 始终是可能的。

Let's see what information stored in the DFA (refer my colorful figure).让我们看看 DFA 中存储了哪些信息(参考我的彩色图)。
( note: In my explanation any number means zero or more times and Λ is null symbol ) 注意:在我的解释中,任何数字表示零次或多次, Λ是空符号


State-1: is START state and information stored in it is even number of a has been come. State-1:是START状态,其中存储的信息是偶数a已经到来。 And ZERO b .和零b
Regular Expression(RE) for this state is = (aa)* .此状态的正则表达式 (RE) 为= (aa)*

State-4: Odd number of a has been come.国家4:奇数a已经来临。 And ZERO b .和零b
Regular Expression for this state is = (aa)*a .此状态的正则表达式为= (aa)*a

数字:

Figure: a BLUE states = EVEN number of a , and RED states = ODD number of a has been come.图:一个BLUE状态=的偶数a ,和RED状态=的ODDa已经到来。

NOTICE: Once first b has been come, move can't back to state-1 and state-4.注意:一旦第一个b来了,移动就不能回到状态 1 和状态 4。

State-5: comes after Yellow b .状态 5:Yellow b Yellow b means b after odd numbers of a . Yellow b表示在b after odd numbers of a
Once you gets b after odd numbers of a (at state-5) every thing is acceptable because there is self a loop for (b,a) at state-5.一旦你得到b的奇数后a (在国家的5)每一件事情是可以接受的,因为有自我为(B,A)在国家的5环。

You can write for state-5 : Yellow-b followed-by any string of a, b that is = Yellow-b (a + b)*您可以为 state-5 编写: Yellow-b 后跟 a, b 的任何字符串,即= Yellow-b (a + b)*

State-6: Just to differentiate whether odd a or even.状态 6:只是为了区分是奇数a还是偶数。

State-2: comes after even a then b then any number of b .状态 2:a之后,然后是b然后是任意数量的b = (aa)* bb* = (aa)* bb*

State-3: comes after state-2 then first a then there is a loop via state-6.状态 3:在状态 2 之后,然后首先a然后是通过状态 6 的循环。 We can write for state-3 comes = state-2 a (aa)* = (aa)*bb* a (aa)*我们可以写为 state-3 come = state-2 a (aa)* = (aa)*bb* a (aa)*

Because in our DFA, we have three final states so language accepted by DFA is union (+ in RE) of three RL (or three RE).因为在我们的 DFA 中,我们有三个最终状态,所以 DFA 接受的语言是三个 RL(或三个 RE)的并集(RE 中的+)。
So the language accepted by the DFA is corresponding to three accepting states-2,3,5 , And we can write like:所以DFA接受的语言对应三个接受状态-2,3,5 ,我们可以这样写:

 State-2 +  state-3           + state-5    

(aa)*bb* + (aa)*bb* a (aa)* + Yellow-b (a + b)* (aa)*bb* + (aa)*bb* a (aa)* + Yellow-b (a + b)*

I forgot to explain how Yellow-b comes?我忘了解释how Yellow-b comes?
ANSWER: Yellow-b is a b after state-4 or state-3.答案: Yellow-b是状态 4 或状态 3 之后的b And we can write like:我们可以这样写:

Yellow-b = ( state-4 + state-3 ) b = ( (aa)*a + (aa)*bb* a (aa)* ) b Yellow-b = ( state-4 + state-3 ) b = ( (aa)*a + (aa)*bb* a (aa)* ) b

[ ANSWER ] [答案]
(aa)*bb* + (aa)*bb* a (aa)* + ( (aa)*a + (aa)*bb* a (aa)* ) b (a + b)* (aa)*bb* + (aa)*bb* a (aa)* + ( (aa)*a + (aa)*bb* a (aa)* ) b (a + b)*


English Description of Language : DFA accepts union of three languages英语语言描述:DFA 接受三种语言的结合

  • EVEN NUMBERs OF a 's, FOLLOWED BY ONE OR MORE b 's,偶数个a ,后跟一个或多个b
  • EVEN NUMBERs OF a 's, FOLLOWED BY ONE OR MORE b 's, FOLLOWED BY ODD NUMBERs OF a 's.偶数个a ,后跟一个或多个b ,后跟奇数个a
  • A PREFIX STRING OF a AND b WITH ODD NUMBER OF a 's, FOLLOWED BY b , FOLLOWED BY ANY STRING OF a AND b AND Λ .前缀字符串的ab与奇数a的,其次是b ,其次是任何字符串abΛ

English Description is complex but this the only way to describe the language.英语描述很复杂,但这是描述语言的唯一方法。 You can improve it by first convert given DFA into minimized DFA then write RE and description.您可以通过首先将给定的 DFA 转换为最小化的 DFA 然后编写 RE 和描述来改进它。


Also, there is a Derivative Method to find RE from a given Transition Graph using Arden's Theorem .此外,还有一种派生方法可以使用Arden 定理从给定的转换图中找到 RE。 I have explained here how to write a regular expression for a DFA using Arden's theorem .我在这里解释了如何使用 Arden 定理为 DFA 编写正则表达式 The transition graph must first be converted into a standard form without the null-move and single start state.转换图必须首先转换为没有空移动和单启动状态的标准形式。 But I prefer to learn Theory of computation by analysis instead of using the Mathematical derivation approach.但我更喜欢通过分析而不是使用数学推导方法来学习计算理论。

I guess this question isn't relevant anymore :) and it's probably better to guide you through it then just stating the answer, but I think I got a basic expression that covers it (it's probably minimizable), so i'll just write it down for future searchers我想这个问题不再相关:) 指导你完成它然后只是陈述答案可能更好,但我想我有一个涵盖它的基本表达(它可能可以最小化),所以我会写它为未来的搜索者打下基础

(aa)*b(b)* // for stoping at 2
U
(aa)*b(b)*a(aa)* // for stoping at 3
U
(aa)*b(b)*a(aa)*b((a)*(b)*)* // for stoping at 5 via 3
U
a(aa)*b((a)*(b)*)* // for stoping at 5 via 4

The examples (1 - 4) that you give there are not the language accepted by the DFA.您在那里提供的示例 (1 - 4)不是DFA 接受的语言 They are merely strings that belong to the language that the DFA accepts.它们只是属于DFA 接受的语言的字符串。 Therefore, they all fall in the same language.因此,它们都属于同一种语言。

If you want to figure out the regular expression that defines that DFA, you will need to do something called k-path induction , and you can read up on it here .如果您想找出定义该 DFA 的正则表达式,您将需要执行称为k 路径归纳的操作,您可以在 此处阅读。

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

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