Title: Single Final State for NFAs
1Single Final State for NFAs
2- Any NFA can be converted
- to an equivalent NFA
- with a single final state
3Example
NFA
Equivalent NFA
4In General
NFA
Equivalent NFA
Single final state
5Extreme Case
NFA without final state
6Properties of Regular Languages
7For regular languages and we will
prove that
Star
Reversal
Complement
Intersection
8We say Regular languages are closed under
Star
Reversal
Complement
Intersection
9(No Transcript)
10Example
11Union
12Example
NFA for
13Concatenation
14Example
15Star Operation
16Example
17Reverse
NFA for
1. Reverse all transitions
2. Make initial state final state and vice
versa
18Example
19Complement
1. Take the DFA that accepts
2. Make final states non-final, and
vice-versa
20Example
21Intersection
DeMorgans Law
22Example
regular
regular
regular
23Regular Expressions
24Regular Expressions
- Regular expressions
- describe regular languages
- Example
- describes the language
25Recursive Definition
Primitive regular expressions
26Examples
A regular expression
27Languages of Regular Expressions
-
- language of regular expression
- Example
-
28Definition
- For primitive regular expressions
29Definition (continued)
- For regular expressions and
-
30Example
31Example
32Example
33Example
34Example
35Equivalent Regular Expressions
- Definition
- Regular expressions and
- are equivalent if
36Example
all strings without two consecutive 0
37Regular ExpressionsandRegular Languages
38Theorem
Languages Generated by Regular Expressions
Regular Languages
39Theorem - Part 1
Languages Generated by Regular Expressions
Regular Languages
40Theorem - Part 2
Languages Generated by Regular Expressions
Regular Languages
41Proof - Part 1
42Induction Basis
- Primitive Regular Expressions
43Inductive Hypothesis
- Assume
- for regular expressions and
- that
- and are regular languages
-
44Inductive Step
Are regular Languages
45- By definition of regular expressions
46By inductive hypothesis we know and
are regular languages
47Are regular languages
48is a regular language
49Proof Part 2
2. For any regular language there is
a regular expression with
Proof by construction of regular expression
50- Since is regular take the
- NFA that accepts it
-
Single final state
51- From construct the equivalent
- Generalized Transition Graph
- in which transition labels are regular
expressions
Example
52 53 54- Resulting Regular Expression
55In General
56- The final transition graph
The resulting regular expression
57Theorem
- If for some DFA A
- Then there is a regular expression R such that
Proof (by induction on the size of R) Let As
states be 1, 2, , n for some integer
n Construct a collection of regular expressions
that describe progressively broader sets of paths
in DFA A
58- Let be the regex that represent the set of
strings w such that w is the label of a path from
state i to j in A, and that path has no
intermediate state whos label is greater than k. - Note beginning end points, i.e. i j are not
intermediate so they can be greater than k
59Inductive Definition
- Basis k 0
- Since all states are gt 1, restriction on the
paths is that the path must have no intermediate
states at all. - If i ? j An arc from i to j
- Depending of the DFA A may be f, a or
-
- (If there are m symbols that label arcs from i to
j)
60Inductive Definition
- If i j all loops from i to itself
- legal paths of length 0
- (If there are m symbols that label arcs from i to
i)
61Inductive Definition
- Induction
- Suppose that there is a path from i to j that
goes through no state with label higher than k.
Consider two cases - path does not go thru state k at all.
-
62- path goes thru state k at least once
- More than once
- once