Automata and finite model theory