fall 2006costas busch - rpi1 non-regular languages (pumping lemma)

Download Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)

If you can't read please download the document

Post on 16-Dec-2015

215 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Slide 1
  • Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
  • Slide 2
  • Fall 2006Costas Busch - RPI2 Regular languages Non-regular languages
  • Slide 3
  • Fall 2006Costas Busch - RPI3 How can we prove that a language is not regular? Prove that there is no DFA or NFA or RE that accepts Difficulty: this is not easy to prove ( since there is an infinite number of them) Solution: use the Pumping Lemma !!!
  • Slide 4
  • Fall 2006Costas Busch - RPI4 The Pigeonhole Principle
  • Slide 5
  • Fall 2006Costas Busch - RPI5 pigeons pigeonholes
  • Slide 6
  • Fall 2006Costas Busch - RPI6 A pigeonhole must contain at least two pigeons
  • Slide 7
  • Fall 2006Costas Busch - RPI7........... pigeons pigeonholes
  • Slide 8
  • Fall 2006Costas Busch - RPI8 The Pigeonhole Principle........... pigeons pigeonholes There is a pigeonhole with at least 2 pigeons
  • Slide 9
  • Fall 2006Costas Busch - RPI9 The Pigeonhole Principle and DFAs
  • Slide 10
  • Fall 2006Costas Busch - RPI10 Consider a DFA with states
  • Slide 11
  • Fall 2006Costas Busch - RPI11 Consider the walk of a long string: A state is repeated in the walk of (length at least 4)
  • Slide 12
  • Fall 2006Costas Busch - RPI12 Pigeons: Nests: (Automaton states) Are more than Walk of The state is repeated as a result of the pigeonhole principle (walk states) Repeated state
  • Slide 13
  • Fall 2006Costas Busch - RPI13 Consider the walk of a long string: A state is repeated in the walk of (length at least 4) Due to the pigeonhole principle:
  • Slide 14
  • Fall 2006Costas Busch - RPI14 Automaton States Pigeons: Nests: (Automaton states) Are more than Walk of The state is repeated as a result of the pigeonhole principle (walk states) Repeated state
  • Slide 15
  • Fall 2006Costas Busch - RPI15...... Repeated state Walk of.... Arbitrary DFA If, by the pigeonhole principle, a state is repeated in the walk In General:
  • Slide 16
  • Fall 2006Costas Busch - RPI16 Walk of Pigeons: Nests: (Automaton states) Are more than (walk states).... A state is repeated
  • Slide 17
  • Fall 2006Costas Busch - RPI17 The Pumping Lemma
  • Slide 18
  • Fall 2006Costas Busch - RPI18 Take an infinite regular language There exists a DFA that accepts states (contains an infinite number of strings)
  • Slide 19
  • Fall 2006Costas Busch - RPI19 (number of states of DFA) then, at least one state is repeated in the walk of...... Take string with Walk in DFA of Repeated state in DFA
  • Slide 20
  • Fall 2006Costas Busch - RPI20 Take to be the first state repeated.... There could be many states repeated.... Second occurrence First occurrence Unique states One dimensional projection of walk :
  • Slide 21
  • Fall 2006Costas Busch - RPI21.... Second occurrence First occurrence One dimensional projection of walk : We can write
  • Slide 22
  • Fall 2006Costas Busch - RPI22... In DFA:... contains only first occurrence of
  • Slide 23
  • Fall 2006Costas Busch - RPI23 Observation:lengthnumber of states of DFA Since, in no state is repeated (except q) Unique States...
  • Slide 24
  • Fall 2006Costas Busch - RPI24 Observation:length Since there is at least one transition in loop...
  • Slide 25
  • Fall 2006Costas Busch - RPI25 We do not care about the form of string... may actually overlap with the paths of and
  • Slide 26
  • Fall 2006Costas Busch - RPI26 The string is accepted Additional string:... Do not follow loop...
  • Slide 27
  • Fall 2006Costas Busch - RPI27 The string is accepted... Follow loop 2 times Additional string:...
  • Slide 28
  • Fall 2006Costas Busch - RPI28 The string is accepted... Follow loop 3 times Additional string:...
  • Slide 29
  • Fall 2006Costas Busch - RPI29 The string is accepted In General:... Follow loop times...
  • Slide 30
  • Fall 2006Costas Busch - RPI30 Therefore: Language accepted by the DFA...
  • Slide 31
  • Fall 2006Costas Busch - RPI31 In other words, we described: The Pumping Lemma !!!
  • Slide 32
  • Fall 2006Costas Busch - RPI32 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that: (critical length)
  • Slide 33
  • Fall 2006Costas Busch - RPI33 In the book: Critical length = Pumping length
  • Slide 34
  • Fall 2006Costas Busch - RPI34 Applications of the Pumping Lemma
  • Slide 35
  • Fall 2006Costas Busch - RPI35 Observation: Every language of finite size has to be regular Therefore, every non-regular language has to be of infinite size (contains an infinite number of strings) (we can easily construct an NFA that accepts every string in the language)
  • Slide 36
  • Fall 2006Costas Busch - RPI36 Suppose you want to prove that An infinite language is not regular 1. Assume the opposite: is regular 2. The pumping lemma should hold for 3. Use the pumping lemma to obtain a contradiction 4. Therefore, is not regular
  • Slide 37
  • Fall 2006Costas Busch - RPI37 Explanation of Step 3: How to get a contradiction 2. Choose a particular string which satisfies the length condition 3. Write 4. Show thatfor some 5. This gives a contradiction, since from pumping lemma 1. Let be the critical length for
  • Slide 38
  • Fall 2006Costas Busch - RPI38 Note: It suffices to show that only one string gives a contradiction You dont need to obtain contradiction for every
  • Slide 39
  • Fall 2006Costas Busch - RPI39 Theorem: The language is not regular Proof: Use the Pumping Lemma Example of Pumping Lemma application
  • Slide 40
  • Fall 2006Costas Busch - RPI40 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma
  • Slide 41
  • Fall 2006Costas Busch - RPI41 Let be the critical length for Pick a string such that: and length We pick
  • Slide 42
  • Fall 2006Costas Busch - RPI42 with lengths From the Pumping Lemma: we can write Thus:
  • Slide 43
  • Fall 2006Costas Busch - RPI43 From the Pumping Lemma: Thus:
  • Slide 44
  • Fall 2006Costas Busch - RPI44 From the Pumping Lemma: Thus:
  • Slide 45
  • Fall 2006Costas Busch - RPI45 BUT: CONTRADICTION!!!
  • Slide 46
  • Fall 2006Costas Busch - RPI46 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore: END OF PROOF
  • Slide 47
  • Fall 2006Costas Busch - RPI47 Regular languages Non-regular language