ENRICHED CATEGORIES AND THE FLOYD-WARSHALL CONNECTION

We give a correspondence between enriched categories and the Gauss-Kleene-Floyd-Warshall connection familiar to computer scientists. This correspondence shows this generalization of categories to be a close cousin to the generalization of transitive closure algorithms. Via this connection we may bring categorical and 2-categorical constructions into an active but algebraically impoverished arena presently served only by semiring constructions. We illustrate these techniques by applying them to Birkoff’s poset arithmetic, interpretable as an algebra of “true concurrency.” The Floyd-Warshall algorithm for generalized transitive closure [AHU74] is the code fragment for v do for u, w do δuw + = δuv · δvw. Here δuv denotes an entry in a matrix δ, or equivalently a label on the edge from vertex u to vertex v in a graph. When the matrix entries are truth values 0 or 1, with + and · interpreted respectively as ∨ and ∧, we have Warshall’s algorithm for computing the transitive closure δ+ of δ, such that δ+ uv = 1 just when there exists a path in δ from u to v. When the entries are nonnegative reals, with + as min and · as addition, we have Floyd’s algorithm for computing all shortest paths in a graph: δ+ uv is the minimum, over all paths from u to v in δ, of the sum of the edges of each path. Other instances of this algorithm include Kleene’s algorithm for translating finite automata into regular expressions, and Gauss’s algorithm for inverting a matrix, in each case with an appropriate choice of semiring. Not only are these algorithms the same up to interpretation of the data, but so are their correctness proofs. This begs for a unifying framework, which is found in the notion of semiring. A semiring is a structure differing from a ring principally in that its additive component is not a group but merely a monoid, see AHU [AHU74] for a more formal treatment. Other matrix problems and algorithms besides Floyd-Warshall, such as matrix multiplication and the various recursive divide-and-conquer approaches to closure, also lend themselves to this abstraction. This abstraction supports mainly vertex-preserving operations on such graphs. Typical operations are, given two graphs δ, on a common set of vertices, to form their pointwise sum δ + defined as (δ + )uv = δuv + uv, their matrix product δ defined as (δ )uv = δu− · −v (inner product), along with their transitive, symmetric, and reflexive closures, all on the same vertex set. We would like to consider other operations that combine distinct vertex sets in various ways. The two basic operations we have in mind are the disjoint union and cartesian product of such graphs, along with such variations of these operations as pasting (as not-so-disjoint union), concatenation (as a disjoint union with additional edges from one component to the other), etc. An efficient way to obtain a usefully large library of such operations is to impose an appropriate categorical structure on the collection of such graphs. In this paper we show how to use enriched categories to provide such structure while at the same time extending the notion of semiring to the more general notion of monoidal category. In so doing we find two layers of categorical structure: 1 enriched categories in the lower layer, as a generalization of graphs, and ordinary categories in the upper layer having enriched categories for its objects. The graph operations we want to define are expressible as limits and colimits in the upper (ordinary) categories. We first make a connection between the two universes of graph theory and category theory. We assume at the outset that vertices of graphs correspond to objects of categories, both for ordinary categories and enriched categories. The interesting part is how the edges are treated. The underlying graph U(C) of a category C consists of the objects and morphisms of C, with no composition law or identities. But there may be more than one morphism between any two vertices, whereas in graph theory one ordinarily allows just one edge. These “multigraphs” of category theory would therefore appear to be a more general notion than the directed graphs of graph theory. A staple of graph theory however is the label, whether on a vertex or an edge. If we regard a homset as an edge labeled with a set then a multigraph is the case of an edge-labeled graph where the labels are sets. So a multigraph is intermediate in generality between a directed graph and an edge-labeled directed graph. So starting from graphs whose edges are labeled with sets, we may pass to categories by specifying identities and a composition law, or we may pass to edge-labeled graphs by allowing other labels than sets. What is less obvious is that we can elegantly and usefully do both at once, giving rise to enriched categories. The basic ideas behind enriched categories can be traced to Mac Lane [Mac65], with much of the detail worked out by Eilenberg and Kelly [EK65], with the many subsequent developments condensed by Kelly [Kel82]. Lawvere [Law73] provides a highly readable account of the concepts. We require of the edge labels only that they form a monoidal category. Roughly speaking this is a set bearing the structure of both a category and a monoid. Formally a monoidal category D = 〈D,⊗, I, α, λ, ρ〉 is a category D = 〈D0,m, i〉, a functor ⊗:D2 → D, an object I of D, and three natural isomorphisms α: c ⊗ (d ⊗ e) → (c ⊗ d) ⊗ e, λ: I ⊗ d → d, and ρ: d ⊗ I → d. (Here c⊗ (d⊗ e) and (c⊗ d)⊗ e denote the evident functors from D3 to D, and similarly for I ⊗ d, d⊗ I and d as functors from D to D, where c, d, e are variables ranging over D.) These correspond to the three basic identities of the equational theory of monoids. To complete the definition of monoidal category we require a certain coherence condition, namely that the other identities of that theory be “generated” in exactly one way from these, see Mac Lane [Mac71] for details. A D-category, or (small) category enriched in a monoidal category D, is a quadruple 〈V, δ,m, i〉 consisting of a set V (which we think of as vertices of a graph), a function δ:V 2 → D0 (the edgelabeling function), a family m of morphisms muvw: δ(u, v)⊗δ(v, w) → δ(u, w) of D (the composition law), and a family i of morphisms iu: I → δ(u, u) (the identities), satisfying the following diagrams. (δ(u, v)⊗ δ(v, w))⊗ δ(w, x) αδ(u,v)δ(v,w)δ(w,x) > δ(u, v)⊗ (δ(v, w)⊗ δ(w, x)) muvw ⊗ 1 ∨ 1⊗mvwx ∨ δ(u, w)⊗ δ(w, x) muwx > δ(u, x) < muvx δ(u, v)⊗ δ(v, x)