these material has been reproduced and presented to you by km khan afridi for idea only. do not...
TRANSCRIPT
These material has been reproduced and presented to you by KM Khan Afridi for
IDEA only. Do not forget me in DUA
Warning:The information herein is for idea purposes only and I cannot guarantee the accuracy of any information provided in this presentation..I makes no warranties, express, implied or statutory, as to the information in this presentation.This Presentation is protected by copyright laws and VU Plagiarism Policy. Unauthorized reproduction or distribution of this Presentation, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.
Converting Finite Automata into Regular Expressions
CS402
Kleene’s Theorem
Regular Expression
Finite Automaton
NFA-LGTG
TG NFA
First Three Proofs
• Every Finite Automaton is a NFA• Every NFA is a Transition Graph.• Every Transition Graph is a Generalised
Transition Graph.
How to convert aGeneralised Transition Graph
into aRegular Expression
Make a uniqueStart State
with no inputtransitions
Are there any Final States
?
Make a uniqueFinal State with nooutput transitions
Eliminatemultiple loops
Eliminatemultiple edges
Is the number of states
> 2?
Eliminate astate which is
NOTthe Start state
or theFinal state
Is the GTGconnected?
Write f
Write thelabel
NO
NO
NO
YES
YESYES
Make a unique Start State
-
-
...
...
...
Make a unique Start State
-
-
...
...
...
-
L
L
Make a unique Start State
...
...
...
-
L
L
Make a unique Final State
+
+
...
...
...
Make a unique Final State
+
+
...
...
...
+
L
L
Make a unique Final State
...
...
...
+
L
L
Eliminate multiple loops
... ...
R1
R2
R3
... ...
R1 + R2 + R3
Eliminate multiple edges
... ...
R1
R2
R3
R1 + R2 + R3... ...
State Elimination
Cases Incoming edgesfrom a different state
Outgoing edgesto a different state
Loops
1 1 1 NO2 1 1 YES3 1 More than 1 NO/YES4 More than 1 More than 1 NO/YES5 0 0, 1, or more NO/YES
6 0, 1, or more 0 NO/YES
... ...R1 R21 2
... ...R1 R2
1 2
... ...R1 (S)* R2
1 2
... ...R1 R21 2
S
... ...R1
R2
1 3
S 2
4
...
...
R3
R4
... ...R1 (S )* R3
1 3
4
2 ...
...
R1 (S )* R2
R1 (S )* R4
... ...
R1
R2
1 3
S 2 ...
R3
R4
... ...R1 (S )* R3
1 3
2 ...R1 (S )* R2
R1 (S )* R4
...
...
R1R2
1
3
S 2
4
...
...
R3
R4... 5 R5
...
...R1 (S )* R3
1
3
4
2 ...
...R1 (S )* R4... 5
R1 (S )* R2
R5 (S )* R2
R5 (S )* R4
R5 (S )* R3
...
...
R1R2
1
3
S 2
4
...
...
R3
R4... 5 R5
...
...
1
3
2
4
...
...... 5
...
...
R1R2
1
3
S 2
4
...
...
R3
R4... 5 R5
...
...
1
3
2
4
...
...... 5
Revision• Know Kleene’s Theorem• Be able to convert FAs into Regular
Expressions
Preparation
• Read– Lectures 11 and 12, Practice on Example