How can an NFA be converted into a regular expression using GNFA?

Click For Summary
An algorithm exists for converting a DFA or NFA into a regular expression by utilizing a GNFA (generalized nondeterministic finite automaton). The process involves adding start and end states to the NFA, followed by collapsing states until only one transition remains, which represents the regular expression. In this method, arrows between states are replaced with regular expressions, allowing for the simplification of multiple transitions into a single one. The iterative process continues until only the start and end states remain, at which point the regular expression can be extracted. This approach effectively transforms the automaton into a format that directly expresses the language it recognizes.
Dragonfall
Messages
1,023
Reaction score
5
Is there an algorithm for converting DFA (or NFA) into regular expressions?
 
Mathematics news on Phys.org
Yes, while I have no idea whether it is the most efficient (probably not), one of the easiest ways is to convert the DFA or NFA into a GNFA (generalized nondeterministic finite automaton) and start collapsing its states till only one transition is left, and then take that as the regular expression.

A GNFA is simply a NFA that accepts regular expressions on arrows instead of just symbols. The general idea is as follows:
1. Take any NFA, and add two states we call start and end. Add an epsilon-arrow from start to the previous start state, and add an epsilon-arrow from all previous final states to the end state. Now start is the only start state, and end is the only end state.
2. If start and end are the only states then we take the regular expression on the arrow between them and are done, if not we go to 3.
3. We pick a state Q that is not start or end. Let R be the arrow from Q to itself. Now from every state A that has an arrow C to Q, for every state B that has an arrow D from Q we add an arrow from A to B with the label CR*D.
4. We remove the state Q and all arrows to it, since we have constructed replacements.
5. If there exist two states A and B such that there are several arrow from A to B, then we reduce them to one by taking the union of all the arrows.
6. Go to step 2.
 
I have been insisting to my statistics students that for probabilities, the rule is the number of significant figures is the number of digits past the leading zeros or leading nines. For example to give 4 significant figures for a probability: 0.000001234 and 0.99999991234 are the correct number of decimal places. That way the complementary probability can also be given to the same significant figures ( 0.999998766 and 0.00000008766 respectively). More generally if you have a value that...

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 43 ·
2
Replies
43
Views
8K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K