简体   繁体   English

自动机的过渡状态图

[英]Transition State Diagram for the automata

What will be the transition state diagram of (a+b)* and (ab)* ? (a + b)*和(ab)*的过渡状态图是什么? I'm little confused with the two state diagrams. 我对两个状态图有些困惑。 I'm finding both of them same. 我发现他们两个都一样。

Assume the teal-colored states are start and accept states. 假设蓝绿色状态为开始状态和接受状态。 (a+b)* can be read as "zero or many a's and b's in any order." (a + b)*可以理解为“零个或多个a和b的任何顺序”。 (ab)* can be read as "zero or many a's and b's in sequence." (ab)*可以理解为“零个或多个顺序的a和b”。 Note that node 3 exists as a dead state to reject a match if the sequence is broken. 请注意,如果序列中断,则节点3将以无效状态存在以拒绝匹配。 在此处输入图片说明

Assuming + means union and . 假设+表示并和。 means concatenation: 表示串联:

(a+b)*
q   s   q'
--  --  --
q0  a   q0
q0  b   q0
(q0 is accepting)

(a.b)*
q   s   q'
--  --  --
q0  a   q1
q0  b   q2
q1  a   q2
q1  b   q0
q2  a   q2
q2  b   q2
(q0 is accepting; q2 is a dead state)

Note that (a+b)* describes all strings of a's and b's, so we only need one state; 注意,(a + b)*描述了a和b的所有字符串,因此我们只需要一个状态。 no strings are rejected. 没有字符串被拒绝。 On the other hand, there are strings of a's and b's that don't match (ab)*; 另一方面,存在a和b的字符串不匹配(ab)*; we end up with three states because: 我们以三种状态结束,因为:

  1. If we've seen an integer number of "ab", we can see nothing or another integer number of "ab" (corresponds to state q0) 如果我们看到整数“ ab”,则什么也看不到,或者看不到另一个整数“ ab”(对应于状态q0)

  2. If we've seen an integer number of "ab" followed by an "a", we can see a "b" followed by an integer number of "ab" (corresponds to state q1) 如果我们看到整数“ ab”后跟“ a”,则可以看到“ b”后跟整数“ ab”(对应于状态q1)

  3. If we've seen something besides what we discuss in points 1 and 2, there's nothing we can add to the string to get an integer number of "ab"; 如果除了在第1点和第2点中讨论的内容之外,还看到其他内容,则无法将任何内容添加到字符串中以获得整数“ ab”; we've messed up, and any string with this prefix is not in the language (corresponds to the "dead" state q2). 我们搞砸了,任何带有此前缀的字符串都不是该语言的语言(对应于“死”状态q2)。

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

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