I have a few questions regarding state elimination and the terminology.
In the example above is a DFA with a accepting state where you must start with symbol 0 and end with 1.
If I were to convert it to regular expression, the upper would be
Here is my problem, I have no idea how to add the top part and the bottom part into on single expression. I am also not totally sure how to eliminate q2 symbol 1 further.
Would it be 0(0*(0+1))1* ?
Thank you to anyone who could help!
There is a much more well known and comprehensible algorithm available to accomplish this task.
To convert a DFA G into a Regular expression we first convert G into a 'GNFA'. Let for example G be the following DFA (q is the start state):
The process of converting a DFA to a GNFA is as follows:
This is the resulting GNFA:
Then we remove each state in-between the new start state and the new accept state one at a time, adjusting the graph to maintain correctness. The process works as follows: Let x, y, and z be states in our DFA. Additionally, the transitions are as follows x->y on input a, y->y on input b and y->z on input c. Say we want to remove y. For every transition from some node n to y and for every transition from y to m, we must add a new transition n->m. The transition from n to m would be the content of the transition from n to y, followed by the content of transition y->y with a kleene star followed by the content of the transition from y->m. In this case x->y on a, y->y on b and y->z on c, after removing state y, there would be a transition from x->z on a(b*)c
.
Consider our DFA in the images. After removing state q we get:
After removing state r, we get:
Finally, after removing state s we are left with:
This is our complete regular expression. Using this process completely avoids any of the problems you are facing. However, I will also provide you with a direct answer to your question. For starters, the upper part would not be what you suggested. Instead, it would become: This simplifies into: This is our final regex, since the bottom part has no accept state and is thus irrelevant.
you start from (q0) state if u input (0) then you can reach to the final ; instead if u input (1) you couldnt reach final . so consider only states (q0) (q1) (q2) and apply elimination rule on these states
after elimination RE would be as follow
0(0)*1 . (1+0(0)*1)*
start from 0 and ending on 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.