Introduction to the theory of finite-state machines