# Courtesy Costas Busch - RPI1 Non-regular languages.

## Presentation on theme: "Courtesy Costas Busch - RPI1 Non-regular languages."— Presentation transcript:

Courtesy Costas Busch - RPI1 Non-regular languages

Courtesy Costas Busch - RPI2 Regular languages Non-regular languages

Courtesy Costas Busch - RPI3 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 !!!

Courtesy Costas Busch - RPI4 The Pigeonhole Principle

Courtesy Costas Busch - RPI5 pigeons pigeonholes

Courtesy Costas Busch - RPI6 A pigeonhole must contain at least two pigeons

Courtesy Costas Busch - RPI7........... pigeons pigeonholes

Courtesy Costas Busch - RPI8 The Pigeonhole Principle........... pigeons pigeonholes There is a pigeonhole with at least 2 pigeons

Courtesy Costas Busch - RPI9 The Pigeonhole Principle and DFAs

Courtesy Costas Busch - RPI10 DFA with states

Courtesy Costas Busch - RPI11 In walks of strings:no state is repeated

Courtesy Costas Busch - RPI12 In walks of strings:a state is repeated

Courtesy Costas Busch - RPI13 If string has length : Thus, a state must be repeated Then the transitions of string are more than the states of the DFA

Courtesy Costas Busch - RPI14 In general, for any DFA: String has length number of states A state must be repeated in the walk of...... walk of Repeated state

Courtesy Costas Busch - RPI15 In other words for a string : transitions are pigeons states are pigeonholes...... walk of Repeated state

Courtesy Costas Busch - RPI16 The Pumping Lemma

Courtesy Costas Busch - RPI17 Take an infinite regular language There exists a DFA that accepts states

Courtesy Costas Busch - RPI18 Take string with There is a walk with label :......... walk

Courtesy Costas Busch - RPI19 If string has length (number of states of DFA) then, from the pigeonhole principle: a state is repeated in the walk...... walk

Courtesy Costas Busch - RPI20...... walk Let be the first state repeated in the walk of

Courtesy Costas Busch - RPI21 Write......

Courtesy Costas Busch - RPI22...... Observations:lengthnumber of states of DFA length

Courtesy Costas Busch - RPI23 The string is accepted Observation:......

Courtesy Costas Busch - RPI24 The string is accepted Observation:......

Courtesy Costas Busch - RPI25 The string is accepted Observation:......

Courtesy Costas Busch - RPI26 The string is accepted In General:......

Courtesy Costas Busch - RPI27 In General:...... Language accepted by the DFA

Courtesy Costas Busch - RPI28 In other words, we described: The Pumping Lemma !!!

Courtesy Costas Busch - RPI29 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:

Courtesy Costas Busch - RPI30 Applications of the Pumping Lemma

Courtesy Costas Busch - RPI31 Theorem: The language is not regular Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI32 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

Courtesy Costas Busch - RPI33 Let be the integer in the Pumping Lemma Pick a string such that: length We pick

Courtesy Costas Busch - RPI34 it must be that length From the Pumping Lemma Write: Thus:

Courtesy Costas Busch - RPI35 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI36 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI37 BUT: CONTRADICTION!!!

Courtesy Costas Busch - RPI38 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

Courtesy Costas Busch - RPI39 Regular languages Non-regular languages

Courtesy Costas Busch - RPI40 Regular languages Non-regular languages

Courtesy Costas Busch - RPI41 Theorem: The language is not regular Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI42 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

Courtesy Costas Busch - RPI43 We pick Let be the integer in the Pumping Lemma Pick a string such that: length and

Courtesy Costas Busch - RPI44 Write it must be that length From the Pumping Lemma Thus:

Courtesy Costas Busch - RPI45 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI46 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI47 BUT: CONTRADICTION!!!

Courtesy Costas Busch - RPI48 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

Courtesy Costas Busch - RPI49 Regular languages Non-regular languages

Courtesy Costas Busch - RPI50 Theorem: The language is not regular Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI51 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

Courtesy Costas Busch - RPI52 We pick Let be the integer in the Pumping Lemma Pick a string such that: length and

Courtesy Costas Busch - RPI53 Write it must be that length From the Pumping Lemma Thus:

Courtesy Costas Busch - RPI54 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI55 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI56 BUT: CONTRADICTION!!!

Courtesy Costas Busch - RPI57 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

Courtesy Costas Busch - RPI58 Regular languages Non-regular languages

Courtesy Costas Busch - RPI59 Theorem: The language is not regular Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI60 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

Courtesy Costas Busch - RPI61 We pick Let be the integer in the Pumping Lemma Pick a string such that: length

Courtesy Costas Busch - RPI62 Write it must be that length From the Pumping Lemma Thus:

Courtesy Costas Busch - RPI63 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI64 From the Pumping Lemma: Thus:

Courtesy Costas Busch - RPI65 Since: There must exist such that:

Courtesy Costas Busch - RPI66 However:for for any

Courtesy Costas Busch - RPI67 BUT: CONTRADICTION!!!

Courtesy Costas Busch - RPI68 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

69 Summary  Showing regular  construct DFA, NFA  construct regular expression  show L is the union, concatenation, intersection (regular operations) of regular languages.  Showing non-regular  pumping lemma  assume regular, apply closure properties of regular languages and obtain a known non-regular language.