A deterministic finite acceptor reads a digit string one symbol at a time — what decides that it accepts?
answer
- one machine, one summary
- no buffer, no second look
- the run is a walk over states
- verdict only when input runs out
- final state against the accepting set
basics
~20 sOne fact decides it: the state the machine is left in after the final symbol. If that state is in the accepting set, the string is accepted. Passing through an accepting state earlier in the run means nothing.
solid answer
~40 sA deterministic finite acceptor is five things: a finite set of states, an input alphabet, a transition function that gives exactly one next state for every state-and-symbol pair, a start state, and a set of accepting states. A run begins in the start state, and each symbol replaces the current state with the one the transition function names. There is no lookahead, no backtracking and no memory besides the state itself. When the input is exhausted, the machine accepts if the state it is sitting in belongs to the accepting set, and rejects otherwise. So the verdict is pronounced exactly once, at the end of the input — visiting an accepting state halfway through is not acceptance.
go deeper
Recall the run: start state, one transition per symbol, and a verdict taken from the state you end in. Be able to trace a four-symbol input on a two-state machine without losing your place.
Explain why the transition rule being single-valued makes the run unique, and why the state after the last symbol is a complete summary of everything read.
Show that you use the model to argue about a real streaming validator: fixed memory, one pass, no buffer, and a verdict that cannot be taken before the input ends unless the state is already absorbing.
Frame it as a cost decision: a recogniser of this shape buys bounded, predictable memory and latency on a device that cannot buffer, and the price is that everything it must remember has to be named as a state up front.
## The five parts of the machine A **deterministic finite acceptor** is a recogniser whose entire memory is one state drawn from a finite set. It is defined by five things, and every claim about it comes back to them: - **States** — a finite set `Q`. The current state is the machine's whole memory: no tape, no counter, no buffer beside it. - **Alphabet** — a finite set of symbols it may read, for instance the ten decimal digits a scanner emits. - **Transition function** — `delta(state, symbol)`, which names **exactly one** next state for every state-and-symbol pair. That single-valuedness is what the word *deterministic* means. - **Start state** — one designated state. Every run begins there, whatever the input is. - **Accepting states** — a subset of the states. Being in that subset is the only thing in the whole model that means "yes". ## What a run is 1. Put the machine in the start state. 2. Read the input left to right. In state `q`, reading symbol `s`, replace the state with `delta(q, s)` and move on. Nothing else happens: no output, no counter, no note kept about earlier symbols. 3. When the input is exhausted, **accept if the state you are left in is an accepting one, and reject otherwise**. Three consequences follow directly: - **No lookahead and no backtracking.** The machine never inspects a symbol it has not reached, and never returns to one it has passed. - **One run per string.** Because the transition rule is a function, the same input always walks the same path and always gets the same verdict. - **The verdict is pronounced once, at the end.** Entering an accepting state mid-run is not acceptance; leaving one is not rejection. ## Tracing a string Take a two-state acceptor over digits for "an even number of 1s": states `E` (start, accepting) and `O`; a `1` toggles the state, every other digit leaves it alone. On input `1 0 1 1`: | step | state before | symbol | state after | |---|---|---|---| | 1 | `E` | `1` | `O` | | 2 | `O` | `0` | `O` | | 3 | `O` | `1` | `E` | | 4 | `E` | `1` | `O` | The run ends in `O`, so the string is **rejected** — it carries three 1s, an odd count. Note that the machine stood in the accepting state `E` after step 3 and that this changed nothing: only the state after the last symbol is consulted. ## Why the final state carries the whole verdict The state is a complete summary of everything read so far, in the only sense that matters: two prefixes that land in the same state are indistinguishable to the machine from then on, because the same remaining symbols drive the same transitions. That is what makes the model implementable in fixed hardware. A validator with `n` states needs only enough storage to name one of `n` values — two states is one bit — plus a table of (states x symbols) entries. It can therefore run over a stream of unbounded length inside a device with no buffer at all, which is exactly why fixed-function readers and scanners are built this way. It also explains the model's limit without any theory: whatever the machine needs to remember must fit into a finite set of labels chosen before the input is ever seen. ## Reading a machine you are handed Given a diagram or a table, answer three questions before anything else, in this order: 1. Which state is marked as the start? Everything else is relative to it. 2. Which states are marked accepting? A machine with no accepting states rejects every string, including the empty one. 3. Does every state have an outgoing arrow for every symbol? If not, the drawing is shorthand and a non-accepting sink is implied. Then trace by hand, writing down the state after each symbol instead of holding it in your head. A single skipped step is the usual reason a candidate's answer disagrees with the machine in front of them. ## Where candidates go wrong - **"It passed through an accepting state, so it accepts."** Only the state after the final symbol is consulted. - **"It got stuck, so it rejects."** A deterministic acceptor does not get stuck; rejection is a state you end in, not a failure to move. - **"The empty string is a special case."** It is not: with no symbols read the machine is still in the start state, so the empty string is accepted exactly when the start state is accepting. - **"It can decide early."** The definition consumes the whole input. An implementation may stop as soon as no remaining symbol can change the accept status, but that is an optimisation, not the model.
- When does a deterministic finite acceptor accept the empty string?Exactly when its start state is an accepting state. With no symbols to read, no transition ever fires, so the run ends where it began. That is why designers who must reject empty input give the machine a separate non-accepting start state instead of starting in an accepting one.
- Can the same string ever produce two different verdicts on the same deterministic acceptor?No. The transition rule is a function, so each state-and-symbol pair has one successor and the run is fully determined by the input. Repeating the run reproduces every intermediate state. Any observed difference means the machine kept state between runs, which the model forbids.
- May an implementation stop reading before the end of the input?Only when the verdict is already fixed — the run has entered a state it can never leave whose accept status is therefore final. The definition still consumes every symbol; stopping early is an engineering optimisation and must not change which strings are accepted.
A clerk who may keep only a single sticky note, replacing what is written on it as each item passes. At the end of the queue, the note alone decides yes or no — no one asks what was written on it earlier.
saying these in an interview costs you the question
- Says a string is accepted because the run visited an accepting state somewhere
- Thinks the machine looks ahead at symbols it has not read yet
- Believes a run can go back and re-read an earlier symbol
- Treats the empty string as outside the model rather than a start-state question
- Assumes the start state is accepting by default