Every computer you have ever used is, at some level of abstraction, absurdly complicated. But strip the abstraction all the way down and you arrive at a finite automaton — a machine with nothing but a fixed set of states, a current state, and a table that says "if you're in state s and you read symbol a, move to state t."
That is it. No scratch pad, no stack, no extra memory at all. The machine reads its input one symbol at a time, moves from state to state, and when the input runs out it checks whether it landed in an accepting state. If yes, the string is accepted; otherwise it is rejected.
These machines — first studied by Warren McCulloch and Walter Pitts in 1943 as a model of neural activity, and formalised by Stephen Kleene in 1956 — are called Deterministic Finite Automata (DFA). Despite being memory-free, they recognise exactly the class of languages described by regular expressions: the patterns that power your text editor's search, your compiler's lexer, and every URL validator on the web.
There is also a richer-seeming variant: a Nondeterministic Finite Automaton (NFA), where a single state may have multiple transitions on the same symbol (or even transitions on nothing, called ε-transitions). It looks more powerful — but as Michael Rabin and Dana Scott proved in 1959, it is not. Every NFA can be converted to an equivalent DFA that accepts exactly the same strings. The price? The DFA may need exponentially more states.
That exponential gap — NFA small, DFA huge — is a preview of a theme that runs through all of computation: the same problem can have wildly different costs depending on which model you choose to solve it in.
Comments
Loading comments...