costas busch - rpi1 standard representations of regular languages regular languages dfas nfas...

Download Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars

Post on 20-Dec-2015

216 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Slide 1
  • Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars
  • Slide 2
  • Costas Busch - RPI2 When we say: We are given a Regular Language We mean:Language is in a standard representation
  • Slide 3
  • Costas Busch - RPI3 Elementary Questions about Regular Languages
  • Slide 4
  • Costas Busch - RPI4 Membership Question Question:Given regular language and string how can we check if ? Answer:Take the DFA that accepts and check if is accepted
  • Slide 5
  • Costas Busch - RPI5 DFA
  • Slide 6
  • Costas Busch - RPI6 Given regular language how can we check if is empty: ? Take the DFA that accepts Check if there is any path from the initial state to a final state Question: Answer:
  • Slide 7
  • Costas Busch - RPI7 DFA
  • Slide 8
  • Costas Busch - RPI8 Given regular language how can we check if is finite? Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state Question: Answer:
  • Slide 9
  • Costas Busch - RPI9 DFA is infinite DFA is finite
  • Slide 10
  • Costas Busch - RPI10 Given regular languages and how can we check if ? Question: Find if Answer:
  • Slide 11
  • Costas Busch - RPI11 and
  • Slide 12
  • Costas Busch - RPI12 or
  • Slide 13
  • Costas Busch - RPI13 Non-regular languages
  • Slide 14
  • Costas Busch - RPI14 Regular languages Non-regular languages
  • Slide 15
  • Costas Busch - RPI15 How can we prove that a language is not regular? Prove that there is no DFA that accepts Problem: this is not easy to prove Solution: the Pumping Lemma !!!
  • Slide 16
  • Costas Busch - RPI16 The Pigeonhole Principle
  • Slide 17
  • Costas Busch - RPI17 pigeons pigeonholes
  • Slide 18
  • Costas Busch - RPI18 A pigeonhole must contain at least two pigeons
  • Slide 19
  • Costas Busch - RPI19........... pigeons pigeonholes
  • Slide 20
  • Costas Busch - RPI20 The Pigeonhole Principle........... pigeons pigeonholes There is a pigeonhole with at least 2 pigeons
  • Slide 21
  • Costas Busch - RPI21 The Pigeonhole Principle and DFAs
  • Slide 22
  • Costas Busch - RPI22 DFA with states
  • Slide 23
  • Costas Busch - RPI23 In walks of strings:no state is repeated
  • Slide 24
  • Costas Busch - RPI24 In walks of strings:a state is repeated
  • Slide 25
  • Costas Busch - RPI25 If string has length : Thus, a state must be repeated Then the transitions of string are more than the states of the DFA
  • Slide 26
  • Costas Busch - RPI26 In general, for any DFA: String has length number of states A state must be repeated in the walk of...... walk of Repeated state
  • Slide 27
  • Costas Busch - RPI27 In other words for a string : transitions are pigeons states are pigeonholes...... walk of Repeated state
  • Slide 28
  • Costas Busch - RPI28 The Pumping Lemma
  • Slide 29
  • Costas Busch - RPI29 Take an infinite regular language There exists a DFA that accepts states
  • Slide 30
  • Costas Busch - RPI30 Take string with There is a walk with label :......... walk
  • Slide 31
  • Costas Busch - RPI31 If string has length (number of states of DFA) then, from the pigeonhole principle: a state is repeated in the walk...... walk
  • Slide 32
  • Costas Busch - RPI32...... walk Let be the first state repeated in the walk of
  • Slide 33
  • Costas Busch - RPI33 Write......
  • Slide 34
  • Costas Busch - RPI34...... Observations:lengthnumber of states of DFA length
  • Slide 35
  • Costas Busch - RPI35 The string is accepted Observation:......
  • Slide 36
  • Costas Busch - RPI36 The string is accepted Observation:......
  • Slide 37
  • Costas Busch - RPI37 The string is accepted Observation:......
  • Slide 38
  • Costas Busch - RPI38 The string is accepted In General:......
  • Slide 39
  • Costas Busch - RPI39 In General:...... Language accepted by the DFA
  • Slide 40
  • Costas Busch - RPI40 In other words, we described: The Pumping Lemma !!!
  • Slide 41
  • Costas Busch - RPI41 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:
  • Slide 42
  • Costas Busch - RPI42 Applications of the Pumping Lemma
  • Slide 43
  • Costas Busch - RPI43 Theorem: The language is not regular Proof: Use the Pumping Lemma
  • Slide 44
  • Costas Busch - RPI44 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma
  • Slide 45
  • Costas Busch - RPI45 Let be the integer in the Pumping Lemma Pick a string such that: length We pick
  • Slide 46
  • Costas Busch - RPI46 it must be that length From the Pumping Lemma Write: Thus:
  • Slide 47
  • Costas Busch - RPI47 From the Pumping Lemma: Thus:
  • Slide 48
  • Costas Busch - RPI48 From the Pumping Lemma: Thus:
  • Slide 49
  • Costas Busch - RPI49 BUT: CONTRADICTION!!!
  • Slide 50
  • Costas Busch - RPI50 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:
  • Slide 51
  • Costas Busch - RPI51 Regular languages Non-regular languages

Recommended

View more >