Cs3102: Theory of Computation Class 5: Non-Regular Languages Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint.

Slides:



Advertisements
Similar presentations
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Advertisements

Finite Automata CPSC 388 Ellen Walker Hiram College.
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.
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
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 Discussion1: Non-Deterministic Finite Automatons 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.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
CS5371 Theory of Computation
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin This work is licensed under.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Limitations.
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 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
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)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
1 Non-regular languages. 2 Regular languages Non-regular languages.
Today Chapter 1: RE = Regular Languages, nonregular languages RL pumping lemma Chapter 2: Context-Free Languages (CFLs)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Cs3102: Theory of Computation Class 2: Problems and Finite Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the.
Cs3102: Theory of Computation Class 4: Nondeterminism Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.
Cs3102: Theory of Computation Class 6: Pushdown Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
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}?
CS355 - Theory of Computation Regular Expressions.
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
CSCI 2670 Introduction to Theory of Computing September 13.
CS 203: Introduction to Formal Languages and Automata
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
CSE 311 Foundations of Computing I Lecture 24 FSM Limits, Pattern Matching Autumn 2011 CSE 3111.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
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.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
CSE 105 theory of computation
PROPERTIES OF REGULAR LANGUAGES
Spring 2010 University of Virginia David Evans
Lecture5 Non-regular languages
CS 154, Lecture 4: Limitations on DFAs (I),
Pumping Lemma September 29, 2006
Chapter 4 Properties of Regular Languages
CS21 Decidability and Tractability
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

cs3102: Theory of Computation Class 5: Non-Regular Languages Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A AAA A AAAAAA AAA A A

Menu PS1, Problem 8 Non-regular languages

PS1 General Comments Proofs are for making convincing arguments, not for obfuscation. – e.g., If you assumed pizzas can only be cut through their center, it is obvious each cut makes 2 new pieces, and the number of pieces is 2n. Adding an inductive proof only adds unnecessary confusion! Pledges are to remind you to be honorable – I assume you are all honorable whether you write a pledge or not – Writing a rote pledge (not what the PS collaboration policy says) doesn’t work

Problem 8 DFA that recognizes: { w | w  [a, b]* and w does not contain two consecutive a s } no-a one-a b a b two-a a a, b How many strings of length n in this language?

no-a one-a b a b two-a a a, b n End in no-a stateEnd in one-a stateTotal of length n = = = 538 n > 2 E 0 (n-1)+E 1 (n-1)E 0 (n-1)2E 0 (n-1) + E 1 (n-1)

Fibonacci Strings! E 1 (n) = E 0 (n-1)E 0 (n) = E 0 (n-1)+E 0 (n-2) T(n) = 2E 0 (n-1) + E 0 (n-2) = 2(E 0 (n-2) +E 0 (n-3)) + E 0 (n-2) = 3E 0 (n-2) + 2E 0 (n-3) T(n - 1) = 2E 0 (n-2) + E 0 (n-3) + T(n - 2) = 2E 0 (n-3) + E 0 (n-4) = 2E 0 (n-2) + 3E 0 (n-3) + E 0 (n-4) = 2E 0 (n-2) + 2E 0 (n-3) + (E 0 (n-3) + E 0 (n-4)) = 3E 0 (n-2) + 2E 0 (n-3) = T(n)

All Languages Regular Languages Can be recognized by some DFA Finite Languages

What DFAs Cannot Do a Keep track of a non-constant amount of state: the amount of state to keep track of cannot scale with the input string DFAs can have any number of states, but the number of states in any particular DFA is fixed and finite.

The Language Recognition Game Players agree on a language A Player 1: draw a DFA M that attempts to recognize language A. Player 2: find a string s that M decides incorrectly. – Either, s  A but M rejects – Or, s  A but M accepts If Player 2 can find such a string, Player 2 wins. Otherwise, Player 1 wins. If A is regular, Player 1 should always win. If A is non-regular, Player 2 should always win. If A is regular, Player 1 should always win. If A is non-regular, Player 2 should always win.

Playing the Language Game A = a*b*

Playing the Language Game A = { a n b n |n >= 0 }

Regular Language Game A = { w|w  [a,b]* and w has more a s than b s. }

Regular Language Game A = { w|w  [0,1]* and w is divisible by 3 when interpreted as a binary number }

q0q0 qzqz

q0q0 qzqz qiqi x y z If input string is longer than |Q|, some state must repeat.

Pumping Lemma flickr: ytwhitelight Capture our intuition about what DFAs can’t do more precisely. We’ll see pumping lemmas for other types of computation models.

Pumping Lemma for Regular Languages If A is a regular language, then there is some number p (the pumping length) where for any string s  A and |s|  p, s may be divided into three pieces, s = xyz, such that |y|> 0, |xy|  p, and for any i  0, xy i z  A. Intuitively: you can go around the circle any number of times.

Using the PLRL: Proof by Contradiction 1.Assume A is regular. 2.Then, the pumping lemma is true for A : there is some number p (the pumping length) where for any string s  A and |s|  p, s may be divided into three pieces, s = xyz, such that |y|> 0, |xy|  p, and for any i  0, xy i z  A. 3.The creative part: Identify a string s that can be built using p and show that there is no way to divide s = xyz that satisfies the pumping lemma: for all possible divisions where |y|> 0 there is some i  0 such that xy i z  A. We can condense the first 2 steps into the statement: ``Assume A is regular and p is the pumping length for A.'' We can condense the first 2 steps into the statement: ``Assume A is regular and p is the pumping length for A.''

Example: A = { a n b n |n >= 0 }

A = { a n b n |n >= 0 } is not regular

A = { w|w has more a s than b s. }

A = { w|w  [0,1]* and w is divisible by 3 when interpreted as a binary number } Pumping lemma can be used to show a language is not regular. It starts by assuming a language is regular and gets a contradiction. This is no way to show a language is regular.

Regular Languages One-Slide Summary A language is a set of strings. A language is regular iff some DFA recognizes it. DFAs, NFAs, and Regular Expressions are equally powerful – They can recognize exactly the same set of languages = the regular languages – Prove by construction: show how to construct a DFA that recognizes the same language as NFA, etc. To prove a language is regular: construct a DFA, NFA or RE that recognizes it To prove a language is not regular: show recognizing it requires keeping track of infinite state use the pumping lemma to get a contradiction

All Languages Regular Languages Can be recognized by some DFA Finite Languages Next week: machines that can recognize some non-regular language.

Return PS1 front of room afg2s (Arthur Gordon) – dk8p afg2s (Arthur Gordon) – dk8p dr7jx (David Renardy) – jmd9xk dr7jx (David Renardy) – jmd9xk jth2ey (James Harrison) - pmc8p ras3kd (Robyn Short) – yyz5w