Every lesson in the Theory of Computation slide course, in full text: 19 decks, 2145 slides.
Deterministic Finite AutomataLesson 4 introduces the first machine model. It covers state diagrams and tracing, the determinism requirement, the formal five-tuple, and transition tables, then defines the extended transition function by recursion and uses it to define acceptance, the language of a machine, and a regular language. From there it gives a design recipe built on asking what has to be remembered, and covers dead states, counting modulo a fixed number, the product construction for union and intersection, complement by swapping the accepting set, and correctness proofs by invariant.
Nondeterministic Finite AutomataLesson 5 drops the determinism requirement and lets a machine take several arrows on one symbol, or none at all. It covers the active-set method of running such a machine, acceptance as an existential claim over paths, and the computation tree, then gives the five-tuple with its set-valued transition function, epsilon-arrows and epsilon-closure, and the extended transition function with closures. It closes with guess-and-verify design and the exponential saving in states it can produce, why swapping the accepting set fails to complement an NFA, and what nondeterminism is not.
Equivalence of DFAs & NFAsLesson 6 proves that nondeterminism buys convenience but not power. It states the equivalence theorem and disposes of its trivial direction, then builds the subset construction component by component, including the empty subset as a dead state and the accepting rule people get wrong, the epsilon-closure in the start subset, and the transition rule. It works conversions from a worklist both with and without free moves, proves correctness by induction on the input length, and gives the pigeonhole lower bound showing that the exponential blowup is unavoidable. It ends with the consequences: complementing an NFA in the right order, and deciding emptiness and infiniteness by graph search.
Regular Operations & ClosureLesson 7 establishes that the regular languages are closed under the three regular operations and more. It explains what closure means and why it is a theorem rather than a definition, then does union by both the product construction and the free-move construction, concatenation as a guessed split with its demotion trap, and Kleene star with the empty-string subtlety and why a naive loop-back is wrong. It adds intersection, complement, difference, reversal, and homomorphism, and ends by using closure properties as a proof technique, including the standard trick of proving a language non-regular by intersecting it with a simple regular pattern.
Regular ExpressionsLesson 8 introduces the notation that describes exactly the languages finite automata recognize. It covers the six-rule inductive syntax and the semantic clauses that assign a language to every expression, then the precedence order that puts star before concatenation before union, and design idioms built around the starred alphabet. It gives the algebraic laws, including the identities, distribution, and the star laws, and Thompson's construction, which converts any expression into an epsilon-NFA of linear size. It ends with Kleene's theorem and what the equivalence buys you.
DFA to Regular ExpressionLesson 9 completes Kleene's theorem by converting any finite automaton back into a regular expression. It explains why this direction cannot be done by structural recursion, then introduces generalized automata whose arrows carry expressions, the four conditions of normal form, and the state-elimination rip-out rule, including the starred self-loop term people drop. It works conversions, among them machines with dead states, shows how the elimination order controls the size of the result, and presents Kleene's original build-up recurrence and its kinship with Floyd-Warshall. It closes with the four now-equivalent definitions of a regular language.
The Pumping Lemma for Regular LanguagesLesson 10 supplies the first tool for proving that a language has no finite automaton. It explains why every earlier technique proves only the positive direction, then shows how finiteness together with the pigeonhole principle forces a repeated state and hence a pumpable cycle. It gives the exact statement with its three conditions and its quantifier order, the adversary game that makes the alternation manageable, and the proof of the lemma itself with each condition traced back to its source. It then shows how to set a proof up: choosing a string built from the pumping length with a uniform prefix, and choosing the repetition count. It includes the one-way-implication trap and the fixed-string trap.
Applications of the Pumping LemmaLesson 11 is a worked catalogue of non-regularity proofs. It gives the canonical matched-counts proof and the trap of choosing your own split, then counting languages and the line between bounded and unbounded quantities, and shape languages such as palindromes and repeated blocks, handled with the marker trick. It works arithmetic languages that need gap and factorization arguments, for the perfect squares and for the primes, and shows closure arguments as the shorter alternative. It ends with a language that pumps yet is not regular, together with the distinguishable-prefix fallback, and a diagnostic table for repairing failed attempts.
Advanced Regular PropertiesLesson 12 proves languages regular without building anything. It covers the subsequence order and how it differs from the substring order, upward and downward closed languages, and well-quasi-orderings with their equivalent characterization as having no descending chain and no antichain. It then proves Dickson's lemma on tuples by extraction and explains why finitely many coordinates is essential, sketches Higman's theorem by the minimal-bad-sequence argument and the role of the finite alphabet, and gives the finite-basis property and the consequence that every subsequence-closed language is regular. It ends on the cost: the argument is non-constructive and yields no machine.
Context-Free GrammarsLesson 13 introduces the first model that generates rather than recognizes. It covers variables, terminals, production rules, and the start variable, then one-step rewriting and why "context-free" means the surroundings are ignored, the language of a grammar, and the distinction between a sentential form and a member. It gives the four-tuple and the bar shorthand, then derivations, including the leftmost and rightmost disciplines and why they agree, and parse trees and yields with the many-derivations-one-tree relationship. A design recipe built on describing shapes recursively follows, with worked grammars for matched counts, palindromes, unions, and equal counts in any order. It closes by proving that every regular language is context-free via right-linear grammars, and showing that the containment is strict.
Grammar Design & AmbiguityLesson 14 takes up what happens when one string has two structures. It defines ambiguity on parse trees rather than on derivations and explains why the distinction matters, then works the arithmetic grammar and its two separate defects, repairing precedence by layering variables and associativity by one-sided recursion. It covers the dangling-else problem with all three standard resolutions and the matched-unmatched grammatical repair, and the habits that keep you from introducing ambiguity by accident. It then treats inherent ambiguity with the standard overlapping-union witness, the undecidability of the ambiguity question, and how to read a parser generator's conflict report, closing with a diagnostic checklist that maps each symptom to its repair.
Chomsky Normal FormLesson 15 makes grammars uniform. It gives the two permitted rule shapes and the single exception for the start variable, and the derivation-length property that follows. It then removes useless variables, computing generating before reachable; removes epsilon-rules by adding one alternative per subset of nullable positions, and explains why every subset is needed; removes unit rules by closing over unit pairs, cycles included; and lifts terminals and binarizes long rules. The full four-pass pipeline follows, with a justification for each ordering constraint. It ends with what the form enables: cubic-time parsing, the pumping lemma's height bound, and the decidability results of Lesson 24.
Pushdown AutomataLesson 16 adds one unbounded stack to a finite automaton. It explains why a stack is exactly the right addition and what its last-in-first-out discipline still forbids, then covers transitions that read, pop, and push, with each part optional, and the bottom-marker trick for testing emptiness. It gives the formal seven-tuple and the six-tuple variant, configurations and the computation relation, and the final-state and empty-stack acceptance conventions with conversions in both directions. Designs follow for matched counts, palindromes, two kinds of bracket, and strict inequalities. It closes with the result that deterministic pushdown automata are strictly weaker, giving the standard witness language and explaining why the subset construction cannot be transferred.
Equivalence of PDAs & CFGsLesson 17 proves that the generator and the recognizer describe the same class. It starts from the key observation that a leftmost sentential form splits into matched input and stack contents, then gives the three-state grammar-to-machine construction with its expansion and matching transitions and the push-order trap, the correctness proof by invariant, and why the stack forces leftmost derivations. It shows how to recover a parse tree from a computation, then gives the triple-variable encoding for the reverse direction with its never-dips-below condition, machine normalization, and the three rule schemas. It ends with the consequences: choosing whichever formalism makes a closure proof easier, cubic-time parsing via Chomsky normal form, and what is still missing before Lesson 18.
The Pumping Lemma for CFLsLesson 18 supplies the tool for proving that a language has no context-free grammar. It shows how Chomsky normal form bounds the height of a parse tree, so that a long string forces a repeated variable somewhere on a root-to-leaf path, then gives the five-piece statement with its three conditions and the crucial difference from the regular case: the short window may sit anywhere rather than at the front. It proves the lemma and points out where minimality of the parse tree is used, then works proofs for three matched counts, a block written twice, and nested inequalities, with explicit case analysis over the window positions. It covers closure arguments using a regular helper and why a context-free helper proves nothing, and ends by comparing the two pumping lemmas.
Context-Free Closure PropertiesLesson 19 works out which operations keep a language context-free. It gives one-rule grammar constructions for union, concatenation, and star, with the variable-renaming condition, then the counterexample showing that intersection fails and why its shape is forced by the one-stack budget, and the De Morgan derivation of the failure of complement together with a concrete witness. It proves closure under intersection with a regular language by a product construction, flagging the trap of advancing the finite component on a free move, and covers reversal and the restricted form of difference. It ends with the full closure table read as a diagnostic for classifying languages.
Proof, Induction & ClosuresLesson 2 of the mathematical toolkit. It starts with what a proof actually is, then covers direct proof and the contrapositive, and proof by contradiction through the irrationality of the square root of 2 and the infinitude of the primes. From there it works through weak and strong mathematical induction, the well-ordering principle, the pigeonhole principle, recursive definitions, and computing the reflexive, symmetric, and transitive closures of a relation. It targets the confusion between a converse and a contrapositive, the missing base case, and the one-round transitive-closure error. Every proof and computation was verified by hand.
Sets, Relations & FunctionsLesson 1 of the mathematical toolkit for automata theory. It covers sets and set-builder notation, the algebra of union, intersection, and complement, power sets, and Cartesian products. It then works through binary relations and their properties, equivalence relations and partitions, partial orders, and functions classified as injective, surjective, and bijective. It targets the classic confusions between membership and the subset relation, between a codomain and a range, and between the ordered pair (a,b) and the set {a,b}. All computations were verified by hand.
Strings & LanguagesLesson 3 of the mathematical toolkit, and the gateway to automata. It covers alphabets and strings, length and the empty string, concatenation and its algebra, substrings, prefixes, and suffixes, and string exponentiation and reversal. It then moves to the set of all strings, languages as sets of strings, the language operations including Kleene star, and the counting results showing that strings are countable while languages are not. It targets the confusion between the empty string and the empty set, the confusion between a substring and a subsequence, the order in which a concatenation reverses, and the difference between star and plus. All computations were verified by hand.
Want this taught 1-on-1? Alexander tutors Theory of Computation — $55/session, free consultation.