This book is based on notes for a master's course given at Queen Mary, University of London, in the 1998/9 session. Such courses in London are quite short, and the course consisted essentially of the material in the ?rst three chapters, together with a two-hour lecture on connections with group theory. Chapter 5 is a considerably expanded version of this. For the course, the main sources were the books by Hopcroft and Ullman ( 20]), by Cohen ( 4]),...