Dynamical systems, automata, and infinite groups