{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

33+Slides--Context-Free+Languages

# 33+Slides--Context-Free+Languages - CS103 HO#33...

This preview shows pages 1–2. Sign up to view the full content.

CS103 HO#33 Slides--Context-Free Languages 4/29/11 1 Show that L = { w | 0 n where n is prime } is not regular. Suppose L is regular, and that p is the pumping length guaranteed to exist by the lemma. We will find a string s such that s L and |s| > p but s does not satisfy the conditions of the lemma. Show that L = { w | 0 n where n is prime } is not regular. Suppose L is regular, and that p is the pumping length guaranteed to exist by the lemma. We will find a string s such that s L and |s| > p but s does not satisfy the conditions of the lemma. Let s = 0 k , where k is the smallest prime > p + 1. s L, and |s| > p. According to the lemma, there must exist strings x, y, and z such that (s = xyz |y| > 0 |xy| p) and xy i z L for all i 0. That is, for all i 0, |x| + |z| + i|y| must be prime. We will show that for any x, y, z satisfying (….), there is an i where the last condition fails. Suppose (s = xyz |y| > 0 |xy| p) and let i = |x| + |z|. Then |x| + |z| + i|y| = |x| + |z| + (|x| + |z|)|y| = (|x| + |z|) (1 + |y|) |x| + |z| > 1 since s = xyz, |s| > p + 1, and |y| p. 1 + |y| > 1 since |y| > 0. But that means (|x| + |z|)(1 + |y|) is not prime. So for at least one value of i, xy i z L, and thus L is not regular. Closure Properties of Regular Languages Regular languages are closed under: Union Intersection Concatenation Difference Complement Reversal Closure (star) (You may use these facts in your proofs.) Using Closure Properties to Show Nonregularity Consider D = { w {0, 1}* | the number of 0's in w is the same as the number of 1's } Suppose D is regular. Then D 0*1* is regular since regular languages are closed under intersection. But D 0*1* = { 0 n 1 n | n 0 } , which we have shown to be nonregular. So D is not regular. Regular Grammars A 1 0 1 0 B Instead of accepting its language, we can think of the machine as generating it. That is, every transition on a path to the accepting state generates a string containing the symbols on the arcs of the path.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

33+Slides--Context-Free+Languages - CS103 HO#33...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online