1 more properties of regular languages. 2 we have proven regular languages are closed under: union...
Post on 19-Dec-2015
219 views
TRANSCRIPT
![Page 1: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/1.jpg)
1
More Properties of
Regular Languages
![Page 2: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/2.jpg)
2
We have proven
Regular languages are closed under:
Union
Concatenation
Star operation
Reverse
![Page 3: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/3.jpg)
3
Namely, for regular languages and :1L 2L
21 LL
21LL
1L
Union
Concatenation
Star operation
Reverse RL1
RegularLanguages
![Page 4: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/4.jpg)
4
We will prove
Regular languages are closed under:
Complement
Intersection
![Page 5: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/5.jpg)
5
Namely, for regular languages and :1L 2L
1L
21 LL
Complement
Intersection
RegularLanguages
![Page 6: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/6.jpg)
6
Complement
Theorem:For regular language the complement is regular L
L
Proof: Take DFA that accepts and make • nonfinal states final• final states nonfinal
Resulting DFA accepts
L
L
![Page 7: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/7.jpg)
7
Example:a
b ba,
ba,
0q 1q 2q
)*( baLL
a
b ba,
ba,
0q 1q 2q
)*))((**( bababaaLL
![Page 8: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/8.jpg)
8
Intersection
Theorem:For regular languages and the intersection is regular 21 LL
1L 2L
Proof: Apply DeMorgan’s Law:
2121 LLLL
![Page 9: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/9.jpg)
9
21 , LL regular
21 , LL regular
21 LL regular
21 LL regular
21 LL regular
![Page 10: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/10.jpg)
10
Standard Representations of
Regular Languages
![Page 11: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/11.jpg)
11
Standard Representations of Regular Languages
Regular Languages
DFAs
NFAsRegularExpressions
RegularGrammars
![Page 12: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/12.jpg)
12
When we say: We are given a Regular Language
We mean:
L
Language is in a standard representation
L
![Page 13: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/13.jpg)
13
Elementary Questions
about
Regular Languages
![Page 14: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/14.jpg)
14
Membership Question
Question: Given regular languageand string how can we check if ?
L
Lw w
Answer: Take the DFA that acceptsand check if is accepted
Lw
![Page 15: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/15.jpg)
15
DFA
Lw
DFA
Lw
w
w
![Page 16: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/16.jpg)
16
Given regular languagehow can we checkif is empty: ?
L
L
Take the DFA that accepts
Check if there is a path from the initial state to a final state
L
)( L
Question:
Answer:
![Page 17: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/17.jpg)
17
DFA
L
DFA
L
![Page 18: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/18.jpg)
18
Given regular languagehow can we checkif is finite?
L
L
Take the DFA that accepts
Check if there is a walk with cyclefrom the initial state to a final state
L
Question:
Answer:
![Page 19: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/19.jpg)
19
DFA
L is infinite
DFA
L is finite
![Page 20: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/20.jpg)
20
Given regular languages and how can we check if ?
1L 2L
21 LL Question:
)()( 2121 LLLLFind ifAnswer:
![Page 21: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/21.jpg)
21
)()( 2121 LLLL
21 LL 21 LLand
21 LL
1L 2L 1L2L
21 LL 12 LL 2L 1L
![Page 22: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/22.jpg)
22
)()( 2121 LLLL
21 LL 21 LLor
1L 2L 1L2L
21 LL 12 LL
21 LL
![Page 23: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/23.jpg)
23
Non-regular languages
![Page 24: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/24.jpg)
24
Regular languages
ba* acb *
...etc
*)( bacb
Non-regular languages}0:{ nba nn
}*},{:{ bawwwR
![Page 25: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/25.jpg)
25
How can we prove that a languageis not regular?
L
Prove that there is no DFA that accepts L
Problem: this is not easy to prove
Solution: the Pumping Lemma !!!
![Page 26: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/26.jpg)
26
The Pigeonhole Principle
![Page 27: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/27.jpg)
27
pigeons
pigeonholes
4
3
![Page 28: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/28.jpg)
28
A pigeonhole mustcontain at least two pigeons
![Page 29: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/29.jpg)
29
...........
...........
pigeons
pigeonholes
n
m mn
![Page 30: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/30.jpg)
30
The Pigeonhole Principle
...........
pigeons
pigeonholes
n
m
mn There is a pigeonhole with at least 2 pigeons
![Page 31: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/31.jpg)
31
The Pigeonhole Principle
and
DFAs
![Page 32: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/32.jpg)
32
DFA with states 4
1q 2q 3qa
b
4q
b
b b
b
a a
![Page 33: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/33.jpg)
33
1q 2q 3qa
b
4q
b
b
b
a a
a
In walks of strings:
aab
aa
a no stateis repeated
![Page 34: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/34.jpg)
34
In walks of strings:
1q 2q 3qa
b
4q
b
b
b
a a
a
...abbbabbabb
abbabb
bbaa
aabb a stateis repeated
![Page 35: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/35.jpg)
35
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 36: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/36.jpg)
36
If in a walk of a string transitions states of DFAthen a state is repeated
1q 2q 3qa
b
4q
b
b
b
a a
a
Pigeonhole principle for any DFA:
w
![Page 37: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/37.jpg)
37
In other words for a string : transitions are pigeons
states are pigeonholes
1q 2q 3qa
b
4q
b
b
b
a a
a
q
a
w
![Page 38: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/38.jpg)
38
In general:
A string has length number of states w
A state must be repeated in the walk wq
q...... ......
walk of w
![Page 39: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/39.jpg)
39
The Pumping Lemma
![Page 40: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/40.jpg)
40
Take an infinite regular languageL
DFA that accepts L
mstates
![Page 41: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/41.jpg)
41
Take string with w Lw
There is a walk with label :w
.........
walk w
![Page 42: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/42.jpg)
42
If string has length w mw || number of states
then, from the pigeonhole principle: a state is repeated in the walkq w
q...... ......
walk w
![Page 43: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/43.jpg)
43
Write zyxw
q...... ......
x
y
z
![Page 44: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/44.jpg)
44
q...... ......
x
y
z
Observations: myx ||length numberof states
1|| ylength
![Page 45: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/45.jpg)
45
The string is accepted zxObservation:
q...... ......
x
y
z
![Page 46: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/46.jpg)
46
The string is accepted
zyyxObservation:
q...... ......
x
y
z
![Page 47: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/47.jpg)
47
The string is accepted
zyyyxObservation:
q...... ......
x
y
z
![Page 48: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/48.jpg)
48
The string is accepted
zyx iIn General:
...,2,1,0i
q...... ......
x
y
z
![Page 49: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/49.jpg)
49
In other words, we described:
The Pumping Lemma !!!
![Page 50: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/50.jpg)
50
The Pumping Lemma:
• Given a infinite regular language L
• there exists an integer m
• for any string with length Lw mw ||
• we can write zyxw
• with andmyx || 1|| y
• such that: Lzyx i ...,2,1,0i
![Page 51: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/51.jpg)
51
Applications
of
the Pumping Lemma
![Page 52: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/52.jpg)
52
Theorem: The language }0:{ nbaL nn
is not regular
Proof: Use the Pumping Lemma
![Page 53: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/53.jpg)
53
Assume for contradictionthat is a regular languageL
Since is infinitewe can apply the Pumping Lemma
L
}0:{ nbaL nn
![Page 54: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/54.jpg)
54
Let be the integer in the Pumping Lemma
Pick a string such that: w Lw
mw ||length
Example: mmbawpick
m
}0:{ nbaL nn
![Page 55: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/55.jpg)
55
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 56: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/56.jpg)
56
From the Pumping Lemma: Lzyx i
...,2,1,0i
Thus:
mmbazyx
Lbazyyxzyx mkm 2
Lzyx 2
We have: 1, kay k
![Page 57: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/57.jpg)
57
Lba mkm Therefore:
}0:{ nbaL nnBUT:
Lba mkm
CONTRADICTION!!!
![Page 58: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/58.jpg)
58
Our assumption thatis a regular language is not true
L
Conclusion: L is not a regular language
Therefore:
![Page 59: 1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse](https://reader030.vdocuments.site/reader030/viewer/2022032800/56649d3f5503460f94a18e64/html5/thumbnails/59.jpg)
59
Regular languages
ba* acb *
...etc
*)( bacb
Non-regular languages }0:{ nba nn