제4 장. regular language의특성 - yonsei...
TRANSCRIPT
제 4 장. Regular Language의특성
학습목표
정규언어의일반적특성에대해이해하고, 주어진언어가 regular인지판별하는방법학습
Closure Property & Pumping Lemma
개요
정의→표현→유용성→특성?
Every formal language is regular?accepts by some complex finite automaton?
① operations on RL : set operations, changing operations, closure question
② ability to decide on certain properties : finite or not?
③ regular language or not?DFA, RE, RG
다양한 language 집합의분별도구
no
general properties를만족하나?
할수있는일, 없는일
Closure Properties : Set Operations (1)
① closure under simple set operationsRL is closed under union, intersection, concatenation, complementation, star-closure
Thm
pf:
RL:,,,,RL:, 1121212121
∗∩∪→ LLLLLLLLLL
⎩⎨⎧
∈−∈∈∈∴
−Σ=→Σ=
⋅+==∃
∗
∗∗
∗
LwifFQwqLwifFwq
FQqQMFqQM
rrrrrrLLrLLrr
LL
),(),(fn total:
),,,,(ˆ),,,,(
ationcomplement,, definitionby ),(),(such that,
0
0
00
12121221121
11
δδδ
δδ
예) RL is closed under union
한두개의 instance가아닌모든원소의특성을설명하기위한방법
Intersection은? 좀더복잡함!
MwiffLLw
FpFqpqF-
papqaq
pqapq-pMqMpqPQQ-
FpqQM
FpPMMLLFqQMMLL
jiji
lj
ki
lkji
j
iji
ˆ by accepted
,),(:ˆ
),(),(
whenever),()),,((ˆ in
,in),,(:ˆ
where)ˆ),,(,ˆ,,ˆ(ˆcombined aconstruct
),,,,(where)(),,,,(where)(
onintersecti
21
21
2
1
2
1
00
202222
101111
∩∈∴
∈∈→
⎜⎜⎝
⎛==
=
×=
Σ=⋅
⎜⎜⎝
⎛Σ==Σ==
⋅
δδ
δ
δ
δδ
Closure Properties : Set Operations (2)
Constructive proof의또다른등장, 여러곳에서유용!
Closure Properties : Reversal
2121
2121
differenceunder closed )
law sDeMorgan':cf)
LLLL
LLLL
∩=−
∪=∩
예
⎪⎩
⎪⎨
⎧→→
→→
directionreverseinitialfinal
finalinitial accepts nfa accepts NFA'NFA' NFA RL :L
wiffwR
Thm RL : closed under reversal
단순히증명만을원한다면이걸로…
단순한 set operation이외에좀더복잡한연산에대한 closure 특성이해필요
Closure Properties : Homomorphism (1)
② Closure under other operations : homomorphism, right quotientDef 1:
}:)({)(image chomomorphi,on language:
)()()()(:
smhomomorphi alphabets,:,
21
21
LwwhLhL
ahahahwhaaawh
n
n
∈=Σ
⎜⎜⎝
⎛==Γ→Σ
ΓΣ∗
L
L
abbbcababahbbcbhabahhcbaba
====Γ=Σ
)()(,)(:},,,{},,{)1 예
∗∗∗∗ +=→+= ))()((:)())((: 1 dbccdbccbdcdbccrLhaabarL
bdcbhdbccahhdcbba ===Γ=Σ )(,)(:},,,{},,{)2 예
},{)(},,{ abbbcabababLhabaaaL ==
Closure Properties : Homomorphism (2)
Pf:
regular:)(RL:sm,homomorphi: LhLh →
)( such that ))(())(()()(
of for )(by )(,with RL:.
whvLwrhLvrhLwhrLw
raahrhrLer
=∈∃→∈∀∈→∈∀
Σ∈
Thmsmshomomorphiarbitrary under closed : RL
Closure Properties: Right Quotient (1)
⎜⎜⎝
⎛
≥=∪≥≥=
}1:{}{}0,1:{)
2
1
mbLbamnbaL
m
mn예
q0
a,ba,b
a
bba
a
bb
a
q1
q3 q5
q2
q4
)/(),( such that state final a walk to,
210
2
LLFqxqxLvvQq
∈=∀∈→∃∈∀
δ
}0,1:{/ 21 ≥≥= mnbaLL mn
} somefor ,:{/ with ofquotient right alphabet, sameon language ,
2121
2121
LyLxyxLLLLLL
∈∈=
Def 2:
① take all strings in L1 having a suffix belonging to L2② for the string, removing this suffix belongs to L1/L2
기본정의가좀이해하기어려우려나?
Closure Properties: Right Quotient (2)
Thm
Pf:
⎜⎜⎝
⎛→≠∩
Σ=
∈=∈∃∈∀
Σ=
Σ==
∗
ˆ to add)(),,,,(
),( such that determine ,
)ˆ,,,,(ˆ),,,,( where),(
2
2
0
01
FqMLLFqQM
FqyqLyQq
FqQM
FqQMMLL
ii
ii
fii
φδ
δ
δ
δ
regular :/ regular :,quotientright under closed : RL
2121 LLLL →
증명도좀해보고…
211
2
0
),(such that on,constructiby
ˆ),(,ˆby accepted ii)
/LLx,LxyFyqLy
FqxqMx
∈∈∴∈∈∃
∈=∀∗
∗
δ
δ
FxqxMFq
Fyq
qxq
FxyqLxyLyLLx
LLML
ˆ),( accepts ˆ,ˆon constructiby
),(
,),(
),(such that ,/
:/)ˆ( i)
0
0
01221
21
∈∈
∈
=∃
∈⇒∈∈∃∈
=
∗
∗
∗
∗
δ
δ
δ
δ
Q
Closure Properties: Right Quotient (3)증명의마무리!
따라서, 는 regular!21 / LL
Closure Properties: Right Quotient (4)
)(
)(/
2
121∗
∗∗
=
=
abLL
baaaLLLL for
φφφ
φ
=∩≠=∩≠=∩
=∩
23
22
21
20
)(}{)(}{)(
)(
LMLaLMLaLML
LML
∗∗∗∗∗ ⎯→⎯+ baabaaaba
3
0 1 2
a,b
b
aab
b
a
예)
예를가지고이해해봅시다
Closure Properties: Exercises 4.1
- 2 : constructive proof를이용한 NFA의구축
- 6 : 집합의특성을이용해볼것
- 10 : Right quotient를제대로이해하고있는지체크하는쉬운문제
- 15 : Right quotient의응용능력 (left quotient)…그리쉽지만은않을걸…
- 20 : 이런류의문제를접해본다는의미이상은없음
Elementary Questions about RL
Thm 1
Thm 2
Thm 3
.acceptance dfa.in not or whether
determinigfor algorithman , ,on RLGiven Lw
wL ∃Σ∈Σ ∗
infinite :ⓕ ⓘ Cycle emptynot :ⓕ ⓘpath simple :dfa ofgraph transition
infinite finite, empty, is RL awhether gdetermininfor algorithman
→
→
∃
213
21213
2121
:)()(
.,,
LL iffLLLLLL
LLLL
==∩∪∩=
=∃
closureby regular
whether determine to algorithm anGiven
φ
Elementary Questions : Exercises 4.2
- 5 : palindrome이 regular인가? 일단 DFA를만들어보고…
- 9 : 좀어려운문제지만, 이것도일단 DFA를만들어보고…
- 12 : 약간의트릭이필요하긴한데, 뒤에답안이있군!
Identifying Nonregular Languages
language is regular only if the information that has to be remembered at any stage is strictly limited
Pigeonhole Principle– If put n objects into m boxes, n>m
then at least one box must have more than one item in it
상자의수보다더많은공을넣어야한다면?어딘가 1개이상의공이들어가는상자가있을수밖에!
Nonregular Languages: 예
예)
regular becannot ifonly accepts that scontradict
),()),,((),(
),( accepts Since
),(&),(with such that state some principle, pigeonholeby
),, },,{ ,(DFA regular. is Suppose
00
00
0
LmnbaM
qbqbaqbaq
FqbqbaM
qaqqaqmnq
FqbaQmL
nm
fnnmnm
fn
nn
mn
∴=
===∴
∈=
==
≠∃=∃
∗∗∗∗
∗
∗∗
δδδδ
δ
δδ
δ
regular?:}0:{ ≥= nbaL nn
pf)
대강은이해할수있겠는데, 이를좀더정형화한틀이필요하지않을까?
Pumping Lemma (1)
Idea : in a transition graph with n vertices, any walk of length n or longer must repeat some vertex (contain a cycle)
L,2,1,0 in also is such that 1||,||
with as decomposedbecan |w|with such thatinteger positive
RL infinite:
=∀=
≥≤=
≥∈∃
iLzxywymxyxyzw
mLwm
L
ii
Thm
그것이바로펌핑렘마!!!
Finite한상태로 infinite한스트링을표현하자니어쩔수없이어떤상태는한번이상사용될수밖에없겠죠!
Pumping Lemma (2)
Pf
L
LLL
L
Q
L
,),(,),(1||,1 with
),(,),(,),(such that of,, substrings and
,,,,,,,,move. n later tha no repeated bemust state oneleast at
entries 1|| of ,,,,,for states ofset infinite is 1||such thatin
,,, states with recognizesDFA regular :
200
0
0
0
10
ff
frrrr
frrji
th
fji
n
qzxyqqxzqymn|xy|
qzqqyqqxqwzyx
qqqqqqn
wqqqqwLnmwLw
qqqLL
==∴
≥=+≤
===
∃
∴
++=≥
∃→
∗∗
∗∗∗
δδ
δδδ
그걸한번증명해봅시다
Pumping Lemma: 예
예1)
• pumping lemma holds for every w∈L & every i→ if it is violated even for one w or i, then language cannot be regular
regularnot is }0:{ ≥= nbaL nn
false bemust regular is lemma pumping contadicts
0 usingby obtained string then , Supposes' ofentirely consist must substring Choose
hold.must lemma pumping regular : that Assume
0
LLbaw
ik |y|aynm
L
mkm
→∉=
==→=
→
−
증명도증명이지만이를다양한문제에적용할수있어야함
Pumping Lemma: 예
예2)
예3)
예4)
예5)
regularnot is }:{ *∑∈= wwwL R
regularnot is )}()(:{ * wnwnwL ba <∑∈=
regularnot is }0,:){( ≥>= kknaabL kn
regularnot is }0:{ ! ≥= naL n
Pumping Lemma: 예예
• closure property to show that L is not regular
예2)
• 그밖의여러문제들… 진득한연습, 또연습
is}0,0:{ ≥≥= + kncbaL knkn예1)
arnot regul then
Takesm.homomorphiunder closurearnot regul
:}0:{}0:{)(
)(,)(,)(
≥=≥+=
===++ icakncaLh
cchabhaahiiknkn
regularnot is }:{ lnbaL ln ≠=
Pumping Lemma : Exercises 4.3
- 4 (b), (d), (f) : pumping lemma의적용능력함양문제
- 14 (8) : pumping lemma의직접적인적용은좀어려울듯. 답은… false
- 15 (a), (c), (e) (9) : 정규언어에대한직관을키울수있는문제들.
- 21 (15) : finite 언어와 infinite 언어의차이…