
It is possible to draw its deterministic finite automata directly. The given regular expression is rather simple.
Find minimum finite state automata how to#
(With some work, it should be possible to identify a combinatorial parameter which determines the minimal number of accepting states in any finite language.In this post, we will learn how to construct deterministic finite automata for the regular expression (a+b)*abb. Let $A$ be the language of words which move the DFA from its initial state to its final state without transitioning through the final state (if the initial state is also final, $A = \$, each word is in its own equivalence class, so exactly three accepting states are needed. It is regular if as a language it is regular.)
Find minimum finite state automata code#
(A prefix code is a set of words, none of which is a prefix of another one. Furthermore, this representation is unique, assuming $L \neq \emptyset$ and $\epsilon \notin B$. A language $L$ over $\Sigma$ is accepted by a DFA with a single accepting state if there exist two regular prefix codes $A,B$ such that $L = AB^*$. Let me provide a characterization of what languages DFAs with a single accepting state can accept.

By arbitrarily restricting DFAs, you are creating a situation where there are NFAs that cannot be converted to DFAs, and that there are regular expressions that cannot be accepted by any DFA. A DFA can't, unless you want to restrict DFAs arbitrarily. So, in summary: an NFA can very well work with just one final state. You will find that you need to mark a state as "final state" if at least one of the NFA states in the set is the final state.

The states of the exploded deterministic finite automaton correspond to sets of states in the nondeterministic finite automaton. However, if you explode a nondeterministic finite automaton into a deterministic finite automaton, you'll find that you no longer can have epsilon transitions. So, a nondeterministic finite automaton can very well work with just one final state. If it has multiple final states, you can create an epsilon transition from all of the final states to one common final state, remove the "final state" mark from all of the previously final states so that you have only one final state. The above is one example of that, but there are many other examples where it is useful.Ĭonsider an arbitrary nondeterministic finite automaton.

In summary, multiple final states gives us the ability to accept multiple different possible patterns in the input. All states (8):, h, ho, hoh, hoho, hohoh, hohoho, It turns out that it would be impossible to accept these three strings if we have to have only one final state. Now in this example, we want to accept three different strings: ho, hoho, and hohoho, so we need all three of those states to be final.

If we get a letter that isn't going to be one of these strings (like if the input is haha or asdf), we need a different state to remember that the input was bad, and we can call that state. Then the "state" of the machine can keep track of what letters we have seen so far: we have 7 states for, h, ho, hoh, hoho, hohoh, hohoho. Suppose we want to design a machine that accepts if the input is either ho, hoho, or hohoho (so we want to accept, in total, three possible input strings). The reason we need to have multiple final states, then, is because we might want to accept the input in multiple different scenarios. The final states are used to indicate which internal states should inform the machine to accept. At the end, it has to decide whether to "accept" or "reject" the input based only on whatever internal state it has at the end. A DFA is a machine that reads in its input left to right, and, while reading, keeps track of its internal state.
