1 / 24

INHERENT LIMITATIONS OF COMPUTER PROGAMS

CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGAMS. QUIZ 1. A language is a:. set of strings. { w | M accepts w }. If M is a DFA, L(M) is the set. states. Let M = (Q,  ,δ ,q 0 ,F). Q is the set of:. δ is the:. Transition function. a. b, a. q 0. q 1. NFA. DFA. DEF.

joshua
Download Presentation

INHERENT LIMITATIONS OF COMPUTER PROGAMS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGAMS

  2. QUIZ 1 A languageis a: set of strings. { w | M accepts w }. If M is a DFA, L(M) is the set states Let M = (Q,,δ,q0,F). Q is the set of: δ is the: Transition function a b,a q0 q1

  3. NFA DFA DEF Regular Language Regular Expression

  4. REGULAR OR NOT? Design a NFA for the language: {0n1n | 0 < n ≤2} {0n1n | 0 < n ≤k} {0n1n | n > 0}? n (For R a regexp, R2 means RR, and Rn means RR…R)

  5. SOME LANGUAGES ARE NOT REGULAR! B = {0n1n | n ≥ 0} is NOT regular!

  6. sk… s2k ∈ F sj 0.. 011111…11 Let M be a k-state DFA that recognizes B Consider the path M takes on 0k1k: s0 s1 s2… sisi+1 0000… 00.. There must be i < j ≤ k such that si= sj= q′ ∈ Q M accepts 0k-(j-i)1k B! So M does not recognize the language B.

  7. REGULAR OR NOT? C = { w | w has equal number of 1s and 0s} NOT REGULAR D = { w | w has equal number of occurrences of 01 and 10} (0Σ*0)  (1Σ*1)  1  0  ε

  8. THE PUMPING LEMMA Let L be a regular language with |L| =  Then there exists a length P such that if w  L and |w| ≥ P then there exist xyz = w where: 1. |y| > 0 2. |xy| ≤ P 3. xyiz  L for any i ≥ 0

  9. THE PUMPING LEMMA Example: Let L = 0*1* ; P = 1 w = 011 ε x = y = 0 if w  L and |w| ≥ P then w = xyz, where: z = 11 Let L = (0∪1)2*; P = 2 1. |y| > 0 2. |xy| ≤ P 3. xyiz  L for any i ≥ 0 2 w = 1 1 x = y = 2 z = ε

  10. q|w| Let M be a DFA that recognizes L Let P be the number of states in M Assume w  L is such that |w| ≥ P 1. |y| > 0 2. |xy| ≤ P 3. xyiz  L for any i ≥ 0 We show w = xyz y x z … q0 qi qj There must be j > i such that qi = qj

  11. 0,1 1 0 0 0 1 a c b d 1 L(M) = *001* 0001→ 001 → abcd 00001 →abcccd abccd

  12. USING THE PUMPING LEMMA Use the pumping lemma to prove that B = {0n1n | n ≥ 0} is not regular Hint: Assume B is regular, and try pumping s = 0P1P If B is regular, s can be split into s = xyz, where for any i≥ 0, xyiz is also in B For every choice of xy with |xy| ≤ P and |y|>0, y must be a string of 0s. In this case xyyz has more 0s than 1s

  13. GENERAL STRATEGY Proof by contradiction – assume L is regular Then there is a pumping length P Find a string w ∈ L with |w| ≥P Show that no matter how you choose xyz, w cannot be pumped! Conclude that L is not regular

  14. Let PALINDROMES = { wwR | w ∈{0,1}* } Assume … pumping length P Find a w ∈PALINDROMES longer than P 0P1P1P0P Show that … w cannot be pumped: 2P P P w= 00…0011…1100…00 If w = xyz with |xy| ≤P then y = 0J for some J>0. Then xyyz = 0P+J12P0P PALINDROMES y xyyz = 00…00011…1100…00 > P P 2P

  15. USING THE PUMPING LEMMA THE ADVERSARY

  16. WHAT THE PUMPING LEMMA DOESN’T SAY - I For everyP, w  L with |w| ≥ P there exist xyz=w, where: 1. |y| > 0 2. |xy| ≤ P 3. xyiz  L for any i ≥ 0 Let L = 1*. L is regular. The string 10 cannot be pumped with P=1. You need to show that no matter what P is chosen, L has a string w, |w| ≥ P, that cannot be pumped.

  17. WHAT THE PUMPING LEMMA DOESN’T SAY - II For every xyz=w, where: 1. |y| > 0 2. |xy| ≤ P: xyiz  L for any i ≥ 0 Example: Let L = 10*1*. Picking w = 10P1P; x=ε; y=10P; z=1P Does not contradict pumping lemma! (you can pick x=1 y=0P z=1P.)

  18. PUMPING DOWN C = { 0i1j | i > j ≥ 0} Assume … pumping length P Find a w ∈ Clonger than P 0P+11P Show that … w cannot be pumped: P P+1 w= 00…0011…11 If w = xyz with |xy| ≤P then y = 0J for some J ≥1. Then xy0z = xz = 0P+1-J1P C y xz = 0…0011…11 xyyz = 00…00011…11 P ≤P > P+1 P

  19. CHOOSING WISELY Let BALANCED = { w | w has an equal # of 1s and 0s } Assume … there is a P Find a w ∈BALANCED longer than P (01)P 0P1P Show that w cannot be pumped: If w = xyz with |xy| ≤ P then y = 0J for some J>0. Then xyyz = 0P+J1P BALANCED

  20. REUSING A PROOF Pumping a language can be lots of work… Let’s try to reuse that work! {0n1n : n ≥0} = BALANCED ∩ 0*1* If BALANCED is regular then so is {0n1n: n ≥0}

  21. USING CLOSURE Prove: A is not regular ∩ A C = B (Not regular) (regular) or any of {¬, ∪, ∩, ・, R, *} If A is regular, then A ∩ C (= B) is regular. But B is not regular so neither is A.

  22. Prove A = {0i1j : i j} is not regular using B = {0n1n : n ≥ 0} ¬A = B ∪{ strings that mix 0s and 1s } B = ¬A ∩ 0*1*

  23. PUMPING NON-REGULAR LANGUAGES Let F = {aibjck | i, j, k ≥0 and i=1 ⇒j=k} F has pumping length 2! i = 0 i = 1 i = 2 F ∩ab*c* = {abncn| n ≥ 0} A non-regular language may still satisfy the pumping lemma.

More Related