Deterministic Automata and State Invariants
Construct a recognizer by assigning a precise meaning to each state and proving it after every consumed symbol.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
A state records just the relevant prefix information
To recognize binary strings whose numeric value is divisible by three, store the current remainder \(r\in\{0,1,2\}\). Reading bit \(b\) changes it to \((2r+b)\bmod3\). The initial remainder is zero. An induction on input length proves the state invariant since appending a bit doubles the previous numeric value before adding the bit. Accepting remainder zero includes the empty string by this convention. A start flag can distinguish it if the language requires nonempty encodings.
Change the task by changing what the state remembers
For \(110\), the successive remainders are \(1,0,0\), so the automaton accepts. Storing the full prefix would be redundant. A minimal automaton goes further by identifying prefix states with the same future behavior. Product constructions and the subset construction similarly build larger states by choosing which prefix facts need to stay available.[1][2]