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
![Page 1: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/1.jpg)
1
Introduction to Computability Theory
Discussion1: Conversion ofA DFA to a Regular Expression
Prof. Amos Israeli
![Page 2: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/2.jpg)
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
![Page 3: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/3.jpg)
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.
![Page 4: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/4.jpg)
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
![Page 5: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/5.jpg)
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
![Page 6: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/6.jpg)
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
![Page 7: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/7.jpg)
Stage 1: Convert D to a GNFA
1.0 Start with D
7
0
aq
bq
1
cq
1
0
1,0
![Page 8: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/8.jpg)
Stage 1: Convert D to a GNFA
1.1 Add 2 new states
8
0
aq
bq
1
cq
1
0
1,0
acceptqstartq
![Page 9: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/9.jpg)
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
![Page 10: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/10.jpg)
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
![Page 11: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/11.jpg)
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
![Page 12: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/12.jpg)
Stage 2: Rip a state
2.0 Start with G.
12
0
aq
bq
1
cq
1
0
startq
acceptq
10
![Page 13: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/13.jpg)
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
![Page 14: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/14.jpg)
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
![Page 15: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/15.jpg)
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
![Page 16: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/16.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled incoming transitions.
16
0
aq
bq
1
cq
1
0
10
startq
acceptq
![Page 17: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/17.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
17
0
aq
bq
1
cq
1
0
10
startq
acceptq
![Page 18: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/18.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
18
0
aq
bq
1
cq
1
0
10
startq
acceptq
![Page 19: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/19.jpg)
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
![Page 20: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/20.jpg)
Stage 2: Rip a state
2.1 Now all incoming transitions are removed.
20
aq
bq
1
cq
1
0
startq
acceptq
10
10
![Page 21: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/21.jpg)
Stage 2: Rip a state
2.2 Remove outgoing transitions.
21
aq
bq
cq
1
startq
acceptq
10
10
![Page 22: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/22.jpg)
Stage 2: Rip a state
2.3 choose a new .
22
aq cq
1
startq
acceptq
10
ripq
10
![Page 23: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/23.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled incoming transitions.
23
aq cq
1
startq
acceptq
10
10
![Page 24: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/24.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
24
aq cq
1
startq
acceptq
10
10
![Page 25: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/25.jpg)
Stage 2: Rip a state
2.1 Remove all - labeled outgoing transitions.
25
aq cq
1
startq
acceptq
10
10
![Page 26: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/26.jpg)
Stage 2: Rip a state
2.2 Remove transitions new label is . .
26
aq cq
1
startq
acceptq
** 10101010
10
10
*1010
![Page 27: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/27.jpg)
Stage 2: Rip a state
2.3 Remove and all its transitions.
27
aq
1
startq
acceptq
** 10101010
ripq
![Page 28: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/28.jpg)
Stage 2: Rip last state
2.3 Choose the last remaining state to be ripped.
28
aq
1
startq
acceptq
** 10101010
![Page 29: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/29.jpg)
Stage 2: Rip a state
2.3 choose a new and repeat procedure.
29
startq acceptq
ripq
**** 1010110101
![Page 30: Introduction to Computability Theory](https://reader035.vdocuments.mx/reader035/viewer/2022062517/56813aee550346895da361e2/html5/thumbnails/30.jpg)
Stage 3: Return the remaining RE
.
30
startq acceptq
** 10011