Electronic Notes in Theoretical Computer Science
Volume 44.1 COALGEBRAIC METHODS IN COMPUTER SCIENCE CMCS'01 Genova, Italy April 6-7, 2001
Guest Editors: A. Corradini
M. Lenisa
U. Montanari
ii
Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v A Coalgebraic View of Infinite Trees and Iteration . . . . . . . . . . . . . . . . . . . . . . . . 1 Peter Aczel, Jiˇr´ı Ad´ amek and Jiˇr´ı Velebil From Varieties of Algebras to Covarieties of Coalgebras . . . . . . . . . . . . . . . . . . 27 Jiˇr´ı Ad´ amek and Hans-E. Porst Process Calculi `a la Bird-Meertens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Lu´ıs S. Barbosa Generalised Coinduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Falk Bartels Deforestation, program transformation, and cut-elimination . . . . . . . . . . . . . . 88 Robin Cockett Algebras, Coalgebras, Monads and Comonads . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Neil Ghani, Christoph L¨ uth, Federico de Marchi and John Power When is a function a fold or an unfold? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Jeremy Gibbons, Graham Hutton and Thorsten Altenkirch A Calculus of Terms for Coalgebras of Polynomial Functors . . . . . . . . . . . . .160 Robert Goldblatt Monoid-labeled transition systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 H. Peter Gumm and Tobias Schr¨ oder Modal Operators for Coequations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Jesse Hughes Two-dimensional linear algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Martin Hyland and John Power Modal Rules are Co-Implications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Alexander Kurz Invariants of monadic coalgebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Dragan Maˇsulovi´c Modal Languages for Coalgebras in a Topological Setting . . . . . . . . . . . . . . . 270 Dirk Pattinson Bialgebraic Semantics and Recursion (Extended Abstract) . . . . . . . . . . . . . . 284 Gordon Plotkin From Algebras and Coalgebras to Dialgebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 Erik Poll and Jan Zwanenburg
iii
iv
Foreword This volume contains the Proceedings of the Fourth Workshop on Coalgebraic Methods in Computer Science (CMCS’2001). The Workshop was held in Genova, Italy on April 6 and 7, 2001, as a satellite event of ETAPS’2001. The aim of the CMCS workshop series is to bring together researchers with a common interest in theory of coalgebras and its applications. Previous workshops have been organized in Lisbon (1998), Amsterdam (1999) and Berlin (2000). The proceedings appeared as ENTCS Vols. 11,19 and 33. During the last few years it is becoming increasingly clear that a great variety of state-based dynamical systems, like transition systems, automata, process calculi and class-based systems can be captured uniformly as coalgebras. The first three volumes together with the current volume demonstrate that theory of coalgebras and its applications are developing into a field of its own interest presenting a deep mathematical foundation, a growing field of applications and interactions with various other fields, such as reactive and interactive system theory, object oriented and concurrent programming, formal system specification, modal logic, dynamical systems, control systems, category theory, algebra, analysis, etc. The Program Committee of CMCS’2001 consisted of •
Alexandru Baltag (CWI, Amsterdam),
•
Andrea Corradini (Department of Computer Science, University of Pisa),
•
Bart Jacobs (Department of Computer Science, University of Nijmegen),
•
Marina Lenisa (Department of Mathematics and Computer Science, University of Udine),
•
Ugo Montanari (Department of Computer Science, University of Pisa), chair,
•
Larry Moss (Department of Mathematics, Indiana University, Bloomington),
•
Ataru T. Nakagawa (Software Research Associates, Tokyo),
•
Dusko Pavlovic (Kestrel Institute, Palo Alto),
•
John Power (Laboratory for Foundations of Computer Science, University of Edinburgh),
•
Horst Reichel (Institute of Theoretical Computer Science, Dresden University of Technology),
•
Jan Rutten (CWI, Amsterdam).
The papers in this volume were reviewed by the program committee members and by Falk Bartels, Anna Bucalo, Corina Cirstea, Pietro Di Gianantonio, Marcelo Fiore, Jesse Hughes, Alexander Kurz, Anna Labella, Lambert Meertens, Marino Miculan, Marco Pistore, Grigore Rosu, Doug Smith. This volume will be published in the series Electronic Notes in Theoretical v
Computer Science (ENTCS). This series is published electronically through the facilities of Elsevier Science B.V. and its auspices. The volumes in the ENTCS series can be accessed at the URL http://www.elsevier.nl/locate/entcs A printed version of the current volume is distributed to the participants at the workshop in Genova. We are very grateful to the following persons, whose help has been crucial for the success of CMCS’2001: Maura Cerioli and Gianna Reggio for their help with the organization of the Workshop as satellite event of ETAPS’2001; and Mike Mislove, Managing Editor of the ENTCS series, for his assistance with the use of the ENTCS style files. Thanks are also due to the Department of Computer Science of the University of Pisa, which has covered the printing cost of the copies distributed in Genova. March 13, 2000
Andrea Corradini, Marina Lenisa and Ugo Montanari
vi
CMCS’01 Preliminary Version
A Coalgebraic View of Infinite Trees and Iteration Peter Aczel 1 Department of Mathematics and Computer Science, Manchester University, Manchester, United Kingdom
Jiˇr´ı Ad´amek 2,4 Institute of Theoretical Computer Science, Technical University, Braunschweig, Germany
Jiˇr´ı Velebil 3,4 Faculty of Electrical Engineering, Technical University, Praha, Czech Republic
Abstract The algebra of infinite trees is, as proved by C. Elgot, completely iterative, i.e., all ideal recursive equations are uniquely solvable. This is proved here to be a general coalgebraic phenomenon: let H be an endofunctor such that for every object X a final coalgebra, T X, of H( )+X exists. Then T X is an object-part of a monad which is completely iterative. Moreover, a similar contruction of a “completely iterative monoid” is possible in every monoidal category satisfying mild side conditions. Key words: monad, coalgebra, monoidal category
1
Email:
[email protected] Email:
[email protected] 3 Email:
[email protected] 4 The support of the Grant Agency of the Czech Republic under the Grant No. 201/99/0310 is gratefully acknowledged. This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcs 2
´mek, Velebil Aczel, Ada
1
Introduction
There are various algebraic approaches to the formalization of computations of data through a given program, taking into account that such computations are potentially infinite. In 1970’s the ADJ group have proposed continuous algebras, i.e., algebras built upon CPO’s so that all operations are continuous. Here, an infinite computation is a join of the directed set of all finite approximations, see e.g. [7]. Later, algebras on complete metric spaces were considered, where an infinite computation is a limit of a Cauchy sequence of finite approximations, see e.g. [6]. In the present paper we show that a coalgebraic approach makes it possible to study infinite computations without any additional (always a bit arbitrary) structure — that is, we can simply work in Set, the category of sets. We use the simple and well-known fact that for polynomial endofunctors H of Set the algebra of all (finite and infinite) properly labelled trees is a final H-coalgebra. Well, this is not enough: what we need is working with “trees with variables”, i.e., given a set X of variables, we work with trees whose internal nodes are labelled by operations, and leaves are labelled by variables and constants. This is a final coalgebra again: not for the original functor, but for the functor H + CX : Set −→ Set where CX is the constant functor with value X. We are going to show that for every polynomial functor H : Set −→ Set (a) final coalgebras T X of the functors H + CX form a monad, called the completely iterative monad generated by H, (b) there is also a canonical structure of an H-algebra on each T X, and all these canonical H-algebras form the Kleisli category of the completely iterative monad, and (c) the H-algebra T X has unique solutions of all ideal systems of recursive equations. A surprising feature of the result we prove is its generality: this has nothing to do with polynomiality of H, nor with the base category Set. In fact, given an endofunctor H of a category A with binary coproducts, and assuming that each H +CX has a final coalgebra, then (a)–(c) hold. Moreover, the completely iterative monad T : A −→ A, as an object of the endofunctor category [A, A], of [A, A]: is a final coalgebra of the following endofunctor H H(B) = H · B + 1A for all B : A −→ A. Now [A, A] is a monoidal category whose tensor product ⊗ is composition and unit I is 1A. And the completely iterative monad generated by H is a monoid in [A, A]. We thus turn to the more general problem: given a monoidal category B, we call an object H iteratable provided that the endofunctor : B −→ B given by H(B) H = H ⊗ B + I has a final coalgebra T . Assuming 2
´mek, Velebil Aczel, Ada
that binary coproducts of B distribute on the left with the tensor product, we deduce that T has a structure of a monoid, called the completely iterative monoid generated by the object H. Coming back to polynomial endofunctors of Set: the solutions of equations mentioned in (c) above refer to a topic extensively studied in 1970’s by C. C. Elgot [11], J. Tiuryn [18], the ADJ group [7] and others: suppose that X and Y are disjoint sets of variables and consider equations of the form x0 = t0 (x0 , x1 , x2 , . . . , y0 , y1 , y2 , . . .) x1 = t1 (x0 , x1 , x2 , . . . , y0 , y1 , y2 , . . .) .. . where xi are variables in X and yj are variables in Y , while ti are trees using those variables. Following Elgot, we call the system ideal provided that each tree ti is different from any variable, more precisely, ti ∈ T (X + Y ) \ η[X + Y ] for each i = 0, 1, 2, . . . It then turns out that the system has a unique solution in T Y . That is, there exists a unique sequence si (y0 , y1 , y2 , . . .) of trees in T Y for which the following equalities s0 (yi ) = t0 (s0 (yi ), s1 (yi ), . . . , yi , . . .) (1) s1 (yi ) = t1 (s0 (yi ), s1 (yi ), . . . , yi , . . .) .. . hold. Expressed categorically, an ideal system of equations is a morphism e : X −→ T (X + Y ) which factors through the H-algebra structure τX+Y : HT (X + Y ) −→ T (X + Y ) mentioned in (b) above: e
X (2) %
/ T (X + Y ) nn6 n nn n n nnτX+Y nnn
HT (X + Y ) A solution of e is given by a morphism
e† : X −→ T Y for which the following diagram e†
X (3)
e
/TY O µY
T (X + Y )
T [e† ,ηY ]
/TTY
commutes. (Here, µY : T T Y −→ T Y is the multiplication of the completely iterative monad. In case of polynomial functors this takes a properly labelled 3
´mek, Velebil Aczel, Ada
tree whose leaves are again properly labelled trees, and it delivers the properly labelled tree obtained by ignoring the internal structure.) In fact, the morphism T [e† , ηY ] takes a tree with variables from X + Y on its leaves and substitutes the solution-tree e† (x) for each occurence of the variable x ∈ X. Thus the equality (3), i.e., e† (x) = µY · T [e† , ηY ](e(x)) for all x ∈ X precisely corresponds to the condition (1) above. Now in this categorical formulation we can, again, forget about polynomiality and about Set: if H has final coalgebras for all functors H + CX , then we prove that every ideal equation-morphism e : X −→ T (X + Y ) has a unique solution, i.e., a unique morphism e† : X −→ T Y for which (3) commutes. Related work. After finishing the present version of our paper we have found out that a similar topic is discussed by L. Moss in his preprints [15] and [16].
2
A Completely Iterative Monad of an Endofunctor
Assumption 2.1 Throughout this section, H denotes an endofunctor of a category A with finite coproducts. Whenever possible we denote by inl : X −→ X + Y
and inr : Y −→ X + Y
the first and the second coproduct injections. Remark 2.2 For the functor H( ) + CX : A −→ A i.e., for the coproduct of H with CX (the constant functor of value X) it is well-known that initial (H + CX )-algebra ≡ free H-algebra on X. (See [4].) More precisely, suppose that F X together with αX : HF X + X −→ F X is an initial (H + CX )-algebra. The components of αX form an H-algebra ϕX : HF X −→ F X and 0 : X −→ F X. a universal arrow ηX
That is, for every H-algebra HA −→ A and for every morphism f : X −→ A there exists a unique homomorphism f : F X −→ A of H-algebras with 0 . f = f · ηX
4
´mek, Velebil Aczel, Ada
Example 2.3 Polynomial endofunctors of Set. These are the endofunctors of the form An × Z n HZ = A0 + A1 × Z + A2 × Z × Z + . . . = n 1 then M is (m, 0)-refinable iff it is positive. For the remaining cases we prove: Proposition 5.10 For any m, n > 1 we have: A commutative monoid is (m, n)-refinable, iff it is (2, 2)-refinable. Proof. In an (m, n+1)-refinement of r1 +. . .+rm = c1 +. . .+cn +0, we can add corresponding elements from the last two rows to obtain an (m, n)-refinement of r1 + . . . + rm = c1 + . . . + cn , so one direction is clear. The other direction is proved by an easy induction over the number of columns, followed by a similar induction over the number of rows. As a hint, we show how to get from (2, 2) to (3, 2): Given r1 + r2 + r3 = c1 + c2 , use the (2, 2) refinement property to find a 2 × 2-matrix (ai,j ) with column sums c1 , c2 and row sums r1 , (r2 + r3 ). Now a2,1 + a2,2 = r2 + r3 , so there is another 2 × 2 matrix with row sums r2 , r3 and column sums a2,1 , a2,1 : b1,1 b1,2 r2
a1,1 a1,2 r1 a2,1 a2,2 r2 + r3 c1
and
c2
b2,1 b2,2 r3 a2,1 a2,2
197
¨ der Gumm and Schro
obviously now, the following matrix solves the original problem: a1,1 a1,2 r1 b1,1 b1,2 r2 b2,1 b2,2 r3 c1
c2
As a consequence of this proposition, we may simply call a commutative monoid refinable if it is (2, 2)-refinable. Refinability does not imply positivity, since nontrivial abelian groups, for instance, are refinable, but not positive. For the next section, we shall need the following observation, referring to infinite matrices: Lemma 5.11 Suppose that M is refinable. Given X, Y nonempty sets, σ ∈ X Y Mω and τ ∈ Mω with (σ(x) | x ∈ X) = (τ (y) | y ∈ Y ). There exists an |X| × |Y |-matrix (mx,y ) with row sums (mx,y | y ∈ Y ) = σ(x) and column sums (mx,y | x ∈ X) = τ (y), where all but finitely many mx,y are 0. Proposition 5.10 makes it easy to check that the first two instances of example 5.8 are refinable. In fact, any commutative monoid which is cancellative and which satisfies ∀c, r ∈ M.∃x ∈ M. c = x + r or r = x + c is easily seen to be refinable. This also covers the case of (N, +, 0). In the case of (N \ {0}, ·, 1), refinability is a consequence of the fact that every element has a unique prime factor decomposition. Refinability does not carry over to submonoids. Consider, for instance, the submonoid (N \ {0, 2}, ·, 1) of the previous example, and the refinement problem 5 · 6 = 3 · 10. Any refinement would require the prime factor 2, which is unavailable. In the case of a lattice L, we obtain a familiar property: Lemma 5.12 If L is a lattice with smallest element 0, then (L, ∨, 0) is refinable if and only if L is distributive. Proof. Given a distributive lattice L and a, b, c, d ∈ L with a ∨ b = c ∨ d, then we have a refinement a∧c a∧d a b∧c b∧d b c
d
Conversely, if L is not distributive, then one of the following lattices, known 198
¨ der Gumm and Schro
as N5 , resp. M3 , must be a sublattice of L (see e.g. [Gr¨a98]):
N5 =
b ?? ?? ?? ?
p PPP
PPP
p
c M3 =
na nnn
q nn
? ??? ?? ? a ?? c b ?? ?? ?
q
In both cases, a ∨ b = b ∨ c. Suppose we had a refinement xya z ub b c with x, y, u, v ∈ L. From the table, it follows that u ≤ b and u ≤ c, so u ≤ b ∧ c = q ≤ a. Also, y ≤ a, hence u ∨ y = c ≤ a. But c ≤ a, both in M3 and in N5 . 5.3
Weak pullback preservation (−)
We now study conditions under which the functor Mω weakly preserves nonempty kernel pairs, pullbacks along injectives, or arbitrary pullbacks. A functor F is said to (weakly) preserve pullbacks along injective maps, provided for any f : X → Z and g : Y → Z with g injective, a (weak) pullback of f with g is transformed by F into a weak pullback of F (f ) with F (g). In [GS00], we have shown that a Set-endofunctor F weakly preserves nonempty pullbacks along injective maps if and only the preimage ϕ− [V ] of any F -subcoalgebra V ≤ B under a homomorphism ϕ : A → B is again a subcoalgebra of A. For L-coalgebras, this condition is always satisfied according to corollary 3.7. We shall see, however, that this is not necessarily the case for Mω coalgebras. In fact we shall algebraically characterize those monoids M for (−) which Mω preserves weak pullbacks along injective maps. Finally, we consider preservation of arbitrary weak pullbacks. Theorem 5.13 Let M = (M, +, 0) be a commutative monoid. (−)
(i) Mω (weakly) preserves nonempty pullbacks along injective maps iff M is positive. (−)
(ii) Mω (iii)
(−) Mω
weakly preserves nonempty kernel pairs iff M is refinable. weakly preserves nonempty pullbacks iff M is positive and refinable.
Proof. (i): Assume that M is positive, and let ϕ : A → B be a homomorphism of M-coalgebras and V a subcoalgebra of B. We need to show that 199
¨ der Gumm and Schro m
ϕ−1 [V ] is a subcoalgebra of A. Given a ∈ ϕ−1 [V ], a ∈ / ϕ−1 [V ] and a−→a , we / V , so by part need to show that m = 0. We know that ϕ(a) ∈ V and ϕ(a ) ∈ 0 (i) of lemma 5.3 we conclude ϕ(a)−→ϕ(a ). Part (ii) of the same lemma then n yields (n | a−→x, ϕ(x) = ϕ(a )) = 0. Positivity forces each summand to be 0, in particular m = 0. To prove the converse, let m1 , m2 ∈ M be given with m1 + m2 = 0. Consider the coalgebra A, given by a point p and two transitions to points q1 and q2 , labeled with m1 and m2 . Let B consist of two points r and s with no transitions (all transitions labeled with 0). We get a homomorphism ϕ with ϕ(p) = r and ϕ(q1 ) = ϕ(q2 ) = s. Now {r} is a subcoalgebra of B, and the assumption forces ϕ−1 {r} = {p} to be a subcoalgebra of A, but this implies m1 = m2 = 0.
A=
p ??? ??m2 m1 ?? ?
q1
r ϕ
/
q2
0
=B
s
A slight modification of this construction also gives us the backward direction of (ii): Assume that F weakly preserves nonempty kernel pairs, then kernels of homomorphisms are bisimulations. Suppose m1 + m2 = s1 + s2 in M. We take a copy A of A as above, but we label the arcs of A with s1 and s2 . If B is obtained from B by changing the edge label to m1 + m2 = s1 + s2 , there is an obvious homomorphism ϕ : A + A → B . Its kernel must be a bisimulation, so lemma 5.5, provides us with a refinement of m1 +m2 = s1 +s2 . We combine the ’if’-directions of (ii) and (iii): Assume that M is refinable. Given homomorphisms ϕ : A → C, and ψ : B → C, we need to show that pb(ϕ, ψ) := {(a, b) | ϕ(a) = ψ(b)} is a bisimulation between A and B. Let (a, b) ∈ pb(ϕ, ψ) be given. We shall define an |A| × |B|-matrix (mx,y ) with entries from M , satisfying the conditions of lemma 5.5. rx ˆ (a, x), i.e. a−→x, For any c ∈ ϕ[A] ∩ ψ[B], put X := ϕ−1 ({c}) and rx := α ˆ y) for every y ∈ Y . for any x ∈ X . Similarly, Y := ψ −1 ({c}) and cy = β(b, With lemma 5.11 we obtain an |X| × |Y | matrix (mcx,y ) with row sums (rx )x∈X and column sums (cy )y∈Y . Observe that we can achieve that •
for all but finitely many c is (mcx,y ) the 0-matrix
•
all but finitely many entries in each (mcx,y ) are 0. The final |A| × |B|-matrix (mx,y ) is obtained by putting all (mcx,y ) together 200
¨ der Gumm and Schro
and filling up with zeroes: ···
0
···
0 (mcx,y ) 0 ···
0
mx,y
" mcx,y := 0
if ϕ(x) = c = ψ(y), otherwise.
···
By construction, mx,y = 0 implies (x, y) ∈ pb(ϕ, ψ). Moreover, all but r Suppose now that a−→a . We need finitely many entries of (mx,y ) are zero. to show that the a -th row sum is r, i.e. (ma ,b | b ∈ B) = r. Let c := ϕ(a ). If ψ −1 ({c}) = ∅ then (ma ,b | b ∈ B) = (mca ,b | b ∈ B) = r. If ψ −1 ({c}) = ∅ (this case cannot happen in (ii)), we shall invoke s positivity to show r = 0. Specifically, for s with ϕ(a)−→c we have m m (m | b−→b , ψ(b ) = c) = 0. (m | a−→a , ϕ(a ) = c) = s = Hence r + u = 0 for some u ∈ M , whence r = 0. A more elegant way to see (iii) is to directly conclude it from (i) and (ii), by invoking the following lemma from the second author’s thesis: Lemma 5.14 [Sch01] A Set-endofunctor weakly preserves pullbacks iff it weakly preserves kernel pairs and pullbacks along injective maps.
6
Discussion
One motivation for this study was to provide a repository of examples of Setendofunctors with particular combinations of preservation properties. This we achieve by parameterizing a certain class of functors with algebraic structures and translating the functorial properties into corresponding algebraic laws. For instance, theorem 5.13 can be used to obtain an example of a functor weakly preserving nonempty kernel pairs, but not weakly preserving nonempty pullbacks: Simply choose for M any nontrivial abelian group. (−) Of course, L-coalgebras and Mω -coalgebras as L-, resp. M-labeled transition systems are of independent interest. L-valued sets and relations are considered by Goguen in [Gog67]. In the book [FS90], Freyd and Scedrov consider the following operations on “L-valued relations” R : A × B → L and S : B × C → L: 2 (R ◦ S)(a, c) := {R(a, b) ∧ S(b, c) | b ∈ B}. When L = {0, 1}, this agrees with the familiar composition of relations. The 201
¨ der Gumm and Schro
authors remark that this operation is associative iff L is join infinitely distributive (JID), also called a locale in [Bor94]. (−) L. Moss, in [Mos99], considers the following subfunctor of R+ : Q(X) := {f : X → R | supp(f ) finite, f (x) = 1}. x∈X
Coalgebras of this functor are stochastic transition systems([Mos99],[dVR99]). Moss invokes the “Row/Column-theorem” for R+ , which is to say that R is (m, n)-refinable for each m, n > 1, to show that Q weakly preserves pullbacks. (He attributes the proof of the Row/Column theorem to Saley Aliyari). We have borrowed the term refinable from a classical line of algebraic investigation, asking for the existence of unique product decompositions of finite algebras. If A1 × . . . × Am ∼ = B1 × . . . × Bn are two representations of the same finite algebra as a product of indecomposables, one would like to conclude m = n and Bi ∼ = Aτ (i) , for some permutation τ . It is easy to come up with examples of finite algebras that do not have unique decompositions. In such cases it may still be possible to prove a refinement property: Given that A1 × . . . × Am ∼ = B1 × . . . × Bn , then each factor can be further decomposed into a product of smaller algebras Qi,j , until one has the same collection of factors Qi,j on the left and on the right side. J.D.H. Smith has reminded us of a result of B. J´onsson and A. Tarski [JT47] which states that a class of algebras, amongst whose operations are a binary operation + and a constant 0, which is neutral with respect to + and idempotent for all fundamental operations, has the (m, n)-refinement property. This means that the class of all finite J´onsson-Tarski algebras, with the monoid structure given by the direct product (×) and with {0} as neutral element, is a refinable monoid. J´onsson and Tarski needed the operations + and 0 to represent direct products as “inner products”. Without some such assumptions, refinement is not possible in general, for refinement implies cancellability: A × B ∼ = ∼ A × C =⇒ B = C. When A has a 1-element subalgebra, cancellability holds, according to L. Lov´asz ([Lov67]), but otherwise, one needs to replace “isomorphy” by the weaker notion of “isotopy”, see [Gum77]. A refinement theorem up to isotopy for algebras in congruence modular varieties has been proved in [GH79].
References [Bor94] F. Borceux, Handbook of categorical algebra 1: basic category theory, Cambridge University Press, 1994. [dVR99] E.P. de Vink and J.J.M.M. Rutten, Bisimulation for probabilistic transition systems: a coalgebraic approach, Theoretical Computer Science (1999), no. 211, 271–293.
202
¨ der Gumm and Schro
[FS90] P. Freyd and A. Scedrov, Categories, allegories, Elsevier, 1990. [GH79] H.P. Gumm and C. Herrmann, Algebras in modular varieties: Baer refinements, cancellation and isotopy, Houston Journal of Mathematics 5 (1979), no. 4, 503–523. [Gog67] J.A. Goguen, L-fuzzy sets, Journal of Mathematical Analysis and Applications (1967), no. 18, 145–174. [Gr¨ a98] G. Gr¨ atzer, General lattice theory, Birkh¨ auser Verlag, 1998. [GSa] H.P. Gumm and T. Schr¨ oder, Coalgebras of bounded type, Submitted. [GSb] H.P. Gumm and T. Schr¨ oder, Products of coalgebras, Algebra Universalis, to appear. [GS00] H.P. Gumm and T. Schr¨ oder, Coalgebraic structure from weak limit preserving functors, CMCS (2000), no. 33, 113–133. [Gum77] H.P. Gumm, A cancellation theorem for finite algebras, Coll. Math. Soc. J´ anos Bolyai (1977), 341–344. [Gum98] H.P. Gumm, Functors for coalgebras, Algebra Universalis, to appear, 1998. [JT47] B. J´ onsson and A. Tarski, Direct decompositions of finite algebraic systems, Notre Dame Mathematical Lectures (1947), no. 5. [Lov67] L. Lov´ asz, Operations with structures, Acta. Math. Acad. Sci. Hungar. 18 (1967), 321–328. [Mos99] L.S. Moss, Coalgebraic logic, Annals of Pure and Applied Logic 96 (1999), 277–317. [Pfe99] S. Pfeiffer, Funktoren f¨ ur Coalgebren, Master Thesis, Universit¨ at Marburg, 1999. [Rut00] J.J.M.M. Rutten, Universal coalgebra: a theory of systems, Theoretical Computer Science (2000), no. 249, 3–80. [Sch01] T. Schr¨ oder, Coalgebren und Funktoren, PhD-Thesis, Philipps-Universit¨ at Marburg, 2001.
203
CMCS’01 Preliminary Version
Modal Operators for Coequations Jesse Hughes Dept. of Philosophy Carnegie Mellon University Pittsburgh, PA 15213
[email protected]
Abstract We present the dual to Birkhoff’s variety theorem in terms of predicates over the carrier of a cofree coalgebra. We then discuss the dual to Birkhoff’s completeness theorem, showing how closure under deductive rules dualizes to yield two modal operators acting on coequations. We discuss the properties of these operators and show that they commute, and we prove the invariance theorem, which is the formal dual of the completeness theorem.
1
Introduction
Jan Rutten’s development of the theory of coalgebras in [Rut96] provided a foundation for coalgebraic semantics for computer science. In addition, he proved the dual to Birkhoff’s variety theorem [Bir35] for coalgebras over Set. The covariety theorem states that a class V of coalgebras is closed under (regular) subcoalgebras, coproducts and codomains of epis just in case V is “coequationally definable”. The notion of a coequation and coequation satisfaction arises as the formal dual of sets of equations and equation satisfaction in categories of algebras. Peter Gumm and Tobias Schr¨oder continued work on the duals of Birkhoff’s theorems for coalgebras over Set in [GS98], where they dualized the deductive completeness theorem as well. Namely, they showed that, given a regular injective coalgebra A, α, the partial order of quasi-covarieties definable by conditional coequations over A, α is isomorphic to the invariant subcoalgebras of A, α. Here, the notion of invariance arises as the dual of closure of sets of equations under substitution of terms for variables. In ibid, we also find the first discussion of “complete” or “behavioral” covarieties. These covarieties are definable by coequations over one “color” This research is part of the Logic of Types and Computation project at Carnegie Mellon University under the direction of Dana Scott. This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcs
Hughes
or, equivalently, are the covarieties closed under total bisimulations. The work on coalgebraic specifications in [RJT01], for instance, involves giving models for classes in an object oriented language as behavioral covarieties in an appropriate category of coalgebras. Hence, we can understand this approach in terms of coequations over a single color. These coequations are dual to variable-free equations for a class of universal algebras, and so one has the idea that there is much more expressive power to exploit in the theory of coequations. We provide examples of coequations here which illustrate some of the expressive power available when one moves from behavioral covarieties to covarieties in general. See also [Ro¸s00] for a discussion of behavioral covarieties, called “sinks” there, and [AH00] or [Hug01] for a synthesis of the work of [GS98] and [Ro¸s00], as well as some further discussion of behavioral covarieties. In this paper, we develop the theory of coequations from a logical viewpoint. A coequation ϕ over a set C of colors is a regular subobject of U HC, the carrier of the cofree coalgebra over C. Hence, we can view ϕ as a predicate over U HC. In particular, we can form new coequations out of old by means of the logical connectives ∧, →, etc. Furthermore, we have available a modal operator ✷ taking a coequation ϕ to the (carrier of the) largest subcoalgebra ✷ϕ contained in the coequation. This modal operator is dual to taking a set E of equations to the least congruence containing E — hence, it is dual to closure of E under the first four rules of inference of Birkhoff’s equational logic. So we see that closure of E under deductive inferences is dual to the addition of related modal operators to Sub(U HC). We introduce a modal operator that is dual to closure under Birkhoff’s fifth rule of inference, substitution of terms for variables. We confirm that is an S4 operator and show that, under certain conditions, commutes with ✷. We then prove the invariance theorem in terms of and ✷. In this way, we develop the coequations-as-predicates view by augmenting the predicates over U HC with two modal operators ✷ and and show that the partial order of covarieties definable by coequations over C is isomorphic to the partial order of predicates ϕ over U HC such that ϕ = ✷ ϕ. In Section 2, we summarize the dual of Birkhoff’s variety theorem, introducing the relevant terminology and results. In Section 3, we generalize the covariety theorem to accommodate quasi-covarieties and conditional coequations. Section 4 is a categorical presentation of Birkhoff’s deductive completeness theorem and its dual, the invariance theorem. We discuss the well-known greatest subcoalgebra operator, ✷, in Section 5 and show that it is an S4 modal operator that commutes with pullbacks along homomorphisms. In Section 6, we introduce a second S4 operator, , taking a coequation to its largest invariant sub-coequation. This allows an easy proof of the invariance theorem in terms of the operators ✷ and in Section 7. This work forms part of the author’s doctoral dissertation, written under the supervision of Professors Dana S. Scott and Steve Awodey. Professor 205
Hughes
Scott suggested research into the dual of Birkhoff’s theorems, and that research and the presentation found here benefited from many conversations with both Professors Scott and Awodey. I also benefited from conversations with Jiˇr´ıAd´amek, who pointed us to the Banaschewski and Herrlich article, Peter Gumm and Bart Jacobs.
2
The dual of Birkhoff ’s variety theorem
We begin with a brief summary of the dual of Birkhoff’s variety theorem. This section summarizes the work found in [AH00], which can be viewed as a generalization of [Rut96] and [GS98]. A similar account of the covariety theorem can be found in [Kur00], and a similar categorical approach to the variety theorem for categories of algebras can be found in [BH76]. We start with some terminology. Recall that a morphism is a regular mono just in case it is the equalizer for some pair of maps, and that a subobject is regular in case its inclusion is a regular mono. In what follows, we call an object C regular injective if it is injective for regular subobjects; that is, if whenever B is a regular subobject of A, then every /C f :B can be extended to a (not necessarily unique) map /C
g :A such that the diagram 1 below commutes.
/C ~> ~ ~ ~~ _RL ~~ f
AO
g
B
We say that a category E has enough regular injectives if, for every object A ∈ E, there is a regular injective C such that A is a regular subobject of C. Definition 2.1 We say that a category E is quasi-co-Birkhoff if it is regularly well-powered, cocomplete and has epi-regular mono factorizations. If, in addition, E has enough regular injectives, then E is co-Birkhoff. A full subcategory of a quasi-co-Birkhoff category is a quasi-covariety iff it is closed under coproducts and codomains of epis. A quasi-covariety of a co-Birkhoff category is a covariety iff it is also closed under regular subobjects. In fact, we could replace regular monos with strong monos throughout what follows and the results shown here would still apply. This entails weakening some assumptions (for instance, E needs only have epi-strong mono factorizations) while strengthening others (for instance, E needs enough strong 1
We use ,2 / to denote regular monos.
206
Hughes
injectives). We prefer to present the material in terms of regular monos, since there is a natural relationship between regular epis and sets of equations in the algebraic setting. Example 2.2 The category EG of coalgebras for a comonad G = G, ε, δ forms a covariety in the category EG of coalgebras for the functor G. Given a map f :A / B in a category with epi-regular mono factorizations, we denote by Im(f ) (read “the image of f ) the object through which f uniquely (up to isomorphism) factors via an epi followed by a regular mono. We denote the partial order of regular subobjects of A by Sub(A). A map f :A / B induces a functor f ∗ :Sub(B)
/ Sub(A),
by pulling back a regular subobject of B along f . This functor has a left adjoint, / Sub(B), ∃f :Sub(A)
which takes a regular subobject i :P ,2 / A to Im(f ◦ i). Recall that an object A is orthogonal to an arrow f :B / C (written A ⊥ f ) if, for every g : A / C , there is a unique map h : A / B such that g = f ◦ h (see [Bor94, Volume 2]). Given a collection 2 S ⊆ E1 of arrows of E, the class S⊥ ⊆ E0 is the collection of all A such that, for all f ∈ S, A ⊥ f . The following theorem can be found in [AH00] or [Hug01].
Theorem 2.3 If C is a co-Birkhoff category, then V is a covariety iff V = S⊥ for some collection S of regular monos with regular injective codomains. One can show that, if G = G, ε, δ is a comonad on a quasi-co-Birkhoff category and G preserves regular monos, then EG inherits the epi-regular mono factorizations from E. We use this fact to prove the following. Theorem 2.4 Let G = G, ε, δ be a comonad on a (quasi-)co-Birkhoff category E and suppose that G preserves regular monos. Then EG is (quasi-)coBirkhoff. In fact, Theorem 2.4 applies more generally than stated. If E is a quasico-Birkhoff category and Γ is any endofunctor that preserves regular monos, then the category EΓ of coalgebras for the endofunctor Γ is quasi-co-Birkhoff. We do not need cofree Γ-coalgebras for this result. Throughout what follows, we state our theorems in terms of coalgebras for a comonad, although we often indicate when the theorem applies to coalgebras for an endofunctor as well. The advantage of working with coalgebras for a comonad is that covarieties in EG are themselves comonadic over E, and so the results here may be “iterated”. Also, any category EΓ of coalgebras for 2
When we use the word collection, we allow that it is a proper class. We often abuse set notation and adopt it for classes in what follows.
207
Hughes
an endofunctor is, given the presence of cofree coalgebras, equivalent to a category EG of coalgebras for a comonad (see [Tur96]). Since we often require cofree coalgebras in what follows, it’s reasonable to work with categories of coalgebras for a comonad. We let U : EG / E (or U : EΓ / E , resp.) denote the coalgebraic forgetful functor and H :E / EG (H :E / EΓ , if it exists, resp.) be the right adjoint of U . We omit U when convenient, writing A for U A, α and just p for U p. Theorem 2.4 ensures that categories of coalgebras are (quasi-)co-Birkhoff, assuming that the base category is and that G preserves regular monos. Thus, the abstract co-Birkhoff theorem applies. In order to understand Theorem 2.3 in categories of coalgebras, we introduce the notion of coequation. Definition 2.5 Let C ∈ E be regular injective. A coequation over C is a regular subobject ϕ ≤ GC(= U HC). We say that a coalgebra A, α satisfies ϕ (written A, α |= ϕ) just in case, for every homomorphism / HC
p :A, α
/ C ), there is a unique map
(equivalently, every “coloring” A
/ϕ
p:A making the diagram below commute. A
p
p
/ GC O LR !_
ϕ
If V is a class of coalgebras, we write V |= ϕ just in case each A, α ∈ V satisfies ϕ. In other words, A, α |= ϕ if, for every homomorphism p :A, α
/ HC ,
we have Im(p) ≤ ϕ, or, equivalently, 1 ≤ p∗ ϕ. We similarly define, for each p :A, α / HC , A, α |= ϕ(p) iff Im(p) ≤ ϕ. Equivalently, following the presentation of [AN82] (also found in [AR94]), one could say that a coalgebra A, α satisfies a coequation ϕ over C just in case A, α is projective with respect to the inclusion ϕ ,2 / U HC . In these terms, Theorem 2.3 says that any covariety is S-Proj for some collection S of regular monos with regular injective codomains. A coequation ϕ over C can be viewed as a predicate over GC. Thus, if Sub(GC) is a Heyting algebra, we can construct coequations ϕ ∧ ψ, ϕ → ψ, etc., and so we see that coequations over C come with a natural structure. 208
Hughes
Continuing this interpretation, if ϕ, ψ ∈ Sub(GC), we often write ϕ , ψ to mean ϕ ≤ ψ. It is easy to see that, if ϕ , ψ and A, α |= ϕ, then A, α |= ψ. If we view coequations ϕ over C as predicates of a variable x of type GC, one may interpret pullback of coequations along homomorphisms / GC
p :A, α
as substitution of p(y) (where y is a variable of type A) for x, i.e., p∗ ϕ = ϕ[p(y)/x]. Thus, A, α |= ϕ just in case, for every homomorphism p, we have 1 , ϕ[p(y)/x]. Remark 2.6 In the case of equations, one can easily distinguish between single equations and sets of equations. Gumm makes a similar distinction between single coequations and sets of coequations in [Gum01], by interpreting coequation satisfaction as an exclusionary condition, we prefer to keep the definition of satisfaction above, in keeping with our view of coequations as predicates. Hence, we do not distinguish between single coequations and sets of coequations. This notion of coequation allows a more familiar statement of the dual of Birkhoff’s variety theorem. Theorem 2.7 Suppose E is co-Birkhoff and G preserves regular monos. Then a full subcategory V of EG is a covariety iff there is a collection S of coequations such that for all A, α, A, α ∈ V iff ∀ϕ ∈ S A, α |= ϕ. If, furthermore, G is bounded by C, then for each covariety V, there is a coequation ϕ over C such that A, α ∈ V iff A, α |= ϕ. The definition of a bounded functor can be found in [Rut96] or [GS98], for instance, where Theorem 2.7 is proved for coalgebras over Set. A proof of this theorem in a more general setting can be found in [Hug01] or [Kur00]. The following corollary is a generalization of Theorem 12 from[Jac95], where the author proves it for a restricted class of coequations over Set, namely those coequations that arise as equalizers of a pair of terms related to the functor G. Corollary 2.8 Let E be co-Birkhoff and G preserves regular monos, and let V be a covariety of EG . Then the forgetful functor /E
V
is comonadic. Moreover, the associated comonad preserves regular monos and so V is again co-Birkhoff. 209
Hughes / E is the composite
Proof. The forgetful functor V V
UV
/ EG U
/E .
To show that this composite is comonadic, it suffices to show (by the dual of [Bor94, Volume 2, Theorem 4.4.4] that the following hold: (i) U ◦ UV has a right adjoint; (ii) U ◦ UV reflects isomorphisms; (iii) U ◦ UV creates equalizers of pairs •
f g
//
•
such that U ◦ UV f , U ◦ UV g have a split equalizer in E. Condition (i) follows from Theorem 3.4, below. Condition (ii) is easily verified and (iii) follows from the same condition for U and the fact that UV creates equalizers. ✷ Remark 2.9 In the examples that follow, we prefer to describe the coalgebras as coalgebras for an endofunctor, rather than coalgebras for a comonad. Because these examples involve categories EΓ in which the forgetful functor has a right adjoint, there is a comonad G such that EΓ ∼ = EG [Tur96] and hence the previous results apply. Example 2.10 Fix a set of “inputs”, I and let Γ :Set
/ Set be defined by
ΓS = (Pfin S)I , where Pfin is the covariant finite powerset functor. A Γ-coalgebra S, σ can be regarded as a non-deterministic automaton over I, where the structure map gives the transition function. Explicitly, for each state s ∈ S and each input i ∈ I, we write s i / s just in case s ∈ σ(s)(i). The deterministic automata are those automata S, σ such that, for each s ∈ S and each i ∈ I, there is at most one s such that s i / s . Let Det denote the class of deterministic automata, so Det ⊆ SetΓ . Then it is easy to see that Det is a covariety in SetΓ . In fact, one can show that there is a coequation ϕ over 2 colors that defines Det. Namely, define ϕ ⊆ U H2 by ϕ = {x ∈ U H2 | ∀i ∈ I ∀y, z ∈ δ(x)(i) . ε2 (y) = ε2 (z)}, where δ : U H2 show that
∼ =
/ ΓU H2 is the structure map for H2. Then, it is easy to
A, α |= ϕ iff A, α ∈ Det . 210
Hughes
Example 2.11 Fix a set Z and let Γ :Set
/ Set be the functor
ΓX = Z × X. Any Γ-coalgebra A, α can be viewed as a collection of streams over Z, then, in which the same stream may be multiply represented as elements of A. The cofree coalgebra HN is the final N × Z × − coalgebra – i.e., HN = (N × Z)ω . Given an element σ ∈ HN, we can define Col(σ) = {π1 ◦ σ(i) | i < ω} (equivalently, Col(σ) = {εN ◦ ti (σ) | i < ω}, where t is the tail destructor). In other words, Col(σ) is the set of all colors that occur in the stream σ. Define a coequation ϕ over N by ϕ = {σ | card(Col(σ)) < ℵ0 }, (where card(X) is the cardinality of X) so σ ∈ ϕ just in case only finitely many colors occur in σ. One can check that, for any Γ-coalgebra A, α, we have A, α |= ϕ just in case, for all a ∈ A, there is n ≥ 0, m > 0 such that tn (a) = tn+m (a), (where α = h, t). In other words, A, α |= ϕ iff each stream in A has only a finite number of “states”. Remark 2.12 If one is interested not in equality of states, but in the observable behavior of streams, then one might require instead that, for every a ∈ A, there is n ≥ 0, m > 0 such that for all i ≥ 0, h ◦ tn+i (a) = h ◦ tn+m+i (a). This condition can be specified by a coequation over 1 color. Remark 2.13 One can easily generate other interesting coequations using Example 2.11. First, it’s easy to see that the same idea can be used with polynomial functors in general. Second, one can require that each state begins repeating within n applications of the destructors by replacing ℵ0 with n in the definition of ϕ.
3
Conditional coequations
In Definition 2.5, we defined a coequation ϕ over C as a regular subobject ϕ ,2
/ U HC
211
Hughes
in E. In this section, we generalize the notion of coequation to include regular subobjects / A, α ϕ ,2 where A, α is an arbitrary coalgebra. Definition 3.1 A conditional coequation over A, α is any regular subobject ϕ ≤ A = U A, α. We say that B, β |=α ϕ (or just B, β |= ϕ) if and only if, for every homomorphism / A, α,
p :B, β
Im(p) ≤ ϕ. We sometimes drop the word “conditional” and refer to ϕ ≤ A as a coequation over A, α. We adopt the name conditional coequation because the semantics introduced in Definition 3.1 arise from the dual of conditional equations in the algebraic case. Given two coequations, ϕ and ψ, over C, we say that B, β |= ϕ ⇒ ψ just in case, for every / HC ,
p :B, β
if B, β |= ϕ(p), then B, β |= ψ(p). (In [Kur99] and [Kur00], ϕ ⇒ ψ is denoted ϕ/ψ.) Now, for any pair of coequations ϕ and ψ over C, there is a coalgebra A, α and a conditional coequation ϑ over A, α such that, for all B, β, B, β |= ϕ ⇒ ψ iff B, β |=α ϑ. Namely, we can take A, α = [ϕ]HC (see Section 5 for the definition of [−]) and ϑ = A ∧ ψ. On the other hand, given a conditional coequation ϑ over A, α, we can view both ϑ and A as coequations over A — that is, as subobjects of U HA. It is easy to check that B, β |=α ϑ iff B, β |= A ⇒ ϑ. Remark 3.2 Given coequations ϕ and ψ over C, one can consider the coequation ϕ → ψ over C, where → is the exponential in Sub(U HC). One can show that, if A, α |= ϕ → ψ, then A, α |= ϕ ⇒ ψ, but the converse does not hold in general. Example 3.3 Let Γ− = − × − and let A = {a, b}. Let εA , l, r :U HA
∼ =
/ A × U HA × U HA
be the structure map of HA. Define coequations ϕ and ψ over A by ϕ = {σ ∈ U HA | σ = l(σ)}, ψ = {σ ∈ U HA | σ = r(σ)}. 212
Hughes
Let α(a) = b, b and α(b) = b, a. Then A, α |= ϕ ⇒ ψ, but A, α |= ϕ → ψ. Conditional coequations provide a means of interpreting the co-quasivariety theorem, below. As before, we first state an abstract version of the quasi-variety theorem and then interpret the theorem in categories of coalgebras. The proof of Theorem 3.4 and its corollaries can be found in [AH00]. The theorem also was proven independently by Alexander Kurz in [Kur00]. Theorem 3.4 Let C be a quasi-co-Birkhoff category and V a full subcategory of C. The following are equivalent. (i) V is a quasi-covariety. (ii) The inclusion U V :V / C has a right adjoint H V such that each component of the counit εV :1C / U V H V is a regular mono. (iii) V = S⊥ for some collection S of regular monos. Corollary 3.5 Let C be a quasi-co-Birkhoff category and V a quasi-covariety of C. Then (i) The inclusion U V :V (ii) The unit η V :idV
/ C has a right adjoint H V .
/ H V U V is an isomorphism.
V is the counit of the (iii) For each C ∈ C, C ∈ V iff C ⊥ εV C , where ε V V adjunction U 2 H .
(iv) The corresponding comonad, GV = U V H V , ε, U V ηH V , is idempotent. (v) The comonad GV preserves regular monos. The following corollary restates the results of Theorem 3.4 for categories of coalgebras in terms of conditional coequations. Corollary 3.6 Let E be quasi-co-Birkhoff and let Γ :E / E be an functor that preserves regular monos. A full subcategory V of EΓ is a quasi-covariety just in case there is a collection S of conditional coequations such that B, β ∈ V iff ∀ϕ ∈ S B, β |= ϕ. The same claim holds if we replace the endofunctor Γ with a comonad G.
4
Deductive completeness and invariance
We focus now on Birkhoff’s completeness theorem. Whereas the variety theorem gives an equivalence between closure conditions on classes of algebras and equational definability, the completeness theorem states an equivalence between deductively closed sets of equations and equational theories for classes of algebras. We first recall the completeness theorem in the classical setting. Let Σ be a signature and Γ the associated polynomial functor (so that 213
Hughes
Alg(Σ) = SetΓ ), and let F :Set
/ SetΓ
be the left adjoint of the forgetful functor U : SetΓ / Set. We say that a set of equations E over X (i.e., a subset of U F X × U F X) is closed if it satisfies the following: (i) For each x ∈ X, x = x ∈ E; (ii) For each t1 = t2 ∈ E, t2 = t1 ∈ E; (iii) If t1 = t2 ∈ E and t2 = t3 ∈ E, then t1 = t3 ∈ E; (iv) For each function symbol f (n) ∈ Σ, and each n-tuple of equations, s1 = t1 , . . . , sn = tn , in E, the equation f (n) (s1 , . . . , sn ) = f (n) (t1 , . . . , tn ) ∈ E. (v) E is closed under substitution of terms for variables. That is, for each t1 = t2 ∈ E, t ∈ U F X, x ∈ X, t1 [t/x] = t2 [t/x] ∈ E. Theorem 4.1 (Birkhoff ’s completeness theorem) A set of equations E is the equational theory for some class V of Σ-algebras just in case E is closed. We say that a (binary) relation E over U F X is stable just in case, for every homomorphism /F X , f :F X the image of E under f is contained in E, i.e., ∃f E ≤ E. In categorical terms, then, a set E of equations over X is closed just in case (i’) E is a congruence; (ii’) E is stable. The notion of stable sets of equations dualizes to a notion of invariant 3 coequations. This definition is first found in [GS98]. Definition 4.2 Let A, α be a G-coalgebra. A regular subobject ϕ of A is invariant just in case, for every homomorphism p :A, α 3
/ A, α,
The use of the word “invariant” in coalgebra is a bit overloaded. We adopt the term from [GS98], but others ([Jac99], for instance) use “invariant” to mean “admits a structure map”, i.e., is the carrier of a subcoalgebra. Perhaps a better term for the latter concept is coinductive predicate, since such predicates are the analogues of inductive predicates for algebras.
214
Hughes
the image of ϕ under p is contained in ϕ, i.e., ∃p ϕ ≤ ϕ. Remark 4.3 If A, α is a subcoalgebra of the final coalgebra, then any conditional coequation ϕ over A, α is invariant. Given a coequational variety V = {B, β | B, β |= ψ}, we are interested in the minimal coequation ϕ such that V |= ϕ. Such minimal coequations can be viewed as generating the collection of coequations that V satisfies, in the sense that, for any coequation ϑ, if V |= ϑ, then ϕ , ϑ. In this sense, the minimal coequation represents the coequational theory of V — it represents the coequational commitment that V entails. This intuition motivates the following definition. Definition 4.4 Let ϕ be a (conditional) coequation over A, α and V a collection of coalgebras. We say that ϕ is the generating (conditional) coequation for V just in case (i) V |= ϕ; (ii) For any conditional coequation ψ over C, if V |= ψ then ϕ , ψ. Theorem 4.5 (Invariance theorem) A coequation ϕ over C is the generating coequation for some collection V of coalgebras just in case ϕ is an invariant subcoalgebra of HC. We postpone the proof until we’ve defined the modal operators ✷ and . The invariance theorem first arises in [GS98], where it is proved for coalgebras over Set. The theorem is stated in different terms in their work, since it is not motivated by the coequation-as-predicate view that we take here.
5
The subcoalgebra operator
In what remains, we construct the modal operators that are used in the proof of the invariance theorem, and prove some basic results regarding these operators. Throughout what follows, we assume that E is co-Birkhoff and has pullbacks and that G preserves regular monos and pullbacks of regular monos, so that EG is co-Birkhoff and U creates pullbacks of regular monos (and, in particular, finite intersections). We further assume that, for each A ∈ E, Sub(A) is a Heyting algebra. In this section, we introduce the modal operator ✷. Given a subobject ϕ of A = U A, α, ✷ϕ is the greatest subcoalgebra of A contained in ϕ. The construction is well-known, although the view that ✷ is a modal operator is perhaps less familiar. The ✷ operator is discussed in [Jac99], where it plays a 215
Hughes
central role. It is from that work that we take the view of ✷ as a “henceforth” operator. Since the coalgebraic forgetful functor U :EG / E preserves regular monos, there is an induced forgetful functor, Uα :Sub(A, α)
/ Sub(A),
from the partial order of regular subobjects of A, α to the partial order of regular subobjects of A. As is well known, Uα has a right adjoint, which we denote [−]α (dropping the subscripts whenever convenient). The right adjoint maps a subobject B ≤ A to the largest subcoalgebra contained in B. More precisely, 2 [B] = {C, γ ≤ A, α | C ≤ B}. Here, we use the fact that Uα creates joins. Alternatively, one may define [B] as the pullback shown below. ,2 [B] _ _
A, α ,2
/ HB _ / HA
This adjoint pair yields a modal operator ✷α :Sub(A)
/ Sub(A),
as usual, by taking the composite ✷α = [−]α ◦Uα . Again, we drop the subscript when convenient. Theorem 5.1 ✷ is an S4 necessity operator, i.e., satisfies the following: (i) If ϕ , ψ, then ✷ϕ , ✷ψ (ii) ✷ϕ , ϕ (iii) ✷ϕ , ✷✷ϕ (iv) ✷(ϕ → ψ) , ✷ϕ → ✷ψ Proof. Condition (i) is just functoriality, and conditions (ii) and (iii) are just the counit and comultiplication for the comonad ✷. The last item follows from the fact that Uα preserves meets, and hence so does ✷. The argument for (iv) from this is standard, but we include it here. By (i), we have ✷((ϕ → ψ) ∧ ϕ) , ✷ψ, and, hence, ✷(ϕ → ψ) ∧ ✷ϕ , ✷ψ. Therefore, ✷(ϕ → ψ) , ✷ϕ → ✷ψ.
✷ 216
Hughes
Theorem 5.2 ✷ is stable under pullback along homomorphisms. That is, for any / B, β, f :A, α we have
✷ α ◦ f ∗ = f ∗ ◦ ✷β .
Proof. The bottom face in Figure 1 commutes, since f is a homomorphism. The front and rear faces are pullbacks by definition of ✷, and the right face is a pullback since G preserves pullbacks along regular monos by assumption. Hence, the left face is a pullback. ✷ ,2 ✷f_∗ P ?
?? ?? ?? ?? ?
,2 ✷P _
A ??,2
?? ?? ?? ?? B ,2
/ Gf ∗ P _ ?? ?? ?? ?? ?? / GP _ / GA ?$ ? ?? ?? ?? ? / GB
Fig. 1. ✷ commutes with pullback along homomorphisms.
Theorem 5.2 can be understood as a statement about substitution of terms for variables. Namely, we view conditional coequations ϕ over A, α as predicates of a single variable x of type A. Then, Theorem 5.2 says that, for any homomorphism / A, α, f :B, β and any variable y of type B, we have (✷ϕ)[f (y)/x] = ✷(ϕ[f (y)/x]). Thus, ✷ is stable under substitutions of terms built from homomorphisms for variables. (It is not stable under substitution of arbitrary terms for variables, however.)
6
The invariance operator
We apply the same approach to invariant coequations as in Section 5. That is, we first define an adjoint pair (a Galois correspondence) between the coequations over A, α and the invariant coequations. Then, we use this pair to define a modal operator on coequations over A, α. 217
Hughes
Accordingly, let Inv(α) denote the full subcategory of Sub(A) consisting of the invariant coequations over A, α, and let / Sub(A)
Iα :Inv(α) be the inclusion functor. Theorem 6.1 Iα has a right adjoint. Proof. Let ϕ ≤ A and define
/ A, α(∃p ψ ≤ ϕ)}.
Pϕ = {ψ ≤ A | ∀p :A, α We define a functor Jα :Sub(A)
/ Sub(A) by
2
Jα (ϕ) =
ψ,
ψ∈Pϕ
omitting the subscripts when convenient. We first show that Jϕ is invariant. Let r :A, α
/ A, α
be given. In order to show that ∃r Jϕ ≤ Jϕ, it suffices to show that ∃r Jϕ ∈ Pϕ , i.e., for every homomorphism p : A, α / A, α, we have ∃p (∃r Jϕ) ≤ ϕ. A quick calculation shows 2 2 ∃p ∃r Jϕ = ∃p◦r ψ= ∃p◦r ψ ≤ ϕ. ψ∈Pϕ
ψ∈Pϕ
Next, we show that I 2 J. Let ψ be invariant. If ψ ≤ ϕ, then, for every endomorphism p, ∃p ψ ≤ ψ ≤ ϕ, so ψ ∈ Pϕ and hence ψ ≤ Jϕ. On the other hand, if ψ ≤ Jϕ, then ψ ≤ Jϕ ≤ ϕ. ✷ Let α = Iα Jα . We confirm that is an S4 operator. Again, it suffices to show that preserves meets. Theorem 6.2 is an S4 necessity operator. Proof. Again, since is a comonad, it suffices to show that preserves meets, or, more specifically, that ϕ ∧ ψ , (ϕ ∧ ψ). 218
Hughes
Let p :A, α / A, α be given (where ϕ and ψ are conditional coequations over A, α). Then ∃p (ϕ ∧ ψ) ≤ ∃p ϕ ≤ ϕ and, similarly, ∃p (ϕ ∧ ψ) ≤ ψ. Hence, ∃p (ϕ ∧ ψ) ≤ ϕ ∧ ψ. Since p was an arbitrary homomorphism, ϕ ∧ ψ , (ϕ ∧ ψ). ✷ Remark 6.3 Unlike ✷, the operator does not commute with pullbacks along homomorphisms. Let Γ : Set / Set be the identity functor. We will consider a coequation ϕ over 2 colors, that is, a subset of U H2 = 2ω , the set of streams over 2. Specifically, let ϕ = {0, 1}, where 0 and 1 are the constant streams. Note that ϕ is invariant. Let p : H3 / H2 be the homomorphism induced by the coloring p : 3 where p(0) = 0, p(1) = 0, p(2) = 1 ∗ (i.e., p = H(p)). Then p ϕ is the set
/ 2,
{σ ∈ 3ω | ∀n σ(n) < 2} ∪ {2}. It is easy to check that p∗ ϕ = {0, 1, 2} = p∗ (ϕ) = p∗ ϕ. In terms of substitutions, then, it is not the case that, for every homomorphism / A, α, f :B, β (ϕ)[f (y)/x] = (ϕ[f (y)/x]). We return to the examples of Section 2 to give some idea of how works. In those examples, the coequations over C were described in terms of the coloring εC . Typically, takes a coequation defined in terms of colorings to a similar coequation defined in terms of equality of states, as these examples illustrate. Example 6.4 Let ΓS = (Pfin S)I , as in Example 2.10. Recall that the class of deterministic automata Det forms a covariety of SetΓ , where the defining coequation ϕ over 2 is given by ϕ = {x ∈ U H2 | ∀i ∈ I ∀y, z ∈ σ(x)(i) . ε2 (y) = ε2 (z)}. It is easy to show that ϕ = {x ∈ U H2 | ∀i ∈ I ∀y, z ∈ σ(x)(i) . y = z}, or, more simply, ϕ = {x ∈ U H2 | ∀i ∈ I . card(σ(x)(i)) < 2}. 219
Hughes
Example 6.5 Recall the functor ΓX = Z × X and the coequation ϕ over N defined by ϕ = {σ | card(Col(σ)) < ℵ0 }, from Example 2.11. For each σ ∈ U HN, let St(σ) = {tn (σ) | n ∈ ω}, where εN , h, t :U HN
∼ =
/ N × Z × U HN is the structure map for HN. Then
ϕ = {σ | card(St(σ)) < ℵ0 }.
7
Generating coequations
We return to the invariance theorem. To begin, we show that, for any ϕ over A, α, ϕ and ✷ϕ have the same expressive power as ϕ – i.e., define the same quasi-covariety. Theorem 7.1 Let A, α be given. For every ϕ ∈ Sub(A), B, β ∈ EG , B, β |= ϕ iff B, β |= ϕ. Proof. Since ϕ , ϕ, one direction is trivial. Suppose, then, that B, β |= ϕ. Let / A, α p :B, β be given. To show that Im(p) ≤ ϕ, we will show that, for every r :A, α
/ A, α,
∃r Im(p) ≤ ϕ. But, ∃r Im(p) = Im(r ◦ p) ≤ ϕ, since B, β |= ϕ.
✷
Theorem 7.2 Let A, α be given. For every ϕ ∈ Sub(A), B, β ∈ EG , B, β |= ✷ϕ iff B, β |= ϕ. Proof. Again, one direction is trivial. Let B, β |= ϕ and let p :B, β
/ A, α
be given. Then Uα Im(p) = Im(U p) ≤ ϕ and so, by the adjunction Uα 2 [−]α , Im(p) ≤ [ϕ]α . Thus, Im(U p) = Uα Im(p) ≤ Uα [ϕ]α = ✷α ϕ. ✷ Lemma 7.3 Let ϕ be a coequation over C. Then the coalgebra [ϕ] satisfies the coequation ϕ. 220
Hughes
Proof. Let p : []ϕ / HC be given. Because HC is regular injective, p extends to a homomorphism HC / HC , as shown below. Hence, because ✷ ϕ < ϕ and ϕ is invariant, there is a unique map ✷ ϕ / ϕ making the square and thus the lower triangle commute, as desired. / U HC 9 O ss s s p s _RL sss _LR / ✷ϕ ϕ
U HC O
✷ Theorem 7.4 (Invariance theorem) A coequation ϕ over C is the generating coequation for some collection V of coalgebras just in case ϕ is an invariant subcoalgebra of HC, i.e., ϕ = ✷ ϕ. Proof. Let ϕ = ✷ ϕ and define V = {B, β | B, β |= ϕ}. Then, clearly, V |= ϕ. We will show that, if V |= ψ, then ϕ , ψ. But, from Lemma 7.3, we know that [ϕ] = [ϕ] is in V. Consequently, []ϕ |= ψ and hence ϕ = ∃id ✷ ϕ , ψ. ✷ Remark 7.5 The same claim and proof holds for conditional coequations over A, α where A, α is regular injective or A, α is an invariant subcoalgebra of HA. That is, a conditional coequation ϕ over such A, α is a generating coequation for some class V just in case ϕ = ✷ ϕ. Remark 7.6 Let ϕ be a coequation over C and Vϕ the covariety it defines. Let U ϕ : Vϕ / EG be the inclusion and H ϕ right adjoint to V (as in Corollary 3.5). Then one can show that U U ϕ H ϕ HC = ✷ ϕ. Example 7.7 Consider again the functor Γ :Set and the coequation ϕ defined by
/ Set where ΓS = (Pfin S)I
ϕ = {x ∈ U H2 | ∀i ∈ I ∀y, z ∈ σ(x)(i) . ε2 (y) = ε2 (z)}. We claimed in Example 6.4 that ϕ = {x ∈ U H2 | ∀i ∈ I ∀y, z ∈ σ(x)(i) . y = z}. We write s / s if there is an i such that s i / s and we write transitive closure of / . One can further show that ✷ ϕ = {x ∈ U H2 | ∀w . x
∗/
∗/
for the
w → ∀i ∈ I card(σ(w)(i)) < 2}.
221
Hughes
By Theorem 7.4, ✷ ϕ is the generating coequation for Det, the class of deterministic automata. Theorem 7.8 For any coalgebra A, α, ✷ ≤ ✷. Proof. By definition of , it suffices to show that, for every homomorphism p : A, α / A, α, ∃p ✷ ϕ ≤ ✷ϕ. We know that, for every p, ∃p ✷ ϕ ≤ ∃p ϕ ≤ ϕ. Thus, since Uα commutes with ∃p , Uα ∃p [ϕ]α = ∃p Uα [ϕ]α ≤ ϕ, and so ∃p [ϕ]α ≤ [ϕ]α . Thus, ∃p ✷ ϕ = Uα ∃p [ϕ]α ≤ Uα [ϕ]α = ✷ϕ. ✷ We can prove that ✷ commutes with given further assumptions. Namely, if the modal operator ✷ has a left adjoint , then ✷ = ✷. The existence of such an adjoint arises naturally, given that the comonad G preserves nonempty intersections. In this case, the subcoalgebra forgetful functor Uα has a left adjoint, / Sub(A, α), Fα :Sub(A) taking a subobject ϕ to the least subcoalgebra B, β such that ϕ ≤ B. The closure operator α is the composite Uα Fα . See [Gum98b] for a discussion of functors which preserve non-empty intersections and an example of a functor which does not have this property. See also [Jac99] for a discussion of the closure operator α , where it is denoted α ⇐
(and ✷ is denoted α ). ⇒
Theorem 7.9 If ✷α has a left adjoint, α , then ✷ = ✷. Proof. To show that ✷ ≤ ✷, it is sufficient (by the adjunction 2 ✷) to show that ✷ ≤ . Let ϕ ≤ A = U A, α. We will show that, for every homomorphism p : A, α / A, α, ∃p ✷ϕ ≤ ϕ and conclude (by definition of ) that ✷ϕ ≤ ϕ. Again, by the adjunctions, it suffices to show that ✷ϕ ≤ ✷p∗ ϕ = p∗ ✷ϕ, or, equivalently, ∃p ✷ϕ ≤ ✷ϕ. This is immediate from the definition of .✷ One suspects that Theorem 7.9 does not depend on the existence of the closure operator — that is, there should be a proof that ✷ = ✷ that does not require an adjoint to the modal operator ✷. At this time, we are 222
Hughes
unaware of such a proof. Nor do we have an example of a coequation ϕ in some EG for appropriate G such that ✷ϕ > ✷ ϕ. In any case, one finds that for many functors of interest (polynomials, finite powerset, etc.), the operator ✷ does have an adjoint and so the assumptions above are not as limiting as one might suspect. Example 7.10 Let ΓX = Z × X and consider again the coequation ϕ over N from Example 2.11, where ϕ = {σ | card(Col(σ)) < ℵ0 }. It is easy to check that ✷ϕ = ϕ, and so ✷ϕ = ϕ (which was defined in Example 6.5) is the least coequation over N such that A, α |= ϕ just in case A, α |= ϕ.
8
Future research
We have tried to develop the idea of “coequation-as-predicate” here. This approach naturally gives a means of constructing new coequations out of old, by using the standard logical operators ∧, ¬, ∃, etc., as well as the modal operators ✷ and . We have shown that, for any coequation ϕ, the covariety ϕ defines is just the same covariety that ✷ϕ and ϕ defines. It is also obvious that the covariety ϕ ∧ ψ defines is the intersection of the covarieties defined by ϕ and ψ. One would like to investigate the relation between the other logical operators (especially the quantifiers) and the partial order of covarieties. One would also like to investigate the apparent inequality between ✷ and ✷. Theorem 7.9 showed that for any functor G which preserves intersections, ✷ = ✷, but it’s not clear that the assumption is really necessary. To this end, it is instructive to consider the dual case. One supposes that closing a set of equations under the congruence conditions followed by stability always yields the same set as closure under stability followed by the congruence conditions, but perhaps there is a technical detail one needs to prove this (maybe an assumption true for all categories of algebras over Set, even).
References [AGM92] S. Abramsky, Dov M. Gabbay, and T. S. E Maibaum, editors. Handbook of Logic in Computer Science, volume 1. Oxford Science Publications, 1992. [AH00] Steve Awodey and Jesse Hughes. The coalgebraic dual of Birkhoff’s variety theorem. Technical Report CMU-PHIL-109, Carnegie Mellon University, Pittsburgh, PA, 15213, November 2000. [AN82] H. Andr´eka and I. N´emeti. A general axiomatizability theorem formulated in terms of cone-injective subcategories. In Proc. Conf.
223
Hughes
“Universal Algebra Esztergom 1977”, pages 13–15. North-Holland, Amsterdam, 1982. [AR94] Jiˇr´ı Ad´ amek and Jiˇr´ı Rosick´ y. Locally Presentable and Accessible Categories, volume 189 of London Mathematical Society Lecture Note Series. Cambridge University Press, 1994. [BH76] B. Banaschewski and H. Herrlich. Subcategories defined by implications. Houston Journal of Mathematics, 2(2), 1976. [Bir35] G. Birkhoff. On the structure of abstract algebras. Proceedings of the Cambridge Philosophical Society, 31:433–454, 1935. [Bor94] F. Borceux. Handbook of Categorical Algebra I-III. University Press, 1994.
Cambridge
[Gr¨ a68] George Gr¨ atzer. Universal Algebra. D. Van Nostrand Company, Inc., 1968. [GS98] H. Peter Gumm and Tobias Schr¨ oder. Covarieties and complete covarieties. In Jacobs et al. [JMRR98], pages 43–56. [Gum98a] H. Peter Gumm. Equational and implicational classes of coalgebras, 1998. Extended Abstract submitted for RelMiCS’4. [Gum98b] H. Peter Gumm. Functors for coalgebras. Preprint, 1998. [Gum01] H. Peter Gumm. Birkhoff’s variety theorem for coalgebras. Cont. to General Algebra 2000, To appear 2001. [Hug01] Jesse Hughes. A Study of Categories of Algebras and Coalgebras. PhD thesis, Carnegie Mellon University, 2001. [Jac95] B. Jacobs. Mongruences and cofree coalgebras. Computer Science, 936, 1995.
Lecture Notes in
[Jac99] B.P.F. Jacobs. The temporal logic of coalgebras via Galois algebras. Technical Report CSI-R9906, Computing Science Institute, April 1999. [JMRR98] Bart Jacobs, Larry Moss, Horst Reichel, and Jan Rutten, editors. ENTCS, volume 11. Coalgebraic Methods in Computer Science (CMCS’1998), 1998. [JR97] Bart Jacobs and Jan Rutten. A tutorial on (co)algebras and (co)induction. Bulletin of the European Association for Theoretical Computer Science, 62, 1997. [Kur98] Alexander Kurz. A co-variety-theorem for modal logic. Proceedings of Advances in Modal Logic, 1998. [Kur99] Alexander Kurz. Modal rules are co-implications. Draft. Available at http://helios.pst.informatik.uni-muenchen.de/~kurz, February 1999.
224
Hughes
[Kur00] Alexander Kurz. Logics for Coalgebras and Applications for Computer Science. PhD thesis, Ludwig-Maximilians-Universit¨ at M¨ unchen, 2000. [Man76] Ernie Manes. Algebraic Theories. Number 26 in Graduate Texts in Mathematics. Springer-Verlag, 1976. [MT92] K. Meinke and J. V. Tucker. Universal algebra. In Abramsky et al. [AGM92], pages 189–412. [RJT01] J. Rothe, B. Jacobs, and H. Tews. The coalgebraic class specification language ccsl. Journal of Universal Computer Science, To appear 2001. [Ro¸s00] Grigore Ro¸su. Equational axiomatizability for coalgebra. Theoretical Computer Science, 260, 2000. Scheduled to appear. [Rut96] J.J.M.M. Rutten. Universal coalgebra: a theory of systems. Technical Report CS-R9652, Centrum voor Wiskunde en Informatica, 1996. [Tur96] Daniele Turi. Functorial Operational Semantics and its Denotational Dual. PhD thesis, Free University, Amsterdam, June 1996.
225
CMCS’01 Preliminary Version
Two-dimensional linear algebra Martin Hyland Department of Pure Mathematics and Mathematical Statistics University of Cambridge Cambridge, ENGLAND
John Power 1 LFCS, Division of Informatics University of Edinburgh King’s Buildings, Edinburgh EH9 3JZ, SCOTLAND
Abstract We introduce two-dimensional linear algebra, by which we do not mean two-dimensional vector spaces but rather the systematic replacement in linear algebra of sets by categories. This entails the study of categories that are simultaneously categories of algebras for a monad and categories of coalgebras for comonad on a category such as SymM ons , the category of small symmetric monoidal categories. We outline relevant notions such as that of pseudo-closed 2-category, symmetric monoidal Lawvere theory, and commutativity of a symmetric monoidal Lawvere theory, and we explain the role of coalgebra, explaining its precedence over algebra in this setting. We outline salient results and perspectives given by the dual approach of algebra and coalgebra, extending to two dimensions the study of linear algebra.
1
Introduction
Fundamental to the development of linear algebra are extensions of the fact that for any commutative ring R, the forgetful functor U : R-M od −→ Ab from the category of R-modules to the category of abelian groups has both left and right adjoints. The left adjoint sends an abelian group A to the tensor product R ⊗ A in Ab, with R-action induced by the multiplication of R. The right adjoint sends an abelian group A to the R-module [R, A] given by the set of abelian group morphisms from R to A, with the pointwise abelian group 1
This work is supported by EPSRC grant GR/M56333: The structure of programming languages : syntax and semantics, and a British Council grant and the COE budget of STA Japan. This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcs
Hyland and Power
structure and with the action of R on [R, A] induced by precomposition. These adjoints can be expressed as left and right Kan extensions respectively, if one enriches in the symmetric monoidal closed category of abelian groups, because a commutative ring is exactly a commutative monoid in the category Ab. The two adjoints exhibit R-M od as both the category of algebras for a monad on Ab and also as the category of coalgebras for a comonad on Ab. The above suggests that linear algebra is a potential area of application of the study of coalgebras. But it does not, a priori, imply that linear algebra is relevant to computer science. However, now suppose we drop the assumption of inverses in the definition of a group. Then, abelian groups above would be replaced by commutative monoids, rings would be replaced by semirings, and R-modules remain the same except that the underlying object need only be a commutative monoid rather than an abelian group. Having done this, consider a second step, generalising from sets to categories. Some of the equalities of commutative monoids are most naturally replaced by coherent isomorphisms, so let us assume we systematically do that. Abelian groups, which became commutative monoids above, now become small symmetric monoidal categories. One can prove that the category of small symmetric monoidal categories does not have a coherent symmetric monoidal closed structure on it, systematically generalising that of Ab, but it does have a pseudo-closed structure, which, with care, should suffice for our purposes. The underlying mathematics is not yet complete, as we shall explain. But in principle, a commutative ring now becomes a pseudocommutative pseudo-monoid M in SymM on and we can consider a comonad of the form [M, −] and coalgebras for it. So we are still in the realm of coalgebra, and this is now relevant to computer science, as illustrated in [12], as it supports analysis of various kinds of contexts as well as various kinds of wiring, as provided for instance by categories with finite products, or finite coproducts, or symmetric monoidal structure, or variants or combinations of these. See for instance [18] for one sophisticated combination, and see [12] for several other examples. However, as mentioned above, the underlying mathematics is not yet complete. We do have a definition of pseudo-closed 2-category [13] generalising Eilenberg and Kelly’s definition of closed category [8], and SymM on is an example, but we do not yet have a notion of pseudo-symmetric pseudo-monoidal pseudo-closed 2-category. So, a priori, we cannot yet say what a pseudocommutative pseudo-monoid in SymM on is. But that seems likely to be achievable in coming years, and we already have clear evidence, based on the work in [13], that the coalgebraic perspective here will be far more primitive than the algebraic perspective. Moreover, despite not yet having completed the underlying mathematics, we are already in a position to explicate much of the relevant coalgebraic structure. In particular, as we have a definition of pseudo-closed 2-category, we can define a monoid to be a comonad of the form [M, −], and continue in that vein. We largely leave that implicit in the 227
Hyland and Power
paper, but it is the underlying idea. This application of coalgebra to computer science has not previously been considered, so here, we present some of the ideas and underlying structures that we have been developing. This may be seen as the beginning of what might be called two-dimensional linear algebra: just as linear algebra is characterised by its special additional features on top of those given by universal algebra, notably its coalgebraic structure, two-dimensional linear algebra may equally be characterised by its special features, notably coalgebraic ones, relative to the two-dimensional universal algebra of [2]. As usual in twodimensional studies, the greatest challenge is in taking careful note of the subtle relationship between equality and coherent isomorphism [15,2]. We have not, at this time, developed other aspects of linear algebra two-dimensionally, but we anticipate doing so. The originality of this paper resides primarily in its identification of twodimensional linear algebra as a topic of study, its development of relevant notions such as that of symmetric monoidal Lawvere theory, and in explaining how this can be seen as an area of application of coalgebra in computer science. Some of the technical results here, primarily those of Sections 3 and 4, have been presented previously in a different (more complicated) form, in [12], but others have not. The paper is organised as follows. In Section 2, we outline our conception of two-dimensional linear algebra and how we hope to develop it. We sketch the basic definitions and results, and we explain why coalgebra plays a stronger role here than in the ordinary one-dimensional linear algebra. In Section 3, we introduce the notion of a symmetric monoidal Lawvere theory. In Section 4, we define what it means for a symmetric monoidal Lawvere theory to be commutative, and we prove that this induces a comonad on SymM ons . And in Section 5, we show how, by means of a more complex construction that may ultimately prove to be less natural, one can obtain a comonad to account for those examples of symmetric monoidal Lawvere theories that are not commutative.
2
An overview of two-dimensional linear algebra
Extending the situation for Ab, or perhaps better, the category CM on of commutative monoids, to two dimensions, we should like to prove that the category SymM ons of small symmetric monoidal categories and strict symmetric monoidal functors is itself a symmetric monoidal category. There is a theorem, ultimately due to Kock [16], but also expressed in [14], which is a primary reference for us, that may help. Given a 2-monad T on Cat, the monad T automatically acquires a strength t : X × T Y −→ T (X × Y ) using the cartesian closed structure of Cat together with the enrichment of T 228
Hyland and Power
to a 2-functor. It also acquires a costrength t∗ : T X × Y −→ T (X × Y ) by trivial use of the symmetry of finite products in Cat. A 2-monad T on Cat is commutative if for every pair of categories X and Y , the diagram TX × TY
t
✲ T (T X × Y )
T t✲∗
t∗
T 2 (X × Y ) µ
❄
T (X × T Y ) ✲ T 2 (X × Y ) Tt
❄ ✲ T (X × Y )
µ
commutes, where µ is the multiplication of the 2-monad. Theorem 2.1 For any finitary 2-monad T on Cat, the category T -Alg is symmetric monoidal closed, making the forgetful functor U : T -Alg −→ Cat into part of a symmetric monoidal closed adjunction if and only if T is commutative. Alas, it follows from this theorem that the 2-category SymM ons has no symmetric monoidal closed structure that is coherent with that of Cat in the sense of the theorem: the reason is that T is not commutative, and the reason for that is that the commutativity diagram does not commute, but rather contains a non-trivial isomorphism determined by the symmetry in the definition of symmetric monoidal category. No coherence theorem can force that symmetry to be an equality, even in the most mundane examples. This contrasts with the situation for Ab relative to Set: the category Ab is symmetric monoidal closed, coherently with respect to the finite product structure of Set, and because of that, one can consider a commutative ring R as a commutative monoid in the symmetric monoidal category Ab and proceed to consider R ⊗ − and [R, −]. So, at first sight, we appear to be stuck. There seem to be two ways to negotiate this difficulty. The first, more elegant, approach is to define a notion of pseudo-symmetric pseudo-monoidal pseudo-closed 2-category and attempt to prove that the 2-category SymM on of small symmetric monoidal categories and strong symmetric monoidal functors has that structure. That should be possible within the coming few years, as we are making good progress in that direction in [13] based upon a notion of pseudo-commutative monad. We do not give detailed definitions here, as our account is not complete yet and the details might distract from the flow of the paper. So we refer the reader to [13] for detail. But the central idea is as follows. One first defines a notion of pseudo-commutative monad. For the 2-category theoretic terminology used here, we refer the reader to [15]. 229
Hyland and Power
Definition 2.2 A pseudo-commutative monad on Cat is a 2-monad T together with a isomorphism, natural in X and Y , with components TX × TY
t
✲ T (T X × Y )
t∗
T t✲∗
⇓ ρX,Y ❄
T (X × T Y )
✲ T 2 (X × Y )
Tt
T 2 (X × Y ) µ
❄ ✲ T (X × Y )
µ
subject to one coherence axiom with respect to each of the symmetry of Cat, and the multiplication, unit, and strength of T . Examples of pseudo-commutative monads include our leading example of the 2-monad for small symmetric monoidal categories, the 2-monad for small categories with finite products, and that for small categories with finite coproducts. Another example is the 2-monad for which an algebra is a small symmetric monoidal category together with a strong endofunctor, as lies at the heart of [9]. A non-example is the 2-monad for which an algebra is a small category together with a monad on it. This can all be verified by routine calculation. We then define a notion of pseudo-closed 2-category. The full definition is complex, owing to a lengthy but definitive list of coherence axioms: the axioms are only a little more complex than those in Eilenberg and Kelly’s definition of closed category in [8], which are also lengthy. The central data is that a pseudo-closed 2-category has, for each pair of objects X and Y , an object [X, Y ] that acts as an internal hom, or exponential, of X and Y . The construction becomes an endo-2-functor [X, −] on the pseudo-closed 2category, so we are in a position in which we can consider coalgebra. A full definition appears in [13]. The main theorem of [13] yields Theorem 2.3 If T is a pseudo-commutative monad on Cat, then the 2category T -Algp of strict T -algebras and pseudo-maps of algebras forms a pseudo-closed 2-category. The leading example here has T being the 2-monad for which the 2category T -Algp is exactly SymM on. So, in due course, we hope to use this theorem as a basis for two-dimensional linear algebra. Note that the pseudo-closedness is strict in that [X, −] is an endo-2-functor. In contrast, if a corresponding pseudo-monoidal structure exists, which we believe it will under mild hypotheses, then the construction − ⊗ X will not be a 2-functor but rather a pseudo-functor. So in this precise sense, coalgebra is more primitive here than algebra. There are difficulties with this line of argument that seem readily resolvable but which we have not successfully addressed yet, in particular the fact 230
Hyland and Power
that the coherence for a pseudo-symmetry appears to be of essentially the same character as that for a definition of tetracategory, which, owing to the complexity of the coherence, does not have a fully established definition yet: see [11] to see some of the relevant issues. But once we resolve that, we can define a notion of pseudo-commutative pseudo-monoid M , then consider the 2-category of coalgebras for what will be a 2-comonad [M, −]. But in the absence of the mathematics required to proceed in this way, we adopt a more subtle approach that includes all the examples of primary interest to us but bypasses this difficulty. The way we proceed is effectively by ignoring pseudo-monoidal structure and defining a monoid in a pseudo-closed category to be a comonad of the form [M, −]. We do not make that explicit in our development, as it will probably become obsolete before long. However, we believe that the constructions we do develop now are of independent interest and will, in due course, become integrated into the above setting. We already have a coalgebraic account here, so we start to explain that in the next section.
3
Symmetric monoidal Lawvere theories
In this section, we introduce the notion of a symmetric monoidal Lawvere theory. This is a symmetric monoidal version of the usual notion of Lawvere theory, and indeed it extends the usual definition. Both definitions may be seen as instances of the same general phenomenon, which may be described for any monad T on Cat: for ordinary Lawvere theories, consider the monad T for small categories with finite products; for symmetric monoidal Lawvere theories, consider the monad T for small symmetric monoidal categories. To make the comparison precise, we recall the definition of Lawvere theory. Let N denote the category whose objects are natural numbers and whose morphisms are all functions between natural numbers. Definition 3.1 A Lawvere theory is a small category L with finite products together with an identity on objects strict finite product preserving functor j : N op −→ L. A model of a Lawvere theory L in a category C with finite products is a finite product preserving functor h : L −→ C. The significance of N op here is that it is the free category with strictly associative finite products on 1. Every category with finite products is equivalent to one with strictly associative finite products, so there are a few different ways to deal with coherence issues here. For simplicitiy of exposition, we shall adopt a slightly different approach to that given by Lawvere as explained in [1]: we shall make our theories non-strict and our models strict. Definition 3.2 A symmetric monoidal Lawvere theory is a small symmetric monoidal category L together with an identity on objects strict symmetric monoidal functor j : S(1) −→ L, where S(1) is the free symmetric monoidal category on 1. A strict model of a symmetric monoidal Lawvere theory L 231
Hyland and Power
in a symmetric monoidal category C is a strict symmetric monoidal functor h : L −→ C. Usually, in referring to a Lawvere theory, we shall simply use the notation L, treating the rest of the data as implicit. Up to equivalence of categories, S(1) may be identified with P , the category of natural numbers and permutations. Strict models of a symmetric monoidal Lawvere theory L in a specified symmetric monoidal category C, together with symmetric monoidal natural transformations, yield a category M ods (L, C). Examples of symmetric monoidal Lawvere theories are given by any small symmetric monoidal category with objects, up to equivalence, given by natural numbers, inheriting the tensor product of natural numbers. Examples abound and are explained in detail in [12]. For instance, if L is an ordinary Lawvere theory, it is automatically a symmetric monoidal Lawvere theory. But also the opposite of an ordinary Lawvere theory is a symmetric monoidal Lawvere theory. More specifically, there is a Lawvere theory for which the models in a symmetric monoidal category amount to commutative comonoids in the category: this example is central to Milner’s work on action calculi in [17], as explained in [12]. Another symmetric monoidal Lawvere theory is that for which models are given by relational bimonoids, as Plotkin plans to use to model concurrency, again explained in [12]. We feel obliged to spell out at least one example in detail, so we do so here. Example 3.3 Let CM on be the symmetric monoidal Lawvere theory for a commutative monoid. The underlying category of CM on is that required to express the data and commutativity axioms for a commutative monoid: its objects must all be generated by a single object X, it has all the maps given by permutations of natural numbers, and it has additional maps j : I −→ X and · : X ⊗ X −→ X together with maps generated by them by closing under tensor product and composition, all subject to the four commutativity axioms in the definition of commutative monoid. It follows that CM on is the free symmetric monoidal category on a commutative monoid, which, perhaps surprisingly, is equivalent to Setf . It may also be characterised as the free category with finite coproducts on 1. One can easily produce variants of this along the lines of considering comonoids rather than monoids, or considering bimonoids, or structures with some of the data and some or perhaps more axioms than those of monoids, comonoids, and combinations of them. Now, we start to analyse how symmetric monoidal Lawvere theories give rise to comonads on SymM on. Proposition 3.4 For any symmetric monoidal Lawvere theory L and any small symmetric monoidal category C, the category M ods (L, C) has a sym232
Hyland and Power
metric monoidal structure given as follows: for strict models h and h , •
put (h ⊗ h )(1) = h1 ⊗ h 1
•
extend the definition of h ⊗ h to an arbitrary object of L, which is the result of inductively applying the tensor operation to the unit and to 1, by induction on the complexity of the tensorial description of the object.
•
define h ⊗ h on arrows by conjugation using the canonical isomorphisms induced by induction between (h ⊗ h )(x) and h(x) ⊗ h (x).
Observe that the tensor product here is not given pointwise: if we tried to define a pointwise tensor product, we would not be able to make h ⊗ h strict symmetric monoidal, so it would not be an object of M ods (L, C). If we further tried to deal with that by extending from M ods (L, C) to the category M od(L, C), we would be unable to obtain an endofunctor because of coherence difficulties: we believe we will be able to resolve this in [13], but this is one of the reasons why we have retreated to single-sorted theories here, as they allow us to keep tight control over the behaviour of a putative tensor product h ⊗ h on objects. With a little effort, the proposition can be extended to show Theorem 3.5 Given a symmetric monoidal Lawvere theory L, the construction M ods (L, −) yields an endofunctor on SymM ons with a copoint M ods (L, −) ⇒ IdSymM ons given by evaluation at 1. If SymM ons were symmetric monoidal closed, coherently with respect to Cat, then the unit of the symmetric monoidal closed structure on it would be S(1), because the left adjoint of a symmetric monoidal adjunction always preserves the symmetric monoidal structure. So, as part of the definition of a symmetric monoidal Lawvere theory j : S(1) −→ L, we immediately have the unit data for a monoid structure on L. It remains for us to find a construct that can act as a multiplication. As we have such tight control on the objects of L, the construct proves to be uniquely determined, so it just amounts to a condition on the data we already have. We explore the situation in the next section. But for the moment, observe that categories of the form M ods (L, −)-Coalg for the copointed endofunctor (M ods (L, −), ev1 ) include categories of very substantial interest. For instance, if L is the symmetric monoidal Lawvere theory for a commutative monoid, the category of coalgebras is the category of small categories with finite coproducts, as can be checked by direct calculation. Dually, if L is the symmetric monoidal Lawvere theory for a commutative comonoid, the category of coalgebras here is the category of small categories with finite products. One can continue along these lines for other examples of symmetric monoidal Lawvere theories to account for the category of small categories with finite biproducts, or finite relational biproducts, or the like. 233
Hyland and Power
4
Commutative symmetric monoidal Lawvere theories
In this section, we place a commutativity condition on the notion of symmetric monoidal Lawvere theory L in order to extend the copointed endofunctor (M ods (L, −), ev1 ) on SymM ons to a comonad on SymM ons . Recall that a symmetric monoidal Lawvere theory L has the same objects as S(1), which in turn is equivalent to the category P of natural numbers and permutations. For simplicity of exposition here, we suppress coherent isomorphisms and identify the objects of S(1) with the objects of P . Thus we identify the objects of L with natural numbers. Now, for natural numbers m and p, denote by m × p the tensor product of m copies of p. It follows that m × − is functorial in L. Note that this does not mean that − × m is functorial in L! Definition 4.1 A symmetric monoidal Lawvere theory L is commutative if for all maps f : m −→ n and g : p −→ q in L, the two maps from m × p to q × n, one given by m×p
m ×✲ g
m×q
✲ q×m
q ×✲ f
q × n,
with the other dual, where the unlabelled maps are given by canonical isomorphisms in P , agree. This definition provides the information we need to obtain a comonad. Proposition 4.2 If L is a commutative symmetric monoidal Lawvere theory, there is a natural transformation with C-component δC : M ods (L, C) −→ M ods (M ods (L, C)) such that M ods (L, −) together with ev1 and δ form a comonad on the category SymM ons . Proof. Given a strict symmetric monoidal functor h : L −→ C, we must obtain a strict symmetric monoidal functor δC (h) from L to the symmetric monoidal category M ods (L, C), whose objects are strict symmetric monoidal functors from L to C. Since δC (h) must be strict symmetric monoidal, and since every object of L is given by a tensor product generated from 1, the behviour of δC (h) on objects is completely determined by its behaviour on 1. And since we must have ev1 (δC (h)) = h in order to satisfy one of the comonad laws, we must have δC (h)(1) = h : L −→ C The commutativity condition is exactly what is required to force the behaviour of δC on maps to be strict symmetric monoidal. ✷ The proposition gives us the comonad we seek. But we can say a little more that we have found valuable in our analysis. Specifically, we can identify the category of coalgebras for the comonad with the category of coalgebras for 234
Hyland and Power
its underlying copointed endofunctor. That is an unususal situation, redolent of that for the Eckmann Hilton argument [7] as explained in [12]. Our argument goes as follows. Proposition 4.3 For a commutative symmetric monoidal Lawvere theory L, the strict symmetric monoidal functors M ods (L, ev1 ) : M ods (L, M ods (L, C)) −→ M ods (L, C) and (ev1 )M ods (L,C) : M ods (L, M ods (L, C)) −→ M ods (L, C) are jointly monomorphic. Proof. The proof takes a little care, as it amounts to decomposing an arbitrary strict symmetric monoidal functor from L to M ods (L, C), which can be seen as a construction on two variables m and n, into consideration of its behaviour on pairs of variables of the form (1, n) and (m, 1) by use of the fact that each object of L is given by a tensor product generated by 1. ✷ The two propositions yield Theorem 4.4 For any commutative symmetric monoidal Lawvere theory L, the category of coalgebras for the copointed endofunctor (M ods (L, −), ev1 ) is equal to the category of coalgebras for the comonad (M ods (L, −), ev1 , δ). The above all fits into our conception of two-dimensional linear algebra. Moreover, the definitions we have developed here, such as that of symmetric monoidal Lawvere theory, obviously can be extended far beyond symmetric monoidal categories. In particular, the use of a comonad along the lines of M ods (L, −) on SymM ons extends in two directions that seem likely to be important, one of them definitely fitting within the scope of two-dimensional linear algebra, the second not quite as clearly. The first of these directions involves the generalisation from consideration of the 2-category SymM on to that of the 2-category T -Algp for a pseudocommutative 2-monad T on Cat. We do not explore that here, but see [13]. The other direction involves removing the commutativity condition that we have just introduced, yet still obtaining a comonad, necessarily a somewhat different one from that we have described: we would hardly have introduced the notion of commutativity if we did not need it to obtain the comonad structure we have defined. We give details of that in the next section.
5
Deleting the commutativity condition
In this section, we try to obtain a comonad much as we did in the previous section, but without resort to the commutativity condition we introduced there. The reason is that some symmetric monoidal Lawvere theories of interest to us, specifically one for Frobenius objects, are not commutative; so we would like to extend our analysis. 235
Hyland and Power
More specifically, all of the specific examples of symmetric monoidal Lawvere theories we have described so far have been commutative. And so are all of the examples implicit in [12]. But for an example of a symmetric monoidal Lawvere theory that is not commutative, consider the following. Example 5.1 Let RF rob be the symmetric monoidal Lawvere theory for relational Frobenius objects. This is generated by an object X together with a commutative monoid structure on X and a commutative comonoid structure on X such that the diagram X ⊗X
X ⊗✲ δ
X ⊗X ⊗X m⊗X
m ❄
X
δ
❄ ✲ X ⊗X
commutes (see [4]) and m.δ = idX . This category can be described explicitly as the category whose objects are finite sets and with a map from m to n given by an equivalence relation on m + n. This category is implicitly used by Danos and Regnier [6] in connection with Geometry of Interaction and is considered by Gardner in [10] for different reasons. For another example, one can drop the condition m.δ = idX in the above, giving the symmetric monoidal Lawvere theory for Frobenius objects, for which an explicit description is the main result of [3]. So there is some value in considering symmetric monoidal Lawvere theories that are not commutative, so we would like to incorporate such examples into coalgebra too. The technical heart of our construction of a comonad allowing us to do that is given by modifying our definition of M ods (L, C) for a symmetric monoidal Lawvere theory L and a symmetric monoidal category C. A priori, this leads us a little away from two-dimensional linear algebra as we initially envisioned it, as M od(L, C) is the pseudo-closed structure of SymM on. However, the objects of the construction we now make are the same as the objects of M ods (L, C), and in a symmetric monoidal closed category such as Ab, there are no arrows between elements of an abelian group, so in a precise sense, if one restricted to a category like Ab, the constructs M od(L, C) and M od∗ (L, C) would agree. So a more subtle view of two-dimensional linear algebra may well incorporate this construction. Definition 5.2 Given a symmetric monoidal Lawvere theory L, and a symmetric monoidal category C, let M od∗s (L, C) denote the (unique) factorisation M ods (L, C) ✲ M od∗s (L, C) 236
✲ C
Hyland and Power
of ev1 : M ods (L, C) −→ C into a functor M ods (L, C) −→ M od∗s (L, C) that is the identity on objects followed by a fully faithful functor M od∗s (L, C) −→ C. The construction M od∗s (L, C) extends to an endofunctor on SymM ons and ev1 trivially restricts to give a copoint ev1∗ for the endofunctor. Emulating the results of the previous section in this somewhat more complex setting, we have Proposition 5.3 If L is a symmetric monoidal Lawvere theory, there is a natural transformation with C-component δC∗ : M od∗s (L, C) −→ M od∗s (M od∗ (L, C)) such that M od∗s (L, −) together with ev1∗ and δ ∗ form a comonad on the category SymM ons . Proof. The proof is essentially the same as for the commutative case. In the commutative case, the commutativity was required to force δC to behave well on maps, but here, we have changed the maps so that the behaviour of δC∗ on maps is trivial. ✷ Proposition 5.4 If L is a symmetric monoidal Lawvere theory, the pair of strict symmetric monoidal functors M od∗s (ev1∗ ) and (ev1∗ )M od∗s (S.C) from the symmetric monoidal category M od∗s (M od∗s (L, C) to M od∗s (L, C) are jointly monomorphic in the category SymM ons . Proof. The proof here is the same as that for the commutative case.
✷
Theorem 5.5 If L is a symmetric monoidal Lawvere theory, the category of coalgebras for the copointed endofunctor (M od∗s (L, −), ev1 ) is equal to the category of coalgebras for the comonad (M od∗s (L, −), ev1∗ , δ ∗ ).
6
Conclusions and Further Work
In this paper, we have introduced the concept of two-dimensional linear algebra and we have commenced a development of it. There are difficult coherence questions that arise, some of which we have resolved, others of which we have not yet resolved. So we have had to skirt our way around a few difficulties at some point. But that in itself has been valuable as it has led us to identify the notion of symmetric monoidal Lawvere theory, generalising Lawvere’s original definition in what seems to us to be an interesting direction. We have further developed a condition, that of commutativity, on symmetric monoidal Lawvere theories. What may be of greatest interest to the coalgebra community is the extent to which, in the second dimension, the coalgebraic structure is simpler and more primitive than the algebraic structure of linear algebra. One intriguing observation, which we have not developed here, is that the comonads we discover here, in all our leading examples, are idempotent comonads, i.e., the comultiplication is an isomorphism, equivalently, the category of coalgebras is a full coreflective subcategory of SymM ons . We believe 237
Hyland and Power
[12] that a full understanding of that observation might provide a conceptual foundation for the Eckmann Hilton argument [8]. So there is plenty of work with which we can proceed: resolving the outstanding coherence issues such as the notion of pseudo-symmetry and the relationship between pseudo-monoidal and pseudo-closed structures on a 2category, providing a conceptual foundation for the Eckmann Hilton argument, or trying to develop specific classes of examples, for instance to support the use of structures on SymM on for concurrency [5] or contexts [9].
References [1] Barr, M., and C. Wells, “Toposes, Triples, and Theories,” Grundlehren der math. Wissenschaften 278 (1985). [2] Blackwell, R., G.M. Kelly, and A.J. Power, Two-dimensional monad theory, J. Pure Appl. Algebra 59 (1989) 1–41. [3] Carmody, S.M., “Cobordism Categories,” Ph.D. dissertation, Cambridge, 1996. [4] Carboni, A., and R.F.C. Walters, Cartesian bicategories I, J. Pure Appl. Algebra 49 (1987) 11–32. [5] Cattani, G., M.P. Fiore, and G. Winskel, A theory of recursive domains with application to concurrency, Proc. LICS 98 (1998) 214–225. [6] Danos, V., and L. Regnier, The Structure of Multiplicatives, Arch. Math. Logic 28 (1989) 181–207. [7] Eckmann, B., and P. Hilton, Group-like structures in general categories I: multiplications and comultiplications, Math. Annalen 145 (1962) 227–255. [8] Eilenberg, S., and G.M. Kelly, Closed categories, “Proc. Conference on Categorical Algebra (La Jolla 1965)”, Springer-Verlag, 1966. [9] Fiore, M., G.D. Plotkin, and A.J. Power, Cuboidal sets in axiomatic domain theory, Proc. LICS 97 (1997) 268–279. [10] Gardner, P., “Graphical presentations of interactive systems,” MathFit Summer School, 1998. [11] Gordon, R., A.J. Power, and R. Street, “Coherence for tricategories,” Mem. Amer. Math. Soc. 558, 1995. [12] Hyland, J.M.E., and A.J. Power, Symmetric Monoidal Sketches, Proc. PPDP 00 (2000) 280–288. [13] Hyland, J.M.E., and A.J. Power, Pseudo-commutative monads and pseudoclosed 2-categories, J. Pure Appl. Algebra (to appear). [14] Kelly, G.M., Coherence theorems for lax algebras and for distributive laws, Lecture Notes in Mathematics 420 (1974) 281–375.
238
Hyland and Power
[15] Kelly, G.M., and R. Street, Review of the elements of 2-categories, Lecture Notes in Mathematics 420 (1974) 75–103 [16] Kock, A., Closed categories generated by commutative monads, J. Austral. Math. Soc. 12 (1971) 405–424. [17] Milner, R., Calculi for interaction, Acta Informatica 33 (1996) 707–737. [18] O’Hearn, P.W., and D.J. Pym, The logic of Bunched Implications, Bull. Symbolic Logic (to appear).
239
CMCS’01 Preliminary Version
Modal Rules are Co-Implications Alexander Kurz CWI, P.O.Box 94079, NL-1090 GB Amsterdam, The Netherlands
Abstract In [13], it was shown that modal logic for coalgebras dualises—concerning definability— equational logic for algebras. This paper establishes that, similarly, modal rules dualise implications: It is shown that a class of coalgebras is definable by modal rules iff it is closed under H (images) and Σ (disjoint unions). As a corollary the expressive power of rules of infinitary modal logic on Kripke frames is characterised.
1
Introduction
The investigation of the relationship of modal logic and coalgebras is motivated by coalgebras being a generalisation of transition systems. A first major achievement was Moss’ paper [15] on ‘coalgebraic logic’ where it was shown how to formulate a modal logic for Ω-coalgebras depending in a canonical way on the functor Ω : Set → Set. Since then, modal logics as a specification language for coalgebras have been investigated in a number of papers, e.g. [17,18,12,10,9,5,16]. On the other hand, it is also interesting to apply categorical and (co)algebraic tools in order to obtain new insights in modal logic. For example, it was shown in [13] that one can characterise the expressive power of infinitary modal logics on Kripke frames by dualising the proof of Birkhoff’s variety theorem (which, in turn, characterises the expressive power of equational logic on algebras). Here, we continue this line of research. 3 We start from the correspondence between implications i∈I ti = ti → s = s , I a set or class, and algebras. The classical result on implicationally definable classes is due to Banaschewski and Herrlich [3] (see also Wechler [20]): A class of algebras is implicationally definable iff it is closed under subalgebras and products (and isomorphisms). Similarly to [13], our aim here is to use the duality of algebras and coalgebras to prove a dual of this theorem for coalgebras. As it turns out, the concept dual to implication is that of a modal rule. Theorem 4.1 establishes that a class of coalgebras is rule-definable iff it is closed under images of morphisms and disjoint unions. Theorem 5.2 applies this result to Kripke frames: A class of Kripke frames is definable by rules of infinitary modal logic iff it is closed under images of p-morphisms and disjoint unions. This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcs
Kurz
An algebraically similar but logically different approach is followed by Gumm [8]. There, also the results on equationally and implicationally definable classes of algebras are dualised. But the logic used for coalgebras is different: A formula ϕ is an element of the carrier of a cofree coalgebra T C and ϕ holds in a coalgebra M iff for all valuations α : U M → C the formula ϕ is not in the image of the induced morphism α# : M → T C. If we consider the semantics of a modal rule or an co-implication in the sense of Gumm as given by the corresponding coreflection morphism (see the proof of theorem 4.1 or chapter 2 in [14]), then both approaches are equivalent. A previous version of this draft has been electronically available since February 1999. It was presented at the 11th International Congress of Logic, Methodology and Philosophy of Science, Cracow, 1999. The main improvement over this draft is that theorem 4.1 does not depend any more on the existence of cofree coalgebras in SetΩ . As a consequence, the application to Kripke frames in theorem 5.2 does not require a bound on the degree of branching of the frames. This result is quite surprising and can not be transferred in an obvious way to the case of the covariety theorem in [13].
2
Coalgebras
We introduce notation and briefly review coalgebras as models for modal logic (for more information see [13,14]). The classical paper on coalgebras is Rutten [19]. Coalgebras are given w.r.t. a category C and an endofunctor Ω : C → C. An Ω-coalgebra M = (U M, fM ) is then given by an object U M ∈ C and an arrow fM : U M → Ω(U M ) in C. Ω-coalgebras form a category CΩ where a coalgebra morphism α : (U M, fM ) → (U N, fN ) is an arrow α : U M → U N in C such that Ωα ◦ fM = fN ◦ α. As an example consider the functor Ω : Set → Set given by ΩX = PX where P denotes powerset. 1 Then Ω-coalgebras are Kripke frames: given a coalgebra M and a world x ∈ U M , fM (x) is the set of successors of x. Coalgebra morphisms in SetP are functional bisimulations, i.e. p-morphisms. A remark on epis and monos in SetΩ : Since a morphism α : (U M, fM ) → (U N, fN ) is also a function α : U M → U N , it is immediate that if α is epi (mono) in Set, α is also epi (mono) in SetΩ . The converse is also true for epis (see Rutten [19], 4.7), that is, a morphism in SetΩ is epi iff it is surjective. Concerning monos it holds: α ∈ SetΩ is mono in Set iff it is strong mono in SetΩ (see the appendix), that is, a morphism in SetΩ is strong mono iff it is injective.
1
This only defines Ω on sets. On functions Ω is defined in the standard way, P being the covariant powerset functor: Given f : X → Y , Ωf = λA ∈ PX.{f (a) : a ∈ A}.
241
Kurz
2.1
Cofree Coalgebras
We first give the definition of cofree coalgebras and then show how they are interpreted in the context of modal logic. To define the notion of a cofree coalgebra consider the diagram below: UT C ✛
α#
PC
❄ C✛
α
UM
Let Ω be a functor. An Ω-coalgebra T C (and a mapping PC : U T C → C) is called cofree over C iff for all Ω-coalgebras M and all mappings α : U M → C there is a unique morphism α# : M → T C such that the diagram commutes. 2 Compared to universal algebra, the set of colours C corresponds to the set of variables and a colouring α to a valuation of variables. As in the case of Ω = P, cofree coalgebras may not exist in SetΩ . This problem can be circumvented
by extending the functor Ω on Set to a functor 3 on SET by defining ΩK = {ΩX : X ⊂ K, X a set} for classes K. It then follows from a theorem by Aczel and Mendler [2] that for every functor Ω on Set and all C ∈ Set the cofree coalgebras T C exist in SETΩ . Thus, in the following, we will allow, without further mentioning, that cofree coalgebras exist in SETΩ instead of SetΩ . As an example consider Ω = P and C = PP where P is a set of propositional variables. Let M be an Ω-coalgebra, i.e. a Kripke frame. The functions α : U M → C are valuations: every world x in M is assigned the set of propositional variables holding in x, that is, (M, α) is a Kripke model. (Note that an Ω-coalgebra M plus a valuation α : U M → C is a C × Ω-coalgebra; and a morphism between C × Ω-coalgebras f : (M, α) → (N, β) is an Ω-morphism f : M → N such that β ◦ f = α, see [13].) The diagram above then shows that any Kripke model (M, α) has a unique p-morphic image in the model (T C, PC ). We can think of (T C, PC ) as the disjoint union of all models based on Ω-frames with the additional feature that any two bisimilar worlds are identified. 2.2
Strong-mono-Coreflective Classes of Coalgebras
The concept of a strong-mono-coreflection is a generalisation of the concept of cofreeness and dualises the concept of a strong epireflection (see Borceux [4], I.3.6). Strong monos do appear here because they are the categorical way of describing subcoalgebras (see the appendix). Coreflective classes are used 2
Note that every morphism α# : M → T C ∈ SetΩ is by definition of morphisms in SetΩ also a mapping α# : U M → U T C ∈ Set. 3 SET is the category of classes and class maps as in Aczel [1], chapter 7, and Aczel and Mendler [2].
242
Kurz
because, on the one hand, they are precisely those classes closed under the operators H (closure under images of coalgebra morphisms) and Σ (closure under disjoint unions (coproducts, sums) of coalgebras), and because, on the other hand, the ‘coreflection morphisms’ will allow us to see what the defining modal rules will be (section 4). Let Ω : Set → Set be a functor. A strong-mono-coreflection for a class K of Ω-coalgebras is given by coalgebras RK M and strong monomorphisms PK M : RK M → M for all M ∈ SetΩ such that for all N ∈ K every morphism α : N → M factors uniquely through PK M: PK M ✛✛ M RK M
α
✻∗
α
N RK M is called the coreflection of M and PK M the coreflection morphism of M . Proposition 2.1 (Existence of strong-mono-coreflections) Let Ω be a functor on Set and K a class of Ω-coalgebras. Then for all M ∈ SetΩ there is RK M ∈ SetΩ and a strong mono PK M : RK M → M ∈ SetΩ such that for all N ∈ K and all α : N → M in SetΩ there is a unique α∗ : N → RK M in ∗ SetΩ such that PK M ◦ α = α. Moreover, RK M ∈ HΣHK. Proof. Let M ∈ SetΩ . Let A = {α : N → M | N ∈ K} be the collection of all coalgebra morphisms N → M with N ∈ K. Now, the union of the images 4 Clearly, of all α ∈ A defines a subcoalgebra RK M of M with inclusion PK M. for each N ∈ K the above factorisation property holds. Moreover, the fact ✷ that union is a quotient of a disjoint union shows that RK M ∈ HΣHK. Definition 2.2 (Strong-mono-coreflective-classes, smc) Let Ω be a functor on Set and K a class of Ω-coalgebras. K is called strong-mono-coreflective, or smc for short, iff it is closed under isomorphisms and contains all coreflections RK M . 5 Strong-epi-reflective classes of algebras are characterised as being exactly those classes of algebras that are closed under subalgebras and products. Dually, smc-classes of coalgebras are characterised by closure under homomorphic images (denoted by H) and closure under disjoint unions, i.e. coproducts (denoted by Σ). Proposition 2.3 Let Ω be a functor on Set and K a class of Ω-coalgebras. K is smc iff it closed under H and Σ. 4
Every coalgebra morphism α ∈ SetΩ factors through its image Im α, see Rutten [19], theorem 7.1; and the union of images of coalgebra morphisms always exists, see [19], theorem 6.4. 5 Categorically: K is smc iff it is closed under isomorphisms and the inclusion functor K → SetΩ has a right adjoint RK with the counit (i.e. 6K M ) being strong mono.
243
Kurz
Proof. “only if”: Closure under H is (the dual) of [4], I.3.6.4. For closure under Σ let Mi ∈ K (for all i ∈ I) and M the sum of all Mi . Note that RK M i is isomorphic to Mi . We have to show that RK M is isomorphic to M . PK M being a strong mono, it suffices to show that PK is epi in Set (and hence epi in M SetΩ ). This follows from the observation that every x ∈ U M is in the image of an inclusion ini : Mi → M and every inclusion factors through PK M. “if”: Follows from RK M ∈ HΣHK. ✷ Closure under H and Σ is equivalent to closure under the operator HΣ. This is dual to the fact that, in universal algebra, SP is closure under subalgebras and products (see Gumm and Schr¨oder [6] for details on closure operators on coalgebras). We can therefore phrase the proposition above as K smc iff K = HΣ(K). 2.3
An Example
To illustrate the notions above and their connection to modal logic we give an example. Let Ω = B × P, where B is the set of Booleans. That is, every state is assigned (b, Y ), where b is a Boolean and Y a set. We interpret b as the truth value of a fixed proposition and Y as the set of successors. A modal language for this functor is build from the usual connectives, modal operators and propositional variables from a set P , plus a propositional constant denoted by start. A SetΩ -coalgebra M = (U M, f ) is a Kripke frame together with a predicate interpreting start. To be more precise, let α : U M → PP, x ∈ U M, p ∈ P . Then (boolean cases as usual and π1 , π2 denoting the projections from the product B × P to its components): M, α, x |= start
⇔
π1 ◦ f (x) = true
M, α, x |= p
⇔
p ∈ α(x)
M, α, x |= ✷ϕ
⇔
∀y ∈ π2 ◦ f (x) : M, α, y |= ϕ
The states x satisfying the first clause are called states marked by start. Next, we want to axiomatise a subclass of these Kripke frames by modal rules. A modal rule ϕ/ψ (where ϕ, ψ are modal formulas) is interpreted via M |= ϕ/ψ ⇐⇒ ∀α : U M → PP : M, α |= ϕ ⇒ M, α |= ψ Modal axioms are rules with true premise. Now, consider the following rules: (refl)
✷p → p
(trans) ✷p → ✷✷p (start)
start → ✷p / p
The first two are the well-known axioms defining reflexivity and transitivity on Kripke frames. The third one is the start rule from Kr¨oger [11]. In the 244
Kurz
presence of reflexivity and transitivity it expresses that every state has to be reachable from a state marked by start. Call Φ the set of the three rules above and let K be the class of Kripke frames defined by Φ. We show that K is smc. Define RK M as the largest subcoalgebra of M satisfying Φ (that is, to find RK M , take the largest subcoalgebra of M that is reflexive and transitive and then cut off all states that are not reachable by a state marked by start). PK M : RK M → M is the canonical embedding and it is a strong mono since it is injective. Recalling the definition of a coreflective subcategory, it remains to show that for all N ∈ SetΩ satisfying Φ it holds that for all f : N → M there is a unique g : N → RK M such that f = PK M ◦ g: PK M ✛✛ M RK M .. ..✻ .. g f .. . N e
m
Consider a factorisation N → Im f → M of f . Since rules are invariant under taking images (see proposition 3.5) it follows that Im f |= Φ. Moreover m : Im f → M is a subcoalgebra of M and since RK M is the largest subcoalgebra K of M satisfying Φ, m factors through PK M as m = PM ◦ g for some g . Now, g = g ◦ e is the required morphism and g is uniquely determined since PK M is injective. Finally, let us note that K is closed under images and disjoint unions (coproducts) but not under subcoalgebras. Hence K is an example of a coquasivariety that is not a covariety.
3
Modal Logics for Coalgebras
There are many different kinds of modal logics but most of them share the following features that are essential for a logic for coalgebras: formulas are evaluated in points (worlds, states) and they are invariant under bisimulations. Compared to the paper on covarieties [13] the definition below changed a little: Since we have no requirement that the functor Ω is bounded, a logic has to have formulas for arbitrary large sets of colours. Definition 3.1 Let Ω be a functor. A modal logic for coalgebras L is given by the following: •
a class Col of sets (the sets in Col are called sets of colours of L), where Col contains for each cardinal κ a set with cardinality ≥ κ, and for each C ∈ Col a class of formulas LC ,
•
for all C ∈ Col, for all M ∈ SetΩ , and for all valuations α : U M → C a C relation |=C (M,α) ⊂ U M × LC . (Write M, α, x |= ϕ for (x, ϕ) ∈ |=(M,α) .)
•
for all C ∈ Col, M, N ∈ SetΩ , α : U M → C, β : U N → C, ϕ ∈ LC , 245
Kurz
x ∈ U M , and all C × Ω-morphisms 6 f : (M, α) → (N, β), it has to hold M, α, x |= ϕ ⇔ N, β, f (x) |= ϕ. The last condition says that formulas have to be invariant under bisimulations respecting not only the structure of the Ω-coalgebras but also the given valuations. As usual, M, x |= ϕ, (M |= ϕ) are defined by quantifying over all valuations (and all elements) of M . Formulas ϕ ∈ LC define subsets of the cofree coalgebra (T C, PC ). It is useful to introduce the following notation: [[ϕ]]T C,AC = {x ∈ U T C : T C, PC , x |= ϕ}. From the invariance of the formulas under bisimulations it follows the fundamental property allowing to reduce validity w.r.t. a valuation in any model to validity in the cofree models: M, α |= ϕ ⇐⇒ Im α# ⊂ [[ϕ]]T C,AC . Next, we show that dualising the concept of an implication in algebra we obtain the notion of a modal rule. The reader might want to recall the semantics of implications in universal algebra. First two basic facts: Let X be a set of variables and T X be the term algebra over variables X. Then every valuation α : X → A has a unique lifting to an algebra morphism αG : T X → A. And every algebra morphism αG : T X → A determines a congruence3 relation on T X that we denote by ker αG . Next, consider an implication i∈I ti = ti → s = s . It determines two congruence 3 relations P, Q on the carrier of T X, P standing for the relation induced by i∈I ti = ti and Q for the relation induced by s = s . Now, it is not difficult to see that the implication holds in an algebra A iff P ⊂ ker αG ⇒ Q ⊂ ker αG for all α : X → A. This characterisation of implications is dualised by the following definition of modal rules. Definition 3.2 (Rules) Given two formulas ϕ, ψ ∈ LC we call the expression ϕ/ψ a rule. The class of all rules built from formulas in LC is denoted by RuC . Define |= M |= ϕ/ψ iff ∀α : U M → C : Im α# ⊂ [[ϕ]]T C,AC ⇒ Im α# ⊂ [[ψ]]T C,AC , Definition 3.3 (rule-definable) Let Ω : Set → Set be a functor and L be a modal logic for Ω-coalgebras. K ⊂ SetΩ is rule-definable iff there are classes ΦC ⊂ RuC , C ∈ Col, such that M ∈ K ⇔ ∀C ∈ Col : M |= ΦC . Up to now, we have only required that formulas of modal logic are evaluated in points and are invariant under bisimulations. We need an additional 6
Recall that f : (M, α) → (N, β) is a C × Ω-morphisms iff f is an Ω-morphism such that β ◦ f = α.
246
Kurz
property that guarantees enough expressive power. Definition 3.4 A modal logic for coalgebras L is called expressive if for all C ∈ Col and every C × Ω-subcoalgebra S of (T C, PC ) there is a formula ϕ such that U S = {x ∈ T C : T C, PC , x |= ϕ}. An important consequence of our definition of a modal logic for coalgebras is that rules are preserved under images and disjoint unions. Proposition 3.5 Let L be a modal logic for Ω-coalgebras and let K be a ruledefinable class of Ω-coalgebras. Then K is closed under the operators H and Σ. Proof. Let C ∈ Col and ϕ, ψ ∈ LC . “H”: Suppose M ∈ K and f : M → N epi in SetΩ . We have to show M |= ϕ/ψ =⇒ N |= ϕ/ψ. For a contradiction assume that N |= / ϕ/ψ, i.e. there exist β : U N → C and y ∈ U N s.t. N, β, y |= ϕ and N, β, y |= / ψ. Define α : U M → C by α = β ◦ f , i.e. f is a C × Ω-bisimulation between (M, α) and (N, β). Now, since f epi in SetΩ implies f epi in Set and since |= is compatible with C × Ω-bisimulations, there is x ∈ U M such that M, α, x |= ϕ and M, α, x |= / ψ, which is the desired contradiction. “Σ”: Similar to the above. Let (Mi )i∈I be a family of models in K and / ϕ/ψ. That is, there exist α : U M → C and M = Σi∈I Mi . Suppose M |= x ∈ U M such that M, α, x |= ϕ and M, α, x |= / ψ. Since sums in SetΩ are 7 constructed as sums in Set there is a j ∈ I such that x ∈ Mj . Now, using that the inclusion inj of Mj into M is a bisimulation shows Mj , ij , x |= ϕ and / ψ. ✷ Mj , ij , x |=
4
Rule-Definable Classes of Coalgebras
We have already seen that rule-definable classes are closed under H and Σ. To show the converse, one uses that every class K closed under H and Σ is strongmono-coreflective (smc) and then shows that K is ‘defined’ by its coreflection morphisms. Theorem 4.1 (Characterisation of rule-definable classes) Let Ω : Set → Set be a functor and L an expressive modal logic for Ωcoalgebras. Then a class K is definable by rules of L iff K is closed under H and Σ. Proof. “only if” is proposition 3.5. For “if” note that K is smc by proposition 2.3. The defining rules are now determined by the coreflection morphisms PK M : RK M → M . Define ΦC for C ∈ Col as follows. For M ∈ SetΩ , |U M | ≤ |C|, choose an injective mapping i : U M → C. By expressiveC C T C,AC = Im i# and ness there are formulas ϕC M , ψM ∈ LC such that [[ϕM ]] C T C,AC C C ]] = Im(i# ◦ PK [[ψM M ). Let ΦC = {ϕM /ψM : M ∈ SetΩ , |U M | ≤ |C|}. 7
Categorically: U : SetΩ → Set creates all colimits, see [19], theorem 4.5.
247
Kurz
We have to show N ∈ K ⇔ ∀C ∈ Col : N |= ΦC . C C # T C,AC ⊂ [[ϕC . “ ⇒ ”: Let ϕC M /ψM ∈ ΦC and suppose N, β |= ϕM , i.e. Im β M ]] C C T C,AC # = Im i . Hence, β # By definition of ϕM there is i : U M → C with [[ϕM ]] factors through i# as β # = i# ◦ f for some f : N → M . Since N ∈ K and K K is smc, f factors through PK M as f = PM ◦ g for some g : N → RK M . It follows # K C T C,AC C , i.e. N, β |= ψM . Im β # = Im(i# ◦ PK M ◦ g) ⊂ Im(i ◦ PM ) = [[ψM ]] “ ⇐ ”: Let N ∈ SetΩ . Choose C ∈ Col, |C| ≥ |U N |, and i : U N → C T C,AC . We show Im i# = Im(i# ◦ PK such that Im i# = [[ϕC N ]] N ) (which implies, # K since i and PN injective, N RK N and hence N ∈ K). “⊃” is obvious and C T C,AC C C ]] = Im(i# ◦ PK ✷ Im i# ⊂ [[ψN N ) holds due to N, i |= ϕN /ψN . Remark 4.2 In the case of Ω = P the cofree coalgebras T C do not exist in SetΩ but in SETΩ . This has no effect on the proof since for all α# : M → T C, M ∈ SetΩ , also Im α# ∈ SetΩ . Note that this reasoning cannot be transferred to the proof of the covariety theorem in [13] since there one needs to consider coreflections RK T C (called FK C in [13]) of the cofree coalgebras which usually are only in SetΩ if T C ∈ SetΩ (which is not the case for Ω = P and C = {}).
5
Rule Definable Classes of Kripke Frames
The generality of theorem 4.1 allows for many applications. For example it is possible to give a version of this theorem for coalgebraic logic (Moss [15]). For covarieties instead of smc-classes this has been carried out in [13]. Coalgebraic logic has the advantage that it gives a definition of a modal logic for coalgebras for all functors Ω (preserving weak pullbacks). But here we only want to give one example of a (concrete) modal logic. We choose Ω = P and show that our theorem becomes a statement about rule-definable classes of Kripke frames. We denote with ML the infinitary modal logic built from a proper class of propositional variables Prop, the / constant ⊥, the operators ¬, ✷ and conjunctions over any set of formulas. and ✸ are defined as abbreviations. When P ⊂ Prop and P a set we write ML(P ) for the class of formulas taking only variables from P . In order to apply theorem 4.1 we need the following lemma: Lemma 5.1 The collection of all ML(P ) where P ranges over subsets of Prop is an expressive modal logic for coalgebras w.r.t. the functor P. Furthermore, the classes RuPP (see definition 3.2) are the classes of rules of ML(P ). Proof. Instantiating Col of definition 3.1 by {PP : P ⊂ Prop, P a set} and |=C (M,α) by the usual satisfaction relation of modal logic, it is immediate that the conditions of definition 3.1 are met. Expressiveness can be shown as in [13]. Next, let ϕ/ψ ∈ RuPP and M be a Kripke frame. Then, according to the definition of a rule in modal logic, M |= ϕ/ψ iff ∀α : U M → PP : M, α |= ϕ ⇒ M, α |= ψ, matching definition 3.2. ✷ 248
Kurz
Theorem 5.2 Let K be a class of Kripke frames. Then K is rule-definable iff K is closed under p-morphic images and disjoint unions. Proof. Recall that Col = {PP : P ⊂ Prop, P a set}. “if”: By lemma 5.1 and theorem 4.1. “only if”: K is rule-definable, that is, there is a class Φ ⊂ {ϕ/ψ : ϕ, ψ ∈ ML} such that K = {M ∈ SetΩ : M |= Φ}. . Let KPP = {M ∈ SetΩ : M |= Φ ∩ RuPP }. We . can then write K = {KPP : PP ∈ Col} and, by proposition 3.5, K = {HΣKPP : PP ∈. Col}. Now, it follows from a general fact on closure operators that K ⊃ HΣ {KPP : PP ∈ Col} and, therefore, K ⊃ HΣK. ✷ Some readers might feel that the ‘detour’ via coalgebras is unneccessary and a proof of the theorem from first principles could be shorter. Let us therefore emphasise that our proof is in fact easy and short: once we established that a class K closed under p-morphic images and disjoint unions is determined by the coreflection morphisms PK M (see proposition 2.3), it remains only to check that the coreflection morphisms (or more generally, generated subframes, ie., strong-monos) are indeed definable by rules (see lemma 5.1 and the proof of theorem 4.1).
6
Conclusion
This paper showed that the duality between quotients in algebra and subcoalgebras in coalgebra does not only allow for a dual of Birkhoff’s variety theorem but also for a dual of the result characterising implicationally definable classes of algebras. Moreover, it was shown that the modal concept corresponding to an implication is not that of a formula ϕ → ψ but that of a rule ϕ/ψ. To study finitary specification languages for coalgebras containing (the expressiveness of) modal rules and appropriate deduction calculi is left for future research. Let us mention that the duality of algebras and coalgebras has been used here as a heuristics. The proof of theorem 4.1 is not the formal (categorical) dual of a corresponding proof for algebras since it depends on the category of sets (and coalgebras over Set are dual to algebras over Setop ). As shown in [14] it is possible to give an account of the duality of modal and equational logic which makes the duality precise in a categorical sense.
Acknowledgements I want to thank Alexander Knapp for comments on a previous draft. Diagrams were produced with Paul Taylor’s macro package. 249
Kurz
References [1] Peter Aczel. Non-Well-Founded Sets. Center for the Study of Language and Information, Stanford University, 1988. [2] Peter Aczel and Nax Mendler. A final coalgebra theorem. In D. H. Pitt et al, editor, Category Theory and Computer Science, volume 389 of LNCS, pages 357–365. Springer, 1989. [3] B. Banaschewski and H. Herrlich. Subcategories defined by implications. Houston Journal of Mathematics, 2(2):149–171, 1976. [4] Francis Borceux. Press, 1994.
Handbook of Categorical Algebra.
Cambridge University
[5] Robert Goldblatt. What is the coalgebraic analogue of Birkhoff’s variety theorem? Theoretical Computer Science. To appear. [6] H. P. Gumm and T. Schr¨ oder. Covarieties and complete covarieties. In B. Jacobs, L. Moss, H. Reichel, and J. Rutten, editors, Coalgebraic Methods in Computer Science (CMCS’98), volume 11 of Electronic Notes in Theoretical Computer Science, 1998. [7] H. P. Gumm and T. Schr¨ oder. Coalgebraic structure from weak limit preserving functors. In B. Jacobs, L. Moss, H. Reichel, and J. Rutten, editors, Coalgebraic Methods in Computer Science (CMCS’00), volume 33 of Electronic Notes in Theoretical Computer Science, pages 113–134, 2000. [8] H. Peter Gumm. Equational and implicational classes of co-algebras. Extended abstract. RelMiCS’4. The 4th International Seminar on Relational Methods in Logic, Algebra and Computer Science, Warsaw, 1998. [9] Bart Jacobs. The temporal logic of coalgebras via galois algebras. Technical Report CSI-R9906, Computing Science Institute Nijmegen, 1999. [10] Bart Jacobs. Towards a duality result in coalgebraic modal logic. In Horst Reichel, editor, Coalgebraic Methods in Computer Science (CMCS’00), volume 33 of Electronic Notes in Theoretical Computer Science, pages 163–198, 2000. [11] Fred Kr¨ oger. Temporal Logic of Programs. Springer, 1987. [12] Alexander Kurz. Specifying coalgebras with modal logic. Theoretical Computer Science, 260(1-2). To appear. [13] Alexander Kurz. A co-variety-theorem for modal logic. In Proceedings of Advances in Modal Logic 2, Uppsala, 1998. Center for the Study of Language and Information, Stanford University, 2000. [14] Alexander Kurz. Logics for Coalgebras and Applications to Computer Science. PhD thesis, Ludwig-Maximilians-Universit¨ at M¨ unchen, 2000. http://www. informatik.uni-muenchen.de/~kurz.
250
Kurz
[15] Lawrence Moss. Coalgebraic logic. Annals of Pure and Applied Logic, 96:277– 317, 1999. [16] Dirk Pattinson. Semantical principles in the modal logic of coalgebras. In Proceedings 18th International Symposium on Theoretical Aspects of Computer Science (STACS 2001), Lecture Notes in Computer Science, Berlin, 2001. Springer. To appear. [17] Martin R¨ oßiger. From modal logic to terminal coalgebras. Computer Science, 260(1-2). To appear.
Theoretical
[18] Martin R¨ oßiger. Coalgebras and modal logic. In Horst Reichel, editor, Coalgebraic Methods in Computer Science (CMCS’00), volume 33 of Electronic Notes in Theoretical Computer Science, pages 299–320, 2000. [19] J. J. M. M. Rutten. Universal coalgebra: A theory of systems. Theoretical Computer Science, 249:3–80, 2000. [20] Wolfgang Wechler. Universal Algebra for Computer Scientists, volume 25 of EATCS Monographs on Theoretical Computer Science. Springer, 1992.
A
Strong Monomorphisms
We establish that the strong monos in a category of coalgebras SetΩ are precisely the injective morphisms, ie. the subcoalgebras. First recall the definition of a strong mono (see eg. Borceux [4], I.4.3). Definition A.1 (Strong mono) A mono f : M → N is called strong iff for all epis g : X → Y and all u : X → M, v : Y → N such that f ◦ u = v ◦ g there is a (necessarily unique) w : Y → M such that w ◦ g = u and f ◦ w = v: g✲
u
.... w .... .... .... .
X
✛..
❄
M
f
Y v ❄
✲ N
From a technical point of view, this factorisation property is crucial to the results of this paper (it is used implicitely in almost all of the proofs). An immediate consequence is the following useful proposition. Proposition A.2 (Extremal monos) A strong mono m is extremal, that is, if m factors as m = f ◦ e with e epi, then e is iso. In the category Set monos, extremal monos, and strong monos are all simply injective mappings. In the category of Ω-coalgebras monos need not be injective (see Gumm and Schr¨ oder [7]). The following proposition shows that strong monos are precisely the injective morphisms in SetΩ . Proposition A.3 (i) If f ∈ SetΩ is mono as a mapping in Set then f is strong mono in SetΩ .
251
Kurz
(ii) Every morphism f ∈ SetΩ factors uniquely as an epi followed by a strong mono. Moreover, this factorisation is obtained as the epi/mono factorisation of f in Set. (iii) Strong monos in SetΩ are monos in Set. Proof. (i) Let f, g, u, v ∈ SetΩ as in the diagram above and f mono in Set, g epi in SetΩ . Since g epi in Set (Rutten [19], 4.7) the required w exists as a mapping in Set. It remains to show that w is a morphism in SetΩ , i.e. Ωw ◦ fY = fM ◦ w where fY , fM are the structure maps of the coalgebras Y, M , respectively. Drawing the appropriate diagram, this follows from g, u morphisms in SetΩ , g epi in Set and w ◦ g = u in Set. e
m
(ii) Let h : X → Y ∈ SetΩ and U X → Im h → U Y the factorisation of h in Set through its image Im h. We have to show that Im h can be equipped in a unique way with a coalgebra structure such that e, m become morphisms in SetΩ . This follows from the “diagonal fill in”: UX Ωe ◦ fX
e ✲ Im h
f Im
h
❄✛
Ω Im h
fY ◦ m
❄
✲ ΩU Y
Ωm
The diagonal fill in exists because either Im h = {} and Ωm mono 8 and e epi or Im h = {} and the empty map makes the diagram commute. That m is strong in SetΩ follows from (1). Uniqueness of the factorisation in SetΩ may be found in [4], I.4.4.5. (iii) By (2), a strong mono h : X → Y in SetΩ factors as epi/strong-mono h = e◦m. Since h is also extremal and e is epi, it follows e iso. m is strong, so is h. ✷
8
Im h = {} and m mono implies m split mono, hence Ωm mono.
252
CMCS’01 Preliminary Version
Invariants of monadic coalgebras Dragan Maˇsulovi´c 1 Institute of Mathematics University of Novi Sad Trg D. Obradovi´ca 4, 21000 Novi Sad, Yugoslavia
Abstract In this paper we consider invariants of computations described by monadic coalgebras, that is, coalgebras for a functor endowed with the structure of a monad. Following the idea of P¨ oschel and R¨ oßiger [8], we propose another concept of invariants of such coalgebras, namely, the one based on co-relations. We introduce the clone-theoretic apparatus for monadic coalgebras and show that co-relations can be taken for a general representation of their invariants. We then demonstrate that not only subuniverses, but arbitrary λ-simulations can be thought of as invariants of monadic coalgebras, and that the approach to invariants via λ-simulations is inferior in comparison to the one via co-relations. In some cases invariant co-relations uniquely determine the monadic coalgebra. Since the same does not hold in general, to every monadic coalgebra we associate a coalgebra for the same monad which emulates the original one, and has the pleasant property of being uniquely determined by its invariant co-relations. Key Words and Phrases: coalgebras, monads, invariants, co-relations, clone theory AMS Subj. Classification (1991): 68Q05
1
Introduction
Coalgebras provide an elegant and unified apparatus for investigation of various models of both computation and data structures. A particularly intriguing approach to modeling computer programs formally was offered by E. Moggi in [5,6]. The idea is to represent programs by coalgebras X → T (X), where T is a functor endowed with the structure of a monad, with the intuition that programs are to be thought of as mappings from data (elements of X) to computations (elements of T (X)). The requirement that T be equipped with the 1
Email:
[email protected] This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcs
´ Maˇ sulovic
structure of a monad is a way of coping with the need to compose simpler programs into larger ones. Note that the carrier of a coalgebra is usually thought of as a set of internal states of the computation model under investigation. Following the idea of E. Moggi, in this paper we accept the other approach and think of it as the set of data. The view of programs as monadic coalgebras (that is, coalgebras for a functor endowed with the structure of a monad) has been widely accepted by the functional programming community, where it has led to elegant solutions to many practical problems. The use of monads in functional programs makes easier both implementation and formal description of some key concepts such as purely functional input/output, destructive arrays, lazy evaluation and modularity [10,11]. The formal investigation of invariant properties of computations has started long time ago and has played an important role in the development of computer science ever since. In this paper, we consider invariants of computations described by monadic coalgebras. Invariants of arbitrary coalgebras were introduced in [4,3] as subsets of the carrier closed with respect to the coalgebraic structure. Inspired by the research presented in [8], we propose another concept: invariant co-relations. We first show that co-relations and monadic coalgebras can be bound together by means of a pair of standard clone-theoretic operators. The Galois connection which emerges from this construction shows that co-relations can be taken for a general representation of invariants of monadic coalgebras. We then demonstrate that not only subuniverses, but arbitrary λ-simulations can be thought of as invariants of such coalgebras, and that the approach to invariants via λ-simulations is inferior in comparison to the one via co-relations. As its main tool, this paper introduces clone-theoretic apparatus for monadic coalgebras. The “classical” clone theory [7] can be understood as a general theory of invariants of sets of operations. We say that an operation f preserves a relation S if
a a a n 1 2 b1 , b2 , . . . , bn ∈ S implies .. .. .. . . .
f (a1 , . . . , an ) f (b1 , . . . , bn ) ∈ S. .. .
By the fact that f preserves S we actually mean that f has the property “encoded” by S. We also say that S is an invariant of f . For example, “f preserves S0 := {0}” means that f (0, . . . , 0) = 0, while “f preserves ≤”, where ≤ is a partial order, means that f is monotone. To every set of operations F we can associate the set Inv F of all invariants common to all the elements of F . Dually, to every set of relations Q we can associate the set Pol Q of all the operations having each of the properties encoded by relations from Q. The pair Pol, Inv forms a Galois connection 2
´ Maˇ sulovic
between sets of operations and sets of relations. Galois closed sets of operations are called clones of operations. Clones of operations can be thought of as maximal sets of operations with the given set of properties. It turns out that there is another, equivalent, characterization: clones of operations are composition closed sets of operations containing all trivial operations. Let us note that the emphasis in clone-theoretic investigations is not on properties of one operation, but on sets of operations having certain sets of properties. This paper is motivated by [8] and relies on notions and results presented there. In [8], a coalgebra is taken to be a pair X, F where X is a set and F a set of co-operations on X. In that context (first proposed by K. Drbohlav in 1971, [2]) an n-ary co-operation is a mapping f : X → X + . . . + X (n times). Clones of co-operations understood in this way were introduced in [1], while the notion of co-relation (which is crucial for our purposes) and the standard clone-theoretic apparatus were introduced in [8]. The authors of [8] had a strong intuition that their results should somehow carry over to T -coalgebras. They expressed this opinion in the form of a problem posed in Remark 6.10. In this paper, we solve the problem for a class of monadic coalgebras.
2
Preliminaries
Co-operations and coalgebras. Let X be a set and T : Set → Set a functor. A T -co-operation is any mapping α : X → T (X). A T -coalgebra on X is any pair X, α where α is a T -co-operation. To keep the terminology simple, we shall omit the prefix “T -” and we shall not distinguish between coalgebras and co-operations – in the sequel, the term coalgebra will refer to both. If T is the identity functor, then T -coalgebras are just mappings X → X. For a set X let TX denote the set of all mappings X → X. For f, g ∈ TX and x ∈ X let (f · g)(x) := (g ◦ f )(x) := g(f (x)). Let X, α and Y, β be coalgebras. A mapping h✲ Y X h : X → Y is a homomorphism between X, α and Y, β, in symbols h : X, α → Y, β, if the adjacent α β ❄ ❄ diagram commutes. A bijective homomorphism is called isomorphism. We write X, α ∼ = Y, β to denote that T (X) T (h) ✲ T (Y ). the two coalgebras are isomorphic. We say that X, α is a subcoalgebra of Y, β if X ⊆ Y and the inclusion mapping iX : X → Y : x → x is a homomorphism. In that case we say that X is a subuniverse of Y, β. Let X, α be a coalgebra, λ > 0 an ordinal and S ⊆ X λ a relation on X. We say that S is a λ-simulation of X, α if there exists a coalgebra γ : S → T (S) such that πνλ is a homomorphism between S, γ and X, α for every ν < λ. Here, πνλ is the projection mapping πνλ (xξ : ξ < λ) = xν . In case of λ = 2, we write π1 and π2 instead of (more correct) π02 and π12 , 3
´ Maˇ sulovic
respectively. Note that 1-simulations are precisely the subuniverses of the coalgebra, while 2-simulations are generally referred to as bisimulations on X, α. A relation S ⊆ X × Y is called a bisimulation between coalgebras X, α and Y, β if there exists a coalgebra γ : S → T (S) such that π1 : S → X and π2 : S → Y are homomorphisms. SetT denotes the category whose objects are T -coalgebras, and whose morphisms are homomorphisms between T -coalgebras.
Monads. Let C be a category and let T : C → C an endofunctor. A C-monad is a triple T, µ, η where µ : T 2 → T and η : id → T are natural transformations such that: T3 µT
Tµ
✲ T2 µ
❄
T2
❄ µ
T
ηT
✲ T 2 ✛T η
❅
id❅
and
µ
❘ ❄✠ ❅
✲ T
T
id
T
Recall that for every coalgebra α : X → T (X) we have µX ◦ T (α) ◦ ηX = α.
Monadic coalgebras. Let M := T, µ, η be a Set-monad. To emphasise that T carries the structure of a monad, coalgebras for functor T will be referred to as Mcoalgebras. Also, the category SetT will be denoted by SetM . For a set X, the pair M, X will be abbreviated to MX. For a set X, let cAMX denote the set of all M-coalgebras on X. Note that for every f ∈ TX , the monounary algebra X, f is a coalgebra for the identity monad id, id, id. For α ∈ cAMX , let α∗ := µX ◦ T (α) ∈ TT (X) (the Kleisli star ). Let TMX := {f ∈ TT (X) | (f ◦ ηX )∗ = f }. The superposition of M-coalgebras α and β, in symbols α·β, is defined in the usual way: α·β := µX ◦T (β)◦α = β ∗ ◦α. It is clear that cAMX , ·, ηX is a monoid isomorphic to TMX , ·, idT (X) under the isomorphism α → α∗ . For α ∈ cAMX and a nonnegative integer k, we define αk by: α0 := ηX and αk := α · . . . · α (k times). A coalgebra α is called idempotent if α2 = α. Let Setidp M denote the full subcategory of SetM whose objects are idempotent coalgebras. Submonoids of cAMX , ·, ηX will be referred to as monoids of coalgebras. For F ⊆ cAMX let MonMX F denote the least monoid of coalgebras containing F . 4
´ Maˇ sulovic
Co-relations. For a set Y let 4Y 6 denote the least infinite cardinal exceeding |Y |: " 4Y 6 :=
ℵ0 , |Y | < ℵ0 ℵξ+1 , |Y | = ℵξ , ξ ≥ 0.
Let Y be a set and let λ > 0 be an ordinal. A λ-ary co-vector on Y is any mapping r : Y → λ. A λ-ary co-relation on Y [8] is any set of λ-ary (λ) co-vectors. If σ is a λ-ary co-relation, we write ar(σ) = λ. Let cRY denote
(λ) the set of all λ-ary co-relations on Y and let cRY = 0