1 / 12

Introduction to the Theory of Computation

Introduction to the Theory of Computation. John Paxton Montana State University Summer 2003. Humor. George W. Bush's Intelligence Quiz

bveras
Download Presentation

Introduction to the Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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: • for each i >= 0, uvixyiz A • |vy| > 0 • |vxy| <= p

  7. Example 1 • Show that B = { anbncn | n >= 0 } is not context free • Select s = apbpcp • Case 1: v and y contain only one type of alphabet symbol. uv2wy2z  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 uv2wy2z  B because either v2 or y2 scrambles the order of the symbols. • B is not context-free!

  9. Example 2 • Show that C = {aibjck | 0 <= i <= j <= k} is not context-free. • Select s = apbpcp • 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 uv2xy2z  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 = 0p1p0p1p

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

More Related