CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Limitations.

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

Chapter Eleven: Non-Regular Languages
Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
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.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
127 The Chomsky Hierarchy(review) Recursively Enumerable Sets Turing Machines Post System Markov Algorithms,  -recursive Functions Regular Expression.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
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.
Transparency No. 7-1 Formal Language and Automata Theory Chapter 7 Limitations of Finite Automata (lecture 11 and 12)
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
1 Non-regular languages. 2 Regular languages Non-regular languages.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong DFA minimization.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Tutorial CSC3130 : Formal Languages and Automata Theory Haifeng Wan ( )
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Closure.
Introduction to CS Theory
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
CS 3240 – Chapter 4.  Closure Properties  Algorithms for Elementary Questions:  Is a given word, w, in L?  Is L empty, finite or infinite?  Are L.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
CS 203: Introduction to Formal Languages and Automata
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong DFA minimization.
1 Applications of pumping lemma(Dr. Torng) Applications of Pumping Lemma –General proof template What is the same in every proof What changes in every.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
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.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Limitations.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Cs466(Prasad)L11PLEG1 Examples Applying Pumping Lemma.
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.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Complexity and Computability Theory I
Formal Language & Automata Theory
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Reducibility The Chinese University of Hong Kong Fall 2010
Properties of Regular Languages
Infiniteness Test The Pumping Lemma Nonregular Languages
More on DFA minimization and DFA equivalence
Elementary Questions about Regular Languages
Non-regular languages
Non-Regular Languages
Limitations of pushdown automata
Non-regular languages
Non-regular languages
More undecidable languages
DFA minimization The Chinese University of Hong Kong Fall 2011
CHAPTER 1 Regular Languages
Limitations of context-free languages
CSCI 2670 Introduction to Theory of Computing
Nondeterminism The Chinese University of Hong Kong Fall 2010
Presentation transcript:

CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Limitations of finite automata Fall 2008

Many examples of regular languages q0q0 q1q , 1 qq qq qq qq ((0 + 1)0 + (0 + 1)(0 + 1)(0 + 1))* all strings not containing pattern 010 followed by 101 Is every language regular?

Which are regular? L 1 = {0 n 1 m : n, m ≥ 0} L 2 = {0 n 1 n : n ≥ 0}  = {0, 1} L 3 = {1 n : n is divisible by 3} L 4 = {1 n : n is prime}  = {1} L 5 = {x: x has same number of 0s and 1s} L 6 = {x: x has same number of patterns 01 and 10}  = {0, 1}

Which are regular? L 1 = {0 n 1 m : n, m ≥ 0} = 0*1*, so regular How about: Let’s try to design a DFA for it … it appears that we need infinitely many states! L 2 = {0 n 1 n : n ≥ 0} = { , 01, 0011, , …}

A non-regular language Theorem To prove this, we argue by contradiction: –Suppose we have managed to construct a DFA M for L 2 –We show something must be wrong with this DFA –In particular, M must accept some strings not in L 2 The language L 2 = {0 n 1 n : n ≥ 0} is not regular.

A non-regular language What happens when we run M on input x = 0 n+1 1 n+1 ? –M better accept, because x  L 2 M imaginary DFA for L 2 with n states x

A non-regular language What happens when we run M on input x = 0 n+1 1 n+1 ? –M better accept, because x  L 2 –But since M has n states, it must revisit at least one of its states while reading 0 n+1 M x r 1 n+1

Pigeonhole principle Here, balls are 0 s, bins are states: Suppose you are tossing n + 1 balls into n bins. Then two balls end up in the same bin. If you have a DFA with n states and it reads n + 1 consecutive 0 s, then it must end up in the same state twice.

A non-regular language What happens when we run M on input x = 0 n+1 1 n+1 ? –M better accept, because x  L 2 –But since M has n states, it must revisit at least one of its states while reading 0 n+1 –But then the DFA must contain a loop with 0 s M x r 1 n+1

A non-regular language The DFA will then also accept strings that go around the loop multiple times But such strings have more 0 s than 1 s, so they are not in L 2 ! M r 1 n+1

General method for showing non-regularity Every regular language L has a property: For every sufficiently long input z in L, there is a “middle part” in z that, even if repeated several times, keeps the input inside L z a1a1 a k+1 akak …… a n-1 anan a n+1 …a m

Pumping lemma for regular languages Theorem: For every regular language L There exists a number n such that for every string z in L, we can write z = u v w where  |uv| ≤ n  |v| ≥ 1  For every i ≥ 0, the string u v i w is in L. z …… u v w

Proving non-regularity If L is regular, then: So to prove L is not regular, it is enough to show: There exists n such that for every z in L, we can write z = u v w where  |uv| ≤ n,  |v| ≥ 1 and  For every i ≥ 0, the string u v i w is in L. For every n there exists z in L, such that for every way of writing z = u v w where  |uv| ≤ n and  |v| ≥ 1, the string u v i w is not in L for some i ≥ 0.

Proving non regularity For every n there exists z in L, such that for every way of writing z = u v w where  |uv| ≤ n and  |v| ≥ 1, the string u v i w is not in L for some i ≥ 0. This is a game between you and an imagined adversary adversary choose n write z = uvw ( |uv| ≤ n, |v| ≥ 1) you choose z  L choose i you win if uv i w  L 1 2

Proving non-regularity You need to give a strategy that, regardless of what the adversary does, always wins you the game adversary choose n write z = uvw ( |uv| ≤ n, |v| ≥ 1) you choose z  L choose i you win if uv i w  L 1 2

Example L 2 = {0 n 1 n : n ≥ 0}  = {0, 1} adversary choose n write z = uvw ( |uv| ≤ n, |v| ≥ 1) you choose z  L choose i you win if uv i w  L 1 2 adversary choose n write z = uvw ( |uv| ≤ n, |v| ≥ 1) you z = 0 n+1 1 n+1 i = 2 uv i w = 0 j+2k+l 1 n+1 = 0 n+1+k 1 n+1  L 1 2 u = 0 j, v = 0 k, w = 0 l 1 n+1 j + k + l = n + 1

More examples L 3 = {1 n : n is divisible by 3} L 4 = {1 n : n is prime}  = {1} L 5 = {x: x has same number of 0s and 1s} L 6 = {x: x has same number of patterns 01 and 10} L 7 = {x: x has more 0s than 1s} L 8 = {x: x has different number of 0s and 1s}  = {0, 1}