Formalizing the Logic-Automaton Connection