Parity-counting deterministic finite automaton (source code)

= Parity-counting deterministic finite automaton

To recognize prescribed parities of several symbol counts, use one state for each tuple of parities. Reading a tracked symbol toggles its coordinate and leaves all other coordinates unchanged. For two tracked symbols this gives four states indexed by $\mathbb Z_2^2$.