CSCD 420 Nov 24 2026
Overview
Chris Cain reviews countability and computability for the CSCD 420 exam, showing how to enumerate finite binary strings and why infinite binary strings and certain language classes cannot be enumerated. He then connects FIRST and FOLLOW sets to converting context-free grammars into nondeterministic pushdown automata and constructing an LL(1) parse table that selects productions from a nonterminal and the next input symbol.
Key takeaways
- All finite binary strings are countable because an enumeration can visit strings in increasing length and then list every string of each fixed length, including the empty string and leading-zero strings.
- An enumeration that misses an element does not by itself prove uncountability; the argument must rule out every possible enumeration, not just one flawed ordering.
- A Turing machine that has not halted after a finite number of steps may still halt later, so bounded simulation cannot generally decide halting behavior.
- To show a language is context-free but not regular, provide a context-free grammar or NPDA and use the regular pumping lemma to exclude regularity.
- The standard grammar-to-NPDA construction replaces a stack-top nonterminal with a production's right-hand side and matches stack-top terminals against the input.
- An LL(1) parse table uses FIRST and FOLLOW sets to choose a production from the current nonterminal and one lookahead terminal, resolving choices that remain ambiguous in a general NPDA simulation.
Chapters
- Finite binary strings are countable when ordered by length, then ordered within each length.
- The enumeration begins with the empty string, followed by 0 and 1, then 00, 01, 10, and 11.
- Treat strings as strings, not binary numbers: leading zeros must be included.
- Enumerating strings by length only covers finite strings, not infinite sequences such as 010101 repeating forever.
- Listing repeating patterns cannot cover infinite strings that do not repeat.
- Cain relates infinite binary strings to real numbers between 0 and 1 and concludes that the full set is uncountable.
- An enumeration procedure for a language class must generate its members and provide a way to identify them.
- For an acceptor that may loop, observing 10,000 steps without a halt does not reveal whether it will ever accept or reject.
- Cain connects the inability to enumerate certain language classes to the halting problem and to the uncountability of the reals between 0 and 1.
- To identify a language's level in the Chomsky hierarchy, show membership with a grammar or machine and rule out a lower class with a pumping lemma.
- For example, an NPDA establishes that a language is context-free, while the regular pumping lemma can show it is not regular.
- Exam responses may outline a Turing machine using an appropriate equivalent model; choosing a simpler one-tape design can avoid unnecessary complexity.
- A transducer intended to list all reals between 0 and 1 would miss elements because that set is uncountable.
- Showing that one proposed procedure misses strings does not prove a set is uncountable; the procedure itself may simply be incomplete.
- The exam may ask students to classify a set as countable or uncountable, give an enumeration for countable sets, and distinguish recursive from recursively enumerable languages.
- FIRST of a nonterminal contains terminals that can begin strings derived from it.
- FOLLOW records terminals that can appear immediately after a nonterminal in a derivation.
- When a nonterminal is followed by another nonterminal, FIRST of the latter contributes to FOLLOW; FOLLOW information can also propagate through productions.
- The construction uses three states: an initial state pushes the start symbol, a working state processes productions, and a final state handles an empty stack.
- For each grammar production, the NPDA pops the left-hand nonterminal and pushes the right-hand side onto the stack.
- For each terminal, it reads the matching input symbol and pops that terminal from the stack; the right-hand side is pushed in reverse order so its leftmost symbol is processed first.
- The NPDA construction can recognize strings generated by a context-free grammar, but it may have multiple applicable productions.
- Cain traces a derivation of ACB using productions that expand S and A, then matches terminals against the input.
- An LL(1) parsing method resolves production choices using the current nonterminal and one-symbol lookahead.
- An LL(1) table has grammar nonterminals as rows and terminals plus the end marker $ as columns.
- For a production, place its right-hand side in the row for its left-hand side and the columns indicated by FIRST of the right-hand side.
- If a production can derive the empty string, use FOLLOW of its left-hand side to determine the additional table entries.
- In the worked grammar, the production S → ASB is entered in row S under the terminal that begins its derivation.
- Productions beginning with a nonterminal contribute table entries under the terminals in that nonterminal's FIRST set.
- At parse time, the table lookup for the stack's top nonterminal and the next input symbol identifies which production to apply.
Transcript excerpt
0:03 part two today. [clears throat] As there is extra time, we may go back to content, but we'll see what happens. I'm so glad we voted to learn new content and then no one showed up. Quite a few people, but yeah. Well, we're not learning new things. We're going to review for at least the start. So if we run out of questions then I'll go back to onet. So we are looking at countable and uncountable sets as the last piece of content that I prepared with questions. So first question on this list is set of all finite length binary strings that countable or uncountable. If it is
0:50 countable determine an enumeration procedure for them. If it is uncountable, then come up with a reason of why it is uncountable. >> Offable or uncountable. If it's countable, determine an independent enumeration procedure. If it's uncountable, come up with reasoning why it is uncountable. The really cool thing would be if you could tie it back to the halting problem. Any
2:08 thoughts on this? Yeah, we are countable due to the fact that it's night but the order that I think uh I don't remember if it which one of the two recursive ones it is but if you up the like machine and then valid and such where it builds string that are within because I think that's that work for Joeless Okay. >> Yeah. >> Kind of along that same line, it would essentially uh put out the empty string, then all uh uh one length strings, then all two length strings and three lengths, and each one would be ordered um numerically.
2:57 >> Okay, I like that. We're going to there are really two dimensions here as as mentioned. There's the ordering within, but also the length. So we could first
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.