introduction to computability theory
DESCRIPTION
Introduction to Computability Theory. Discussion1: Conversion of A DFA to a Regular Expression Prof. Amos Israeli. Ripping a state from a GNFA(rem.). - PowerPoint PPT PresentationTRANSCRIPT
1
Introduction to Computability Theory
Discussion1: Conversion ofA DFA to a Regular Expression
Prof. Amos Israeli
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 :
Ripping a state from a GNFA(rem.)
2
GLstartq acceptq
ripq
iq jq
Removing a state from a GNFA
3
1R
iqjq
ripq
4R
3R
2R
43*
21 RRRR iq jq
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 .
4
1t 2t 3t
5t4t 53
4352425141
,
,,,,,,,,,,
tt
tttttttttt
ripq
ripq
ripq
GL
The Conversion Algorithm - Outline
The conversion algorithm has 3 stages:1. Converting a DFA D with k states to an
equivalent GNFA G with states .2. Repeatedly ripping an arbitrarily chosen state
of G while preserving its functionality until remaining with a 2 states equivalent GNFA with two states.
3. Return the RE labeling remaining transition.
5
2k
Exercise
Apply the algorithm to obtain the regular expression equivalent to D:
What is the equivalent Regular expression?
6
** 10101
0aq bq
1cq
1 0 1,0
Stage 1: Convert D to a GNFA
1.0 Start with D
7
0
aq
bq
1
cq
1
0
1,0
Stage 1: Convert D to a GNFA
1.1 Add 2 new states
8
0
aq
bq
1
cq
1
0
1,0
acceptqstartq
Stage 1: Convert D to a GNFA
1.2 Make the initial state and the finalstate.
9
0
aq
bq
1
cq
1
0
1,0
acceptqstartq
startq acceptq
Stage 1: Convert D to a GNFA
1.3 Replace multi label transitions by their union.
10
0
aq
bq
1
cq
1
0
10
acceptqstartq
Stage 1: Convert D to a GNFA
1.4 Add all missing transitions and label them .
11
0
aq
bq
1
cq
1
0
startq
acceptq
10
Stage 2: Rip a state
2.0 Start with G.
12
0
aq
bq
1
cq
1
0
startq
acceptq
10
Stage 2: Rip a state
2.1 Choose an arbitrary state to be ripped.
13
0
aq
bq
1
cq
1
0
startq
acceptq
10
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.
14
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,
15
43*
21 RRRR
1R2Rripq
ripqiq
ripq jq3R
iq jq4R
RR
iq jq
Stage 2: Rip a state
2.1 Remove all - labeled incoming transitions.
16
0
aq
bq
1
cq
1
0
10
startq
acceptq
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
17
0
aq
bq
1
cq
1
0
10
startq
acceptq
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
18
0
aq
bq
1
cq
1
0
10
startq
acceptq
Stage 2: Rip a state
2.1 Remove transitions new label is .
19
0
aq
bq
1
cq
1
0
startq
acceptq
10100*
10
10
Stage 2: Rip a state
2.1 Now all incoming transitions are removed.
20
aq
bq
1
cq
1
0
startq
acceptq
10
10
Stage 2: Rip a state
2.2 Remove outgoing transitions.
21
aq
bq
cq
1
startq
acceptq
10
10
Stage 2: Rip a state
2.3 choose a new .
22
aq cq
1
startq
acceptq
10
ripq
10
Stage 2: Rip a state
2.1 Remove all - labeled incoming transitions.
23
aq cq
1
startq
acceptq
10
10
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
24
aq cq
1
startq
acceptq
10
10
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
25
aq cq
1
startq
acceptq
10
10
Stage 2: Rip a state
2.2 Remove transitions new label is . .
26
aq cq
1
startq
acceptq
** 10101010
10
10
*1010
Stage 2: Rip a state
2.3 Remove and all its transitions.
27
aq
1
startq
acceptq
** 10101010
ripq
Stage 2: Rip last state
2.3 Choose the last remaining state to be ripped.
28
aq
1
startq
acceptq
** 10101010
Stage 2: Rip a state
2.3 choose a new and repeat procedure.
29
startq acceptq
ripq
**** 1010110101
Stage 3: Return the remaining RE
.
30
startq acceptq
** 10011