Discrete Mathematics and Automata Theory