1 cdt314 faber formal languages, automata and models of computation lecture 5 school of innovation,...
TRANSCRIPT
![Page 1: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/1.jpg)
1
CDT314
FABER
Formal Languages, Automata and Models of Computation
Lecture 5
School of Innovation, Design and Engineering Mälardalen University
2012
![Page 2: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/2.jpg)
2
Content
- More Properties of Regular Languages (RL)- Standard Representations of RL- Elementary Questions about RL- Non-Regular Languages- The Pigeonhole Principle- The Pumping Lemma- Applications of the Pumping Lemma- NFA-DFA repetition
![Page 3: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/3.jpg)
3
More Properties of
Regular Languages
Based on C Busch, RPI, Models of Computation
![Page 4: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/4.jpg)
4
We have shown
Regular languages are closed under
Union
Concatenation
Star operation
Reverse
![Page 5: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/5.jpg)
5
Namely, for regular languages and :1L 2L
21 LL
21LL
1L
Union
Concatenation
Star operation
Reverse RL1
Regular
Languages
![Page 6: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/6.jpg)
6
We will show that
Regular languages are also closed under
Complement
Intersection
![Page 7: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/7.jpg)
7
Namely, for regular languages and :1L 2L
1L
21 LL
Complement
Intersection
Regular
Languages
![Page 8: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/8.jpg)
8
Complement
Theorem For regular language
the complement is regular. LL
Proof
Take DFA that accepts and exchange:L
non-accepting states accepting states
LResulting DFA accepts
![Page 9: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/9.jpg)
9
Examplea
b ba,
ba,
0q 1q 2q
)*( baLL
a
b ba,
ba,
0q 1q 2q
)))((( bababaaLL
![Page 10: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/10.jpg)
10
Intersection
Theorem For regular languages and
the intersection is regular. 21 LL 1L 2L
Proof Apply DeMorgan’s Law:
2121 LLLL
![Page 11: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/11.jpg)
11
21 , LL regular
21 , LL regular
21 LL regular
21 LL regular
21 LL regular
![Page 12: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/12.jpg)
12
Standard Representations of
Regular Languages
![Page 13: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/13.jpg)
13
Regular Language Representations
DFA
NFA
Regular
Expression
Regular
Grammar
Regular
Language
![Page 14: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/14.jpg)
14
Elementary Questionsabout
Regular Languages
![Page 15: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/15.jpg)
15
Membership Question
Question: Given regular language
and string
how can we check if ?
L
Lw w
Answer: Take the DFA that accepts
and check if is accepted.
Lw
![Page 16: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/16.jpg)
16
Lw
DFAw
Lw
DFAw
![Page 17: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/17.jpg)
17
Take the DFA that accepts .
Check if there is a path from
the initial state to a final state.
L
Given regular language
how can we check
if is empty: ?
L
L )( L
Question:
Answer:
Empty Language Question
![Page 18: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/18.jpg)
18
DFA
L
L
DFA
![Page 19: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/19.jpg)
19
Given regular language
how can we check
if is finite?
L
L
Take the DFA that accepts .
Check if there is a walk with a cycle
from the initial state to a final state.
L
Question:
Answer:
Finiteness Question
![Page 20: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/20.jpg)
20
DFA
L is infinite
DFA
L is finite
![Page 21: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/21.jpg)
21
Given regular languages and
how can we check if ? 1L 2L
21 LL Question:
)()( 2121 LLLLFind ifAnswer:
Equality Question
![Page 22: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/22.jpg)
22
)()( 2121 LLLL
21 LL 21 LLand
21 LL
1L2L 1L2L
21 LL 12 LL 2L 1L
![Page 23: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/23.jpg)
23
)()( 2121 LLLL
21 LL 21 LLor
1L2L 1L2L
21 LL 12 LL
21 LL
![Page 24: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/24.jpg)
24
Non-Regular Languages
![Page 25: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/25.jpg)
25
Regular languages
ba * acb *
...etc
*)( bacb
Non-regular languages???
![Page 26: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/26.jpg)
26
How can we prove that a language
is not regular?
L
Prove that there is no DFA that accepts L
Problem: this is not easy to prove.
Solution: the Pumping Lemma !
a
b
b
a
a
b
}0:{ nbaL nn
![Page 27: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/27.jpg)
27
The Pigeonhole Principle
![Page 28: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/28.jpg)
28
The Pigeonhole Principle
![Page 29: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/29.jpg)
29
pigeons
pigeonholes
4
3
![Page 30: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/30.jpg)
30
A pigeonhole must
contain at least two pigeons
![Page 31: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/31.jpg)
31
...........
...........
pigeonsn
pigeonholesm mn
![Page 32: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/32.jpg)
32
The Pigeonhole Principle
...........
pigeons
pigeonholes
n
m
mn There is a pigeonhole
with at least 2 pigeons
![Page 33: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/33.jpg)
33
The Pigeonhole Principleand DFAs
![Page 34: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/34.jpg)
34
DFA with states 4
1q 2q 3qa
b
4q
b
b b
b
a a
![Page 35: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/35.jpg)
35
1q 2q 3qa
b
4q
b
b
b
a a
a
In walks of strings:
aab
aa
ano state
is repeated
![Page 36: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/36.jpg)
36
In walks of strings:
1q 2q 3qa
b
4q
b
b
b
a a
a
...abbbabbabb
abbabb
bbaa
aabb a state
is repeated
![Page 37: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/37.jpg)
37
If the walk of string has length
1q 2q 3qa
b
4q
b
b
b
a a
a
w 4|| w
then a state is repeated
![Page 38: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/38.jpg)
38
If in a walk of a string
transitions states of DFA
then a state is repeated
Pigeonhole principle for any DFA:
w
![Page 39: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/39.jpg)
39
In other words for a string
transitions are pigeons
states are pigeonholesq
a
w
![Page 40: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/40.jpg)
40
A string has length number of states w
A state must be repeated in the walk of wq
In general
...... ......
walk of w
q
![Page 41: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/41.jpg)
41
The Pumping Lemmafor Regular Languages
see alsohttp://www.math.uu.se/~salling/Movies/Nonregularity.mov
![Page 42: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/42.jpg)
42
Take an infinite regular language L
DFA that accepts L
nstates
![Page 43: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/43.jpg)
43
Take string with w Lw
There is a walk with label w
.........
walk w
![Page 44: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/44.jpg)
44
If string has length w1|| nmw
then, from the pigeonhole principle:
a state is repeated in the walkq w
...... ......
walk w
( number of states)
q
n
![Page 45: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/45.jpg)
45
Write zyxw
...... ......
x
y
z
q
![Page 46: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/46.jpg)
46
myx ||
Lengths:
1|| y
...... ......
x
y
z
q
(from pigeon principle, as q is the first repetition in sequence)
(there is a walk in the graph)
![Page 47: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/47.jpg)
47
The string is accepted zxObservation:
...... ......
x
y
z
q
![Page 48: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/48.jpg)
48
The string
is accepted
zyyxObservation:
...... ......
x
y
z
q
![Page 49: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/49.jpg)
49
The string
is accepted
zyyyxObservation:
...... ......
x
y
z
q
![Page 50: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/50.jpg)
50
The string
zyx iGenerally:
...,2,1,0i
...... ......
x
y
z
q
is accepted
![Page 51: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/51.jpg)
51
The Pumping Lemma
Given an infinite regular language L
there exists an integer such that m
for any string with length Lw mw ||
we can write zyxw
with andmyx || 1|| y
such that: Lzyx i ...,2,1,0i
![Page 52: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/52.jpg)
52
Applications of
the Pumping Lemma
![Page 53: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/53.jpg)
53
Theorem
The language}0:{ nbaL nn
is not regular.
Proof
Use the Pumping Lemma!
![Page 54: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/54.jpg)
54
Assume to the contrary,
that is a regular language.L
Since is infinite
we can apply the Pumping Lemma.
L
}0:{ nbaL nn
![Page 55: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/55.jpg)
55
Let be the integer in the Pumping Lemma
Pick a string such that: w Lw
mw ||with length
mmbaw e.g. pick
m
}0:{ nbaL nn
![Page 56: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/56.jpg)
56
Write: zyxba mm
it must be that length
From the Pumping Lemma
1||,|| ymyx
Therefore:
1, kay k
babaaaaba mm ............
x y z
m m
![Page 57: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/57.jpg)
57
From the Pumping Lemma: Lzyx i ...,2,1,0i
We can choose
mmbazyx
0i
We have:
1, kay k
Lbaw mkm
CONTRADICTION!
![Page 58: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/58.jpg)
58
Therefore: Our assumption that
is a regular language is not true.
L
Conclusion
L is not a regular language.
END OF PROOF
![Page 59: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/59.jpg)
59
Regular languages
ba * acb *
...etc
*)( bacb
Non-regular languages
}0:{ nba nn
![Page 60: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/60.jpg)
60
Theorem The language
Proof
Use the Pumping Lemma!
is not regular.
*}:{ wwwL R },{ ba
![Page 61: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/61.jpg)
61
*}:{ wwwL R
Assume to the contrary,
that is a regular language.
Since is infinite
we can apply the Pumping Lemma.
L
L
![Page 62: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/62.jpg)
62
mmmm abbaw pick
Pick a string such that: w Lw
mw ||length
Let be the integer in the Pumping Lemma.m
*}:{ wwwL R
![Page 63: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/63.jpg)
63
Write zyxabba mmmm
it must be that length
From the Pumping Lemma
ababbabaaaaabba mmmm ..................
x y z
m m m m
1||,|| ymyx
1, kay k
![Page 64: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/64.jpg)
64
ababbabaaaaabba mmmm ..................
x y z
m m m m
1, kay k
We can choose 0i
CONTRADICTION!
So we get a’s on the left,
while is on the right:
km m
![Page 65: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/65.jpg)
65
Conclusion
L is not a regular language.
Our assumption that
is a regular language is not true.
Therefore:
END OF PROOF
L
![Page 66: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/66.jpg)
66
Regular languages
ba * acb *
...etc
*)( bacb
Non-regular languages
}0:{ nba nn *}:{ wwwR
![Page 67: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/67.jpg)
67
Theorem The language
is not regular.
Proof
Use the Pumping Lemma.
}0,:{ lncbaL lnln
![Page 68: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/68.jpg)
68
Assume to the contrary
that is a regular language.L
Since is infinite
we can apply the Pumping Lemma.
L
}0,:{ lncbaL lnln
![Page 69: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/69.jpg)
69
mmm cbaw 2Pick
Let be the integer in the Pumping Lemma.
Pick a string such that: w Lw
mw ||length
m
}0,:{ lncbaL lnln
![Page 70: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/70.jpg)
70
Write zyxcba mmm 2
cccbcabaaaaacba mmm ..................2
x y z
m m m2
it must be that length
From the Pumping Lemma
1||,|| ymyx
1, kay k
![Page 71: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/71.jpg)
71
From the Pumping Lemma
Lzyx i ...,2,1,0i
Thus:
Lcbazxzyx mmkm 20
Lzyx 0
mmm cbazyx 2We have:
1, kay k
![Page 72: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/72.jpg)
72
Lcba mmkm 2Therefore:
Lcba mmkm 2
BUT:
CONTRADICTION!
}0,:{ lncbaL lnln
![Page 73: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/73.jpg)
73
Conclusion
L is not a regular language.
LTherefore: Our assumption that
is a regular language is not true.
END OF PROOF
![Page 74: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/74.jpg)
74
Regular languages
Non-regular languages
}0,:{ lncba lnln
*}:{ wwwR
}0:{ nba nn
![Page 75: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/75.jpg)
75
Theorem
The language
is not regular.
ProofUse the Pumping Lemma.
}0:{ ! naL n
nnn )1(21!
Factorial of n, (n!) is the product of all positive integers less than or equal to n. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120 The value of 0! is 1.
![Page 76: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/76.jpg)
76
Assume to the contrary
that is a regular language.L
Since is infinite
we can apply the Pumping Lemma.
L
}0:{ ! naL n
![Page 77: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/77.jpg)
77
!maw Pick
Pick a string such that: w
Lw mw ||length
Let be the integer in the Pumping Lemma.m
}0:{ ! naL n
![Page 78: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/78.jpg)
78
Write zyxam !
From the Pumping Lemma
aaaaaaaaaaam ...............!
x y z
m mm !
it must be that length 1||,|| ymyx
mkay k 1,
![Page 79: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/79.jpg)
79
From the Pumping Lemma:
Lzyx i ...,2,1,0i
Thus:
!mazyx
Lazyyxzyx km !2
Lzyx 2
We have:
mkay k 1,
![Page 80: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/80.jpg)
80
La km !Therefore:
!! pkm
}0:{ ! naL nSince:
mk 1
mk 1There is p
![Page 81: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/81.jpg)
81
However
)!1( += m)1(! += mm!! +< mmm
!!+£ mm!+£ mmkm !
for 1m
! ! ( 1)!m m k m
!! pkm for any p
![Page 82: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/82.jpg)
82
La km !
Therefore: La km !
BUT:
CONTRADICTION!
}0:{ ! naL n mk 1and
![Page 83: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/83.jpg)
83
Conclusion
L is not a regular language.
Our assumption that
is a regular language is not true.LTherefore:
END OF PROOF
![Page 84: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/84.jpg)
84
Regular languages
Non-regular languages
}0:{ ! nan}0,:{ lncba lnln
*}:{ wwwR}0:{ nba nn
![Page 85: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/85.jpg)
85
Theorem
The language
is not regular.
ProofUse the Pumping Lemma.
}:{ primeiaL i
![Page 86: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/86.jpg)
86
Assume to the contrary,
that is a regular language.L
Since is infinite
we can apply the Pumping Lemma.
L
}:{ primeiaL i
![Page 87: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/87.jpg)
87
it must be that length 1||,|| ymyx
Lw mw ||length
From the Pumping Lemma:
Lzyx i ...,2,1,0i
The length of zxyw k 1
must be prime for each string of .
mk
L
![Page 88: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/88.jpg)
88
Thus:
But, choosing
which is not prime!
CONTRADICTION!
))(1(
))((
)()(
)()( 1
ylengthk
ylengthkk
ylengthxyzlength
zxyylengthzxylengthk
kk
)( mk
Lw
( )length xyz k
![Page 89: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/89.jpg)
89
Conclusion
L is not a regular language.
Our assumption that
is a regular language is not true.LTherefore:
END OF PROOF
![Page 90: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/90.jpg)
90
Regular languages
Non-regular languages
}0:{ ! nan}0,:{ lncba lnln
*}:{ wwwR}0:{ nba nn
}:{ primeiaL i
![Page 91: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/91.jpg)
91
Theorem
The language}0:{ nbaL nn
is not regular.
Proof
Use the Pumping Lemma!
For your exercise:An alternative variant of proof from slide 53.
![Page 92: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/92.jpg)
92
Assume to the contrary
that is a regular language.L
Since is infinite
we can apply the Pumping Lemma.
L
}0:{ nbaL nn
![Page 93: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/93.jpg)
93
Pick a string such that: w Lw
mw ||length
mmbaw Pick
Let be the integer in the Pumping Lemma.m
}0:{ nbaL nn
![Page 94: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/94.jpg)
94
Write: zyxba mm
it must be that: length
From the Pumping Lemma
1||,|| ymyx
Therefore: babaaaaba mm ............
1, kay kx y z
m m
![Page 95: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/95.jpg)
95
From the Pumping Lemma: Lzyx i
...,2,1,0i
Thus:
mmbazyx
Lbazyyxzyx mkm 2
Lzyx 2
We have: 1, kay k
![Page 96: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/96.jpg)
96
Lba mkm Therefore:
}0:{ nbaL nnBUT:
Lba mkm
CONTRADICTION
![Page 97: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/97.jpg)
97
Our assumption that
is a regular language is not true.
L
Conclusion: L is not a regular language.
Therefore:
END OF PROOF
![Page 98: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/98.jpg)
98
Pumping Lemma, in short
![Page 99: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/99.jpg)
99
Observation:
Every language of finite size has to be regular.
(We can easily construct an NFA that accepts every string in the language, or a union of regular expressions)
Therefore, every non-regular language
has to be of infinite size. (contains an infinite number of strings)
![Page 100: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/100.jpg)
100
Suppose you want to prove that
An infinite language is not regular
1. Assume the opposite: is regular
2. The pumping lemma should hold for
3. Use the pumping lemma to obtain a contradiction
L
L
L
4. Therefore, is not regular L
![Page 101: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/101.jpg)
101
Explanation of Step 3: How to get a contradiction
with pumping lemma
i. Find a particular string which satisfies
the conditions of the pumping lemma
Lw
ii. Write xyzw
iii. Show that Lzxyw i for some 1i
iv. This gives a contradiction, since from
pumping lemma Lzxyw i
![Page 102: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/102.jpg)
102
Note: It suffices to show that
only one string
gives a contradiction Lw
You don’t need to obtain
contradiction for every Lw
![Page 103: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/103.jpg)
103
Extra Examples on Regular Languages
![Page 104: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/104.jpg)
104
FA RE
![Page 105: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/105.jpg)
105
FA RE
or
![Page 106: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/106.jpg)
106
NFA DFA
Subset Construction
Delmängdkonstruktion
![Page 107: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/107.jpg)
107
Convert an NFA to DFAusing the subset construction
![Page 108: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/108.jpg)
108
Each state of the DFA is a set of states of the NFA.
Start by the initial state of the DFA which is the -closure of the initial state of the NFA (all the states you reach by -transitions from the initial state) .
CLOSE{0}={0, 1, 3}=S0
![Page 109: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/109.jpg)
109
Determine the transition function of the DFA on all inputs. Begin with the initial state S0, and determine the transition on input a.
CLOSE{0} = {0, 1, 3} = S0
(S0, a) = CLOSE{1, 2}
![Page 110: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/110.jpg)
110
The e-closure of the set {1, 2} is {1, 2, 3}This is a new state in the DFA, call it S1.
CLOSE{0} = {0, 1, 3} = S0
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
![Page 111: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/111.jpg)
111
With the initial state S0, determine the transition on input b. CLOSE{0} = {0, 1, 3} = S0
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
(S0, b) = CLOSE{3}
![Page 112: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/112.jpg)
112
The -closure of the set {3} is {1, 3}. This is a new state in the DFA, call it S2.
CLOSE{0} = {0, 1, 3} = S0
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
(S0, b) = CLOSE{3} = {1, 3} = S2
![Page 113: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/113.jpg)
113
Determine the transition function of the DFA from state S1 oninputs a and b. On a there is no where to go in the NFA, so wecreate a “sink“(“trap”) state for DFA.
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
(S0, b) = CLOSE{3} = {1, 3} = S2
(S1, a) = CLOSE{} = = S3
![Page 114: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/114.jpg)
114
Determine the transition function of the DFA from state S1 oninputs a and b. On b there is a transition to an existing state S2.
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
(S0, b) = CLOSE{3} = {1, 3} = S2
(S1, a) = CLOSE{} = = S3
(S1, b) = CLOSE{3} = {1, 3} = S2
![Page 115: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/115.jpg)
115
Determine the transition from state S2 on inputs a and b.
(S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1
(S0, b) = CLOSE{3} = {1, 3} = S2
(S1, a) = CLOSE{} = = S3
(S1, b) = CLOSE{3} = {1, 3} = S2
(S2, a) = CLOSE{} = = S3
(S2, b) = CLOSE{3} = {1, 3} = S2
![Page 116: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/116.jpg)
116
Determining the transition from state S2 on inputs a and b is easy;from the empty set of states there are no transitions in the NFA. Inthe DFA this is represented by a transition from the empty setback to itself.
![Page 117: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/117.jpg)
117
The final states of the DFA are determined from the final states of the NFA. State 3 was the only final state in the NFA. (Any set of NFA states containing a final state is a final state in the DFA.)
![Page 118: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/118.jpg)
118
NFA DFA RESULT
![Page 119: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/119.jpg)
State elimination
l+10* 0*11
0*1
q0 q1 q2
01
q0 q2
01
(l+10*)(0*1)*0*11
q0 q2
(l+10*)(0*1)*0*11 + 01
![Page 120: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/120.jpg)
Example 7
Convert the following NFA to DFA.
s
p
0
ε0 ε
0
1
1
ε
0
r
srp
0 qrp
1
s
q, r, p
0
10
1
q
![Page 121: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/121.jpg)
s
p
0
0
0
1
10
r
q
0q
1
q r p
0
1
0
1
Converting the NFA to DFA
p r sp r s
![Page 122: 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012](https://reader035.vdocuments.us/reader035/viewer/2022062422/56649e925503460f94b9781c/html5/thumbnails/122.jpg)
122
Application: Lex - lexical analyzer
Lex
RE NFA DFAMinimalDFA
The final states of the DFA are associated with actions.