310 likes | 448 Views
Introduction to Computability Theory. Discussion1: Conversion of A DFA to a Regular Expression Prof. Amos Israeli. Ripping a state from a GNFA(rem.).
E N D
Introduction to Computability Theory Discussion1: Conversion of A DFA to a Regular Expression Prof. Amos Israeli
Ripping a state from a GNFA(rem.) Given a GNFA G, any state of G, not including and , can be ripped off G, while preserving .This is demonstrated in the next slide by considering a general state, denoted by , and an arbitrary pair of states, and :
Removing a state from a GNFA Before Ripping After Ripping Note: This should be done for every pair of incoming and outgoing transitions.
Ellaboration Assume the following situation:In order to rip , all pairsof incoming and outgoingtransitions should be considered in the way showed on the previous slide namely consider one after the other. After that can be ripped while preserving .
The Conversion Algorithm - Outline The conversion algorithm has 3 stages: • Converting a DFA D with k states to an equivalent GNFA G with states . • Repeatedly ripping an arbitrarily chosen state of G while preserving its functionality until remaining with a 2 states equivalent GNFA with two states. • Return the RE labeling remaining transition.
Exercise Apply the algorithm to obtain the regular expression equivalent to D: What is the equivalent Regular expression?
Stage 1: Convert D to a GNFA 1.0 Start with D
Stage 1: Convert D to a GNFA 1.1 Add 2 new states
Stage 1: Convert D to a GNFA 1.2 Make the initial state and the finalstate.
Stage 1: Convert D to a GNFA 1.3 Replace multi label transitions by their union.
Stage 1: Convert D to a GNFA 1.4 Add all missing transitions and label them .
Stage 2: Rip a state 2.0 Start with G.
Stage 2: Rip a state 2.1 Choose an arbitrary state to be ripped.
Stage 2: Rip a state 2.1 Remove all -labeled incoming and outgoing transitions. (Note: This stage does not appear in the book). 2.3 Replace each pair of incoming and outgoing transitions using the procedure we showed before.
Stage 2: Rip a state Reminder: if the incoming transition from to is labeled , the self-loop of , , the transition from to with , and the transition from to is labeled with then the new label from to is labeled .Also note: for any regular expression R,
Stage 2: Rip a state 2.1 Remove all - labeled incoming transitions.
Stage 2: Rip a state 2.1 Remove all - labeled outgoing transitions.
Stage 2: Rip a state 2.1 Remove all - labeled outgoing transitions.
Stage 2: Rip a state 2.1 Remove transitions new label is .
Stage 2: Rip a state 2.1 Now all incoming transitions are removed.
Stage 2: Rip a state 2.2 Remove outgoing transitions.
Stage 2: Rip a state 2.3 choose a new .
Stage 2: Rip a state 2.1 Remove all - labeled incoming transitions.
Stage 2: Rip a state 2.1 Remove all - labeled outgoing transitions.
Stage 2: Rip a state 2.1 Remove all - labeled outgoing transitions.
Stage 2: Rip a state 2.2 Remove transitions new label is . .
Stage 2: Rip a state 2.3 Remove and all its transitions.
Stage 2: Rip last state 2.3 Choose the last remaining state to be ripped.
Stage 2: Rip a state 2.3 choose a new and repeat procedure.