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

AI Thread 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.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...

Similar threads

Back
Top