A deterministic finite automaton in 10 lines of Prolog.