CSCD 420 Oct 12 2026
Overview
Chris Cain reviews the pumping-lemma proof template for showing that a language is not regular, using the example {a^n b^n} and explaining how to handle every possible cycle decomposition. The class then develops context-free grammars for strings with unequal counts of a’s and b’s and for nested scopes, before introducing grammar ambiguity and leftmost/rightmost derivations.
Key takeaways
- For L = {a^n b^n}, choosing W = a^M b^M forces the pumped segment Y to contain only a’s because |XY| ≤ M; pumping with i = 2 then creates more a’s than b’s.
- A pumping-lemma proof must establish a contradiction for every decomposition satisfying |XY| ≤ M and |Y| ≥ 1, not merely for one convenient placement of Y.
- In the pumping notation used in class, M is the DFA’s number of states and |Y| is the cycle length; i = 1 reproduces the original string, while i = 2 adds one extra cycle.
- A context-free grammar for ordered strings with unequal a and b counts can branch into excess-a and excess-b cases, pair matching symbols recursively, and require at least one unmatched symbol in the chosen branch.
- Recursive nesting plus concatenation lets a context-free grammar represent both nested and sequential scopes, with a’s and b’s serving as opening and closing braces.
- Ambiguity arises when a string has multiple valid derivations; restricting expansions to leftmost or rightmost order can standardize derivations but does not guarantee that every grammar becomes unambiguous.
Chapters
- Homework 3 is due Wednesday, with an exam study session planned for Wednesday and the exam scheduled for Friday.
- The exam covers regular-language material, including regular grammars; proving a language nonregular and the brief introduction to context-free languages are excluded.
- Screen flickering and connection issues delay the start of the lecture, but class continues.
- Begin by assuming the language L is regular, so the proof can later derive a contradiction to that assumption.
- Let a DFA accepting L have M states, then choose a string W in L whose length is at least M.
- Decompose W into XYZ and state the pumping conditions: |XY| ≤ M, |Y| ≥ 1, and XY^iZ must remain in L for every i ≥ 0.
- The decomposition XYZ represents the path before a DFA cycle, the cycle itself, and the path after the cycle.
- A nonregularity proof must examine every possible location and structure of Y allowed by |XY| ≤ M.
- For each case, choose a pumping value i that makes the resulting string fail the language’s defining condition.
- Assume L = {a^n b^n} is regular and select W = a^M b^M, using M as the DFA’s number of states.
- Since |XY| ≤ M, Y lies entirely within the first M symbols of W, so Y contains only a’s.
- Set i = 2 to add |Y| a’s; the pumped string has more a’s than b’s and is therefore outside L, despite being accepted under the pumping assumption.
- The contradiction between the DFA’s required acceptance of the pumped string and that string’s exclusion from L disproves the assumption that L is regular.
- Choosing i = 1 leaves XYZ unchanged, so it cannot demonstrate a contradiction; i = 2 adds one extra traversal of Y.
- Use M for the number of DFA states, W for the chosen string, and |Y| for the cycle length rather than mixing notation from outside sources.
- A poor choice of W can make a proof unnecessarily difficult or impossible; reconsider the string or ask Chris Cain for guidance if the case analysis becomes unwieldy.
- The proof has a universal requirement: for every valid decomposition of W, there must be a pumping choice that yields a contradiction.
- Check edge cases such as |Y| = 1 and lengths from 1 through M; an argument that works for only one illustrative decomposition is incomplete.
- Useful shorthand includes |X| for string length and superscript notation such as (0 or 1)^6 for six binary digits.
- The target language consists of some number of a’s followed by some number of b’s, with the two counts unequal.
- Split the grammar into two permanent branches: strings with more a’s and strings with more b’s.
- Pair a’s and b’s from the outside inward, then make the selected branch produce at least one extra symbol of its chosen type.
- The grammar’s shared structure pairs outer a and b symbols while recurring in the middle, allowing any number of matched pairs.
- The more-a branch must produce at least one additional a, and the more-b branch must produce at least one additional b.
- Keeping the branches separate prevents a derivation from switching between excess-a and excess-b logic or generating equal counts.
- Treat a’s as opening braces and b’s as closing braces; recursive productions can represent nested scopes, while concatenation represents sequential scopes.
- For the example a a b a b, an outer a…b pair encloses two sequential inner a…b scopes.
- The scope grammar can model deeply nested constructs and call-stack structure, but its multiple production paths create an ambiguity problem.
- A grammar is ambiguous if at least one string can be generated through distinct production paths or parse structures.
- The example grammar produces the same string through two derivations, illustrating how alternative nonterminal-expansion orders can create ambiguity.
- Requiring leftmost or rightmost nonterminal expansion gives derivations a consistent order and can remove some order-based ambiguity, though grammars may still be ambiguous.
- The next class will continue the ambiguity discussion; the first project is expected to be assigned early the following week.
Transcript excerpt
0:02 we can get started. I have quite a few announcements beginning in class. So, let's get through them. We have homework three due on Wednesday. I am also planning to do a first study session for the exam on Friday on Wednesday. So today and tomorrow are our last full lecture days before we shift focus to preparing for the exam. But this won't be on the test though, right? >> Correct. >> Yes. Just through just through regular grammarss. So kind of all the all the regular stuff. Nothing proving something is not regular. The language is not regular or nothing of the contextfree language that we just briefly started last summer.
0:52 That will focus to preparing for the exam that we'll take on Friday. That's basically it. Assignments second half of this week is prep for the exam and the exam. I know so many announcements. Any questions on schedule or anything that we're covering? Okay. This is something that I'm going to be revealing right after class as a that does not look fun. I don't know how to be part that's let me quickly which >> video
1:52 correctly. Oh, that still doesn't look good. It's not good. Well, let's say goodbye to my camera and B. I'll turn on the room. Wow. Well, we just have to feel like we're in the matrix for a day given what time it is.
2:40 That did not work either. So, apologies in advance. I guess you can't really tell a ton remotely maybe, but there's some annoying flickering going on on the screen. Is that horribly bothering anyone to the extent to which we should just cancel class today? Yeah. >> All right. And now it's vibrating as well. Nice >> technology. All right. If you weren't glitchy enough, you will be by the end of
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Chris Cain.