Introduction to switching and automata theory