This book makes the mathematical basis of formal methods accessible both to the student and to the professional. It is motivated in the later chapters by examples and exercises. Throughout, the premise is that mathematics is as essential to design and construction in software engineering as it is to other engineering disciplines. The exercises range from simple drills, intended to provide familiarity with concepts and notation, to advanced material. The first four chapters of the book are devoted to foundations, with an introduction to formal systems, then the propositional and predicate calculi, concluding with a chapter on theories in general. The second part of the book builds upon the foundations by covering in detail the theory of sets, relations, functions, and sequences. The mathematical data types then presented are powerful enough to describe many aspects of software systems, and small case studies are included as examples of their use in the modelling of software: a configuration manager, a storage allocator, and a simple backing store interface. The concrete syntax of the Z notation has been adopted. The third part of the book presents two detailed case studies in the use of mathematics in software engineering. The first is the specification of the behaviour of a telephone exchange, and the second illustrates the importance of the development of a mathematical theory in gaining an understanding of a system. Both case studies stress the roles of modelling and of proof in the construction of specifications. The final part describes the algebraic approach to specification and then summarizes and compares the various formal techniques.