Lecture 5: Regular Expressions, cont
David Dill
Department of Computer Science
1
Outline
•
Converting Regular Expressions to
NFAs
•
Converting NFAs to regular expressions.
2
From Regular Expressions to Finite Automata
Theorem:
For every regular expression
R
, there is an
NFA
E
such that
L
(
R
) =
L
(
E
)
.
It is easier to prove a stronger theorem:
Theorem:
For every regular expression
R
, there is an
NFA
E
with these
properties:
•
L
(
E
) =
L
(
R
)
.
•
There is a single final state.
•
No transitions enter the start state.
•
No transitions leave the final state.
The theorem is proved by induction on the structure of regular expressions.
(A fully detailed proof would have a lot of tedious manipulation of
ˆ
δ
s)
3
Proof of
R
→

NFA
•
When
R
=
∅
, the NFA is:
h
See figure in text.
i
All four properties are obviously met.
•
When
R
=
, the NFA is
h
See figure in text.
i
All four properties are obviously met.
4
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Proof of
R
→

NFA
, cont.
•
When
R
=
a
, the NFA is
h
See figure in text.
i
All four properties are obviously met.
•
When
R
=
R
1
+
R
2
, the NFA is:
h
See figure in text.
i
Assuming the induction hypothesis for
R
1
and
R
2
, all four conditions are
obviously met.
5
Proof of
R
→

NFA
, cont.
•
R
1
R
2
h
See figure in text.
i
Assuming the induction hypothesis for
R
1
and
R
2
, all four conditions are
obviously met.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '08
 Motwani,R
 Computer Science, Formal language, Regular expression, Regular language, Nondeterministic finite state machine, regular expressions, rij

Click to edit the document details