Costas Busch - RPI1 More Applications of the Pumping Lemma.

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.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
Fall 2006Costas Busch - RPI1 Regular Expressions.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Courtesy Costas Buch - RPI1 Simplifications of Context-Free Grammars.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Recursively Enumerable and Recursive Languages
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.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
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.
Costas Busch - RPI1 Positive Properties of 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.
1 More Applications of The Pumping Lemma. 2 The Pumping Lemma: there exists an integer such that for any string we can write For infinite context-free.
Prof. Busch - LSU1 Pumping Lemma for Context-free Languages.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
Fall 2006Costas Busch - RPI1 Lex. Fall 2006Costas Busch - RPI2 Lex: a lexical analyzer A Lex program recognizes strings For each kind of string found.
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
1 Non-regular languages. 2 Regular languages Non-regular languages.
1 Applications of Regular Closure. 2 The intersection of a context-free language and a regular language is a context-free language context free regular.
Costas Busch1 More Applications of The Pumping Lemma.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 7 Mälardalen University 2010.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Solution Exercise 1.43 a A r r s q q > b b e b s’ q r q’ b r’ a A’
A Universal Turing Machine
1 Lex. 2 Lex is a lexical analyzer Var = ; if (test > 20) temp = 0; else while (a < 20) temp++; Lex Ident: Var Integer: 12 Oper: + Integer: 9 Semicolumn:
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Properties of Regular Languages
Costas Busch - LSU1 Pumping Lemma for Context-free Languages.
Costas Busch - LSU1 Lex. Costas Busch - LSU2 Lex: a lexical analyzer A Lex program recognizes strings For each kind of string found the lex program takes.
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.
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.
Lecture 8UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 8.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Recursively Enumerable and Recursive Languages
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
More Applications of the Pumping Lemma
PROPERTIES OF REGULAR LANGUAGES
NPDAs Accept Context-Free Languages
NPDAs Accept Context-Free Languages
Undecidable Problems (unsolvable problems)
Infiniteness Test The Pumping Lemma Nonregular Languages
DPDA Deterministic PDA
Pumping Lemma for Context-free Languages
Elementary Questions about Regular Languages
Non-regular languages
Undecidable problems:
More Applications of the Pumping Lemma
DPDA Deterministic PDA
More Applications of The Pumping Lemma
Applications of Regular Closure
Formal Definitions for Turing Machines
Presentation transcript:

Costas Busch - RPI1 More Applications of the Pumping Lemma

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

Costas Busch - RPI3 Regular languages Non-regular languages

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

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

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

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

Costas Busch - RPI8 From the Pumping Lemma: Thus:

Costas Busch - RPI9 From the Pumping Lemma: Thus:

Costas Busch - RPI10 BUT: CONTRADICTION!!!

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

Costas Busch - RPI12 Regular languages Non-regular languages

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

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

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

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

Costas Busch - RPI17 From the Pumping Lemma: Thus:

Costas Busch - RPI18 From the Pumping Lemma: Thus:

Costas Busch - RPI19 BUT: CONTRADICTION!!!

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

Costas Busch - RPI21 Regular languages Non-regular languages

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

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

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

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

Costas Busch - RPI26 From the Pumping Lemma: Thus:

Costas Busch - RPI27 From the Pumping Lemma: Thus:

Costas Busch - RPI28 Since: There must exist such that:

Costas Busch - RPI29 However:for for any

Costas Busch - RPI30 BUT: CONTRADICTION!!!

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

Costas Busch - RPI32 Lex

Costas Busch - RPI33 Lex: a lexical analyzer A Lex program recognizes strings For each kind of string found the lex program takes an action

Costas Busch - RPI34 Var = ; if (test > 20) temp = 0; else while (a < 20) temp++; Lex program Identifier: Var Operand: = Integer: 12 Operand: + Integer: 9 Semicolumn: ; Keyword: if Parenthesis: ( Identifier: test.... Input Output

Costas Busch - RPI35 In Lex strings are described with regular expressions “if” “then” “+” “-” “=“ /* operators */ /* keywords */ Lex program Regular expressions

Costas Busch - RPI36 (0|1|2|3|4|5|6|7|8|9)+ /* integers */ /* identifiers */ Regular expressions (a|b|..|z|A|B|...|Z)+ Lex program

Costas Busch - RPI37 integers [0-9]+(0|1|2|3|4|5|6|7|8|9)+

Costas Busch - RPI38 (a|b|..|z|A|B|...|Z)+ [a-zA-Z]+ identifiers

Costas Busch - RPI39 Each regular expression has an associated action (in C code) Examples: \n Regular expressionAction linenum++; [a-zA-Z]+ printf(“identifier”); [0-9]+ prinf(“integer”);

Costas Busch - RPI40 Default action: ECHO; Prints the string identified to the output

Costas Busch - RPI41 A small lex program % [a-zA-Z]+printf(“Identifier\n”); [0-9]+printf(“Integer\n”); [ \t\n] ; /*skip spaces*/

Costas Busch - RPI test var Input Output Integer Identifier Integer

Costas Busch - RPI43 % [a-zA-Z]+ printf(“Identifier\n”); [0-9]+ prinf(“Integer\n”); [ \t] ; /*skip spaces*/. printf(“Error in line: %d\n”, linenum); Another program %{ int linenum = 1; %} \nlinenum++;

Costas Busch - RPI test var temp Input Output Integer Identifier Integer Error in line: 3 Identifier

Costas Busch - RPI45 Lex matches the longest input string “if” “ifend” Regular Expressions Input: ifend if Matches: “ifend” “if” Example:

Costas Busch - RPI46 Internal Structure of Lex Lex Regular expressions NFADFA Minimal DFA The final states of the DFA are associated with actions