by Michael Barr and Charles Wells
Category Theory for Computing Science is a textbook in basic category theory, written specifically to be read by researchers and students in computing science. You may read the excerpts from the Preface to find out more about it.
The third edition is now available from Centre de recherches mathématiques, or by email to crmbooks@crm.umontreal.ca . This edition contains all the material dropped from the second edition (with corrections) and the answers to all the exercises.
Some of the chapters in the first edition were dropped from the second edition in order to make room for new material. Revised and corrected versions of the omitted chapters may now be found in an electronic supplement to the text. We also provide corrections and additions to the first edition and corrections to the second edition.
This book is a textbook in basic category theory, written specifically to be read by researchers and students in computing science. We expound the constructions we feel are basic to category theory in the context of examples and applications to computing science. Some categorical ideas and constructions are already used heavily in computing science and we describe many of these uses. Other ideas, in particular the concept of adjoint, have not appeared as widely in the computing science literature. We give here an elementary exposition of those ideas we believe to be basic categorical tools, with pointers to possible applications when we are aware of them.
In addition, this text advocates a specific idea: the use of sketches as a systematic way to turn finite descriptions into mathematical objects. This aspect of the book gives it a particular point of view. We have, however, taken pains to keep most of the material on sketches in separate sections. It is not necessary to read to learn most of the topics covered by the book.
As a way of showing how you can use categorical constructions in the context of computing science, we describe several examples of modeling linguistic or computational phenomena categorically. These are not intended as the final word on how categories should be used in computing science; indeed, they hardly constitute the initial word on how to do that! We are mathematicians, and it is for those in computing science, not us, to determine which is the best model for a given application.
The emphasis in this book is on understanding the concepts we have introduced, rather than on giving formal proofs of the theorems. We include proofs of theorems only if they are enlightening in their own right. We have attempted to point the reader to the literature for proofs and further development for each topic.
In line with our emphasis on understanding, we frequently recommend one or another way of thinking about a concept. It is typical of most of the useful concepts in mathematics that there is more than one way of perceiving or understanding them. It is simply not true that everything about a mathematical concept is contained in its definition. Of course it is true that in some sense all the theorems are inherent in its definition, but not what makes it useful to mathematicians or to scientists who use mathematics. We believe that the more ways you have of perceiving an idea, the more likely you are to recognize situations in your own work where the idea is useful.
We have acted on the belief just outlined with many sentences beginning with phrases such as `This concept may be thought of as …'. We have been warned that doing this may present difficulties for a non-mathematician who has only just mastered one way of thinking about something, but we feel it is part of learning about a mathematical topic to understand the contextual associations it has for those who use it.
Categories originally arose in mathematics out of the need
of a formalism to describe the passage from one type of mathematical structure
to another. A category in this way represents
a kind of mathematics, and may be described as category as mathematical workspace.
A category is also a mathematical structure. As such, it is a common generalization of
both ordered sets and monoids (the latter are a simple type of algebraic structure
that include transition systems as examples), and questions motivated by those
topics often have interesting answers for categories. This is
category as mathematical
structure.
A third point of view is emphasized in this book. A category can be seen as a structure that formalizes a mathematician's description of a type of structure. This is the role of category as theory. Formal descriptions in mathematical logic are traditionally given as formal languages with rules for forming terms, axioms and equations. Algebraists long ago invented a formalism based on tuples, the method of signatures and equations, to describe algebraic structures. In this book, we advocate categories in their role as formal theories as being in many ways superior to the others just mentioned. Continuing along the same path, we advocate sketches as finite specifications for the theories.
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Most sections have exercises which provide additional examples of the concepts and pursue certain topics further. Many exercises can be solved by carefully keeping track of the definitions of the terms involved. A few exercises are harder and are marked with a dagger. Some of those so marked require a certain amount of ingenuity (although we do not expect the reader to agree in every case with our judgment on this!). Others require familiarity with some particular type of mathematical structure. For example, although we define monoids in the text, a problem asking for an example of a monoid with certain behavior can be difficult for someone who has never thought about them before reading this book.
The third edition contains solutions to all the exercises. The solutions to the easy exercises, especially in the early chapters, go into considerable detail. The solutions to the harder exercises often omit routine verifications.