inf2080
play

INF2080 2. Regular Expressions and Nonregular languages Daniel Lupp - PowerPoint PPT Presentation

INF2080 2. Regular Expressions and Nonregular languages Daniel Lupp Universitetet i Oslo 25th January 2018 Department of University of Informatics Oslo INF2080 Lecture :: 25th January 1 / 39 Last week Deterministic finite automata (DFA)


  1. GNFA: Convenient assumptions Generalized Nondeterministic Finite Automaton (GNFA): NFA where the transitions are RE, not only symbols from Σ . ( 0 ∪ 1 ) ∗ some other assumptions for convenience: 0 start state goes to every other state, but B C 1 has no incoming states every state goes to the unique accepting ǫ start A state, which is different from the starting D 1 ∗ state. The accepting state does not have any outgoing arrows. all other states have one transition to all other states, including themselves. INF2080 Lecture :: 25th January 12 / 39

  2. GNFA: Convenient assumptions Generalized Nondeterministic Finite Automaton (GNFA): NFA where the transitions are RE, not only symbols from Σ . ( 0 ∪ 1 ) ∗ some other assumptions for convenience: 0 ∅ ∅ start state goes to every other state, but B C 1 has no incoming states � ε ǫ every state goes to the unique accepting start A state, which is different from the starting D 1 ∗ ∅ state. The accepting state does not have any outgoing arrows. all other states have one transition to all other states, including themselves. INF2080 Lecture :: 25th January 13 / 39

  3. GNFA: Convenient assumptions Generalized Nondeterministic Finite Automaton (GNFA): ( 0 ∪ 1 ) ∗ NFA where the transitions are RE, not 0 only symbols from Σ . ∅ ∅ B C 1 some other assumptions for convenience: ∅ ε start state goes to every other state, but ∅ ε ǫ start A has no incoming states � ∅ ε D 1 ∗ every state goes to the unique accepting ∅ state, which is different from the starting state. The accepting state does not have any outgoing arrows. � all other states have one transition to all other states, including themselves. ( � ) INF2080 Lecture :: 25th January 14 / 39

  4. GNFA: Convenient assumptions Generalized Nondeterministic Finite Automaton (GNFA): ( 0 ∪ 1 ) ∗ NFA where the transitions are RE, not 0 only symbols from Σ . ∅ ∅ B C 1 some other assumptions for convenience: ∅ ε start state goes to every other state, but ∅ ε ǫ start A has no incoming states � ∅ ε D 1 ∗ every state goes to the unique accepting ∅ for the state, which is different from the starting last point, add ∅ transitions between any two state. The accepting state does not have non-accepting/starting states that were not any outgoing arrows. � previously connected (e.g., ( B , D ) ) all other states have one transition to all other states, including themselves. ( � ) INF2080 Lecture :: 25th January 14 / 39

  5. Generalized Nondeterministic Finite Automata Definition A generalized nondeterministic finite automaton (GNFA) is a 5-tuple ( Q , Σ , δ, q start , q accept ) where 1 Q is a finite set of states 2 Σ is the input alphabet 3 δ : ( Q \ { q accept } ) × ( Q \ { q start } ) → R is the transition function, where R is the set of all RE’s over Σ , 4 q start is the start state, and 5 q accept is the accept state. INF2080 Lecture :: 25th January 15 / 39

  6. Regular Expressions and Automata Proposition Every regular language can be described using a RE. INF2080 Lecture :: 25th January 16 / 39

  7. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Proof idea: take DFA and transform into a GNFA that accepts the same language. Iteratively remove (non-starting and non-accepting) states so that the same language is accepted, until only the starting and accepting state remain. Then the RE along the transition between the two states describes the regular language. INF2080 Lecture :: 25th January 16 / 39

  8. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Proof: Given a DFA M , we construct an equivalent GNFA G by adding a new start state q start with an ε transition to the old start state q 0 , as well as a new accepting state q acept , with ε transitions from all old accept states. add ∅ transitions for all state pairs that do not have a transition in M . INF2080 Lecture :: 25th January 17 / 39

  9. Regular Expressions and Automata Recall the “convenient” properties of GNFA: start state goes to every other state, but has no incoming states every state goes to the unique accepting state, which is different from the starting state. The accepting state does not have any outgoing arrows. all other states have one transition to all other states, including themselves. INF2080 Lecture :: 25th January 18 / 39

  10. Regular Expressions and Automata ⇒ When removing X, we only need to consider situations like this: Recall the “convenient” properties of R 1 GNFA: start state goes to every other state, but has no incoming states R 2 R 4 every state goes to the unique accepting X state, which is different from the starting state. The accepting state does not have R 3 any outgoing arrows. all other states have one transition to all other states, including themselves. INF2080 Lecture :: 25th January 18 / 39

  11. Regular Expressions and Automata ⇒ When removing X, we only need to consider situations like this: Recall the “convenient” properties of R 1 GNFA: start state goes to every other state, but has no incoming states R 2 R 4 every state goes to the unique accepting X state, which is different from the starting state. The accepting state does not have R 3 any outgoing arrows. ⇓ all other states have one transition to all R 1 ∪ ( R 2 R ∗ 3 R 4 ) other states, including themselves. INF2080 Lecture :: 25th January 18 / 39

  12. Regular Expressions and Automata Let’s formalize this! Let us define a procedure CONVERT( G ): 1 If k = 2 then G only has one start and one accept state, so return the regular expression R of the transition connecting them. INF2080 Lecture :: 25th January 19 / 39

  13. Regular Expressions and Automata Let’s formalize this! Let us define a procedure CONVERT( G ): 1 If k = 2 then G only has one start and one accept state, so return the regular expression R of the transition connecting them. 2 if k > 2 select a state q ′ �∈ { q accept , q start } . Define G ′ = { Q ′ , Σ , δ ′ , q start , q accept } with Q ′ = Q \ { q ′ } and δ ′ ( q i , q j ) = R 1 ∪ R 2 R ∗ 3 R 4 where R 1 = δ ( q i , q j ) , R 2 = δ ( q i , q ′ ) , R 3 = δ ( q ′ , q ′ ) , R 4 = δ ( q ′ , q j ) , and . INF2080 Lecture :: 25th January 19 / 39

  14. Regular Expressions and Automata Let’s formalize this! Let us define a procedure CONVERT( G ): 1 If k = 2 then G only has one start and one accept state, so return the regular expression R of the transition connecting them. 2 if k > 2 select a state q ′ �∈ { q accept , q start } . Define G ′ = { Q ′ , Σ , δ ′ , q start , q accept } with Q ′ = Q \ { q ′ } and δ ′ ( q i , q j ) = R 1 ∪ R 2 R ∗ 3 R 4 where R 1 = δ ( q i , q j ) , R 2 = δ ( q i , q ′ ) , R 3 = δ ( q ′ , q ′ ) , R 4 = δ ( q ′ , q j ) , and . 3 Return the result of CONVERT( G ′ ). INF2080 Lecture :: 25th January 19 / 39

  15. Regular Expressions and Automata Let’s formalize this! Let us define a procedure CONVERT( G ): 1 If k = 2 then G only has one start and one accept state, so return the regular expression R of the transition connecting them. 2 if k > 2 select a state q ′ �∈ { q accept , q start } . Define G ′ = { Q ′ , Σ , δ ′ , q start , q accept } with Q ′ = Q \ { q ′ } and δ ′ ( q i , q j ) = R 1 ∪ R 2 R ∗ 3 R 4 where R 1 = δ ( q i , q j ) , R 2 = δ ( q i , q ′ ) , R 3 = δ ( q ′ , q ′ ) , R 4 = δ ( q ′ , q j ) , and . 3 Return the result of CONVERT( G ′ ). 4 correctness still remains to be shown! See book for details! (Claim 1.65) INF2080 Lecture :: 25th January 19 / 39

  16. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: DFA: 0 1 1 start 0 0 1 INF2080 Lecture :: 25th January 20 / 39

  17. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: DFA: GNFA: 0 0 1 1 1 1 ∅ start start ∅ ∅ 0 0 0 0 1 1 INF2080 Lecture :: 25th January 20 / 39

  18. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: Remove state X: 0 X 1 1 ∅ start ∅ ∅ 0 0 1 INF2080 Lecture :: 25th January 21 / 39

  19. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: Remove state X: 0 ∅ ∪ ( 10 ∗ 1 ) X 1 1 start ∅ 0 0 start ∅ ∅ 0 0 1 1 INF2080 Lecture :: 25th January 21 / 39

  20. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: Remove state Y: ( 10 ∗ 1 ) start 0 0 Y 1 INF2080 Lecture :: 25th January 22 / 39

  21. Regular Expressions and Automata Proposition Every regular language can be described using a RE. Example: Remove state Y: ( 10 ∗ 1 ) ( 10 ∗ 1 ) ∪ ( 01 ∗ 0 ) start start 0 0 Y 1 INF2080 Lecture :: 25th January 22 / 39

  22. Summary So RE = GNFA = DFA = NFA = Regular languages... INF2080 Lecture :: 25th January 23 / 39

  23. Summary So RE = GNFA = DFA = NFA = Regular languages... But when is a language nonregular ? How can we check? INF2080 Lecture :: 25th January 23 / 39

  24. Summary So RE = GNFA = DFA = NFA = Regular languages... But when is a language nonregular ? How can we check? ⇒ Pumping Lemma! INF2080 Lecture :: 25th January 23 / 39

  25. Pumping Lemma DFAs only have finite memory, aka states. INF2080 Lecture :: 25th January 24 / 39

  26. Pumping Lemma DFAs only have finite memory, aka states. Pumping lemma gives a pumping length : if a string is longer than the pumping length, it can be pumped , i.e., there is a substring that can be repeated arbitrarily often such that the string remains in the language INF2080 Lecture :: 25th January 24 / 39

  27. Pumping Lemma DFAs only have finite memory, aka states. Pumping lemma gives a pumping length : if a string is longer than the pumping length, it can be pumped , i.e., there is a substring that can be repeated arbitrarily often such that the string remains in the language If a DFA has p states, and a string has length ≥ p , then the accepting path in the DFA must visit at least p + 1 states. In other words, at least one state appears twice. ⇒ loop! This loop can be repeated while staying in the language. INF2080 Lecture :: 25th January 24 / 39

  28. Pumping Lemma - Example 0 b 1 1 a c start 0 0 d 1 INF2080 Lecture :: 25th January 25 / 39

  29. Pumping Lemma - Example 0 Language ( 10 ∗ 1 ) ∪ ( 01 ∗ 0 ) b 1 1 a c start 0 0 d 1 INF2080 Lecture :: 25th January 25 / 39

  30. Pumping Lemma - Example 0 Language ( 10 ∗ 1 ) ∪ ( 01 ∗ 0 ) b 1 1 DFA has 4 states a c start 0 0 d 1 INF2080 Lecture :: 25th January 25 / 39

  31. Pumping Lemma - Example 0 Language ( 10 ∗ 1 ) ∪ ( 01 ∗ 0 ) b 1 1 DFA has 4 states a c start consider string 10001, length 5 0 0 d 1 INF2080 Lecture :: 25th January 25 / 39

  32. Pumping Lemma - Example 0 Language ( 10 ∗ 1 ) ∪ ( 01 ∗ 0 ) b 1 1 DFA has 4 states a c start consider string 10001, length 5 ⇒ path must contain a loop (in this case, 0 0 at node b) d 1 INF2080 Lecture :: 25th January 25 / 39

  33. Pumping Lemma - Example 1 e d 0 0 b 1 1 a c start INF2080 Lecture :: 25th January 26 / 39

  34. Pumping Lemma - Example 1 Language 1 ( 010 ) ∗ 1 e d 0 0 b 1 1 a c start INF2080 Lecture :: 25th January 26 / 39

  35. Pumping Lemma - Example 1 Language 1 ( 010 ) ∗ 1 e d DFA has 5 states 0 0 b 1 1 a c start INF2080 Lecture :: 25th January 26 / 39

  36. Pumping Lemma - Example 1 Language 1 ( 010 ) ∗ 1 e d DFA has 5 states consider string 10101, length 5 0 0 b 1 1 a c start INF2080 Lecture :: 25th January 26 / 39

  37. Pumping Lemma - Example 1 Language 1 ( 010 ) ∗ 1 e d DFA has 5 states consider string 10101, length 5 0 0 b ⇒ path must contain a loop (in this case, 1 1 at nodes b,d,e) a c start INF2080 Lecture :: 25th January 26 / 39

  38. Pumping Lemma - Example 1 Language 1 ( 010 ) ∗ 1 e d DFA has 5 states consider string 10101, length 5 0 0 b ⇒ path must contain a loop (in this case, 1 1 at nodes b,d,e) a c start ⇒ 10100101 is also a word! INF2080 Lecture :: 25th January 26 / 39

  39. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . INF2080 Lecture :: 25th January 27 / 39

  40. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Proof: We formalize our intuition. Let M = ( Q . Σ , δ, q 0 , F ) be a DFA, A = L ( M ) the language accepted by M , and p be the number of states in M . INF2080 Lecture :: 25th January 28 / 39

  41. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Proof: We formalize our intuition. Let M = ( Q . Σ , δ, q 0 , F ) be a DFA, A = L ( M ) the language accepted by M , and p be the number of states in M . Let w = w 1 · · · w n be a word in A of length n ≥ p . Since w ∈ A , it is accepted by M , i.e., there exists a sequence of states s 1 , s 2 , . . . s n + 1 of length n + 1, where s n + 1 is an accept state and δ ( s i , w i + 1 ) = s i + 1 . INF2080 Lecture :: 25th January 28 / 39

  42. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let w = w 1 · · · w n be a word in A of length n ≥ p . Since w ∈ A , it is accepted by M , i.e., there exists a sequence of states s 1 , s 2 , . . . s n + 1 of length n + 1. INF2080 Lecture :: 25th January 29 / 39

  43. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let w = w 1 · · · w n be a word in A of length n ≥ p . Since w ∈ A , it is accepted by M , i.e., there exists a sequence of states s 1 , s 2 , . . . s n + 1 of length n + 1. Since n + 1 ≥ p + 1, one state must occur twice within the first p + 1 elements of the sequence (pigeonhole pricniple). INF2080 Lecture :: 25th January 29 / 39

  44. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let w = w 1 · · · w n be a word in A of length n ≥ p . Since w ∈ A , it is accepted by M , i.e., there exists a sequence of states s 1 , s 2 , . . . s n + 1 of length n + 1. Since n + 1 ≥ p + 1, one state must occur twice within the first p + 1 elements of the sequence (pigeonhole pricniple). Let these occurences be s j and s l . Since these occur in the first p + 1 elements of the sequence, we have l ≤ p + 1. INF2080 Lecture :: 25th January 29 / 39

  45. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let these occurences be s j and s l . Since these occur in the first p + 1 elements of the sequence, we have l ≤ p + 1. INF2080 Lecture :: 25th January 30 / 39

  46. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let these occurences be s j and s l . Since these occur in the first p + 1 elements of the sequence, we have l ≤ p + 1. define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . INF2080 Lecture :: 25th January 30 / 39

  47. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let these occurences be s j and s l . Since these occur in the first p + 1 elements of the sequence, we have l ≤ p + 1. define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . Then | y | > 0 and | xy | ≤ p . INF2080 Lecture :: 25th January 30 / 39

  48. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . x takes M from s 1 to s j , y takes M from s j to s l , z takes M from s l to s n + 1 . INF2080 Lecture :: 25th January 31 / 39

  49. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . x takes M from s 1 to s j , y takes M from s j to s l , z takes M from s l to s n + 1 . Thus the word xy i z takes M from the start state s 1 to s j , follows the path from s j to s l i times (recall that s j = s l ), then takes M from s l to s n + 1 . INF2080 Lecture :: 25th January 31 / 39

  50. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . x takes M from s 1 to s j , y takes M from s j to s l , z takes M from s l to s n + 1 . Thus the word xy i z takes M from the start state s 1 to s j , follows the path from s j to s l i times (recall that s j = s l ), then takes M from s l to s n + 1 . Thus M accepts any word xy i z for i ≥ 0. INF2080 Lecture :: 25th January 31 / 39

  51. Pumping Lemma Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . define x = w 1 · · · w j − 1 , y = w j · · · w l − 1 , z = w l · · · w n . x takes M from s 1 to s j , y takes M from s j to s l , z takes M from s l to s n + 1 . Thus the word xy i z takes M from the start state s 1 to s j , follows the path from s j to s l i times (recall that s j = s l ), then takes M from s l to s n + 1 . Thus M accepts any word xy i z for i ≥ 0. INF2080 Lecture :: 25th January 31 / 39

  52. Pumping Lemma very useful for determining if a language is nonregular INF2080 Lecture :: 25th January 32 / 39

  53. Pumping Lemma very useful for determining if a language is nonregular → find a string with length ≥ p such that the pumping lemma does not hold INF2080 Lecture :: 25th January 32 / 39

  54. Pumping Lemma very useful for determining if a language is nonregular → find a string with length ≥ p such that the pumping lemma does not hold not very useful for proving a language is regular INF2080 Lecture :: 25th January 32 / 39

  55. Pumping Lemma very useful for determining if a language is nonregular → find a string with length ≥ p such that the pumping lemma does not hold not very useful for proving a language is regular → not an if and only if statement! INF2080 Lecture :: 25th January 32 / 39

  56. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . INF2080 Lecture :: 25th January 33 / 39

  57. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . Is A regular? INF2080 Lecture :: 25th January 33 / 39

  58. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . Is A regular? If it is, then the pumping lemma gives us a pumping length p . Let s = 0 p 1 p . INF2080 Lecture :: 25th January 33 / 39

  59. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . Let s = 0 p 1 p . INF2080 Lecture :: 25th January 34 / 39

  60. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . Let s = 0 p 1 p . Condition 3 tells us that y consists of only 0s. INF2080 Lecture :: 25th January 34 / 39

  61. Pumping Lemma - Applied Lemma (Pumping Lemma) If A is a regular language, then there is a number p , called the pumping length, where if w is a word in A of length ≥ p then w can be divided into three parts, w = xyz , such that 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let A = { 0 n 1 n | n ≥ 0 } . Let s = 0 p 1 p . Condition 3 tells us that y consists of only 0s. ⇒ then xy i z for i ≥ 2 has more 0s than 1s. Contradiction! ⇒ A is nonregular. INF2080 Lecture :: 25th January 34 / 39

  62. Pumping Lemma - Applied Even if a language is nonregular, it might contain strings for which the pumping lemma is true! INF2080 Lecture :: 25th January 35 / 39

  63. Pumping Lemma - Applied Even if a language is nonregular, it might contain strings for which the pumping lemma is true! We have to be careful! INF2080 Lecture :: 25th January 35 / 39

  64. Pumping Lemma - Applied Lemma (Pumping Lemma) | w | ≥ p , w = xyz , s.t. 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let B = { ω | ω contains an equal number of 0s and 1s } . Let w = ( 01 ) p . INF2080 Lecture :: 25th January 36 / 39

  65. Pumping Lemma - Applied Lemma (Pumping Lemma) | w | ≥ p , w = xyz , s.t. 1 xy i z ∈ A for every i ≥ 0 , 2 | y | > 0 , 3 | xy | ≤ p . Let B = { ω | ω contains an equal number of 0s and 1s } . Let w = ( 01 ) p . x = ε, y = 01 , z = ( 01 ) p − 1 INF2080 Lecture :: 25th January 36 / 39

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend