You are on page 1of 20

Joseph A.

Goguen Programming Research Group, University of Oxford SRI International, Menlo Park CA

A Categorical Manifesto

Abstract: This paper tries to explain why and how category theory is useful in computing science, by giving guidelines for applying seven basic categorical concepts: category, functor, natural transformation, limit, adjoint, colimit and comma category. Some examples, intuition, and references are given for each concept, but completeness is not attempted. Some additional categorical concepts and some suggestions for further research are also mentioned. The paper concludes with some philosophical discussion.

0 Introduction
This paper tries to explain why category theory is useful in computing science. The basic answer is that computing science is a young eld that is growing rapidly, is poorly organised, and needs all the help it can get, and that category theory can provide help with at least the following:
Formulating de nitions and theories . In computing science, it is often more di cult to formulate concepts and results than to give a proof. The seven guidelines of this paper can help with formulation; the guidelines can also be used to measure the elegance and coherence of existing formulations. Carrying out proofs . Once basic concepts have been correctly formulated in a categorical language, it often seems that proofs just happen": at each step, there is a natural" thing to try, and it works. Diagram chasing see Section 1.2 provides many examples of this. It could almost be said that the purpose of category theory is to reduce all proofs to such simple calculations. Discovering and exploiting relations with other elds . Su ciently abstract formulations can reveal surprising connections. For example, an analogy between Petri nets and the -calculus might suggest looking for a closed category structure on the category of Petri nets 52 . Dealing with abstraction and representation independence . In computing science, more abstract viewpoints are often more useful, because of the need to achieve independence from the often overwhelmingly complex details of how things are represented or implemented. A corollary of the rst guideline given in Section 1 is that two objects are abstractly the same" i they are isomorphic; see Section 1.1. Moreover, universal constructions i.e., adjoints de ne their results uniquely up to isomorphism, i.e., abstractly" in just this sense.
The research reported in this paper has been supported in part by grants from the Science and Engineering Research Council, the National Science Foundation, and the System Development Foundation, as well as contracts with the O ce of Naval Research and the Fujitsu Corporation. 

1

Formulating conjectures and research directions . Connections with other elds can suggest new questions in your own eld. Also the seven guidelines can help to guide research. For example, if you have found an interesting functor, then you might be well advised to investigate its adjoints. Uni cation . Computing science is very fragmented, with many di erenct subdisciplines having many di erent schools within them. Hence, we badly need the kind of conceptual uni cation that category theory can provide.

Category theory can also be abused, and in several di erent styles. One style of abuse is specious generality , in which some theory or example is generalised in a way that does not actually include any new examples of genuine interest. A related style of abuse is categorical overkill , in which the language of category theory is used to describe phenomena that do not actually require such an elaborate treatment or terminology. An example is to describe a Galois connection in the language of adjoint functors. Category theory has been called abstract nonsense" by both its friends and its detractors. Perhaps what this phrase suggests to both is that category theory has relatively more form than content, compared to other areas of mathematics. Its friends claim this as a virtue, in contrast to the excessive concreteness and representation dependence of set theoretic foundations, and the relatively poor guidance for discovering elegant and coherent theories that they provide. Section 9 discusses this further. Category theory can also be used in quite concrete ways, because categories are after all just another algebraic structure, generalising both monoids and partial orders see also Example 1.4 below. This paper presents seven guidelines for using category theory, each with some general discussion and speci c examples. There is no claim to originality, because I believe the underlying intuitions are shared by essentially all workers in category theory, although they have been perhaps understandably reluctant to place such dogmatic assertions in textbooks or other written documents1 . The guidelines are necessarily imprecise, and will seem exaggerated if taken too literally, because they are not objective facts, but rather heuristics for applying certain mathematical concepts. In particular, they may seem di cult to apply, or even impossible, in some situations, and they may need re nement in others. As a reminder that they should not be taken too dogmatically, I will call them dogmas . No attempt is made to be exhaustive. In particular, the technical de nitions are omitted, because our purpose is to provide intuition, and the de nitions can be found in any textbook. Thus, if you are a newcomer to category theory, you will need to use some text in connection with this paper. Unfortunately, no existing text is ideal for computing scientists, but perhaps that by Goldblatt 36 comes closest. The classic text by Mac Lane 47 is warmly recommended for those with su cient mathematics background, and Herrlich and Strecker's book 39 is admirably thorough; see also 2 and 45 . The paper 22 gives a relatively concrete and self-contained account of some basic category theory for computing scientists, using theories, equations, and uni cation as motivation, and many examples from that paper are used here.
As far as I know, the rst such attempt is my own in 34 , which gives four of the guidelines here. The only other attempt that I know is due to Lambek and Scott 45 , who give a number of slogans" in a similar style.
1

2

we may de ne a relation from a set A0 to a set A1 to be a triple A0 ." for composition. that each function has a domain in which its arguments are meaningful. R. Now some examples: 1. it seems desirable to take the view that the composition of relations is only meaningful when the domains match. By way of notation. and like all such representations.1 Sets. 64 for some related discussion. 1. See 36 for related discussions. there corresponds a category whose objects have that structure. The set theoretic representation of functions is an artifact of the set theoretic foundations of mathematics. it is necessary to understand the morphisms that preserve it. Just as with functions. A1  with R . and composition of functions is only allowed when meaningful in this sense. a codomain in which its results are meaningful. and whose morphisms preserve it. has accidental properties beyond those of the concept it is intended to capture. Thus. Moreover. It is part of this guideline that in order to understand a structure. If we take sets to be objects. the category concept can be de ned using only morphisms. category theorists have argued that morphisms are more important than objects. and 1A for the identity morphism at an object A. however. The category Set of sets embodies a contrary point of view. because they reveal what the structure really is. because it must also specify particular source and target sets.1 Categories The rst dogma is as follows: To each species of mathematical structure.2 Relations. This is consistent with practice in computation theory which assigns types to functions. One of those properties is that any two sets of ordered pairs can be composed to yield a third. we use . A set morphism. Indeed. Perhaps the bias of modern Western languages and cultures towards objects rather than relationships accounts for this see 50. then their morphisms are clearly going to be functions. is not just a set of ordered pairs.

3 Graphs. @1 : E ! N which give the source and target of each edge.N? 0 @i0 3 . 1: E f E @i -N g ? 0 . N. and then allow its composition with B0 . respectively. Thus a morphism from G = E. S. @0 . of which Set can be considered a subcategory. B1  to be de ned i A1 = B0 . This gives rise to a category that we denote Rel. A0  A1 . f : E ! E 0 and g : N ! N 0 . @1  consists of two functions. @1  0 0 to G0 = E 0 . a set N of nodes. A graph G consists of a set E of edges. @0 . 1. such that the following diagram commutes in Set for i = 0. N 0 . Because the major components of graphs are sets. the major components of their morphisms should be corresponding functions that preserve the additional structure. and two functions @0 .

can be composed to form another path p. the registers" are denoted by variable symbols" from X . 1. p and p0 .5 Automata. if we identify the number n with the set f1. we must show that a composition of two such morphisms is another. A simple example is nite product types. Y 0 . i : S ! S 0 . rather than by natural numbers. with morphisms that describe what might be called register transfer operations" among tuples of registers". A variant of N has as its objects the nite subsets of a xed countable set X . g0  should consist of three functions. n. Details may be found in 47 . f. Thus. 1. which are conveniently represented by natural numbers. :::. 1." and a morphism f : m ! n is a function f1. An automaton consists of an input set X . di erent categories will arise.. :::. and each node can be given an identity path" having no edges. 19 . each path in G has a source and a target node in G. such that the following diagrams commute in Set: fg  H  i hi HH ? ? jS s00 H 0 X 0  S 0 s 0 * S X S f -S . depending on what is being classi ed. Y. of course. These checks show that we have a category Aut of automata. Going a little further. ng ! f1.To show that we have a category Graph of graphs. :::. so that we get another opposite of a subcategory of Set . and require that the morphisms preserve these sorts. Clearly this composition is associative when de ned. f 0 . for i = 1. This category is denoted PaG. they should form a category having types as objects. denoted say X . S 0 . s0 . and that a pair of identity functions satis es the diagrams and also serves as an identity for composition. 34 ." and according to the rst dogma. ng and 0 with . then this category is the opposite of a subcategory of Set . p0 i the source of p0 equals the target of p.S? 0 i S i S g -Y j where fg denotes an arbitrary one point set with point . s00 . and many other places. 4 f0 ? 0 g . tn i of data items in n registers. :::. and an output function g : S ! Y . we can assign sorts from a set S to the symbols in X . Given a graph G. Types are used to classify things. Let us denote this category XS . It must be shown that a composition of two such morphisms is another. n 2 ! indicates an n-tuple ht1 . h : X ! X 0 . S. and two paths. a state set S . and that a triple of identities satis es the diagrams and serves as an identity for composition. Here. What does it mean to preserve all this structure? Because the major components of automata are sets. the major components of their morphisms should be corresponding functions that preserve the structure. In fact. and their simplicity increases our con dence in the correctness of the de nitions 18 . Thus a morphism from A = X. an initial state s0 2 S . let us denote it N .Y? 0 0 .6 Types. an output set Y . and as morphisms again the opposites of functions among these. :::. and j : Y ! Y 0 . mg indicating that the content of register f i should be transferred to register i. g to A0 = X 0 .4 Paths in a Graph. a transition function f : X  S ! S .

1. Moreover. and the X " is used instead of an X " when X is actually only de ned up to isomorphism. but still signi cant. for uniqueness of morphisms.2 Diagram Chasing . substitutions have natural source and target objects.6 above.5. Thus. In computing science. Two key attributes of a substitution are the set of variables into which it substitutes. Lawvere developed a very elegant approach to universal algebra. the objects.W.8 Theories. and in many other ways. and for certain other common situations. or the morphisms. In this approach.f = 1A and f . theorem.1 Isomorphism One very simple. as in Example 1.6 above. for example. 1. in which an algebraic theory is de ned to be a category T whose morphisms correspond to equivalence classes of terms. suitable for any species of structure at all: a morphism f : A ! B is an isomorphism in a category C i there is another morphism g : B ! A in C such that g. theories are closed under nite products as de ned in Example 4. we get a category with substitutions as morphisms. A diagram commutes i whenever p and p0 are paths with the same source and target.7 Substitutions. F. this principle guided the successful search for the right de nition of abstract data type" in 33 . see 3 . and the set of variables that occur in what it substitutes. In this case. fruit of category theory is a general de nition of isomorphism. Gray. then the compositions of the morphisms along these two paths are equal. Because it is valid for diagrams in any category whatever. This demi-dogma can be seen as a corollary of the rst dogma. all the theories of a given kind form a category. In his 1963 thesis 49 . This principle is so pervasive that isomorphic objects are often considered the same. and now in other elds as well. it applies to substitutions as in Example 1. it easily extends to the many-sorted case. Of course. is to draw one or more diagrams that show the main objects and morphisms involved. It provides an immediate check on whether or not some structure has been correctly formalised: unless it is satis ed. this proof style is very widely applicable. and an abstract object" is an isomorphism class of objects. and whose objects indicate the variables involved in these terms. including the so-called sketches" studied by Ehresmann. Although Lawvere's original development was unsorted. Thus. 5 1. for example.1. the objects A and B are isomorphic. each a set of variables. It is a well established principle in abstract algebra. or more precisely: Two objects have the same structure i they are isomorphic. are wrong. The fact that pasting two commutative diagrams together along a common edge yields another commutative diagram provides a basis for a purely diagrammatic style of reasoning about equality of compositions. and the composition of substitutions is associative when de ned. Barr. or proof. Wells. A useful way to get an overview of a problem. and others. Clearly there are identity substitutions for each set of variables substituting each variable for itself. g = 1B .1 below. as in Example 1. that isomorphic objects are abstractly the same. or both. it has been extended with conventions for pushouts.

Given an automaton A = X. Of course. to Y . g = g. It is part of this dogma that a construction is not merely a function from objects of one species to objects of another species.1 Free Monoids.3 is to prove that a composition of two graph morphisms is another graph morphism. with a function f : X ! Y inducing f  : X  ! Y  by sending  to . functoriality does not guarantee correct formulation. A simple illustration from Example 1. f and B h. and sending x1 : : : xn to f x1  : : : f xn. and compositions and identities for these morphisms. we need a category of behaviours. for x 2 X and u 2 X  . including the empty string . This functor is called the polymorphic list type constructor" in functional programming. S. S. Y. but must also preserve the essential relationships among objects. For this. such that the diagram X h X 0 b -Y . de ned by bu = gf u. yielding structures of another species. b0 : X 0 ! Y 0  be pairs h.Often proofs are suggested just by drawing diagrams for what is known and what is to be proved. It consists of all nite strings x1 : : : xn from X . but it can be surprisingly helpful in practice. This provides a test for whether or not the construction has been properly formalised. That this is a functor helps to con rm the elegance and coherence of the previous de nitions. g. where f is de ned by f  = s0 and f ux = f x. 6 . 2. its behaviour is a function b : X  ! Y . b : X  ! Y  and to let its morphisms from X. Y. b : X  ! Y  to X 0 . f. 2 Functors The second dogma says: To any natural construction on structures of one species. Denote this category Beh and de ne B : Aut ! Beh by B X. j  where h : X ! X 0 and j : Y ! Y 0 . f u. including their structure preserving morphisms.Y? 0 j ? b0 commutes in Set. f. there corresponds a functor from the category of the rst species to the category of the second. See 18 . i. Now some examples: 2. It is quite common in computing science to construct the free monoid X  over a set X . This construction gives a functor from the category of sets to the category of monoids. The obvious choice is to let its objects be pairs X. This construction should be functorial. all we have to do is paste together the corresponding diagrams for the two morphisms. from the monoid X  of all strings over X . j  = h.2 Behaviours. j .

nite products. For example. also called a T -algebra. an interpretation for T . the test if X 2" on natural numbers corresponds to the partial identity function ! ! ! de ned i X 2. It is denoted Cat. with shape a graph G. by taking S to have three elements. as nite product preserving functors. A semantics for statements then arises by giving a functor A : T ! Rel . which is a graph morphism. constructed concretely in Set. many sorted algebras arise as functors from a theory over the type system XS .e.. and arbitrary built-in data structures. Techniques that allow programs to have syntax as well as semantics are described in 19 2 : A program scheme is a functor P : G ! T into a theory T enriched" with a partial order structure on its morphism sets T A. every group is a monoid by forgetting its inverse operation. with functors as morphisms. An edge e : n ! n0 in G corresponds to a program statement.e. then models" of T are functors M : T ! Set that preserve the structure of these theories.5 can be seen as an example of this.. The construction in Example 1.. B  the reader familiar with 2-categories should note that this makes T a 2-category. More generally. and the relation P e : P n ! P n0  gives its semantics. see Example 6.6 Diagrams and the Path Category Construction. In the Lawvere approach to universal algebra 49 . can be seen as a functor from a graph G the program's shape" into the category Rel whose objects are sets and whose morphisms are relations. i." because D : PaG ! C is in fact fully determined by its restriction to G.g. construction" takes the meaning of interpretation": the abstract structure in T is interpreted i. 2. 1 when X 0. is a functor D: PaG ! C . if T is some kind of theory. Notice that a ring with identity is a monoid in two di erent ways.2 below. More generally. It is conventional to write just D : G ! C . we can take models of T in a suitable category C with nite products. 2. 7 .7 Programs and Program Schemes. the small categories also form a category. go-to's. an algebra is a functor from a theory T to Set. For example. Here. For example. A non-deterministic ow diagram program P with parallel assignments. including arbitrary functions and tests. and even to call D a functor.2. Then a diagram in a category C .4 of the category PaG of all paths in a graph G gives rise to a functor Pa : Graph ! Cat from graphs to categories. e. If all widgets are whatsits.4 Forget It. 2. 1" corresponds to the partial function ! ! ! sending X to X .3 Models. and every monoid is a semigroup by forgetting its identity. Of course. and the assignment X := X . n0 = SfP p j p : n ! n0 2 PaGg. that is. then there is a forgetful functor" from the category of widgets to the category of whatsits. Example 1. This approach originated in Burstall 5 . these functors must preserve nite products. The semantics of a program is then computed by the above 2 Only the original 1972 conference version contains this de nition. The semantics of P with input node n and output node n0 is then given by the formula P n. one for its additive structure and one for its multiplicative structure.5 Categories. 2.

and homomorphisms.1 Homomorphisms. In particular. algebras are functors.3.  = 1G . and hence why so many of them are ill-suited for computing scientists. For example. 3 Naturality The third dogma says: To each natural translation from a construction F : A ! B to a construction G : A ! B there corresponds a natural transformation F  G. If we think of the types of a functional programming language as forming a category T . since Eilenberg and Mac Lane 11 used it to formalise the notion of an equivalence of homology theories. some others would be set and list  list. they are.3 Data Re nement.g. As already indicated. will arise in this way. Although this looks like a mere de nition of the phrase natural translation. It is also interesting that this concept was the historical origin of category theory. which of course are programs.8 Theory Interpretations. 2. Extending the discussion in Example 2. This is also exactly the concept that motivated Eilenberg and Mac Lane. and for functors to make sense. which of course are natural transformations. an interpretation" of a theory T in a theory T 0 should be a functor F : T ! T 0 which preserves theory structure e. types and nite products. then polymorphic type constructors. 3. and then found that for this de nition to make sense. and indeed. such theories still admit algebras. Such functors are the same thing as theory morphisms. and so we should expect homomorphisms to be natural transformations. 3. A : G ! Rel . are endofunctors on T . 2. and it would be interesting to consider other program constructions in a similar setting. in the Lawvere approach to universal algebra.. This is the natural notion of isomorphism for functors.2 Natural Equivalence. with objects like Int and Bool." it can nevertheless be very useful in practice. 29 gives an inductive proof principle for collections of mutually recursive procedures. like list. they had to de ne categories.formula for the composition P . the latter sending a type to the type list   list . which are functors into Set. and in the context of Example 3. interpretations of program schemes. However. This history also explains why homology theory so often appears in categorical texts. A natural transformation : F  G is a natural equivalence i each A : F A ! GA is an isomorphism. they had to de ne functors. that is. Now some examples: 3.9 Polymorphic Type Constructors. A graph with its nodes labelled by types and its edges labelled by function symbols can be seen as an impoverished Lawvere theory that has no equations and no function symbols with more than one argument.1. it specialises to isomorphism of algebras. functors T ! T . There seems to be much more research that could be done in this area. and is equivalent to the existence of  : G  F such that  . = 1F and . These algebras can be viewed as data representations for the basic data types and functions 8 .

and to the more general data representations studied in the abstract data type literature e. by unfolding programs into equivalent in nite trees. they are. and whose morphisms are natural transformations. Then there is a category. but only understood vaguely as a general concept. Let A and B be categories.g. 3. and indeed. whose objects are the functors from A to B. and equivalence. Examples include and append : list list ." which was previously known in many special cases. 4 Limits The fourth dogma says: A diagram D in a category C can be seen as a system of constraints. we expect program homomorphisms to be natural transformations between programs. In 19 . termination. This intuition goes back to some work on General System Theory from 1969-74. then the limit provides an object which together with its projection morphisms represents all possible behaviours of the system that are consistent with the given constraints. and has many applications in computing science: 4. if the diagram represents some physical or conceptual system. Indeed. then polymorphic functions should be natural transformations. this can lead to some general techniques for developing correct programs 40 .6 Functor Categories. Some theory and applications for this are also given in 19 .1 Products. denoted Cat A. and to maps from edges to paths. this is generalised to programs that may have di erent shapes.. Considered in connection with the basic program construction operations of a language. 16.8. then the T -algebras are a subcategory of C at T. 33. In particular. Set .list 3.list reverse : list . and then a limit of D represents all possible solutions of the system. Burstall 5 shows that a weak form of Milner's program simulations 53 arises in just this way.7 de nes programs as functors. The de nition is due to Mac Lane 46 .4 Program Homomorphisms. including techniques for proving correctness. P1 . by de ning a homomorphism from P0 : G0 ! C to P1 : G1 ! C to consist of a functor F : G0 ! PaG1  and a natural transformation : P0 ! F . 27 . and their homomorphisms can be viewed as data re nements . B .of a programming language. It would be interesting to extend this to more general variants of Lawvere theories such as many-sorted theories or sketches. Because Example 2.5 Polymorphic Functions. 9 . In particular. 9 . if T is a theory. An early achievement of category theory was to give a precise de nition for the notion of product. If polymorphic type constructors are functors as in Example 2. 3.

we get the classical unsorted general algebras. usually denoted 1. 4. When T = X .e. g : T ! T 0 of morphisms in a theory as an equation. including an empty product the product of no factors. if it exists.3 Theories.e. homomorphisms of T -algebras are natural transformations. from T to a category A with nite products. All these examples and some others are discussed in more detail in 22 . and products in them are disjoint unions in Set . to a category C with nite products. Generalising again. Then. 10 . if it exists. these weaken the there exists a unique morphism" requirement to mere existence. in Lawvere form. nonetheless. the stronger condition is often satis ed in practice. For the classical case of unsorted. of type T . with X S -sorted. as are some techniques for proving that uni ers exist. Of course. polymorphic type inference. and returns one output. obeying no laws theories. i. A morphism of theories over T is a nite product preserving functor which also preserves T . the morphisms are terms. Given types T1 and T2 . weak equalisers formalise the classical de nition of uni ers. and equalisers give most general uni ers .. A generalised Lawvere theory T : T ! A over a type system T assumed to have nite products is a nite product preserving functor that is surjective on objects. and least xpoints. a morphism f : T1  T2 ! T takes two inputs" in parallel. 4.2 Product Types. For some theories. There are many examples of this situation: solving systems of linear equations. giving a category of T -algebras. a theory T : T ! A is bijective on objects.7 for the semantics of a program. solving Scott domain equations. hence. a system of constraints is a diagram in a theory. uni cation in the sense of uni cation grammars" in linguistics. and we can assume that jT j = jAj and that T is a subcategory of A. We can think of a pair f. and its most general solution is given by its limit. Except for degenerate" cases. for example.4 Equations and uni cation. we get S -sorted general algebras. anarchic i. of types T1 and T2 . the most general solution of this equation is given by the equaliser of f and g. An algebra of a theory T : T ! A is a nite product preserving functor to Set or more generally. a nal object. 22 also discusses congruences and quotients of generalised Lawvere theories. In fact..4. we may identify T and A. by the fourth dogma. their parallel composition" is their product in the category T of types. 5 Adjoints The fth dogma says: To any canonical construction from one species of structure to another corresponds an adjunction between the corresponding categories. When T = N . imposing associative and commutative laws on some operations in the theory leads to so-called AC-uni cation. Thus. More general kinds of uni cation arise by going to more general kinds of theories. It is usual to assume that a category of types used in de ning some kind of theory has nite products. only weak equalisers can be found. Both N and X are subcategories of Set op. Another example is the justication of the formula in Example 2.

see 49 . and a right adjoint to each functor sending A to A  B . C . This property says that there is a unique morphism satisfying certain conditions. Again.5 Cartesian Closed Categories. binary products in a category C give a functor  : CC ! C . Let A denote the subcategory of Aut whose objects are reachable and whose morphisms i. The paper 22 shows how a Kleisli category generates a generalised Lawvere theory. sending an object C in C to the pair C. Moreover. One of the more spectacular adjoints is that between syntax and semantics for algebraic theories. more general minimal realisation situations. Another beautifully simple formalisation gives a general de nition of free" constructions: they are the left adjoints of forgetful functors. and extends to general limits and colimits. C 0  in CC . Examples include 11 . as a basis for the efcient compilation of higher order functional languages 8 . which is left adjoint to  : C ! CC .3 Minimal Realisation. So-called monads also called triples are an abstraction of the necessary structure. 5. the path category functor Pa : Graph ! Cat of Example 2. see 17 . This connection has been used. there are surprisingly many examples. A Cartesian closed category has binary products. adjointness determines a construction uniquely up to isomorphism. c : C. Many of the constructions described above are intuitively canonical. and the Kleisli category over a monad gives the category of free algebras 47 . f. e. 5. Because right adjoints are uniquely determined." it can be very useful in practice. of solving systems of equations can be naturally formulated as nding equalisers in Kleisli categories. 5. again due to Lawvere in his thesis. C has coproducts also called sums" i  has a right adjoint.. Y. the diagonal" functor. C  ! C 0 . An automaton X. and sending a morphism c : C ! C 0 in C to c. For example. and then shows that many di erent problems of uni cation that is. It is remarkable that this concept turns out to be essentially the typed -calculus.4 Syntax and Semantics. Now some examples: 5. S. and thus may be said to give the free category over a graph. Another way to generalise Lawvere theories is to view an arbitrary adjunction as a kind of theory.Although this can be seen as just a de nition of canonical construction. this provides a convenient abstract characterisation of minimal realisation. g is reachable i its function f : X  ! S is surjective. An advantage is that optimisation techniques can be proved correct by using purely equational reasoning.2 Freebies. 5. and hence are adjoints. Moreover. or left adjoints to a given functor are naturally equivalent.g. 5..1 Products and Sums. see 45 . k have i surjective.6 is left adjoint to the forgetful functor Cat ! Graph .e. j. For example. and even suggests. for example. this characterisation extends to. This beautifully simple way to formalise two mathematical concepts of basic importance is due to Mac Lane 46 . Then the restriction B : A ! Beh of B : Aut ! Beh to A has a right adjoint which gives the minimal realisation of a behaviour 18 . The essence of an adjoint is the universal property that is satis ed by its value objects.4 Kleisli Categories. i. It is worth noting that any two right.

27 . 22 . Its colimit is an initial object . this can also be shown directly. it is determined uniquely up to isomorphism. in essentially the same sense as Lawvere but many-sorted. 15.. There seem to be many opportunities for further research in these areas. Another important problem in computing science is to nd models of computation that are suitable for massively parallel machines. Complexity is a fundamental problem in programming methodology: large programs. and speci cations are put together by colimits in the category of such theories. and object oriented programming. to understand. In the semantics of Clear 6. are very di cult to produce. the application of a generic theory to an actual is computed by a pushout. 32. which is more simply explained as an object that has a unique morphism to any object. More speci cally. and that when put back together give the original system. logic i.e. and their large speci cations. A successful model should be abstract enough to avoid the implementation details of particular machines. 63 . It has even been applied to Ada 21. If successful.uni cation in order sorted and continuous theories. 6. speci cations are represented by theories. then the result of interconnecting a system of widgets to form a super-widget corresponds to taking the colimit of the diagram of widgets in which the morphisms show how they are interconnected. It is also worth mentioning that universality can be reduced to initiality in a comma category. 6 Colimits The sixth dogma says: Given a species of structure. 12 . A basic strategy for defeating complexity is to break large systems into smaller pieces that can be understood separately.1 Putting Theories together to make Speci cations. 14 . 41 . and yet concrete enough to serve as an intermediate target language for compilers. and colimits seem to be quite useful here 10.2 Graph Rewriting. 7 . Graph rewriting is also important for the uni cation grammars that are now popular in linguistics 60. 28. Now some examples: 6. hence. OBJ 13. Graph rewriting provides one promising area within which to search for such models 43. and in their combinations. so any two initial objects in a category are isomorphic of course. relational. say widgets. and hence so can colimits. 44 . 6. and FOOPS 31 extend this notion of generic module to functional. this intuition arose in the context of General Systems Theory 16. 58. Moggi 55 uses Kleisli categories to get an abstract notion of computation" which gives rise to many interesting generalisations of the -calculus. The simplest possible diagram is the empty diagram. It may be interesting to note that the duality between the categorical de nitions of limits and colimits suggests a similar duality between the intuitive notions of solution and interconnection. initiality gives a convenient way to de ne entities abstractly". At least for me. Like any adjoint.3 Initiality. and to modify. and with signatures. to get right. Eqlog 30 . this in e ect takes the logarithm" of the complexity.

3 is the comma category Set  2.. 51 . For example. logic i. 13 . domain equations see below.5 Solving Domain Equations. The following are just a few of the many examples that can be found in computing science: 7.e. then the category of theories over T is T  FP Cat .e. and model theoretic semantics for functional 13 . 7. In the same way. relational. If FPCat is the category of categories with nite products. initiality has been applied to an increasing range of fundamental concepts. They tend to arise when morphisms are used as objects.6.2 Labelled Graphs. of morphisms. Viewing a category as a comma category also makes available some general results to prove the existence of limits and colimits 25 . among other things. and it seems likely that much more interesting work can be done along these lines. These ideas are taken further in 61 . Scott 59 presents an inverse limit" construction for solving domain equations. if 2 denotes the functor Set ! Set sending S to S  S . then a species of structure obtained by decorating" or enriching" that of C corresponds to a comma category under C or under a functor from C . 7. including induction and recursion 35. and smoothing out the classical Herbrand Universe construction 38 . then the category Graph of Example 1. and records some suggestions by Lawvere that clarify this construction by viewing it as a colimit in an associated category of retracts. then the comma category U  L is the category of graphs from G with nodes labelled by L. and constraint logic 30 programming languages. computability 51 .e. we can decorate edges of graphs.4 Initial Model Semantics. 6. Many categories of graph are comma categories... Comma categories are another basic construction that rst appeared in Lawvere's thesis. and if T is a type system i. The latter is interesting because it involves initiality in a category of model extensions. this research can be seen as formalising. rather than just models. 7 Comma Categories The seventh dogma says: Given a species of structure C . but hopefully some examples will help to clarify things. Given some category G of graphs and a forgetful functor U : G ! Set . combined functional and relational. It seems remarkable that initiality is so very useful in computing science.1 Graphs. A key construction is the colimit of an in nite F sequence of morphisms. i. Beginning with the formalisation of abstract syntax as an initial algebra 20 . say giving the node set of graphs in G . which also generalises from partial orders to categories and shows that least xpoints are initial algebras. In general. with nite product preserving functors as morphisms. abstract data types 33 . or branches of trees. generalising the traditional construction n2! F n ? of a least xpoint.3 Theories. It seems more di cult to be precise about this intuition than the others. an object in FP Cat . and given a set L to be used for node labels. generalising.

This section mentions some further categorical constructions.. within the system.g. 40 . e.5 Topoi. and intuitionistic logic 36. preferably rst order. in order to nurture belief in their consistency. and a variety of recent work suggests that monoidal categories may be broadly useful in understanding the relationships among the various theories of concurrency. A strict indexed category is just a functor Bop ! Cat. 9 Discussion The traditional view of foundations requires giving a system of axioms. This approach is inspired by the classical Greek account of plane geometry. The category of Petri nets studied in 52 has already been mentioned.7. however. It also has surprising relationships to algebraic geometry. The best known foundation for mathematics is set theory. Moggi 56 applies indexed categories to programming languages. Sometimes morphisms not only have their usual composition. In a sense. identity.2 Monoidal Categories. computing science. failed to provide a commonly agreed upon set of simple. 56 . For example. A profound generalisation of the idea that a theory is a category appears in the topos notion developed by Lawvere.8 Further Topics Although they are particularly fundamental. It has. The papers 62 and 23 give many examples of indexed categories in computing science. 8. and is mentioned in 61 .3 Indexed Categories. including simple su cient conditions for completeness of the associated Grothendieck" category. this notion captures the essence of set theory. as few in number. and all their relevant properties derived. and of certain primitive constructions on objects. and 62 gives some general theorems. There are many cases where a category has a natural notion of multiplication that is not the usual Cartesian product but nevertheless enjoys many of the same properties. as possible. about each of which one might express surprise at how many examples there are in computing science. Tierney. that assert the existence of certain primitive objects with certain properties. see 12 . 42 . This concept was mentioned in Example 2.1 2-Categories. but also serve as objects for some other. 8. This leads to 2-categories. classical formulations of set theory such as Zermello-Frankel have 14 . and to make them as easy to use as possible. source and target. morphisms. such that all objects of interest can be constructed. Non-strict indexed categories are signi cantly more complex. self-evident axioms. higherlevel. and is also used in 24 . The axioms should be as self-evident. among other places. 2. and as simple. and have been used in foundational studies 57 . of which the category Cat of categories is the canonical example. with natural transformations as morphisms of its morphisms. and in particular shows how to get a kind of higher order module facility for languages like ML. and others. which has been very successful at constructing the objects of greatest interest in mathematics. 8. 26 . 8. the seven dogmas given above far from exhaust the richness of category theory.

such as large cardinals. which asserts that there is no in nite sequence of sets S1 . Volume 14. Aczel 1 and others have used an Anti-Foundation Axiom. Mac Lane 48 gives a lively discussion of these issues. editors. Still more recently. which positively asserts the existence of such non-well founded sets. 15 . Michael Mislove. Springer. Grundlehren der mathematischen Wissenschafter. attempts to nd a minimal set of least debatable concepts upon which to erect mathematics have little direct relevance to computing science. and moreover have encouraged research into areas that have little or nothing to do with mathematical practice. Of course. 1985. 1988. and that many no longer believe in the possibility of nding unshakable certainties" 4 upon which to found all of mathematics. because they can suggest which research directions may be fruitful. I wish to suggest that the existence of such guidelines can be seen to support an alternative. CSLI Lecture Notes. Non-Well-Founded Sets. The successful use of category theory for such purposes suggests that it provides at least the beginnings of such a foundation.been under vigorous attack by intuitionists for nearly eighty years. Triples and Theories. more widely accepted axioms of set theory. In any case. the issue no longer seems as urgent as it once did. using relatively explicit measures of elegance and coherence. more pragmatic view: Foundations should provide general concepts and tools that reveal the structures and interrelations of various areas of mathematics and its applications. including category theory itself. 2 Michael Barr and Charles Wells. Springer. In Michael Main. generalising. In a eld which is not yet very well developed. Set theoretic foundations have also failed to provide fully satisfying accounts of mathematical practice in certain areas. S2 . The formal description of data types using sketches. In fact. Center for the Study of Language and Information. to model various phenomena in computation. there has been debate about the Axiom of Foundation. Stanford University. ::: such that each Si+1 is an element of Si. and discovering analogies among and within various branches of mathematics and its applications. see also 37 for an overview of various approaches to foundations. and yet surprisingly speci c. Mathematical Foundations of Programming Language Semantics. because no new paradoxes have been discovered for a long time. S3 . 3 Michael Barr and Charles Wells. Lecture Notes in Computer Science." following the originally startling proof by Paul Cohen that it is independent of other. References 1 Peter Aczel. including communicating processes in the sense of Milner 54 . there has been debate about whether the Generalised Continuum Hypothesis is true. More recently. and that help in doing and using mathematics. and D. foundations in this sense can be very useful. I think it is fair to say that most mathematicians no longer believe in the heroic ideal of a single generally accepted foundation for mathematics. Volume 298. such as computing science. guidelines for organising. Volume 278. Melton. Schmidt. Toposes. where it often seems that getting the de nitions right is the hardest task. A. 1988. This paper has tried to show that category theory provides a number of broadly useful.

editor. 1979 Copenhagen Winter School on Abstract Software Speci cation. K. 1972. 1967. pages 1045 1058. 1985. editors. Jean-Pierre Jouannaud. 1978. 13 Kokichi Futatsugi. G. Proceedings. Conference on Proving Assertions about Programs. Jean van Heijenoort editor. Warsaw.R. implementation and parameterization of abstract data types. and Gregor Rozenberg. Jos Meseguer. Hammond. University of East Anglia. 1977. e Principles of OBJ2. Department of Computer Science. Lecture Notes in Computer Science. In Raj Reddy. Claus. Mack Adams. In J. An algebraic description of programs with assertions.R. 1986. Journal of the Association for Computing Machinery.W. 15 J. 14 Kokichi Futatsugi. pages 7 14. Research Notes in Theoretical Computer Science. Springer. Hartmut Ehrig. Springer.A. Stefan Banach Center. 1928. pages 1 69. and simulation. In Brian Reid. PhD thesis. Proceedings. pages 490 492. DACTL: Some introductory papers. Joseph Goguen. Pitman and Wiley. Association for Computing Machinery. Graph Gramars and their Application to Computer Science and Biology. Transactions of the American Mathematical Society. The semantics of Clear. Proceedings. Sequential Algorithms. pages 51 60. 31:374 379. Harvard. University of Pisa. IEEE Computer Society. In V. Fifth International Joint Conference on Arti cial Intelligence. In From Frege to Godel. 16 . Kennaway. Technical Report SYS-C88-08. 9 Hans-Dieter Ehrich. 10 Hartmut Ehrig. Koninklijke Akademie van wetenschappen te Amsterdam. 58:231 294. a speci cation language. Volume 73. editor. Proceedings of the section of sciences. Glauert. Categorial Combinators. Proceedings. 8 Pierre-Luc Curien. pages 292 332. and Functional Programming. 1988. and Jos Meseguer. Ninth International Conference on Software Engineering. Poland. John Johnston. 29:206 227.R. Lecture Notes in Computer Science. editors. Parame eterized programming in OBJ2. 1990. pages 52 66. veri cation. Twelfth ACM Symposium on Principles of Programming Languages. 1982. and Richard Stark. On the theory of speci cation. In Dines Bjorner.4 Luitzen Egbertus Jan Brouwer. based on unpublished notes handed out at the Symposium on Algebra and Applications. Intuitionistische betrachtungen uber den formalismus. Introduction to the algebraic theory of graph grammars. Sleep. In Robert Balzer. and M. editor. 1945. Carnegie-Mellon University. 1980. Papadopoulos. 7 Rod Burstall and Joseph Goguen. and Koji Okada. March 1987. General theory of natural equivalences. 12 Gian Luigi Ferrari. 5 Rod Burstall. Putting theories together to make speci cations. Unifying Models of Concurrency. J. editor. Proceedings. 11 Samuel Eilenberg and Saunders Mac Lane. Joseph Goguen. 1979. Association for Computing Machinery. School of Information Systems. 6 Rod Burstall and Joseph Goguen. Volume 86.

In George Klir. editor. Academic. Bulletin of the American Mathematical Society. Computer. Oxford. 1972. 20 Joseph Goguen. Global Systems Dynamics. unfoldments and equivalence of ow diagram programs. Resolution of Equations in Algebraic Structures. Plenum. Peter Freeman. and Ralph F. 1987. 6:359 374. pages 357 390. editors. 1973. In Ernest G. 312:175 209. editors. Some fundamental algebraic tools for the semantics of computation. pages 52 60. Types as theories. In Maurice Nivat and Hassan A t-Kaci. 1974. pages 217 261. pages 251 263. Topology and Category Theory in Computer Science. 785:777 783. Mathematical System Theory. 1991. On homomorphisms. 23 Joseph Goguen. pages 234 249. Manes. 18 Joseph Goguen. Proceedings of a Conference held at Oxford. Theoretical Computer Science. 17 Joseph Goguen. October 1980. Theoretical Computer Science. 1975. What is uni cation? A categorical view of substitution. 26 Joseph Goguen and Rod Burstall. Technical Report Report CSL-118. In E. correctness. Attinger. 1984.16 Joseph Goguen. IEEE Computer Society. Original version in Proceedings. Rub n Prieto-D az and Guillermo e Arango. 19 Joseph Goguen. S. pages 151 163. First International Symposium on Category Theory Applied to Computation and Control. Karger. Semantics of computation. SRI Computer Science Lab. Andrew William Roscoe. February 1986. Reprinted in Tutorial: Software Reusability. 1972 IEEE Symposium on Switching and Automata. 1978. Volume 1: Algebraic Techniques. IEEE Computer Society. Computer Science Lab. CAT. pages 112 128. contains an additional section on program schemes. editors. Mathematical representation of hierarchically organized systems. 8:333 365. A categorical approach to general systems theory. signatures and theories. editor. colimits. termination. 27 Joseph Goguen and Susanna Ginali. Applied General Systems Research. editor. part 1: Comma categories. 21 Joseph Goguen. Minimal realization of machines in closed categories. August 1988. 1991. 313:263 295. equation and solution. 24 Joseph Goguen and Rod Burstall. a system for the structured elaboration of correct programs from structured speci cations. pages 257 270. editor. Springer. 22 Joseph Goguen. Proceedings. and in Domain Analysis and Software Systems Modelling . Volume 25. part 2: Signed and abstract theories. 17 . 1989. 25 Joseph Goguen and Rod Burstall. 1984. Some fundamental algebraic tools for the semantics of computation. In George Michael Reed. University of Massachusetts at Amherst. Reusing and interconnecting software components. Realization is universal. Wachter. 1971. June 1989. Journal of Computer and System Sciences. pages 125 137. 192:16 28. Also Report SRI-CSL-88-2R2. SRI International. Also in Lecture Notes in Computer Science. 1974.

28 Joseph Goguen. Claude Kirchner. H l.

Eric Wagner. Current Trends in Programming Methodology. Classe III. An initial algebra approach to the speci cation. The Logical Foundations of Mathematics. Programming Research Group. Earlier version in Proceedings. pages 628 637. 18 . 1977. North-Holland. IBM T. 34 Joseph Goguen. Hatcher. editor. 33 Joseph Goguen. Volume 308. and Jos ee e e Meseguer. 31 Joseph Goguen and Jos Meseguer. Category Theory. Oxford University. correctness and implementation of abstract data types. In Hartmut Ehrig. IBM Watson Research Center. A junction between computer science and category theory. Volume 53. 30 Joseph Goguen and Jos Meseguer. October 1983. 1988. Watson Research Center. Proceedings. 29 Joseph Goguen and Jos Meseguer. Models and equality for logical programe ming. 1930. and Eric Wagner. with James Thatcher. In Raymond Yeh. Topoi. Report RC 4865. editors. pages 153 162. Software for the Rewrite Rule Machine. Aristide M grelis. Correctness of recursive parallel none deterministic ow programs. In e Hideo Aiso and Kazuhiro Fuchi. with logical semantics. An introduction to OBJ3. Allyn and Bacon. Journal of the Association for Computing Machinery.A. 1978. Research Directions in Object-Oriented Programming. pages 1 22. Eric Wagner. editors. James Thatcher. pages 80 149. pages 417 477. Natural transformations and data re nement. May 1974. Lecture Notes in Computer Science. 33128. editors. Report RC 4526. 1987 TAPSOFT. Institute for New Generation Computer Technology ICOT. Initial algebra semantics and continuous algebras. Technical report. 37 William S. Yorktown Heights NY. ee 39 Horst Herrlich and George Strecker. pages 258 263. 32 Joseph Goguen and Jos Meseguer. 40 C.R. 1982. Recherches sur la th orie de la d monstration. Lecture Notes in Computer Science. 36 Robert Goldblatt. Springer. MIT. October 1986. Proceedings. 241:68 95. James Thatcher. IV. Hoare and Jifeng He. 1988. 1987. Unifying functional.ne Kirchner. Giorgio Levi. and Ugo Montanari. Proceedings. 1973.J. James Thatcher. 272:268 290. Robert Kowalski. 38 Jacques Herbrand. object-oriented and e relational programming. Conference on Conditional Term Rewriting. Volume 21. Prentice Hall. January 1977. 1987. Journal of Computer and System Sciences. 1979. Permagon. Number 10. editors. the Categorial Analysis of Logic. Springer Lecture Notes in Computer Science. I: Basic concepts and examples part 1. pages 580 595. Travaux de e e la Soci t des Sciences et des Lettres de Varsovie. In Jean-Pierre Jouannaud and Stephane Kaplan. and Jesse Wright. Conference on Mathematical Foundations of Computer Science. 1988. 35 Joseph Goguen. An early version is Initial Algebra Semantics". Preliminary version in SIGPLAN Notices. and Jesse Wright. Volume 250. International Conference on Fifth Generation Computer Systems 1988. 1973. Springer. In Bruce Shriver and Peter Wegner.

50:869 872. SRI International. Theoretical Computer Science. The Brouwer Symposium. 103:17 20. Universitat Bremen.D. Springer. An algebraic de nition of simulation between programs. Graph Reduction Workshop. Jungle evaluation for e cient term rewriting. Computer Science Laboratory. 1963. 52 Jos Meseguer and Ugo Montanari. Troelstra and van Dalen. See also Mathematical Intelligencer 5. William Lawvere.A. National Academy of Sciences. 51 Jos Meseguer and Joseph Goguen. Shambhala.41 Berthold Ho mann and Detlef Plump. 55 Eugenio Moggi. Volume 92. In e Maurice Nivat and John Reynolds.A. U. 1988. 42 Martin Hyland. 1987. 1988. Symposium on Logic in Computer Science. Technical Report CS-205. A Calculus of Communicating Systems. Technical Report 4 88. Proceedings. In A. Lecture Notes in Computer Science.S. Algebraic Methods in Semantics. induction and computability. Lecture Notes in Computer Science.. 1971. North-Holland. Technical Report ECS-LFCS-88-66. 54 Robin Milner. The e ective topos. University of Edinburgh. Laboratory for Foundations of Computer Science. Cambridge. Columbia University. 4. In Proceedings. 1983. pages 459 541. Cambridge Studies in Advanced Mathematics. Duality for groups. Proceedings. Laboratory for Foundations of Computer Science. pp. New Science Library. 50 Humberto Maturana and Francisco Varela. 47 Saunders Mac Lane. Springer. Full version in Report SRI-CSL-88-3. Stanford University. Computational lambda-calculus and monads. 1988. 1988. 43 Robert Keller and Joseph Fasel. 53 55.S. National Academy of Sciences. Summary of Ph. Fachbereich Mathematik und Informatik. Introduction to Higher Order Categorical Logic. 1989. Springer.S. 48 Saunders Mac Lane. The Tree of Knowledge. 44 Richard Kennaway. Volume 279. Volume 7. 45 Joachim Lambek and Phil Scott. submitted to Information and Computation. Categories for the Working Mathematician. 34:263 267. editors. Initiality. editors. 1987. 1985. U. On `On graph rewritings'. To the greater health of mathematics. 46 Saunders Mac Lane. Petri nets are monoids: A new algebraic e foundation for net theory. A category-theoretic account of program modules. Functorial semantics of algebraic theories. 49 F. 1948. Computer Science Department. Thesis. Cambridge. 1987. January 1988. 1971. 56 Eugenio Moggi. IEEE Computer Society. editors. No. Proceedings. 53 Robin Milner. 1980.. Mathematical Intelligencer. 19 . 1982. 52:37 58. University of Edinburgh. 1986.

59 Dana Scott.I. University of Edinburgh.A. Indexed Categories and their Applications. 1984. Center for the Study of Language and Information. Lecture Notes in Mathematics. Theoretical Computer Science. The category-theoretic solution of recursive domain equations. and Joseph Goguen. Process and Reality. An Introduction to Uni cation-Based Approaches to Grammar. Also. Formal Speci cation of Parameterized Programs in lilleanna. December 1978.57 Robert Par and Peter Johnstone. In Proceedings. Lecture Notes in Mathematics. e Springer. 60. 60 Stuart Shieber. 1982. Rod Burstall. 62 Andrzej Tarlecki. 63 William Joseph Tracz. On graph rewritings. Department of Arti cial Intelligence. to appear. Also Report D. part 3: Indexed categories. Springer. 1986. Continuous lattices. Oxford University. 58 Jean Claude Raoult. 61 Michael Smyth and Gordon Plotkin. 1991. 64 Alfred North Whitehead. 1969. Monograph PRG 77. Free. Dalhousie Conference. 91:239 264. 20 . Theoretical Computer Science. Programming Research Group. 32:1 24. pages 97 136. PhD thesis. Stanford University. Volume 661. SIAM Journal of Computation. 1972. August 1989. Volume 274. 1978. 11:761 783. Some fundamental algebraic tools for the semantics of computation.