Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.

Similar presentations


Presentation on theme: "Introduction to the Theory of Computation John Paxton Montana State University Summer 2003."— Presentation transcript:

1 Introduction to the Theory of Computation John Paxton Montana State University Summer 2003

2 Humor In a train carriage there was Bill Clinton, George Bush, Janet Reno and Bo Derek. After several minutes of the trip, the train passes through a dark tunnel and the unmistakable sound of a slap is heard. When they leave the tunnel, Clinton has a big red slap mark on his cheek. (1) Bo Derek thought - "That sleazeball Clinton wanted to touch me and by mistake, he must have put his hand on Janet Reno, who in turn must have slapped his face." (2) Janet Reno thought - "That dirty Bill Clinton laid his hands on Bo Derek and she smacked him." (3) Bill Clinton thought - "George put his hand on Bo Derek and by mistake she slapped me." (4) George Bush thought - "I hope there's another tunnel soon so I can smack Clinton again."

3 1.4 Nonregular Languages A = { w | w has an equal number of 0s and 1s}. Is A regular? B = { w | w has an equal number of 01s and 10s} Is B regular?

4 Pumping Lemma If A is a regular language, then there is a number p (the pumping length) 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:

5 Pumping Lemma 1.for each i >= 0, xy i z  A 2.|y| > 0 3.|xy| <= p

6 Proof Idea Pigeonhole Principle q1q1 qmqm qnqn x y z

7 Example: 0*1*0 p >= 3 0 1 0 

8 Example: 0*1*0 s = 0001 2p 0 x = 000, y = 1, z = 1 2p-1 0 s = 0 p 0 x = , y = 0, z = 0 p-1 0

9 Example Prove that C = {0 n 1 n | n >= 0} is not regular Assume C is regular, let s = 0 p 1 p Since |xy| 0, then y must consist of 1 or more 0s, call this number k xyz = 0 j 0 k 0 p-j-k 1 p = 0 p 1 p  C xy 2 z = 0 j 0 2k 0 p-j-k 1 p = 0 p+k 1 p  C Contradiction!

10 Exercises Prove that A = { w | w has an equal number of 0s and 1s} is not regular. Prove that D = { ww | w  {0,1}* } is not regular. Prove that E = {0 i 1 j | i > j} is not regular.

11 Exercise Show that F = {a k | where k is a multiple of n} is regular for all n >= 1. Show the the language G = { w | w is not a palindrome } satisifies the three conditions of the pumping lemma even though it is not regular. Explain why this fact does not contradict the pumping lemma.


Download ppt "Introduction to the Theory of Computation John Paxton Montana State University Summer 2003."

Similar presentations


Ads by Google