CS181 Lecture 6 -- Fall 2026, UCLA
Overview
Eli Jaffe develops closure properties of deterministic finite automata (DFAs): complement flips accepting states, while intersection and union use a product construction with up to C1 × C2 states. Concatenation and reversal expose difficulties with single-pass deterministic computation, motivating nondeterministic finite automata (NFAs), where multiple paths are explored and an input is accepted if any path reaches an accepting state.
Key takeaways
- DFA complement is immediate: preserve the transition function and swap accepting with nonaccepting states.
- DFA intersection and union can be computed with a product machine whose states are pairs, potentially multiplying the state count from C1 and C2 to C1 × C2.
- A DFA can simulate two computations in parallel by recording both current states, but it cannot directly try all possible input split points for concatenation.
- Concatenating the language of all strings with strings of length four that start with 1 yields the property that the fourth bit from the end is 1.
- An NFA accepts existentially: an input is accepted if any branch reaches an accepting state, even when other branches die.
- An epsilon transition changes an NFA's state without consuming an input bit, allowing a branch to begin at a chosen point in the input.
Chapters
- Eli Jaffe recaps universal circuits, also called meta evaluators, and the limitation of circuits to fixed-length inputs.
- The lecture expands from DFA examples to closure properties, then introduces nondeterminism as a new computational model.
- A DFA has a bounded number C of states, a transition table, and a set S of accepting states.
- It reads any finite-length input in one pass, unlike a circuit designed for a fixed input length.
- Streaming algorithms, networking, robotics, car locks, and elevators illustrate single-pass state-based computation.
- The language of a Boolean function is the set of all input strings for which the function outputs 1.
- A DFA accepts or recognizes a language L when D(x) = 1 exactly for inputs x in L.
- Language notation makes a computational problem precise by identifying its complete set of yes-instances.
- Given a DFA D = (T, S) computing f, keep transition table T unchanged to compute not f.
- Replace S with the complement of S within the full state set {0, 1, ..., C − 1}.
- Every input accepted before is rejected, and every previously rejected input is accepted.
- For functions f1 and f2, their AND outputs 1 exactly when both functions output 1 on the same input.
- Running one DFA and then the other would require two passes over the input, which a DFA cannot do.
- The construction must simulate both computations while consuming each input bit only once.
- If D1 has C1 states and D2 has C2 states, create product states (i, j) from their state sets.
- Each product state records D1's current state in its first coordinate and D2's current state in its second.
- The product construction can use as many as C1 × C2 states to preserve both computations in one pass.
- On input bit a, transition from (i, j) to (T1(i, a), T2(j, a)).
- Mark (i, j) accepting exactly when i belongs to D1's accepting set S1 and j belongs to D2's set S2.
- The product DFA computes f1 AND f2 because both component machines process every bit together.
- The product machine's coordinates retain the two component states reached after the full input.
- Acceptance checks membership in both S1 and S2, rather than relying on a geometric arrangement of the state diagram.
- The construction uses additional states to compensate for the DFA's inability to reread the input.
- De Morgan's law gives a route to OR: negate both functions, compute AND, then negate the result.
- A direct construction uses the same product states and transition function as the AND machine.
- For OR, accept (i, j) when i is in S1 or j is in S2.
- The concatenation f1 cat f2 accepts x if some split x = x1x2 has f1(x1) = 1 and f2(x2) = 1.
- For languages L1 and L2, L1 cat L2 contains every string formed by joining a string from L1 to one from L2.
- Unlike AND, concatenation requires finding an unknown split point in the input.
- A straightforward Python-style algorithm tests each possible index i, evaluating f1(x[0:i]) and f2(x[i:]).
- An input of length n can have n possible split positions, so this approach repeatedly examines portions of the input.
- The repeated trials suggest that concatenation may need more memory than simple DFA closure operations.
- The example f1 accepts every input, so its DFA can remain in an accepting state for all bits.
- The example f2 accepts strings that start with 1 and have length exactly four.
- A DFA for f2 tracks progress through four input positions and sends an initial 0 or an extra bit to a rejecting dead state.
- Concatenating the universal language with strings of length four starting with 1 accepts strings whose fourth bit from the end is 1.
- A left-to-right DFA cannot know which bit is fourth from the end until it reaches the input's end.
- The example turns the unknown split point into a concrete memory challenge for deterministic one-pass computation.
- For a function f, define f-reverse(x) as f applied to the bits of x in reverse order.
- Computing the reversed function can require basing an early decision on the original input's final bits.
- This creates a second example of a computation that conflicts with a DFA's left-to-right, single-pass operation.
- Reversing every arrow can create multiple outgoing edges with the same bit label from one state.
- A deterministic transition table must specify exactly one next state for each state and input bit.
- Reversal also raises questions about how to choose a start state when the original DFA has multiple accepting states.
- Jaffe uses the problems with concatenation and reversal to motivate nondeterministic finite automata.
- He attributes the development of nondeterminism to Dana Scott and Michael Rabin.
- The new model permits choices that ordinary DFAs cannot make while reading a bit.
- An NFA may have multiple outgoing edges with the same input label, unlike a DFA.
- It may also use epsilon edges that change state without consuming an input bit.
- A missing transition is treated as a path that dies, equivalent to sending that path to a dead state.
- In the first NFA example, state 0 can either stay in state 0 or move to state 1 when it reads a 1.
- The machine conceptually follows every available branch in parallel as it processes the input 01001.
- The NFA accepts if at least one branch finishes in an accepting state; other branches may fail.
- The second NFA uses an epsilon edge from state 0 to state 1 to begin a branch without reading a bit.
- On input 01001, the machine can choose when to leave its looping state and attempt the remaining pattern.
- The epsilon transition is described as convenient notation that does not add expressive power beyond ordinary NFA branching.
- The two NFA diagrams accept the same input when a 1 occurs exactly four positions from the end.
- A looping state consumes an arbitrary prefix, while a branch tests the final four-bit pattern.
- At least one branch reaches the accepting state on the demonstrated input, so the NFA outputs 1.
- An NFA transition can return a set of successor states, represented as an element of the power set of the state set.
- The machine accepts when some computation branch ends in an accepting state; a transition can return the empty set when no path continues.
- Jaffe's formal setup says epsilon edges do not form cycles, then defers further NFA analysis to the next lecture.
Transcript excerpt
0:05 Oh, all right. Welcome everybody. Thank you for being here. >> The attendance is bad. But, you know, people are probably just late, right? People are going to wander in and they're going to be so disappointed that they missed the first 10 minutes of class. I mean, last class I almost screwed up the room. So, who knows? Maybe I'll accidentally screw up the recording. People will be really upset that they weren't here. Regardless, I'm glad you guys are here. Um, we're going to be talking about some cool stuff today. As a reminder, what did we do last time? So, last class we finished up our talk about circuits. So, we talked about universal circuits or as I called them, meta evaluators.
0:57 So we got this really cool uh circuit that could actually evaluate any other circuit in a flexible way and we stated without proof that actually we could do this very efficiently and we talked about the limitations of circuits gave kind of a summary of what they can do what they can't do. Uh specifically we talked about this big limitation of non-standard length inputs. So if we don't have an input that the standard length circuits are kind of busted, we can't use them. And so in order to handle that, we introduced a new computational model called a discrete finite automaton or a DFA. And we gave some examples of what DFAs look like. What are some simple functions that we can comput them?
1:48 Now, today we are going to expand that and talk about DFAs in a slightly more abstract way. We're still going to use a lot of examples, but in particular, we're going to want to talk about properties of DFAs as a computational model. Um, we're going to talk about
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, Eli Jaffe.