简体   繁体   English

画出一个 FSA 来识别:(A∗ | AB+)。 (条形超出了其他运算符的范围,因此它等于:(A∗) | (AB+)。)使用尽可能少的状态

[英]Draw an FSA that recognizes: (A∗ | AB+). (The bar outscopes the other operators, so its equal to: (A∗) | (AB+).) Use as few states possible

I've attached what I have.我已经附上了我所拥有的。 My problem is that I don't know if its correct and if I've even used the fewest states possible to answer this question.我的问题是我不知道它是否正确,以及我是否使用了尽可能少的状态来回答这个问题。 Really appreciate any help on what I currently did wrong this is what i have currently非常感谢对我目前做错的任何帮助这是我目前所拥有的

I would start by creating two FSAs, one for each of the branches.我将首先创建两个 FSA,每个分支一个。

For A* you only need one state.对于A* ,您只需要一个 state。

For AB+ you need three states.对于AB+ ,您需要三个状态。

Then you merge the two.然后你合并两者。 Assuming it does not have to be deterministic, the total FSA ends up with three states as well, two of which are final states.假设它不一定是确定性的,那么整个 FSA 最终也会有三个状态,其中两个是最终状态。

As you tagged your question dfa — a deterministic FSA would need 4 states in total:当您标记您的问题dfa时——确定性 FSA 总共需要 4 个状态:

Start state: 1;启动 state:1; Final States: 1,2,3,4最终状态:1,2,3,4

Transitions:过渡:

1 - a -> 2 1 - 一个 -> 2
2 - a -> 4 2 - 一个 -> 4
2 - b -> 3 2 - b -> 3
3 - b -> 3 3 - b -> 3
4 - a -> 4 4 - 一个 -> 4

That is a DFA that recognises (a*|ab+):这是一个识别 (a*|ab+) 的 DFA:

使用 graphviz 绘制的 FSM

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

相关问题 构建一个仅接受单词 baa、ab 和 abb 且不接受其他更长或更短字符串的 FA - Build an FA that accepts only the words baa, ab, and abb and no other strings longer or shorter 怎么把(ab u aab u aba)*转换成NFA? - How to convert (ab u aab u aba)* into a NFA? Python 中 {ab, abc}* 的非确定性有限自动机 - Non-Deterministic Finite Automata of {ab, abc}* in Python 如何实施可识别评论的DFA? - How to implement a DFA which recognizes comments? 是否可以在没有显式构造的情况下确定最小DFA中的状态数? - Is it possible to determine the number of states in a minimal DFA without explicitly constructing it? 确定DFA中的州数 - Determining number of states in a DFA 两个DFA的交集,有多少个州? 最终状态? - Intersection of two DFA, how many states? Final States? 从DFA的起始状态是否可以到达所有最终状态? - Are all final states reachable from the starting states of a DFA? 如何构建可识别以两个D开头的位字符串集的dfa? - how to construct a dfa that recognizes the set of bit string that begins with two D's? 如何在最小化DFA期间对具有死态的DFA的状态进行分区 - How to partition the states of a DFA having a dead state during minimisation of the same
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM