1 / 17

Pumping Theorem Examples Closure Decisions

MA/CSSE 474 Theory of Computation. Pumping Theorem Examples Closure Decisions. Your Questions?. Previous class days' material Reading Assignments. HW 12 problems Anything else. Anonymous feedback question. A student wrote (yesterday, I presume):

Download Presentation

Pumping Theorem Examples Closure Decisions

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. MA/CSSE 474 Theory of Computation Pumping Theorem Examples Closure Decisions

  2. Your Questions? • Previous class days' material • Reading Assignments • HW 12 problems • Anything else

  3. Anonymous feedback question • A student wrote (yesterday, I presume): • Could homework 12 be postponed until Friday? There already seems to be some confusion, and I feel unprepared to answer all the questions within the next day. It seems we have to use the PT for CFL, multiple times, yet we just began talking about it in Tuesday's lecture. In class examples and more practice/discussion would be helpful. • The assumption about the problems is incorrect. There are no PT questions in HW 12. Those are in HW 13. We covered all of the HW 12 material by the end of Monday's class. • Because my Piazza post could have caused confusion, I will let everyone do a late submission (until Friday at 11:55 PM) without using a late day. "Early" still means "by the end of Wednesday", and Friday is still the last day to submit for credit. • Beware: HW 12 is "normal" length; HW 13 is longer and harder. So the shorter time for HW 12 and longer time for HW 13 is appropriate. If you don't finish HW 12 today, try to do it early enough tomorrow so you can get started on HW 13 before the weekend.

  4. Anonymous feedback comment • A student wrote: • I think that you take a little bit too long explaining the announcements at the beginning of class. Because we occasionally go overtime, I think on days we have to cover a lot of material you should try to make announcements • Thank you for pointing this out. The Announcements have often taken too long. In the past couple of weeks I have worked hard to reduce this time; I will continue to do so. • Today they will be a little bit long because of responding to these questions.

  5. Anonymous feedback comment • A student wrote: • I think the true false questions on exam are unfair. I understand that you want us to identify our weakness. • However, trying very hard but find the wrong answer not only earns me nothing, but also costs half of my credits on another question which I also work very hard to solve. Differently, choosing IDK can earn more credits with much less work. I feel that the balance between credits and the amount of work needs to be re-judged. • I suggest that: • 2 points for right answer • 1 for idk • 0 for wrong answer • I think it is more fair than it is now. My answer is on the next slideItalicized words above are ones whose spelling I corrected.

  6. Answer to previous comment • I think "fair" means treating all students the same. I also think your suggestion of "no risk guessing" leads to inflated scores for those who don't understands the material. If the exam is too hard, I adjust the "bottom line", by dividing scores by a number less than 1 (0.9 for Exam 1, and 0.95 for Exam 2). • For Exam 3, I am going to try a new point scheme where the penalty for an incorrect guess is a smaller percentage of the possible points.Instead of (2, -1, 1), I will make it (4, -1 2). Here are the scores students would receive for four questions under the old and new schemes. What do you think?

  7. Anonymous feedback comment • A student wrote: • I'm taking another CSSE course at this point in time that is very out of class and project based. Therefore, I am pleased that this CS class has 80% of the grade being determined by what you do in the classroom. • I think that the grade you get in a class like Theory of Computation is a much more accurate representation of your ability in the subject than in a class where 50% (or more) of the grade is based on work that you (and probably others) do outside of the classroom. • In my opinion, there are too many variables involved for out of classroom work to be considered for more than 10-15% of the grade for a class, especially a class which keeps its rubric and test cases similar across quarters, which many classes do.

  8. Anonymous feedback comment • A student wrote: • Just wanted to let you know that while I had a hard time with this class at first, it's become one of the most interesting classes I've taken at rose and I'm really enjoying it right now. • The only other anonymous feedback this term was the one about showing rank in the Moodle gradebook. I dealt with that one already.

  9. The Context-Free Pumping Theorem If L is a context-free language, then k 1 ( strings wL, where |w| k (u, v, x, y, z ( w = uvxyz, vy, |vxy| k, and q 0 (uvqxyqz is in L)))) If k 1 ( a string wL, where |w| k ( u, v, x, y, z((w = uvxyz, vy, and |vxy| k) implies ( q 0 (uvqxyqz is not in L))))), then L is not context-free Write it in contrapositive form

  10. Regular vs. CF Pumping Theorems Similarities: ● We don't get to choose k. ● We choose w, the string to be pumped, based on k. ● We don't get to choose how w is broken up (into xyz or uvxyz) ● We choose a value for q that shows that w isn’t pumpable. ● We may apply closure theorems before we start. Things that are different in CFL Pumping Theorem: ● Two regions, v and y, must be pumped in tandem. ● We don’t know anything about where in the strings v and y will fall in the string w. All we know is that they are reasonably “close together”, i.e., |vxy| k. ● Either v or y may be empty, but not both.

  11. An Example of Pumping: AnBnCn AnBnCn = {anbncn, n0} Choose w = ak bk ck (we don't get to choose the k) 1 | 2 | 3 (the regions: all a's, all b's, all c's) If either v or y spans two regions, then let q = 2 (i.e., pump in once). The resulting string will have letters out of order and thus not be in AnBnCn. If both v and y each contain only one distinct character, set q to 2. Additional copies of at most two different characters are added, leaving the third unchanged. We no longer have equal numbers of the three letters, so the resulting string is not in AnBnCn.

  12. An Example of Pumping: { , n0} L = { , n 0} The elements of L:

  13. Nested and Cross-Serial Dependencies PalEven = {wwR : w {a, b}*} a a b b a a The dependencies are nested. WcW = {wcw : w {a, b}*} a a b c a a b Cross-serial dependencies.

  14. WcW = {wcw : w {a, b}*} Let w = akbkcakbk. aaa … aaabbb … bbbcaaa … aaabbb … bbb | 1 | 2 |3| 4 | 5 | Call the part before c the left side and the part after c the right side. ● If v or y overlaps region 3, set q to 0. The resulting string will no longer contain a c. ● If both v and y occur before region 3 or they both occur after region 3, then set q to 2. One side will be longer than the other. ● If either v or y overlaps region 1, then set q to 2. In order to make the right side match, something would have to be pumped into region 4. Violates |vxy| k. ● If either v or y overlaps region 2, then set q to 2. In order to make the right side match, something would have to be pumped into region 5. Violates |vxy| k.

  15. Work with another student on these • {(ab)nanbn : n > 0} • {x#y : x, y {0, 1}* and xy}

  16. Hidden: {(ab)nanbn : n > 0} • Let w = (ab)kakbk. Divide w into three regions: the ab region, the a region, and the b region. If either v or y crosses the boundary between regions 2 and 3 then pump in once. The resulting string will have characters out of order. We consider the remaining alternatives for where nonempty v and y can occur: • (1, 1) If |vy| is odd, pump in once and the resulting string will have characters out of order. If it is even, pump in once. The number of ab’s will no longer match the number of a’s in region 2 or b’s in region 3. • (2, 2) Pump in once. More a’s in region 2 than b’s in region 3. • (3, 3) Pump in once. More b’s in region 3 than a’s in region 2. • v or y crosses the boundary between 1 and 2: Pump in once. Even if v and y are arranged such that the characters are not out of order, there will be more ab pairs than there are b’s in region 3. • (1, 3) |vxy| must be less than or equal to k, so this is impossible.

  17. Hidden: {x#y : x, y {0, 1}* and xy} • SURPRISINGLY, it is Context-free! We can build a PDA M to accept L. All M has to do is to find one way in which x and y differ. We sketch its construction: M starts by pushing a bottom of stack marker Z onto the stack. Then it nondeterministically chooses to go to state 1 or 2. From state 1, it pushes the characters of x, then after the # starts popping the characters of y. It accepts if the two strings are of different lengths. • From state 2, it must accept if two equal-length strings have at least one different character. So M starts pushing a % for each character it sees. It nondeterministically chooses a character on which to stop pushing. • It remembers that character in its state (so it branches and there are two similar branches (one for "0" and one for "1" from here on). Next it reads the characters up to the # and does nothing with them. • Starting with the first character after the #, it pops one % for each character it reads. When the stack is empty (actually when it contains Z) it checks to see whether the next input character matches the remembered character. • If it does not, it accepts.

More Related