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 George W. Bush's Intelligence Quiz While visiting England, George W. Bush is invited to tea with the Queen. He asks her what her leadership philosophy is. She says that it is to surround herself with intelligent people. He asks how she knows if they're intelligent. "I do so by asking them the right questions," says the Queen. "Allow me to demonstrate." She phones Tony Blair and says, "Mr. Prime Minister. Please answer this question: Your mother has a child, and your father has a child, and this child is not your brother or sister. Who is it?" Tony Blair responds, "It's me, ma'am." "Correct. Thank you and good-bye, sir," says the Queen. She hangs up and says, "Did you get that, Mr. Bush?" "Yes ma'am. Thanks a lot. I'll definitely be using that!"

3 Humor Upon returning to Washington, he decides he'd better put the Chairman of the Senate Foreign Relations Committee to the test. He summons Jesse Helms to the White House and says, "Senator Helms, I wonder if you can answer a question for me." "Why, of course, sir. What's on your mind?" "Uh, your mother has a child, and your father has a child, and this child is not your brother or your sister. Who is it?" Helms hems and haws and finally asks, "Can I think about it and get back to you?" Bush agrees, and Helms leaves. He immediately calls a meeting of other senior senators, and they puzzle over the question for several hours, but nobody can come up with an answer. Finally, in desperation, Helms calls Colin Powell at the State Department and explains his problem.

4 Humor "Now look here Colin Powell, your mother has a child, and your father has a child, and this child is not your brother, or your sister. Who is it?" Powell answers immediately, "It's me, of course." Much relieved, Helms rushes back to the White House and exclaims, "I know the answer, sir! I know who it is! It's Colin Powell!" And Bush replies in disgust, "Wrong, It's Tony Blair!"

5 2.3 Non-Context-Free Languages To show that a language is not context- free, we can use the pumping lemma for context-free languages

6 Pumping Lemma If A is a Context-Free Language, there 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 five pieces s = uvxyz satisfying these conditions: 1.for each i >= 0, uv i xy i z  A 2.|vy| > 0 3.|vxy| <= p

7 Example 1 Show that B = { a n b n c n | n >= 0 } is not context free Select s = a p b p c p Case 1: v and y contain only one type of alphabet symbol. uv 2 wy 2 z  B since there aren’t enough of the third symbol.

8 Example 1 Case 2: Either v or y or both contain two symbols. Now uv 2 wy 2 z  B because either v 2 or y 2 scrambles the order of the symbols. B is not context-free!

9 Example 2 Show that C = {a i b j c k | 0 <= i <= j <= k} is not context-free. Select s = a p b p c p Case 1: either v or y or both contain more than one symbol. Then uv2xy2z  C

10 Example 2 Case 2: v contains a’s and y contains b’s. Now uv 2 xy 2 z  C. Case 3: v contains a’s and y contains c’s. Now uxz  C. Case 4: v contains b’s and y contains c’s. Now uxz  C.

11 Exercise Show that D = { ww | w  {0, 1}* } is not context free. Hint: Let s = 0 p 1 p 0 p 1 p

12 Exercises Prove whether or not E = { 0 n #0 2n | n >= 0 } is context-free. Prove whether or not F = { w#x | w is a substring of x over {a,b}* } is context-free.


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

Similar presentations


Ads by Google