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

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.
 
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...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.

Similar threads

Back
Top