1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

Properties of Regular Languages
1 Midterm I review Reading: Chapters Test Details In class, Wednesday, Feb. 25, :10pm-4pm Comprehensive Closed book, closed notes.
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
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.
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.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
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.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications.
Fall 2006Costas Busch - RPI1 Properties of Regular 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.
Homework 4 Solutions.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
1 For each language, give a regular expression that generates the language and a DFA that accepts it. L 1 = { w  {0, 1}* : has both 00 and 11 as substrings}
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
1 L= { w c w R : w  {a, b}* } is accepted by the PDA below. Use a construction like the one for intersection for regular languages to design a PDA that.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
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}?
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
Properties of Regular Languages
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2006.
Regular Languages ภาษาปกติ. Jaruloj Chongstitvatana Outline Regular expressions Regular languages Equivalence between languages accepted by.
Critique this PDA for L= { u u R v v R : u ∈ {0,1}* and v ∈ {0,1}+ } u0εu0 u1εu1 uεεvε v00vε v11vε vεεfε sεεtε t0εt0 t1εt1 t00tε t11tε tεεuε After you.
1 For each language, give a DFA that accepts it. L 1 = { w  {a, b}* : w at most 2 a’s} L 2 = { w  {0, 1}* : has both 00 and 11 as substrings} L 3 = {
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.
1 Create a NDFA which accepts the language generated by this context-free grammar. Start symbol: S S → aa S S → ε S → M M → bbb M → ab M M → b S M → E.
Cs466(Prasad)L11PLEG1 Examples Applying Pumping Lemma.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
L1= { w  {a,b}* : w consists of all strings that begin with an even number of a's followed by an odd number of b's. } L2= { w  {a,b}* : the number of.
Properties of Regular Languages
PROPERTIES OF REGULAR LANGUAGES
CSE 105 theory of computation
PDAs Accept Context-Free Languages
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Single Final State for NFA
CSE322 PROPERTIES OF REGULAR LANGUAGES
Deterministic PDAs - DPDAs
Closure Properties of Context-Free languages
Elementary Questions about Regular Languages
Closure Properties of Regular Languages
Chapter 4 Properties of Regular Languages
Properties of Context-Free languages
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
Algorithms to Answer Questions about Regular Languages
Applications of Regular Closure
CSE 105 theory of computation
Presentation transcript:

1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.

2 CSC 320 midterm: Friday October 22 Midterm tutorial: Tues. Oct. 19, 5pm, ECS 116 Assignment #3 has been posted: Due Wed. Oct. 20, beginning of class.

3 L= { a n b n : n ≥ 0 } is not a regular language. Proof (by contradiction) Assume L is regular. Then L is accepted by a DFA M with k states for some integer k. Since L is accepted by a DFA M with k states, the pumping lemma holds. Let w = a r b r where r = ⌈ k/2 ⌉.

4 Consider all possibilities for y: Case 1: a i (a j ) a r-i-j b r j ≥ 1. Pump zero times: a r-j b r ∉ L since r-j < r. Case 2: a r-i ( a i b j ) b r-j i, j ≥ 1. Pump 2 times: a r-i a i b j a i b j b r-j ∉ L because it is not of the form a * b * Case 3: a r b i (b j ) b r-i-j j ≥ 1. Pump zero times: a r b r-j ∉ since r-j < r. Therefore, L is not regular.

5 L= { a n b n : n ≥ 0 } is not a regular language. Proof (by contradiction) Assume L is regular. Then L is accepted by a DFA M with k states for some integer k. Since L is accepted by a DFA M with k states, the pumping lemma holds. Let w = a k b k (a more judicious choice for w). Since w is in L and |w| ≥k,  x, y, z such that 1. w = x y z, 2. y ≠ ε, 3. | x y | ≤ k, and 4. x y n z is in L for all n ≥ 0.

6 For w = a k b k (a more judicious choice for w): Consider all possibilities for y: Case 1: a i (a j ) a k-i-j b k j ≥ 1. Pump zero times: a k-j b k ∉ L since k-j < k. This covers all cases with |xy| ≤ k. Therefore, L is not regular.

7 Using closure properties: L= {w  {a, b} * : w has the same number of a’s as b’s} is not regular. Proof (by contradiction) Assume L is regular. The language a* b* is regular since it has a regular expression. Because regular languages are closed under intersection, L ⋂ a* b* is regular. But L ⋂ a* b* = { a n b n : n ≥ 0} which is not regular. Therefore, L is not regular.

8 Question from 2003 Midterm: Apply the pumping lemma to w= a s b a s^4 to prove that L= { a n b a r : n 2 ≤ r ≤ n 4 } is not regular. All you may assume is that s 4 + s + 1  k where k is the number of states. What is a more judicious choice for w and how does this change the proof?

9 Given the DFA below which accepts L, prove that L R = { u R : u  L} is regular by designing a NDFA which accepts L R. For example, abaa is in L so (abaa) R = aaba is in L R.

10 Algorithms to Answer Questions about Regular Languages if (if23==23) x= -23.2e23-6;

11 The first step of a compiler is to break your program into tokens. Tokens: Keywords: if Brackets: ( ) Variables: if23 x Assignment: = Math Operator: - if (if23==23) x= -23.2e23-6; Logical: == Delimiter: ; Double:-23.2e23 Integers: 23 6

12 Keywords: if ⋃ while ⋃ int ⋃ double ⋃ switch ⋃ …. Variables: Not a Keyword but of the form: (a-z ⋃ A-Z)(a-z ⋃ A-Z ⋃ 0-9 ⋃ _ )* Non-negative Integers: N= (0 ⋃ (1-9)(0-9)*) Numeric values: (Ф* ⋃ - ) ⋃ N (Ф* ⋃. (0-9)*) (Ф* ⋃ (e ⋃ E)(Ф* ⋃ + ⋃ - ) N )

13 The pumping lemma and also closure properties are used to prove languages are not regular. Regular languages are closed under: union concatenation Kleene star complement intersection exclusive or difference reversal

14 There are algorithms for the following questions about regular languages: 1. Given a DFA M and a string w, is w  L(M)? 2. Given a DFA M, is L(M) = Ф ? 3. Given a DFA M, is L(M) = Σ* ? 4. Given DFA’s M 1 and M 2, is L(M 1 )  L(M 2 )? 5. Given DFA’s M 1 and M 2, is L(M 1 ) = L(M 2 )? How can we use these to check correctness of student answers for the java tutorial?

15 Java Regular expression tutorial: S= student answer, T= teacher answer Strings student generates but should not. Is S intersect the complement of T = Ф?

16 Java Regular expression tutorial: S= student answer, T= teacher answer Strings student should generate but does not. Is T intersect the complement of S = Ф?