Non-regular languages

Slides:



Advertisements
Similar presentations
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Advertisements

Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
3.2 Pumping Lemma for Regular Languages Given a language L, how do we know whether it is regular or not? If we can construct an FA to accept the language.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Mount Holyoke College 2 Nonregular languages? We now know: –Regular languages may be specified either.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
Fall 2006Costas Busch - RPI1 Regular Expressions.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Courtesy Costas Busch - RPI1 The Pumping Lemma for Context-Free Languages.
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Costas Busch - RPI1 The Pumping Lemma for Context-Free Languages.
1 More Applications of the Pumping Lemma. 2 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we.
Courtesy Costas Busch - RPI1 Non-regular languages.
Fall 2003Costas Busch1 More Applications of The Pumping Lemma.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Fall 2006Costas Busch - RPI1 More Applications of the Pumping Lemma.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Prof. Busch - LSU1 Pumping Lemma for Context-free Languages.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
1 Non-regular languages. 2 Regular languages Non-regular languages.
Costas Busch1 More Applications of The Pumping Lemma.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
A Universal Turing Machine
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Regular Expressions Costas Busch - LSU.
Costas Busch - LSU1 Pumping Lemma for Context-free Languages.
1 Find as many examples as you can of w, x, y, z so that w is accepted by this DFA, w = x y z, y ≠ ε, | x y | ≤ 7, and x y n z is in L for all n ≥ 0.
Costas Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
Nonregular Languages How do you prove a language to be regular? How do you prove a language to be nonregular? A Pumping Lemma.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
A Universal Turing Machine
Non-regular languages - The pumping lemma
Formal Language & Automata Theory
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
More Applications of the Pumping Lemma
PROPERTIES OF REGULAR LANGUAGES
Busch Complexity Lectures: Reductions
Undecidable Problems Costas Busch - LSU.
Reductions Costas Busch - LSU.
NPDAs Accept Context-Free Languages
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Regular Expressions Prof. Busch - LSU.
DPDA Deterministic PDA
Non-Deterministic Finite Automata
Properties of Regular Languages
Non-Deterministic Finite Automata
Decidable Languages Costas Busch - LSU.
Deterministic PDAs - DPDAs
Pumping Lemma for Context-free Languages
Elementary Questions about Regular Languages
Non-regular languages
Chapter 4 Properties of Regular Languages
Undecidable problems:
Non-Regular Languages
More Applications of the Pumping Lemma
DPDA Deterministic PDA
Applications of Regular Closure
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Non-regular languages (Pumping Lemma) Costas Busch - LSU

Non-regular languages Costas Busch - LSU

Difficulty: this is not easy to prove 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 !!! Costas Busch - LSU

The Pigeonhole Principle Costas Busch - LSU

pigeons pigeonholes Costas Busch - LSU

contain at least two pigeons A pigeonhole must contain at least two pigeons Costas Busch - LSU

pigeons ........... pigeonholes ........... Costas Busch - LSU

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

The Pigeonhole Principle and DFAs Costas Busch - LSU

Consider a DFA with states Costas Busch - LSU

Consider the walk of a “long’’ string: (length at least 4) A state is repeated in the walk of Costas Busch - LSU

The state is repeated as a result of the pigeonhole principle Walk of Pigeons: (walk states) Are more than Nests: (Automaton states) Repeated state Repeated state Costas Busch - LSU

Consider the walk of a “long’’ string: (length at least 4) Due to the pigeonhole principle: A state is repeated in the walk of Costas Busch - LSU

The state is repeated as a result of the pigeonhole principle: Walk of Pigeons: (walk states) Are more than Nests: (Automaton states) Repeated state Automaton States Costas Busch - LSU

by the pigeonhole principle, a state is repeated in the walk In General: If , by the pigeonhole principle, a state is repeated in the walk Walk of .... .... .... Arbitrary DFA ...... ...... Repeated state Costas Busch - LSU

Number of states in walk is at least Walk of Pigeons: (walk states) .... .... .... Are more than .... .... Nests: (Automaton states) A state is repeated Costas Busch - LSU

The Pumping Lemma Costas Busch - LSU

Take an infinite regular language (contains an infinite number of strings) There exists a DFA that accepts states Costas Busch - LSU

then, at least one state is repeated in the walk of Take string with (number of states of DFA) then, at least one state is repeated in the walk of Walk in DFA of ...... ...... Repeated state in DFA Costas Busch - LSU

There could be many states repeated Take to be the first state repeated One dimensional projection of walk : First occurrence Second occurrence .... .... .... Unique states Costas Busch - LSU

One dimensional projection of walk : We can write One dimensional projection of walk : First occurrence Second occurrence .... .... .... Costas Busch - LSU

In DFA: ... ... ... ... Where corresponds to substring between first and second occurrence of ... ... ... ... Costas Busch - LSU

Observation: length number of states of DFA ... Because of unique states in ... Since, in no state is repeated (except q) Costas Busch - LSU

Since there is at least one transition in loop Observation: length Since there is at least one transition in loop ... Costas Busch - LSU

We do not care about the form of string may actually overlap with the paths of and ... ... Costas Busch - LSU

Additional string: The string is accepted Do not follow loop ... ... Costas Busch - LSU

Additional string: The string is accepted Follow loop 2 times ... ... Costas Busch - LSU

The string is accepted Additional string: Follow loop 3 times ... ... Costas Busch - LSU

In General: The string is accepted Follow loop times ... ... ... ... Costas Busch - LSU

Language accepted by the DFA Therefore: Language accepted by the DFA ... ... ... ... Costas Busch - LSU

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

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

Applications of the Pumping Lemma Costas Busch - LSU

Every language of finite size has to be regular Observation: Every language of finite size has to be regular (we can easily construct an NFA that accepts every string in the language) Therefore, every non-regular language has to be of infinite size (contains an infinite number of strings) Costas Busch - LSU

Suppose you want to prove that αn 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 Costas Busch - LSU

Explanation of Step 3: How to get a contradiction 1. Let be the critical length for 2. Choose a particular string which satisfies the length condition 3. Write 4. Show that for some 5. This gives a contradiction, since from pumping lemma Costas Busch - LSU

It suffices to show that only one string gives a contradiction Note: It suffices to show that only one string gives a contradiction You don’t need to obtain contradiction for every Costas Busch - LSU

Theorem: Proof: Example of Pumping Lemma application The language is not regular Proof: Use the Pumping Lemma Costas Busch - LSU

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

Let be the critical length for Pick a string such that: and length We pick Costas Busch - LSU

From the Pumping Lemma: we can write with lengths Thus: Costas Busch - LSU

From the Pumping Lemma: Thus: Costas Busch - LSU

From the Pumping Lemma: Thus: Costas Busch - LSU

BUT: CONTRADICTION!!! Costas Busch - LSU

Conclusion: Therefore: Our assumption that is a regular language is not true Conclusion: is not a regular language END OF PROOF Costas Busch - LSU

Non-regular language Regular languages Costas Busch - LSU