How to convert this automata to regular expression via NFAIs there a regular expression to detect a valid regular expression?How to validate an email address using a regular expression?Regular expression to match a line that doesn't contain a wordHow do you access the matched groups in a JavaScript regular expression?How do you use a variable in a regular expression?Converting user input string to regular expressionDoes Python use NFAs for regular expression evaluation in the re module?Converting RE -> NFAConverting a regular expression to a DFAleft regular grammar to nfa

Can someone give the intuition behind Mean Absolute Error and the Median?

Does every piano need tuning every year?

Cut a cake into 3 equal portions with only a knife

Co-supervisor comes to the office to help her students, which distracts me

What are the consequences of high orphan block rate?

Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?

What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?

How to justify a team increase when the team is doing well?

Golf (6-card) Golf!

Fuel sender works when outside of tank, but not when in tank

I am 15 years old and do not go to a Yeshiva but would like to learn Talmud. A few rabbis near me said they could teach me. How should I start

Why solving a differentiated integral equation might eventually lead to erroneous solutions of the original problem?

Do wheelchair-accessible aircraft exist?

Why does (inf + 0j)*1 evaluate to inf + nanj?

How do you use the interjection for snorting?

How to deal with a Homophobic PC

Is it possible to make Decompose work with coefficients containing radicals?

What is the meaning of word 'crack' in chapter 33 of A Game of Thrones?

Is it a good idea to leave minor world details to the reader's imagination?

Clear text passwords in Unix

My manager quit. Should I agree to defer wage increase to accommodate budget concerns?

awk: print only lines that come after specific guard line pattern

My Project Manager does not accept carry-over in Scrum, Is that normal?

Tesla coil and Tesla tower



How to convert this automata to regular expression via NFA


Is there a regular expression to detect a valid regular expression?How to validate an email address using a regular expression?Regular expression to match a line that doesn't contain a wordHow do you access the matched groups in a JavaScript regular expression?How do you use a variable in a regular expression?Converting user input string to regular expressionDoes Python use NFAs for regular expression evaluation in the re module?Converting RE -> NFAConverting a regular expression to a DFAleft regular grammar to nfa






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I need to transform this finite automata to regular expressions via converting the DFA (Deterministic Finite Automata) to a general NFA (Non-deterministic Finite Automata). How one should go about it? Will state diagrams of the NFA and the DFA will be identical?



DFA Picture










share|improve this question
































    0















    I need to transform this finite automata to regular expressions via converting the DFA (Deterministic Finite Automata) to a general NFA (Non-deterministic Finite Automata). How one should go about it? Will state diagrams of the NFA and the DFA will be identical?



    DFA Picture










    share|improve this question




























      0












      0








      0








      I need to transform this finite automata to regular expressions via converting the DFA (Deterministic Finite Automata) to a general NFA (Non-deterministic Finite Automata). How one should go about it? Will state diagrams of the NFA and the DFA will be identical?



      DFA Picture










      share|improve this question
















      I need to transform this finite automata to regular expressions via converting the DFA (Deterministic Finite Automata) to a general NFA (Non-deterministic Finite Automata). How one should go about it? Will state diagrams of the NFA and the DFA will be identical?



      DFA Picture







      regex computer-science automata computation-theory






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 at 5:56









      Adnan Sharif

      6764 silver badges15 bronze badges




      6764 silver badges15 bronze badges










      asked Mar 28 at 17:49









      safqwsafqw

      61 bronze badge




      61 bronze badge

























          3 Answers
          3






          active

          oldest

          votes


















          0
















          So there are two DFAs in the picture, so I'll show how to get the RE for each one in turn. For the first, we write down some equations:



          (q1) = (q1)a + (q2)b + e
          (q2) = (q1)b + (q2)a


          Now we can use the rule (q) = (q)x + y <=> (q) = yx* on each:



          (q1) = ((q2)b + e)a*
          (q2) = (q1)ba*


          Now we can substitute in and since we care about (q2) we might as well get that directly:



          (q2) = ((q2)b + e)a*ba*
          = (q2)ba*ba* + a*ba*
          = a*ba*(ba*ba*)*


          We get the regular expression a*ba*(ba*ba*)* which, at a glance, appears to be correct. How did we get the equations? For each state, we wrote down the ways of "getting to" the state, and combined them with + (or, union). We include the empty string e in (q1)'s equation since (q1) is the initial state and nothing needs to be consumed to get there (initially).



          For the second, the equations look like this:



          (q1) = (q3)a + e
          (q2) = (q1)(a + b) + (q2)a + (q3)b
          (q3) = (q2)b


          We can use our rule to eliminate the self-reference for (q2):



          (q1) = (q3)a + e
          (q2) = ((q1)(a + b) + (q3)b)a*
          (q3) = (q2)b


          Now we substitute and use the rule again:



          (q1) = (q3)a + e
          (q2) = ((q1)(a + b) + (q3)b)a*
          (q3) = ((q1)(a + b) + (q3)b)a*b
          = (q1)(a + b)a*b + (q3)ba*b
          = (q1)(a + b)a*b(ba*b)*


          Now we substitute again and use the rule again:



          (q1) = (q1)(a + b)a*b(ba*b)*a + e
          = e((a + b)a*b(ba*b)*a)*
          = ((a + b)a*b(ba*b)*a)*
          (q2) = ((q1)(a + b) + (q3)b)a*
          (q3) = (q1)(a + b)a*b(ba*b)*


          We can now substitute back in to get the expression for (q3):



          (q1) = ((a + b)a*b(ba*b)*a)*
          (q2) = ((q1)(a + b) + (q3)b)a*
          (q3) = ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*


          The regular expression will be the union of the expressions for (q1) and (q3) since these are the accepting states:



          r = ((a + b)a*b(ba*b)*a)* + ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*
          = ((a + b)a*b(ba*b)*a)*(e + (a + b)a*b(ba*b)*)


          The first part of this takes you from the state q1 back to the state q1 in every possible way; the second part says you can stay in q1 or do the other thing, which leads to q3, otherwise.






          share|improve this answer

























          • Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

            – safqw
            Mar 28 at 22:08












          • @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

            – Patrick87
            Mar 28 at 23:44


















          0
















          Wikipedia references this course PDF: Second Part of Regular Expressions Equivalence with Finite Automata, and according to this document, the procedure starts with this initial step:




          A DFA is converted to a GNFA of special form by the following procedure:



          1. Add a new start state with an epsilon arrow to the old start state and a new accept state with an epsilon arrow from all old accept states.



          (emphasis mine)



          So the NFA and DFA will not be identical. This also explains how to deal with multiple accepting states.






          share|improve this answer
































            -1
















            NO the state diagrams of the NFA and the DFA will not be identical during the conversion process.



            For the second FSM regex will be -
            ε U (aUb) ab (bUa(aUb)ab)* (εUa)



            You can refer to these steps -





            Here's an example -
            These are screenshots from the PDF version of the book - "Introduction to the theory of computation" by Michael Sipser.






            share|improve this answer





























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );














              draft saved

              draft discarded
















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403980%2fhow-to-convert-this-automata-to-regular-expression-via-nfa%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0
















              So there are two DFAs in the picture, so I'll show how to get the RE for each one in turn. For the first, we write down some equations:



              (q1) = (q1)a + (q2)b + e
              (q2) = (q1)b + (q2)a


              Now we can use the rule (q) = (q)x + y <=> (q) = yx* on each:



              (q1) = ((q2)b + e)a*
              (q2) = (q1)ba*


              Now we can substitute in and since we care about (q2) we might as well get that directly:



              (q2) = ((q2)b + e)a*ba*
              = (q2)ba*ba* + a*ba*
              = a*ba*(ba*ba*)*


              We get the regular expression a*ba*(ba*ba*)* which, at a glance, appears to be correct. How did we get the equations? For each state, we wrote down the ways of "getting to" the state, and combined them with + (or, union). We include the empty string e in (q1)'s equation since (q1) is the initial state and nothing needs to be consumed to get there (initially).



              For the second, the equations look like this:



              (q1) = (q3)a + e
              (q2) = (q1)(a + b) + (q2)a + (q3)b
              (q3) = (q2)b


              We can use our rule to eliminate the self-reference for (q2):



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q2)b


              Now we substitute and use the rule again:



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((q1)(a + b) + (q3)b)a*b
              = (q1)(a + b)a*b + (q3)ba*b
              = (q1)(a + b)a*b(ba*b)*


              Now we substitute again and use the rule again:



              (q1) = (q1)(a + b)a*b(ba*b)*a + e
              = e((a + b)a*b(ba*b)*a)*
              = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q1)(a + b)a*b(ba*b)*


              We can now substitute back in to get the expression for (q3):



              (q1) = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*


              The regular expression will be the union of the expressions for (q1) and (q3) since these are the accepting states:



              r = ((a + b)a*b(ba*b)*a)* + ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*
              = ((a + b)a*b(ba*b)*a)*(e + (a + b)a*b(ba*b)*)


              The first part of this takes you from the state q1 back to the state q1 in every possible way; the second part says you can stay in q1 or do the other thing, which leads to q3, otherwise.






              share|improve this answer

























              • Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

                – safqw
                Mar 28 at 22:08












              • @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

                – Patrick87
                Mar 28 at 23:44















              0
















              So there are two DFAs in the picture, so I'll show how to get the RE for each one in turn. For the first, we write down some equations:



              (q1) = (q1)a + (q2)b + e
              (q2) = (q1)b + (q2)a


              Now we can use the rule (q) = (q)x + y <=> (q) = yx* on each:



              (q1) = ((q2)b + e)a*
              (q2) = (q1)ba*


              Now we can substitute in and since we care about (q2) we might as well get that directly:



              (q2) = ((q2)b + e)a*ba*
              = (q2)ba*ba* + a*ba*
              = a*ba*(ba*ba*)*


              We get the regular expression a*ba*(ba*ba*)* which, at a glance, appears to be correct. How did we get the equations? For each state, we wrote down the ways of "getting to" the state, and combined them with + (or, union). We include the empty string e in (q1)'s equation since (q1) is the initial state and nothing needs to be consumed to get there (initially).



              For the second, the equations look like this:



              (q1) = (q3)a + e
              (q2) = (q1)(a + b) + (q2)a + (q3)b
              (q3) = (q2)b


              We can use our rule to eliminate the self-reference for (q2):



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q2)b


              Now we substitute and use the rule again:



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((q1)(a + b) + (q3)b)a*b
              = (q1)(a + b)a*b + (q3)ba*b
              = (q1)(a + b)a*b(ba*b)*


              Now we substitute again and use the rule again:



              (q1) = (q1)(a + b)a*b(ba*b)*a + e
              = e((a + b)a*b(ba*b)*a)*
              = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q1)(a + b)a*b(ba*b)*


              We can now substitute back in to get the expression for (q3):



              (q1) = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*


              The regular expression will be the union of the expressions for (q1) and (q3) since these are the accepting states:



              r = ((a + b)a*b(ba*b)*a)* + ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*
              = ((a + b)a*b(ba*b)*a)*(e + (a + b)a*b(ba*b)*)


              The first part of this takes you from the state q1 back to the state q1 in every possible way; the second part says you can stay in q1 or do the other thing, which leads to q3, otherwise.






              share|improve this answer

























              • Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

                – safqw
                Mar 28 at 22:08












              • @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

                – Patrick87
                Mar 28 at 23:44













              0














              0










              0









              So there are two DFAs in the picture, so I'll show how to get the RE for each one in turn. For the first, we write down some equations:



              (q1) = (q1)a + (q2)b + e
              (q2) = (q1)b + (q2)a


              Now we can use the rule (q) = (q)x + y <=> (q) = yx* on each:



              (q1) = ((q2)b + e)a*
              (q2) = (q1)ba*


              Now we can substitute in and since we care about (q2) we might as well get that directly:



              (q2) = ((q2)b + e)a*ba*
              = (q2)ba*ba* + a*ba*
              = a*ba*(ba*ba*)*


              We get the regular expression a*ba*(ba*ba*)* which, at a glance, appears to be correct. How did we get the equations? For each state, we wrote down the ways of "getting to" the state, and combined them with + (or, union). We include the empty string e in (q1)'s equation since (q1) is the initial state and nothing needs to be consumed to get there (initially).



              For the second, the equations look like this:



              (q1) = (q3)a + e
              (q2) = (q1)(a + b) + (q2)a + (q3)b
              (q3) = (q2)b


              We can use our rule to eliminate the self-reference for (q2):



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q2)b


              Now we substitute and use the rule again:



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((q1)(a + b) + (q3)b)a*b
              = (q1)(a + b)a*b + (q3)ba*b
              = (q1)(a + b)a*b(ba*b)*


              Now we substitute again and use the rule again:



              (q1) = (q1)(a + b)a*b(ba*b)*a + e
              = e((a + b)a*b(ba*b)*a)*
              = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q1)(a + b)a*b(ba*b)*


              We can now substitute back in to get the expression for (q3):



              (q1) = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*


              The regular expression will be the union of the expressions for (q1) and (q3) since these are the accepting states:



              r = ((a + b)a*b(ba*b)*a)* + ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*
              = ((a + b)a*b(ba*b)*a)*(e + (a + b)a*b(ba*b)*)


              The first part of this takes you from the state q1 back to the state q1 in every possible way; the second part says you can stay in q1 or do the other thing, which leads to q3, otherwise.






              share|improve this answer













              So there are two DFAs in the picture, so I'll show how to get the RE for each one in turn. For the first, we write down some equations:



              (q1) = (q1)a + (q2)b + e
              (q2) = (q1)b + (q2)a


              Now we can use the rule (q) = (q)x + y <=> (q) = yx* on each:



              (q1) = ((q2)b + e)a*
              (q2) = (q1)ba*


              Now we can substitute in and since we care about (q2) we might as well get that directly:



              (q2) = ((q2)b + e)a*ba*
              = (q2)ba*ba* + a*ba*
              = a*ba*(ba*ba*)*


              We get the regular expression a*ba*(ba*ba*)* which, at a glance, appears to be correct. How did we get the equations? For each state, we wrote down the ways of "getting to" the state, and combined them with + (or, union). We include the empty string e in (q1)'s equation since (q1) is the initial state and nothing needs to be consumed to get there (initially).



              For the second, the equations look like this:



              (q1) = (q3)a + e
              (q2) = (q1)(a + b) + (q2)a + (q3)b
              (q3) = (q2)b


              We can use our rule to eliminate the self-reference for (q2):



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q2)b


              Now we substitute and use the rule again:



              (q1) = (q3)a + e
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((q1)(a + b) + (q3)b)a*b
              = (q1)(a + b)a*b + (q3)ba*b
              = (q1)(a + b)a*b(ba*b)*


              Now we substitute again and use the rule again:



              (q1) = (q1)(a + b)a*b(ba*b)*a + e
              = e((a + b)a*b(ba*b)*a)*
              = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = (q1)(a + b)a*b(ba*b)*


              We can now substitute back in to get the expression for (q3):



              (q1) = ((a + b)a*b(ba*b)*a)*
              (q2) = ((q1)(a + b) + (q3)b)a*
              (q3) = ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*


              The regular expression will be the union of the expressions for (q1) and (q3) since these are the accepting states:



              r = ((a + b)a*b(ba*b)*a)* + ((a + b)a*b(ba*b)*a)*(a + b)a*b(ba*b)*
              = ((a + b)a*b(ba*b)*a)*(e + (a + b)a*b(ba*b)*)


              The first part of this takes you from the state q1 back to the state q1 in every possible way; the second part says you can stay in q1 or do the other thing, which leads to q3, otherwise.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 28 at 18:36









              Patrick87Patrick87

              19.6k3 gold badges28 silver badges61 bronze badges




              19.6k3 gold badges28 silver badges61 bronze badges















              • Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

                – safqw
                Mar 28 at 22:08












              • @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

                – Patrick87
                Mar 28 at 23:44

















              • Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

                – safqw
                Mar 28 at 22:08












              • @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

                – Patrick87
                Mar 28 at 23:44
















              Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

              – safqw
              Mar 28 at 22:08






              Thanks, but I actually needed to use general NFA (GNFA) to construct the regular expression. I think the method I need to use is called "state elimination". I think I already managed to do the first finite automata, but I'm having troubles with the second one. I have the following automata at the moment, but I am stuck, how should I deal with multiple final states? Here's what I've got (I used JFLAP to draw the automata) Thanks a lot for help. i.stack.imgur.com/It7GJ.png

              – safqw
              Mar 28 at 22:08














              @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

              – Patrick87
              Mar 28 at 23:44





              @DanL I suspect that what you are referring to is essentially this but just superimposed on a directed graph. In particular, the above works by representing states and transitions in a particular way and then eliminating states one at a time. If that's the case, the answer about how to handle multiple accepting states may simply be to stop eliminating states once you have regular expressions for each one, then do the union. This would be equivalent to adfing a fake new accepting state and lambda/spsilon transitions to force one accepting state, then solve for that.

              – Patrick87
              Mar 28 at 23:44













              0
















              Wikipedia references this course PDF: Second Part of Regular Expressions Equivalence with Finite Automata, and according to this document, the procedure starts with this initial step:




              A DFA is converted to a GNFA of special form by the following procedure:



              1. Add a new start state with an epsilon arrow to the old start state and a new accept state with an epsilon arrow from all old accept states.



              (emphasis mine)



              So the NFA and DFA will not be identical. This also explains how to deal with multiple accepting states.






              share|improve this answer





























                0
















                Wikipedia references this course PDF: Second Part of Regular Expressions Equivalence with Finite Automata, and according to this document, the procedure starts with this initial step:




                A DFA is converted to a GNFA of special form by the following procedure:



                1. Add a new start state with an epsilon arrow to the old start state and a new accept state with an epsilon arrow from all old accept states.



                (emphasis mine)



                So the NFA and DFA will not be identical. This also explains how to deal with multiple accepting states.






                share|improve this answer



























                  0














                  0










                  0









                  Wikipedia references this course PDF: Second Part of Regular Expressions Equivalence with Finite Automata, and according to this document, the procedure starts with this initial step:




                  A DFA is converted to a GNFA of special form by the following procedure:



                  1. Add a new start state with an epsilon arrow to the old start state and a new accept state with an epsilon arrow from all old accept states.



                  (emphasis mine)



                  So the NFA and DFA will not be identical. This also explains how to deal with multiple accepting states.






                  share|improve this answer













                  Wikipedia references this course PDF: Second Part of Regular Expressions Equivalence with Finite Automata, and according to this document, the procedure starts with this initial step:




                  A DFA is converted to a GNFA of special form by the following procedure:



                  1. Add a new start state with an epsilon arrow to the old start state and a new accept state with an epsilon arrow from all old accept states.



                  (emphasis mine)



                  So the NFA and DFA will not be identical. This also explains how to deal with multiple accepting states.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 22:14









                  fjardonfjardon

                  6,74216 silver badges28 bronze badges




                  6,74216 silver badges28 bronze badges
























                      -1
















                      NO the state diagrams of the NFA and the DFA will not be identical during the conversion process.



                      For the second FSM regex will be -
                      ε U (aUb) ab (bUa(aUb)ab)* (εUa)



                      You can refer to these steps -





                      Here's an example -
                      These are screenshots from the PDF version of the book - "Introduction to the theory of computation" by Michael Sipser.






                      share|improve this answer































                        -1
















                        NO the state diagrams of the NFA and the DFA will not be identical during the conversion process.



                        For the second FSM regex will be -
                        ε U (aUb) ab (bUa(aUb)ab)* (εUa)



                        You can refer to these steps -





                        Here's an example -
                        These are screenshots from the PDF version of the book - "Introduction to the theory of computation" by Michael Sipser.






                        share|improve this answer





























                          -1














                          -1










                          -1









                          NO the state diagrams of the NFA and the DFA will not be identical during the conversion process.



                          For the second FSM regex will be -
                          ε U (aUb) ab (bUa(aUb)ab)* (εUa)



                          You can refer to these steps -





                          Here's an example -
                          These are screenshots from the PDF version of the book - "Introduction to the theory of computation" by Michael Sipser.






                          share|improve this answer















                          NO the state diagrams of the NFA and the DFA will not be identical during the conversion process.



                          For the second FSM regex will be -
                          ε U (aUb) ab (bUa(aUb)ab)* (εUa)



                          You can refer to these steps -





                          Here's an example -
                          These are screenshots from the PDF version of the book - "Introduction to the theory of computation" by Michael Sipser.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Mar 30 at 16:40









                          Bhargav Rao

                          32.7k21 gold badges96 silver badges115 bronze badges




                          32.7k21 gold badges96 silver badges115 bronze badges










                          answered Mar 30 at 14:26









                          Amani SaaduddinAmani Saaduddin

                          13 bronze badges




                          13 bronze badges































                              draft saved

                              draft discarded















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403980%2fhow-to-convert-this-automata-to-regular-expression-via-nfa%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현