A Common Framework for Automata Theory and Control Theory