Your SlideShare is downloading. ×
  • Like
  • Save
 Class6
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,250
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Properties of Regular Languages We will talk about 4.2 & 4.3: Elementary Questions about Regular Languages Pumping Lemma for Regular Languages 1
  • 2. 4.2&3: Pumping Lemma Standard Representations of Regular Languages Regular Languages DFAs Regular Grammars NFAs Regular Expressions 2
  • 3. 4.2&3: Pumping Lemma When we say: We are given a Regular Language L We mean: Language L is in a standard representation 3
  • 4. Elementary Questions about Regular Languages 4
  • 5. 4.2&3: Pumping Lemma Membership Question Question: Given regular language L and string w how can we check if w L? Hint: Take a DFA that accepts L Answer: Take the DFA that accepts L and check if w is accepted 5
  • 6. 4.2&3: Pumping Lemma For any w * : For a DFA of L w w or w L w L Answer: There is a unique path starting from q0 for w in such DFA. w L if it ends at a final state. Theorem 4.5 (p.112) 6
  • 7. 4.2&3: Pumping Lemma Question: Given regular language L how can we check if L is empty: (L )? Answer: Take the DFA that accepts L Check if there is a path from the initial state to a final state 7
  • 8. 4.2&3: Pumping Lemma DFA L DFA L 8
  • 9. 4.2&3: Pumping Lemma Question: Given regular language L how can we check if L is finite? Answer: Take the DFA that accepts L Check if there is a walk with cycle from the initial state to a final state 9
  • 10. 4.2&3: Pumping Lemma DFA L is infinite DFA L is finite 10
  • 11. 4.2&3: Pumping Lemma Theorem 4.6 (p.112) There is an algorithm for determining whether a regular language is empty, finite, or infinite. 11
  • 12. 4.2&3: Pumping Lemma Question: Given regular languages L1 and L2 how can we check if L1 L2 ? Answer: check if( L1 L2 ) ( L1 L2 ) Since L1and L2are regular, (L1 L2 ) (L1 L2 ) is 3 L also regular. From Thm. 4.6, we can check whether L3 is empty. If L3= then L1= L2 otherwise L1 L2 . Theorem 4.7 (p.112) 12
  • 13. 4.2&3: Pumping Lemma ( L1 L2 ) ( L1 L2 ) L1 L2 and L1 L2 L1 L2 L L2 L1 L1 2 L1 L2 and L2 L1 L1 L2 13
  • 14. 4.2&3: Pumping Lemma ( L1 L2 ) ( L1 L2 ) L1 L2 or L1 L2 L1 L2 L2 L1 L1 L2 or L2 L1 L1 L2 14
  • 15. 4.2&3: Pumping Lemma Theorem 4.5 (p.112) Membership algorithm. Theorem 4.6 (p.112) Algorithm for determining whether a regular language is empty, finite, or infinite. Theorem 4.7 (p.112) Algorithm for checking whether 2 regular languages are the same. 15
  • 16. Examples 4.2&3: Pumping Lemma Question: Given regular languages L1 and L2 how can we check if L1 L2 ? Question: Given regular languages L1 and L2 and any string w how can we check if w L1 L2 ? 16
  • 17. Examples cont. 4.2&3: Pumping Lemma Question: Given regular language L how can we check if L? Definition: A language is said to be a palindrome language if L = LR. Given regular language L how can we check if L is a palindrome language. 17
  • 18. Existence Examples 4.2&3: Pumping Lemma Question: Given regular language L how can we check if there exist any w L such that wR L ? Question: Given regular language L and string u how can we check if L contains any w such that u is a substring of it, i.e. w =v1u v2 for u, v1,v2 *? 18
  • 19. Existence Examples cont. 4.2&3: Pumping Lemma Question: Given regular language L how can we check if there exist any w L such that |w| is an odd number ? Question: Given regular language L how can we check if L contains an infinite number of odd-number strings? You are able to do (4.2) hw# 1~15 except 10 p.113. 19
  • 20. Non-regular languages 4.2&4.3 20
  • 21. 4.2&3: Pumping Lemma n n {a b : n 0} Non-regular languages R {ww : w {a, b}*} Regular languages a *b b*c a b c ( a b) * etc... 21
  • 22. 4.2&3: Pumping Lemma How can we prove that a language L is not regular? Prove that there is no DFA that accepts L Problem: this is not easy to prove Solution: the Pumping Lemma !!! 22
  • 23. The Pigeonhole Principle 23
  • 24. 4.2&3: Pumping Lemma 4 pigeons 3 pigeonholes 24
  • 25. 4.2&3: Pumping Lemma A pigeonhole must contain at least two pigeons 25
  • 26. 4.2&3: Pumping Lemma n pigeons ........... m pigeonholes n m ........... 26
  • 27. 4.2&3: Pumping Lemma The Pigeonhole Principle n pigeons m pigeonholes There is a pigeonhole n m with at least 2 pigeons ........... 27
  • 28. The Pigeonhole Principle and DFAs 28
  • 29. 4.2&3: Pumping Lemma DFA with 4 states b b b q1 a q2 b q3 b q4 a a 29
  • 30. 4.2&3: Pumping Lemma In walks of strings: a, aa, aab no state is repeated b, aba have states repeated For any string w, |w| 3, then its walk in this DFA may repeat the state(s) or does not repeat. b b b q1 a q2 a q3 b q4 a a 30
  • 31. 4.2&3: Pumping Lemma However, aabb in walks of At least one bbaa state is repeated strings with length 4: abbabb abbbabbabb... b b b q1 a q2 a q3 b q4 a a 31
  • 32. 4.2&3: Pumping Lemma Magic If string w has length | w | 4: number? The transitions of string w are more than the states of the DFA Thus, at least one state must be repeated b b b q1 a q2 a q3 b q4 a a 32
  • 33. In general, for any DFA: 4.2&3: Pumping Lemma String w has length number of states A state q must be repeated in the walk of w walk of w ...... q ...... Repeated state 33
  • 34. 4.2&3: Pumping Lemma In other words for a string w: a transitions are pigeons q states are pigeonholes walk of w ...... q ...... Repeated state 34
  • 35. The Pumping Lemma 35
  • 36. 4.2&3: Pumping Lemma Take an infinite regular language L DFA that accepts L m states 36
  • 37. 4.2&3: Pumping Lemma Take string w with w L There is a walk with label w : ......... walk w 37
  • 38. 4.2&3: Pumping Lemma If string w has length | w | m number of states of the DFA then, from the pigeonhole principle: a state q is repeated in the walk w ...... q ...... walk w 38
  • 39. 4.2&3: Pumping Lemma Let q be the first state repeated in the walk ...... q ...... walk w 39
  • 40. 4.2&3: Pumping Lemma Write w xyz y ...... q ...... x z 40
  • 41. 4.2&3: Pumping Lemma Observations: length |x y| m number of states length | y| 1 of DFA y ...... q ...... x z 41
  • 42. 4.2&3: Pumping Lemma Observation: The string xz is accepted y ...... q ...... x z 42
  • 43. 4.2&3: Pumping Lemma Observation: The string xyyz is accepted y ...... q ...... x z 43
  • 44. 4.2&3: Pumping Lemma Observation: The string xyyyz is accepted y ...... q ...... x z 44
  • 45. i 4.2&3: Pumping Lemma In General: The string xy z is accepted i 0, 1, 2, ... y ...... q ...... x z 45
  • 46. 4.2&3: Pumping Lemma In General: xy z ∈ L i i 0, 1, 2, ... The original language y ...... q ...... x z 46
  • 47. 4.2&3: Pumping Lemma In other words, we described: The Pumping Lemma !!! 47
  • 48. 4.2&3: Pumping Lemma The Pumping Lemma • Given a Infinite Regular language L • there exists an integer m • for any string w L with length | w | m • exists a decompsition of w: wxyz with |x y| m and | y | 1 • such that: wi L for all i 0, 1, 2, ... i xy z 48
  • 49. 4.2&3: Pumping Lemma Example of pumping lemma L M = { all strings without substring 001 } 1 0 0,1 1 q0 q1 0 1 q3 q2 0 49
  • 50. 4.2&3: Pumping Lemma L M = { all strings without substring 001 } 1 0 0,1 1 q0 q1 0 1 q3 q2 0 L(M) is infinite and regular, show it satisfies the pumping lemma. 50
  • 51. 4.2&3: Pumping Lemma The Pumping Lemma: L is reg. & inf. • there exists an integer m Let m = 4 • for any string w L with length | w | m a decomposition w x y z with | x y | m and | y | 1 1 0 0,1 1 q0 q1 0 1 q3 q2 0 • such that: i for all xy z L i 0, 1, 2, ... 51
  • 52. 4.2&3: Pumping Lemma For any w L(M), |w| 4: Then either w= 00...0, or w has 1s; (1)w contains 0 only: let let x=00, y=0 (or x= , y=0) and z= rest of the string (2)w contains one: w is in the form of (1+01)* if w stops at q0, or w is in the form of (1+01)*0 if w stops at q1, or w is in the form of (1+01)*000* if w stops at q2. Since w contains 1, the first 1 in w must occurs at the first or second symbols of w. For the first case, let x= , y=1, and z= rest of the string ; for the second case, let x= , y=01, and z= rest of the string. 52
  • 53. 4.2&3: Pumping Lemma Example of pumping lemma L M = { a nb m : n 2, m 2} L(M) is infinite and regular, show it satisfies the pumping lemma. 53
  • 54. 4.2&3: Pumping Lemma L M = { anbm : n 2, m 2} The Pumping Lemma: L is reg. & inf. • there exists an integer m Let m = 5 • for any string w L with length | w | m a decomposition w x y z with | x y | m and | y | 1 • such that: i for all xy z L i 0, 1, 2, ... 54
  • 55. 4.2&3: Pumping Lemma Example of pumping lemma L M = { uabv : u,v {a,b}* } L(M) is infinite and regular, show it satisfies the pumping lemma. 55
  • 56. 4.2&3: Pumping Lemma L M = { uabv : u,v {a,b}* } The Pumping Lemma: L is reg. & inf. • there exists an integer m Let m = 4 • for any string w L with length | w | m a decomposition w x y z with | x y | m and | y | 1 • such that: i for all xy z L i 0, 1, 2, ... 56
  • 57. 4.2&3: Pumping Lemma Discussion  Section 4.2  What is the Pumping lemma?  Show a regular language satisfies the pumping lemma. 57
  • 58. Applications of the Pumping Lemma 58
  • 59. 4.2&3: Pumping Lemma Theorem: The language L n n {a b : n 0} is not regular Proof: Use the Pumping Lemma 59
  • 60. 4.2&3: Pumping Lemma n n L {a b : n 0} Since L is infinite L is regular L satisfies P.L. (L satisfies P.L.) ( L is regular) (contrapositive) Goal is to show L does not satisfy the pumping lemma then L is not regulatr. by contradiction i.e. assume L is regular and show L does not satisfy the pumping lemma  contradiction L is not regular 60
  • 61. 4.2&3: Pumping Lemma (The Pumping Lemma) • Given a infinite regular language L for any positive integer m • there exists an integer m we pick a string w L • for any string w L with length | w | m for any possible decomposition of w • exist a decompsition of w: w xyz with |x y| m and | y | 1 some i such that wi= xyiz L • such that: wi L for all i 0, 1, 2, ... i xy z 61
  • 62. n n 4.2&3: Pumping Lemma L {a b : n 0} Since L is infinite, if L is regular then L satisfies the Pumping lemma. Let m be the positive integer in the Pumping lemma. Pick a string w such that: w L length | w| m m m We pick w a b 62
  • 63. 4.2&3: Pumping Lemma Any decomposition of w = ambm: m m w a b xyz it must be that length | x y | m, | y | 1 m m m m xyz a b a...aa...aa...ab...b x y z Thus: k y a , 1 k m 63
  • 64. 4.2&3: Pumping Lemma m m w xyz a b y k a , 1 k m i wi xy z L k i a...aa...aa...aa...aa...ab...b...b x y y ......y z m k ki m m ( i 1) k m wi a a b a b for all i 0, 1, 2, ... We need to find some i in order to have wi= xyiz L 64
  • 65. 4.2&3: Pumping Lemma m k ki m m ( i 1) k m wi a a b a b for all i 0, 1, 2, ... We need to find some i in order to have wi= xyiz L Let i = 2 m ( 2 1) k m m k m w2 a b a b Since 1 k m , thus m k m n n w2 a b L {a b : n 0} 65
  • 66. 4.2&3: Pumping Lemma Therefore L does not satisfy the pumping lemma. Conclusion: L is not a regular language 66
  • 67. 4.2&3: Pumping Lemma Non-regular languages R L {uu : u *} Regular languages 67
  • 68. 4.2&3: Pumping Lemma Theorem: The language R L {uu : u *} {a, b} is not regular Proof: Use the Pumping Lemma 68
  • 69. 4.2&3: Pumping Lemma R L {ww : w {a, b}*} Since L is infinite L is regular L satisfies P.L. (L satisfies P.L.) ( L is regular) (contrapositive) Goal is to show L does not satisfy the pumping lemma then L is not regulatr. by contradiction i.e. assume L is regular and show L does not satisfy the pumping lemma  contradiction L is not regular 69
  • 70. 4.2&3: Pumping Lemma R L {uu : u *} Since L is infinite, if L is regular then L satisfies the Pumping lemma. Let m be the positive integer in the Pumping lemma. Pick a string w such that: w L and length | w| m m m m m We pick w a b b a 70
  • 71. 4.2&3: Pumping Lemma Any decomposition of w : m m m m w a b b a xyz it must be that length | x y | m, | y | 1 m m m m xyz a...aa...a...ab...bb...ba...a x y z k Thus: y a , 1 k m 71
  • 72. 4.2&3: Pumping Lemma m m m m w xyz a b b a y k a , 1 k m i wi xy z L 2m m a...aa...aa...aa...a...ab...bb...ba...a x y y... y z m k ki m m m m ( i 1) k m m m wi a a b b a a b b a for all i = 0, 1, 2, 3, … We need to find some i in order to have wi= xyiz L 72
  • 73. 4.2&3: Pumping Lemma m k ki m m m m ( i 1) k m m m wi a a b b a a b b a for all i = 0, 1, 2, 3, … We need to find some i in order to have wi= xyiz L Let i = 2 m ( 2 1) k m m m m k m m m w2 a b b a a b b a Since 1 k m , thus m k m m m R w2 a b b a L {uu : u {a, b}*} 73
  • 74. 4.2&3: Pumping Lemma Therefore: L does not satisfy the pumping lemma. Conclusion: L is not a regular language 74
  • 75. Prove a language is not regular by pumping lemma How to write a good proof? 75
  • 76. 4.2&3: Pumping Lemma Show L={w: na(w) > nb(w)} is not regular. w = ambm-1 Let y = ak wi L L is not regular. 76
  • 77. 4.2&3: Pumping Lemma Non-regular languages n l n l L {a b c : n, l 0} Regular languages 77
  • 78. 4.2&3: Pumping Lemma Theorem: The language n l n l L {a b c : n, l 0} is not regular Proof: Use the Pumping Lemma 78
  • 79. n l n l 4.2&3: Pumping Lemma L {a b c : n, l 0} Assume for contradiction that L is a regular language Since L is infinite we can apply the Pumping Lemma 79
  • 80. n l n l 4.2&3: Pumping Lemma L {a b c : n, l 0} Since L is infinite, if L is regular then L satisfies the Pumping lemma. Let m be the positive integer in the Pumping lemma. Pick a string w such that: w L and length | w| m We pick w a b c m m 2m 80
  • 81. Any decomposition of w : 4.2&3: Pumping Lemma m m 2m w=a b c xyz From the Pumping Lemma it must be that length | x y | m, | y | 1 m m 2m w = xyz a...aa...aa...ab...bc...cc...c x y z k Thus: y a for some k , 1 k m 81
  • 82. 4.2&3: Pumping Lemma m m 2m k w= x yz a b c y a , k 1 i wi xy z L i 0, 1, 2, ... = am-k(ak)ibmc2m = am+(i-1)k bmc2m Let i = 0 0 m k m 2m w0 x y z a b c L since (m-k)+m = 2m- k 2m for k 1 82
  • 83. 4.2&3: Pumping Lemma Therefore: L does not satisfy the pumping lemma. Conclusion: L {a nbl c n l : n, l 0} is not a regular language 83
  • 84. 4.2&3: Pumping Lemma n l n l L {a b c : n, l 0} is not regular, n l k how about L1 {a b c : k n l} ? L1 must be non-regular otherwise …. 84
  • 85. 4.2&3: Pumping Lemma Non-regular languages n! L {a : n 0} Regular languages 85
  • 86. 4.2&3: Pumping Lemma Theorem: The language n! L {a : n 0} is not regular n! 1 2  (n 1) n Proof: Use the Pumping Lemma 86
  • 87. 4.2&3: Pumping Lemma n! L {a : n 0} Since L is infinite L is regular L satisfies P.L. (L satisfies P.L.) ( L is regular) (contrapositive) Goal is to show L does not satisfy the pumping lemma thus L is not regular. by contradiction 87
  • 88. 4.2&3: Pumping Lemma n! L {a : n 0} Let m be the integer in the Pumping Lemma Pick a string w such that: w L length | w| m m! We pick w a 88
  • 89. 4.2&3: Pumping Lemma Any decomposition of w : m! w= a xyz From the Pumping Lemma it must be that length | x y | m, | y | 1 m m! m m! w = xyz a a...aa...aa...aa...aa...a x y z k Thus: y a for some k , 1 k m 89
  • 90. 4.2&3: Pumping Lemma m! k xyz a y a , 1 k m m! k k i m! ( i 1) k wi a (a ) a i 0, 1, 2, ... Let i = 2 2 m! k w2 xy z a 1 k m 90
  • 91. 4.2&3: Pumping Lemma 2 m! k w2 xy z a 1 k m Since: n! L {a : n 0} In order to show w2 L, we need to show m!+k is not a factorial number. By showing m! < m!+k < ( m+1)! It works only for all k = 1, 2, 3, …, m when m 2 ! 91
  • 92. However: 4.2&3: Pumping Lemma m! m! k (m 1)! given m 1 m!< m!+k is trivial since k 1. To show m!+k < (m+1)! From (m+1)! = (m+1) m! = m! + m m! > m! + k 1 = m!+k since m k & m! > 1! =1 m! k p! for any p 92
  • 93. 4.2&3: Pumping Lemma What happen if m = 1? If m =1, we choose w = a, with x= = z, and y=a is the only decomposition for w = a. Then wi = ai for all i = 0, 1, 2, … Clearly that when i= 3, w3 = a3 L={an! : n 0}. Now, put everything together: 93
  • 94. 4.2&3: Pumping Lemma n! Show L {a : n 0} is not regular. Since L is infinite, if L does not satisfy pumping lemma then L is not regular. So the goal is to prove L does not satisfy pumping lemma. (it is proved by contradiction) For any given positive integer m in m pumping lemma, w L and |w| the if m =1, we choose w = a, then x = z = , and y=a is the only decomposition for w = a. Then wi = ai for all i = 0, 1, 2, … Clearly that when i= 3, A contradiction to w3 = a3 L={an! : n 0}. pumping lemma! 94
  • 95. 4.2&3: Pumping Lemma n! Show L {a : n 0} is not regular. w L and |w| m If m > 1, we pick w = am!. Consider all possible decompositions of w = xyz with |xy| m, |y| 1, k y must be in the form of y a for some k , 1 k m m! k k i m! ( i 1) k wi a (a ) a for i= 0, 1, 2, … 2 m! k choose i = 2: w2 xy z a 1 k m From m! < m!+k m! + m < m! + m m! (since m!>1) = (m+1)! i.e. m! < m!+k < (m+1)!, m!+k is not a factorial number. w2 L, a contradiction. Thus L does not satisfy pumping lemma, and therefore L is not regular. 95
  • 96. 4.2&3: Pumping Lemma Non-regular languages L n l k {a b c : k n l} Regular languages 96
  • 97. 4.2&3: Pumping Lemma Theorem: The language L {a nbl c k : k n l} is not regular Proof: Use the Pumping Lemma Choose a w from L and, later,exist an i such that wi L What does wi L imply? 97
  • 98. 4.2&3: Pumping Lemma n l k L {a b c : k n l} Since L is infinite, if L is regular then L satisfies the Pumping lemma. Let m be the positive integer in the Pumping lemma. Pick a string w such that: w L length | w| m We pick 99
  • 99. 4.2&3: Pumping Lemma Any decomposition of w : m! ( m 1)! w=a c xyz From the Pumping Lemma it must be that length | x y | m, | y | 1 m! (m 1)! m! ( m 1)! w = xyz a c a...aa...aa...ac...cc...c x y z Thus: y a k for some k , 1 k m 100
  • 100. 4.2&3: Pumping Lemma m! ( m 1)! k xyz a c y a , 1 k m m! k k i ( m 1)! m! ( i 1) k ( m 1)! wi a (a ) c a c i 0, 1, 2, ... How to choose i such that wi L? i.e. choose i such that m!+(i-1)k = (m+1)! m! m Is such i an integer? choose i 1 k 101
  • 101. 4.2&3: Pumping Lemma m! ( m 1)! k xyz a c y a , 1 k m m! k k i ( m 1)! m! ( i 1) k ( m 1)! wi a (a ) c a c i 0, 1, 2, ... Since 1 k m, k | m! m! m when i 1 (: a positive integer) k m!+(i-1)k = (m+1)! which causes wi L A contradiction to pumping lemma! 102
  • 102. 4.2&3: Pumping Lemma Therefore: L does not satisfy the pumping lemma. Conclusion: L {a b c : k n l k n l} is not a regular language Theorem: The language L {a nbl c k : k n l} is not regular 103
  • 103. 4.2&3: Pumping Lemma n! 2 6 24 120 Show {a : n 0} {a, a , a , a , a , ...} not regular. Since L is infinite, if L does not satisfy pumping lemma then L is not regular. So the goal is to prove L does not satisfy pumping lemma. (it is proved by contradiction) For any given positive integer m in m pumping lemma, w L and |w| the if m =1, we choose w = a, then x = z = , and y=a is the only decomposition for w = a. Then wi = ai for all i = 0, 1, 2, … Clearly that when i= 3, A contradiction to w3 = a3 L={an! : n 0}. pumping lemma! 104
  • 104. 4.2&3: Pumping Lemma n! 2 6 24 120 L {a : n 0} {a, a , a , a , a , ...} w L and |w| m If m > 1, we pick w = am!. Consider all possible decompositions of w = xyz with |xy| m, |y| 1, k y must be in the form of y a for some k , 1 k m m! k k i m! ( i 1) k wi a (a ) a for i= 0, 1, 2, … 2 m! k choose i = 2: w2 xy z a 1 k m From m! < m!+k m! + m < m! + m m! (since m!>1) = (m+1)! i.e. m! < m!+k < (m+1)!, m!+k is not a factorial number. w2 L, a contradiction. Thus L does not satisfy pumping lemma, and therefore L is not regular. 105
  • 105. 4.2&3: Pumping Lemma  Consider the following two languages, determine which is regular. n l L1 {a b : n l} n l L2 {a b : n l} Both are non-regular. Which is easier to prove by pumping lemma? 106
  • 106. 4.2&3: Pumping Lemma  Consider the following two languages, determine which is regular. n l L1 {a b : n l} n l L2 {a b : n l} Both are non-regular. Which is easier to prove by pumping lemma? 107
  • 107. 4.2&3: Pumping Lemma Non-regular languages n l L {a b : n l} Regular languages 108
  • 108. 4.2&3: Pumping Lemma Theorem: The language L n l {a b : n l} is not regular Proof: Use the Pumping Lemma The proof is similar to the proof in n l k L {a b c : k n l} 109
  • 109. 4.2&3: Pumping Lemma n l L {a b : n l} Since L is infinite L is regular L satisfies P.L. (L satisfies P.L.) ( L is regular) (contrapositive) Goal is to show L does not satisfy the pumping lemma thus L is not regular. by contradiction 110
  • 110. 4.2&3: Pumping Lemma n l L {a b : n l} Let m be the integer in the Pumping Lemma Pick a string w such that: w L length | w| m We pick w a b m! ( m 1)! 111
  • 111. 4.2&3: Pumping Lemma Any decomposition of w : m! ( m 1)! w=a b xyz From the Pumping Lemma it must be that length | x y | m, | y | 1 m! (m 1)! m! m 1! w = xyz a b a...aa...aa...ab...bb...b x y z Thus: y a k for some k , 1 k m 112
  • 112. 4.2&3: Pumping Lemma m! ( m 1)! k xyz a b y a , 1 k m m! k k i ( m 1)! m! ( i 1) k ( m 1)! wi a (a ) b a b i 0, 1, 2, ... How to choose i such that wi L? i.e. choose i such that m!+(i-1)k = (m+1)! m! m Is such i an integer? choose i 1 k 113
  • 113. 4.2&3: Pumping Lemma m! ( m 1)! k xyz a b y a , 1 k m m! k k i ( m 1)! m! ( i 1) k ( m 1)! wi a (a ) b a b i 0, 1, 2, ... Since 1 k m, k | m! m! m when i 1 (: a positive integer) k m!+(i-1)k = (m+1)! which causes wi L A contradiction to pumping lemma! 114
  • 114. 4.2&3: Pumping Lemma Therefore: L does not satisfy the pumping lemma. Conclusion: L n l {a b : n l} is not a regular language Theorem: The language L n l {a b : n l} is not regular 115
  • 115. 4.2&3: Pumping Lemma Theorem: The language L n l {a b : n l} is not regular Proof: Another way to prove L is not regular by closure property of regular family. L is regular then L is also regular What is the complement of L? 116
  • 116. 4.2&3: Pumping Lemma is not regular n l L {a b : n l} Proof: Assume L is regular then L is also regular Let R = L L(a*b*) an intersection of two regular languages, thus R is a regular language too. In fact, R = {anbn : n 0} which is not regular. A contradiction! Therefore, the assumption that L is regular is not true, i.e., L is not regular. 117
  • 117. Similar problem: 4.2&3: Pumping Lemma Show L {a b c : k n l} is not regular. n l k Show L ={ w: na(w) nb(w) } is not regular. Is L* regular or non-regular? Prove or disprove: If L1 and L2 are non-regular, then L1 L2 must be non-regular. If L1 and L2 are non-regular, then L1 L2 must be non-regular. If L is regular then any subset of L must be regular too. If L is non-regular then any subset of L must be non-regular . 118
  • 118. 4.2&3: Pumping Lemma Prove or disprove: If L1 L2 and L1 are regular, then L2 must be regular. If L1 L2 is regular and L1is finite, then L2 must be regular. The family of regular languages closed under finite number union. The family of regular languages closed under infinite number union. 119
  • 119. 4.2&3: Pumping Lemma Regular or Non-regular? R L1 {uww v : u, v, w {a, b} }. R L2 {uww v : u, v, w {a, b} , | u | | v |}. // L1 is regular, but L2 is non-regular. 120
  • 120. 4.2&3: Pumping Lemma 4.3 (p.122) 3, 4, 5abcd, 6 ~9, 13, 14, 15abcf, 16, 17, 19, 24, 26 and 16 (p.110) Hand in: 4bcf, 5bcd, 6, 13, 16, 24, 16(p.110). 121