Download presentation

Presentation is loading. Please wait.

Published byOswin Taylor Modified over 5 years ago

1
CSCI 2670 Introduction to Theory of Computing September 13, 2005

2
Announcement Homework due next Tuesday 9/20 –Use the pumping lemma to prove the following language is not regular A = {ww R | w {a,b} * } –1.54, 2.1 c & d, 2.4 c & e, 2.6 b & d Note in 2.6 d, it is possible that i = j

3
Agenda Last week –Proved correspondence between regular languages and regular expressions This week –Learn how to prove a language is not regular –Introduce a new class of language –Introduce a new type of state machine

4
Nonregular languages So far, we have explored several ways to identify regular languages –DFA’s, NFA’s, GNFA’s, RE’s There are many nonregular languages –{0 n 1 n | n 0} –{101,101001,1010010001,…} –{w | w has the same number of 0s and 1s} How can we tell if a language is not regular?

5
Property of regular languages All regular languages can be generated by finite automata States must be reused if the length of a string is greater than the number of states If states are reused, there will be repetition

6
The pumping lemma Theorem: If A is a regular language, then there is a number p where, if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions 1.for each i 0, xy i z is in A 2.|y| > 0, and 3.|xy| p p is called the pumping length

7
Proof idea Pumping length is equal to the number of states in the DFA whose language is A –p = |Q| If A accepts a word w with |w| > p, then some state must be entered twice while processing w –Pigeonhole principle

8
Proof idea 1.for each i 0, xy i z is in A 2.|y| > 0, and 3.|xy| p x y z

9
Using the pumping lemma We can use the pumping lemma to prove a language B is not regular Proof by contradiction –Assume B is regular with pumping length p –Find a string in w B with |w| ≥ p –Show that the pumping lemma is not satisfied Show that any xyz satisfying the properties of the pumping lemma cannot be pumped You can choose a specific w, but you cannot choose a specific xyz!

10
Example B={wbbw | w {a,b} * } Assume B is regular and p is the pumping length of B Consider the string w = a p bba p w B and |w| ≥ p so the pumping lemma aplies –w = xyz, |xy| ≤ p, |y| > 0, xy i z B for all i

11
Example Consider the string w = a p ba p w B and |w| ≥ p so the pumping lemma aplies –w = xyz, |xy| ≤ p, |y| > 0, xy i z B for all i Since |xy| ≤ p and w begins with xy, xy = a k for some k ≤ p –y = a j for some j = 1, 2, …, k Therefore xy 2 z = a p+j bba p B –Pumping lemma is contradicted so B is not regular

12
Proof of Pumping Lemma Let A be any regular language Find DFA M=(Q, , ,q 0,F) with L(M)=A Let p=|Q| Let s=s 1 s 2 s 3 …s n be any string in A with |s| = n ≥ p –What if no such s is in A?

13
Proof (cont.) Let r 1, r 2, r 3, …, r n+1 be the sequence of states entered while processing s –r 1 = q 0 –r n+1 F –r i+1 = (r i, s i )

14
Proof (cont.) Consider the first p+1 elements of this sequence –p+1 states must contain a repeated state Let r k be the first state to be repeated and let r t be the second occurance of this state –t p+1

15
Proof (cont.) Let x=s 1 s 2 …s k-1, y=s k s k+1 …s t-1, z=s t s t+1 …s n –x takes M from r 1 to r k If k = 1, then x = –y takes M from r k to r t –z takes M from r t to r n+1, which is an accept state Since r k and r t are the same state, M must accept xy i z for any i=0, 1, 2, …

16
Proof (cont.) Have we satisfied the conditions of the theorem? 1.for each i 0, xy i z is in A 2.|y| > 0, and 3.|xy| p Have we satisfied the conditions of the theorem? 1.for each i 0, xy i z is in A Yes 2.|y| > 0, and Yes since t > k and y=s k s k+1 …s t-1 3.|xy| p Yes since t p+1 and xy = s 1 s 2 …s t-1

17
Regular languages -- Summary Let R be any language. The following are equivalent 1.R is a regular language 2.R = L(M) for some finite automata M, where M is a DFA, an NFA, or a GNFA 3.R is describe by some regular expression If R can be shown not to have a finite pumping length, then R is not regular

Similar presentations

© 2020 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google