Deterministic Finite Automata (DFA)

a computation of a DFA

A computation, or run, of a DFA on an input string is the play-by-play of the machine working through that string: the sequence of states it passes through as it reads the symbols one by one. If you imagine your finger walking the state diagram, the run is the trail your finger leaves. It is a single path, because the machine is deterministic.

Spelled out, on input w = a1 a2 ... an the run is a sequence of states r0, r1, ..., rn where r0 = q0 (you begin at the start state) and each next state follows the rule ri = δ(ri-1, ai) (read the i-th symbol, take the one arrow it dictates). There are n+1 states for an n-symbol string, because you record where you are before reading anything and after each of the n symbols. The final state rn is the one that decides the verdict.

Two features make a DFA's run especially tame. It is unique: the same machine on the same input always produces the same single path, with no branching to explore. And it is exactly as long as the input: reading n symbols takes n steps, so a DFA processes any string in time proportional to its length, using only the constant amount of memory needed to remember one state. This is why DFAs are the model of streaming, one-pass, constant-memory recognition.

Run the parity-of-1-s DFA on 1011: r0 = Even, read 1 -> r1 = Odd, read 0 -> r2 = Odd, read 1 -> r3 = Even, read 1 -> r4 = Odd. Five states for a four-symbol string. The final state Odd means an odd number of 1-s.

A run is the unique state sequence r0=q0, ri=δ(ri-1, ai); n symbols give n+1 states.

A DFA run never backs up and never reads a symbol twice — it is strictly left-to-right, one pass. The state at the end is all that determines accept or reject.

Also called
runexecutiontracepath執行路徑計算