Scalars, Monads, and Categories

This chapter describes interrelations between: (1) algebraic structure on sets of scalars, (2) properties of monads associated with such sets of scalars, and (3) structure in categories (esp. Lawvere theories) associated with these monads. These inte…

Authors: Dion Coumans, Bart Jacobs

Scalars, Monads, and Catego ries Dion Coumans Bart Jacobs Inst. for Mathematics , Astrophysics Inst. for Computing and and P article Ph ysics (IMAPP) Information Sciences (ICIS) www.math.r u.nl/ ~ coumans www.cs.ru. nl/ ~ bart Radb oud Universit y Nijmegen, The Netherlands Nov em ber 26, 2024 Abstract The paper describ es interrela tions b etw e en: (1) alg ebraic structure on sets of scalars, (2) prop erties of monads associated with suc h sets of scalars, and (3) structure in categorie s (esp. Lawv ere theories) associated with these monads. These i nterrel ations will b e expressed in terms o f “triangles of adjunctions”, invo lving for instance v arious kinds of monoids (non-commutativ e, comm utative, invol utive) and semirings as scalars. It will be sho wn to whic h k ind o f monads and categories these a lgebraic structures correspond v ia adjunctions. 1 In tro duction Scalars are the elements s used in scala r multiplication s · v , yielding fo r in- stance a new v ector for a given vector v . Scalars are elements in some algebraic structure, suc h as a field (for vector spa ces), a ring (for mo dules), a group (for group actions), or a mono id (for monoid actions). A categoric al description of scalar s can b e given in a monoidal categor y C , with tensor ⊗ and tensor unit I , as the ho mset C ( I , I ) of endomaps on I . In [15] it is shown that such homs ets C ( I , I ) a lwa ys form a commutativ e monoid; in [2, § 3.2 ] this is called the ‘miracle’ o f scalars. More recent w ork in the area of quantum computation has led to renewed interest in such sca la rs, see for instance [1, 2], wher e it is shown that the presence o f bipro ducts makes this homset C ( I , I ) of scalar s a semiring, and that daggers † make it inv olu- tive. These a re first ex amples where catego rical structure (a categor y which is mono idal or has bipro ducts or dagger s) gives rise to algebraic structure (a set with a co mm utative monoid, se mir ing or involution structure). Such co r- resp ondences for m the fo cus of this pa p er , not only tho s e b etw een categoric a l and alg ebraic str ucture, but a lso involving a third element, namely str ucture on endofunctors (espec ia lly monads). Suc h corresp ondence s will be describ ed in terms of triangles o f adjunctions. 1 Sets A 7→ A × ( − )   A 7→ A × ( − ) ' ' ⊣ ⊣ Sets Sets restrict 1 1 ( − )(1) @ @ Sets ℵ 0 ( − )(1) h h left Kan ⊥ q q Figure 1: Basic triangle of adjunctions. T o sta rt, we describ e the basic triangle of adjunctions that we sha ll build on. At this stage it is meant as a sk etc h o f the setting, and no t as a n exhaustive explanation. Let ℵ 0 be the catego ry with natural num bers n ∈ N as ob jects. Such a num ber n is identified with the n -element set n = { 0 , 1 , . . . , n − 1 } . Morphisms n → m in ℵ 0 are or dinary functions n → m b etw een these finite sets. Hence there is a full a nd faithful functor ℵ 0 ֒ → Sets . The underline notation is useful to av oid ambiguit y , but w e often omit it when no co nfusion arises and write the n um ber n for the set n . Now consider the tria ngle in Figure 1, with functor catego ries at the tw o bo ttom co rners. W e briefly explain the arrows (functors) in this diagram. The down w ard arrows Sets → Sets Sets and Sets → Se ts ℵ 0 describ e the functors that map a s et A ∈ Sets to the functor X 7→ A × X . In the other, upw ard direction r ight adjoints are giv en by the functors ( − )(1) de s cribing “ ev aluate a t unit 1”, that is F 7→ F (1). At the b ottom the inclusion ℵ 0 ֒ → Sets induces a functor Sets Sets → Sets ℵ 0 by restriction: F is mapp ed to the functor n 7→ F ( n ). In the reverse direction a left adjoint is obtained by left Kan extens ion [17, Ch. X]. Explicitly , this left adjoint maps a functor F : ℵ 0 → Sets to the functor L ( F ) : Sets → Sets giv en b y: L ( F )( X ) =  ` i ∈ N F ( i ) × X i  / ∼ , where ∼ is the least equiv alence rela tion such that, for eac h f : n → m in ℵ 0 , κ m ( F ( f )( a ) , v ) ∼ κ n ( a, v ◦ f ) , where a ∈ F ( n ) and v ∈ X m . The a djunction o n the left in Figure 1 is then in fact the comp osition of the other tw o . The a djunctions in Fig ure 1 ar e not new. F or instance, the one at the b o ttom plays an impor tant ro le in the descr iptio n of ana lytic functors and sp ecies [14], se e a lso [10, 3, 6]. The categ ory of presheaves Sets ℵ 0 is used to provide a se ma nt ics for binding, see [7]. What is new in this pap er is the systematic org a nisation of corr esp ondences in triang les like the one in Figure 1 for v ario us kinds o f algebra ic structures (instea d of sets). • Ther e is a triangle of a djunctions for monoids, monads, and La wvere the- ories, s ee Figure 2. 2 • This triang le restricts to commut ative monoids, comm utative monads, a nd symmetric monoidal Lawv ere theor ie s , see Fig ur e 3. • Ther e is a lso a tria ngle o f a djunctions for co mm utative semirings, commu- tative additive monads, a nd symmetric monoidal Lawv ere theorie s with bipro ducts, see Figure 4. • This last triangle restric ts to inv o lutive commutativ e semirings, in volutiv e commutativ e additive monads, and dagger symmetric mono idal Lawv er e theories with dagger bipro ducts, see Figure 5 below. These four fig ur es with tr iangles of a djunctions provide a quick way to ge t an overview of the pa per (the r est is just hard work). The triangles capture fundamen tal cor resp ondences b etw een basic mathematica l structure s . As far as we kno w they hav e not been made explicit at this level of g enerality . The pap er is org anised as follows. It star ts with a section containing some background material on mona ds and Lawvere theories. The tr iangle o f adjunc- tions for monoids , m uch of which is fo lklore, is developed in Section 3. Sub- sequently , Section 4 forms an intermezzo; it intro duces the notion of additive monad, and prov es that a monad T is additiv e if a nd only if in its Kleisli cate- gory K ℓ ( T ) copro ducts form bipro ducts, if and only if in its catego r y Alg ( T ) of algebras pro ducts for m bipro ducts. These additive monads play a crucial r ole in Sections 5 and 6 which develop a triang le of adjunctions for commutativ e semirings. Finally , Sec tion 7 introduces the refined triang le with inv olutions and dagg ers. The triangles of adjunctions in this pap er are based on many detailed v er i- fications of basic facts. W e ha ve c hosen to describ e all constructions explicitly but to omit most of these verifications, certainly when these a re just routine. Of cours e , one can co nt in ue and try to elab or ate deep e r (categorical) structur e underlying the triangles. In this pap er we have chosen not to follow that ro ute, but ra ther to fo cus on the triangles themselves. 2 Preliminaries W e shall ass ume a basic level of familiarity with categ ory theory , esp ecially with adjunctions a nd monads. This section r e calls some basic fa cts and fixes notation. F or background information we refer to [4, 5, 1 7]. In an arbitr ary catego ry C w e write finite pr o ducts as × , 1 , wher e 1 ∈ C is the final ob ject. The pro jectio ns are written a s π i and tupling a s h f 1 , f 2 i . Finite copro ducts ar e written as + with initial ob ject 0 , and with copro jections κ i and cotupling [ f 1 , f 2 ]. W e write !, b oth for the unique map X → 1 and the unique map 0 → X . A catego ry is c a lled distributive if it has b oth finite pro ducts and finite copro ducts such that functors X × ( − ) pre s erve these copro ducts: the ca nonical maps 0 → X × 0, and ( X × Y ) + ( X × Z ) → X × ( Y + Z ) are isomorphisms. Monoidal pro ducts ar e wr itten as ⊗ , I wher e I is the tenso r unit, with the familiar is o morphisms: α : X ⊗ ( Y ⊗ Z ) ∼ = → ( X ⊗ Y ) ⊗ Z for 3 asso ciativity , ρ : X ⊗ I ∼ = → X and λ : I ⊗ X ∼ = → X for unit, and in the symmetric case also γ : X ⊗ Y ∼ = → Y ⊗ X for sw ap. W e write Mnd ( C ) for the categor y of monads on a categor y C . F or con- venience we write Mnd for Mnd ( Se ts ). Although we s hall use strength for monads mo s tly with resp ect to finite pro ducts ( × , 1) we shall give the more general definition inv o lving monoida l pro ducts ( ⊗ , I ). A monad T is ca lled strong if it comes with a ‘str ength’ na tural transformation st with c omp o nents st : T ( X ) ⊗ Y → T ( X ⊗ Y ), commuting with unit η and multiplication µ , in the sense that st ◦ η ⊗ id = η and st ◦ µ ⊗ id = µ ◦ T ( st ) ◦ st . Additionally , for the familiar mono idal isomorphisms ρ and α , T ( Y ) ⊗ I st / / ρ $ $ I I I I I I I I I T ( Y ⊗ I ) T ( ρ )   T ( X ) ⊗ ( Y ⊗ Z ) st / / α   T ( X ⊗ ( Y ⊗ Z )) T ( α )   T ( Y ) ( T ( X ) ⊗ Y ) ⊗ Z st ⊗ id / / T ( X ⊗ Y ) ⊗ Z st / / T (( X ⊗ Y ) ⊗ Z ) Also, when the tensor ⊗ is a cartesian pro duct × we sometimes write these ρ and α for the obvious maps. The category StMnd ( C ) has mona ds with strength ( T , st ) as o b jects. Mor- phisms a re monad maps commuting with strength. The monoidal structur e on C is usually clear from the context. Lemma 1 Monads on Sets ar e always str ong w.r.t. finite pr o ducts, in a c anon- ic al way, yielding a functor Mnd ( Sets ) = Mnd → StMnd = StMnd ( Sets ) . Pro of F o r every functor T : Sets → Se ts , ther e exists a strength map st : T ( X ) × Y → T ( X × Y ), namely st ( u, y ) = T ( λx. h x, y i )( u ). It makes the ab ove diagrams commute, and also commutes with unit and multiplication in ca s e T is a monad. Additionally , strengths commute with natura l tr a nsformations σ : T → S , in the sense that σ ◦ st = st ◦ ( σ × id).  Given a gener a l strength map st : T ( X ) ⊗ Y → T ( X ⊗ Y ) in a s ymmetric monoidal category one can define a swapped st ′ : X ⊗ T ( Y ) → T ( X ⊗ Y ) as st ′ = T ( γ ) ◦ s t ◦ γ , wher e γ : X ⊗ Y ∼ = → Y ⊗ X is the sw ap map. There ar e now in principle t wo maps T ( X ) ⊗ T ( Y ) ⇒ T ( X ⊗ Y ), namely µ ◦ T ( st ′ ) ◦ st and µ ◦ T ( st ) ◦ st ′ . A str ong monad T is ca lled commutativ e if these tw o comp osites T ( X ) ⊗ T ( Y ) ⇒ T ( X ⊗ Y ) are the same. In that case w e shall wr ite dst for this (single) map, which is a mono ida l transforma tio n, see also [16]. The p ow er s et monad P is an e x ample of a commutative monad, with dst : P ( X ) × P ( Y ) → P ( X × Y ) giv en by dst ( U, V ) = U × V . La ter w e shall see other examples. W e wr ite K ℓ ( T ) for the Kleisli category of a monad T , with X ∈ C as ob jects, and maps X → T ( Y ) in C as a rrows. F or clarity we s ometimes write a fat dot • for comp osition in Kleisli categor ie s, so that g • f = µ ◦ T ( g ) ◦ f . The inclus io n functor C → K ℓ ( T ) is wr itten as J , where J ( X ) = X and J ( f ) = η ◦ f . A map of mona ds σ : T → S yields a functor K ℓ ( σ ) : K ℓ ( T ) → K ℓ ( S ) which is the identit y o n ob jects, and ma ps an ar row f to σ ◦ f . This functor K ℓ ( σ ) 4 commutes with the J ’s. One obtains a functor K ℓ : Mnd ( C ) → Cat , where Cat is the category o f (small) c a tegories . W e will use the following sta nda rd result. Lemma 2 F or T ∈ Mnd ( C ) , c onsider the generic statement “if C has ♦ then so do es K ℓ ( T ) and J : C → K ℓ ( T ) pr eserves ♦ ’s”, wher e ♦ is some pr op erty. This holds for: (i). ♦ = (finite c opr o ducts + , 0 ), or in fa ct any c olimits; (ii). ♦ = (monoidal pr o ducts ⊗ , I ), in c ase the monad T is c ommu tative; Pro of Point (i) is obvious; for (ii) one defines the tensor on mor phisms in K ℓ ( T ) as:  X f → T ( U )  ⊗  Y g → T ( V )  =  X ⊗ Y f ⊗ g − → T ( U ) ⊗ T ( V ) dst − → T ( U ⊗ V )  . Then: J ( f ) ⊗ J ( g ) = dst ◦ (( η ◦ f ) ⊗ ( η ◦ g )) = η ◦ ( f ⊗ g ) = J ( f ⊗ g ).  As in this le mma we sometimes formulate results o n monads in full gener- ality , i.e. for arbitrary categor ies, even though our main results—see Figures 2, 3, 4 and 5—only deal with monads on Sets . These res ults in volve algebra ic structures like monoids and semir ings, which we in terpr et in the standard set- theoretic universe, a nd not in arbitr ary c ategories . Such greater gener ality is po ssible, in pr inciple, but it do es not se em to add enough to justify the addi- tional complexity . Often we shall b e interested in a “finitary” version o f the Kleisli constructio n, corres p o nding to the Lawv ere theory [18, 1 2] as so ciated with a monad. F or a monad T ∈ M nd on Sets we shall write K ℓ N ( T ) for the category with natura l nu m ber s n ∈ N a s o b jects, r egarded as finite sets n = { 0 , 1 , . . . , n − 1 } . A map f : n → m in K ℓ N ( T ) is then a function n → T ( m ). This yields a full inclusion K ℓ N ( T ) ֒ → K ℓ ( T ). It is ea sy to see that a map f : n → m in K ℓ N ( T ) ca n b e ident ified with an n -co tuple of elements f i ∈ T ( m ), whic h may b e seen as m -ary terms/op era tions. By the pre v ious lemma the categor y K ℓ N ( T ) has copr o ducts given on ob jects simply by the additive monoid structure (+ , 0) o n natural num b ers. There are obvious copr o jections n → n + m , using n + m ∼ = n + m . The identities n + 0 = n = 0 + n and ( n + m ) + k = n + ( m + k ) a re in fac t the familiar monoidal isomorphisms. The swap map is a n isomor phism n + m ∼ = m + n rather than an identit y n + m = m + n . In genera l, a Lawv er e theory is a s ma ll category L with natural num b ers n ∈ N as ob jects, and (+ , 0 ) o n N for ming finite copro ducts in L . It forms a categoric al version of a ter m algebr a, in which maps n → m a re understo o d as n -tuples of terms t i each with m fr ee v ariables. F orma lly a Lawv ere theory inv olves a functor ℵ 0 → L that is the identit y o n o b jects and preserves finite copro ducts “on the nose” (up-to-identit y) as oppos e d to up-to- is omorphism. A morphism of Lawv er e theorie s F : L → L ′ is a functor that is the identit y on ob jects and strictly preser ves finite copro ducts. This yields a categ ory La w . 5 Mon A   K ℓ N A ) ) ⊣ ⊣ Mnd K ℓ N 1 1 E ∼ = HK ℓ N ? ? ⊥ La w H i i T q q where                  A ( M ) = M × ( − ) action monad E ( T ) = T (1) ev aluation at singleton set 1 H ( L ) = L (1 , 1) endo-homset o f 1 ∈ L K ℓ N ( T ) Kleisli ca teg ory restr icted to ob jects n ∈ N T ( L ) = T L monad ass o ciated with Lawvere theory L . Figure 2: Ba sic relations betw een mono ids, monads and Lawv er e theories. Corollary 3 The finitary Kleisli c onst ruction K ℓ N for monads on Sets , yields a functor K ℓ N : Mnd → La w .  3 Monoids The aim of this section is to r e place the category Se ts of s e ts at the top o f the triangle in Figure 1 b y the catego ry Mon of mono ids ( M , · , 1), and to see how the co rners at the b ottom change in order to keep a triangle of adjunctions. F ormally , this can b e done by considering mo noid ob jects in the three catego ries at the co rners of the tr iangle in Figure 1 (see also [7, 6]) but we pr efer a more concrete des cription. The results in this section, which are summarised in Fig- ure 2, ar e not claimed to b e new, but are presented in prepa ration of further steps later on in this paper . W e star t b y studying the interrelations b etw een monoids a nd monads. In principle this part ca n be skipped, b ecause the a djunction on the left in Figur e 2 betw een mo noids and mona ds follows from the o ther t wo by comp os itio n. But we do make this adjunction explicit in or de r to co mpletely describ e the situa tio n. The following result is standard. W e only sk etch the pr o of. Lemma 4 Each monoid M gives rise t o a monad A ( M ) = M × ( − ) : Sets → Sets . The mapping M 7→ A ( M ) yield s a functor Mon → M nd . Pro of F o r a mono id ( M , · , 1) the unit ma p η : X → M × X = A ( M ) is x 7→ (1 , x ). The m ultiplication µ : M × ( M × X ) → M × X is ( s, ( t, x )) 7→ ( s · t, x ). The standard stre ng th map st : ( M × X ) × Y → M × ( X × Y ) is given by st (( s, x ) , y ) = ( s, ( x, y )). Ea ch mo noid map f : M → N gives rise to a map of 6 monads with comp onents f × id : M × X → N × X . These comp onents co mmute with stre ng th.  The monad A ( M ) = M × ( − ) is called the ‘ac tio n mona d’, as its c ate- gory of Eilen b erg -Mo ore algebra s consists of M -actions M × X → X and their morphisms. The monoid elements act as scalars in suc h a ctions. Conv erse ly , eac h monad (on Sets ) g ives rise to a monoid. In the following lemma we prove this in more gener ality . F or a categ ory C with finite pro ducts, we denote by Mo n ( C ) the ca tegory of monoids in C , i.e. the categor y of ob jects M in C carr y ing a monoid structur e 1 → M ← M × M with structure preser ving maps b etw een them. Lemma 5 Each st r ong monad T on a c ate gory C with finite pr o ducts, gives rise to a monoid E ( T ) = T (1) in C . The mapping T 7→ T (1) yields a functor StMnd ( C ) → Mon ( C ) Pro of F o r a strong mo nad ( T , η , µ, st ), we define a m ultiplica tio n o n T (1 ) by µ ◦ T ( π 2 ) ◦ st : T (1) × T (1) → T (1 ), with unit η 1 : 1 → T (1 ). Each monad map σ : T → S g ives rise to a mono id map T (1) → S (1) by taking the compo nent of σ at 1.  The swapp ed strength map st ′ gives rise to a swapped multiplication o n T (1), namely µ ◦ T ( π 1 ) ◦ s t ′ : T (1 ) × T (1) → T (1), a g ain with unit η 1 . It corres p o nds to ( a, b ) 7→ b · a instead of ( a, b ) 7→ a · b like in the le mma . In case T is a commutativ e monad, the t wo multiplications co incide as we prove in Lemma 10. The functors defined in the pr evious tw o Lemmas 4 and 5 form an adjunction. This result go es back to [19]. Lemma 6 The p air of functors A : Mo n ⇄ Mnd : E forms an adjunction A ⊣ E , as on t he left in Figur e 2. Pro of F o r a monoid M and a (strong) monad T on Sets there are (natural) bijectiv e co rresp ondences : A ( M ) σ / / T in Mnd M f / / T (1) in Mon Given σ one defines a monoid map σ : M → T (1) as: σ =  M ρ − 1 ∼ = / / M × 1 = A ( M )(1) σ 1 / / T (1)  , where ρ − 1 = h id , ! i in this cartes ia n case. Conv ersely , giv en f one gets a monad map f : A ( M ) → T with components: f X =  M × X f × i d / / T (1) × X st / / T (1 × X ) T ( λ ) ∼ = / / T ( X )  , 7 where λ = π 2 : 1 × X ∼ = → X . Straightforward computations show that these assignments indeed give a natura l bijective corresp ondence.  Notice that, for a monoid M , the counit of the abov e adjunction is the pro jection ( E ◦ A )( M ) = A ( M )(1) = M × 1 ∼ = → M . Hence the a djunction is a reflection. W e now mov e to the b ottom of Figure 2. The finitar y Kleisli co nstruction yields a functor from the catego ry of monads to the ca tegory of Lawvere theories (Corollar y 3). This functor ha s a left adjoin t, as is prov en in the follo wing t wo standard lemmas. Lemma 7 Each L awver e t he ory L , gives rise t o a monad T L on Sets , whi ch is define d by T L ( X ) =  ` i ∈ N L (1 , i ) × X i  / ∼ , (1) wher e ∼ is the le ast e quivalenc e r elation such t hat, for e ach f : i → m in ℵ 0 ֒ → L , κ m ( f ◦ g , v ) ∼ κ i ( g , v ◦ f ) , wher e g ∈ L (1 , i ) and v ∈ X m . Final ly, t he mappi ng L → T L yields a functor T : La w → Mnd . Pro of F o r a Lawv er e theory L , the unit map η : X → T L ( X ) =  ` i ∈ N L (1 , i ) × X i  / ∼ is given by x 7→ [ κ 1 ( id 1 , x )] . The multiplication µ : T 2 L ( X ) → T L ( X ) is given by: µ ([ κ i ( g , v )]) = [ κ j (( g 0 + · · · + g i − 1 ) ◦ g , [ v 0 , . . . , v i − 1 ])] where g : 1 → i, and v : i → T L ( X ) is written as v ( a ) = κ j a ( g a , v a ) , fo r a < i , and j = j 0 + · · · + j i − 1 . It is straightforward to show that this map µ is well-defined and that η and µ indeed define a monad s tructure on T L . F or ea ch morphism of Lawv ere theor ie s F : L → K , one may define a monad morphism T ( F ) : T L → T K with compo nen ts T ( F ) X : [ κ i ( g , v )] 7→ [ κ i ( F ( g ) , v )]. This yie lds a functor T : La w → Mnd . Checking the details is left to the reader.  Lemma 8 The p air of functors T : La w ⇄ Mnd : K ℓ N forms an adjunction T ⊣ K ℓ N , as at the b ottom in Figur e 2. Pro of F o r a Lawvere theory L and a mo na d T there ar e (natural) bijective corres p o ndenc e s : T ( L ) σ / / T in Mnd L F / / K ℓ N ( T ) in La w 8 Given σ , one defines a La w - ma p σ : L → K ℓ N ( T ) whic h is the iden tity on ob jects and sends a morphism f : n → m in L to the morphism n λi > ⊥ SMLa w H j j T q q Figure 3: Co mm utative version of Figur e 2, with co mm uta tive monoids, com- m utative monads and symmetr ic monoidal Lawv ere theories. By Lemma 2 we know that the K leisli categor y K ℓ ( T ) is symmetric mo noidal if T is commutativ e . In order to see that a lso the finitary Kleis li categor y K ℓ N ( T ) ∈ La w is s ymmetric mo noidal, we have to us e the co o rdinatisation map descr ibed in (2). F or f : n → p and g : m → q in K ℓ N ( T ) we then obtain f ⊗ g : n × m → p × q as f ⊗ g =  n × m co / / n × m f × g / / T ( p ) × T ( q ) dst / / T ( p × q ) T ( co − 1 ) / / T ( p × q )  . W e recall from [15] (see also [1 , 2]) that for a monoidal categor y C the homset C ( I , I ) of endomaps on the tensor unit forms a commutativ e mo noid. This applies in par ticular to Lawv er e theor ie s L ∈ SMLa w , and y ields a functor H : SMLa w → Mon given by H ( L ) = L (1 , 1 ), where 1 ∈ L is the tensor unit. Thu s we almost ha ve a tria ngle of a djunctions a s in Figure 3. W e only need to chec k the fo llowing result. Lemma 12 The functor T : La w → Mn d define d in (1) re stricts to SMLa w → CMnd . F urt her, this r estr iction is left adjoint to K ℓ N : CM nd → SMLa w . Pro of F o r L ∈ SM La w we define a map T ( L )( X ) × T ( L )( Y ) dst / / T ( L )( X × Y )  [ κ i ( g , v )] , [ κ j ( h, w )]   / / [ κ i × j ( g ⊗ h, ( v × w ) ◦ co i,j )] , where g : 1 → i a nd h : 1 → j in L yield g ⊗ h : 1 = 1 ⊗ 1 → i ⊗ j = i × j , and co is the co o rdinatisation function (2). Then one can sho w tha t b oth µ ◦ T ( L )( st ′ ) ◦ st and µ ◦ T ( L )( st ) ◦ st ′ are equal to dst . This makes T ( L ) a commutativ e mona d. In order to chec k that the adjunction T ⊣ K ℓ N restricts, we only need to verify that the unit L → K ℓ N ( T ( L )) strictly preserves tensors. This is easy .  12 4 Additiv e monads Having an adjunction b etw een comm utative monoids and commutativ e monads (Figure 3) raises the questio n whether w e may also define an a djunction betw een commutativ e semiring s and so me s pec ific class of monads. It will a ppe ar that so-called additive commutativ e mona ds are needed here. In this section we will define a nd study such additive (commutativ e) monads a nd see ho w they rela te to bipro ducts in their K leisli categ ories and ca tegories o f algebras. W e consider monads on a catego r y C with both finite pro ducts and copro d- ucts. If, for a mo nad T o n C , the ob ject T (0 ) is final— i.e. satisfies T (0 ) ∼ = 1— then 0 is b oth initia l and final in the K leisli catego ry K ℓ ( T ). Suc h an o b ject that is both initial and final is called a zer o obje ct . Also the conv e rse is true, if 0 ∈ K ℓ ( T ) is a zero ob ject, then T (0) is final in C . Althoug h we don’t use this in the r emainder o f this pa p er , we also mention a related result on the categor y of Eilenberg- Mo ore algebra s. T he pro ofs are simple and are left to the reader . Lemma 13 F or a monad T on a c ate gory C with finite pr o ducts ( × , 1) and c opr o ducts (+ , 0) , the fol lowing statement s ar e e quivalent. (i). T (0) is final in C ; (ii). 0 ∈ K ℓ ( T ) is a zer o obje ct; (iii). 1 ∈ Alg ( T ) is a zer o obje ct.  A zero ob ject yields, for any pair of o b jects X , Y , a unique “zero map” 0 X,Y : X → 0 → Y betw e e n them. In a K leisli categor y K ℓ ( T ) for a monad T on C , this zero map 0 X,Y : X → Y is the following map in C 0 X,Y =  X ! X / / 1 ∼ = T (0) T (! Y ) / / T ( Y )  . (3) F or convenience, we make some basic proper ties of this zero map explicit. Lemma 14 Assume T (0) is final, for a monad T on C . The r esult ing zer o maps 0 X,Y : X → T ( Y ) fr om (3) make the following diagr ams in C c ommute X 0 / / 0 # # G G G G G G G T 2 ( Y ) µ   T ( X ) T (0) o o 0 y y t t t t t t t X 0 / / f   0 " " F F F F F F F T ( Y ) T ( f )   X 0 / / 0 " " F F F F F F F T ( Y ) σ Y   T ( Y ) Y 0 / / T ( Z ) S ( Y ) wher e f : Y → Z is a map in C and σ : T → S is a map of monads.  Still as suming that T (0) is final, the z e ro map (3 ) enables us to define a canonical map b c def =  T ( X + Y ) h µ ◦ T ( p 1 ) ,µ ◦ T ( p 2 ) i / / T ( X ) × T ( Y )  , (4) 13 where p 1 def =  X + Y [ η, 0 Y ,X ] / / T ( X )  , p 2 def =  X + Y [0 X,Y ,η ] / / T ( Y )  . (5) Here w e a ssume that the under lying category C has b oth finite pro ducts a nd finite co pro ducts. The abbreviatio n “ b c ” stands for “bicar tesian”, s ince this maps c o nnects the copro ducts and pr o ducts. The auxiliary maps p 1 , p 2 are sometimes called pro jections, but sho uld not b e confused with the (pro per ) pro jections π 1 , π 2 asso ciated with the pro duct × in C . W e contin ue by listing a s eries of pro pe rties of this map b c that will b e useful in what follo ws . Lemma 15 In t he c ontext just describ e d, the map b c : T ( X + Y ) → T ( X ) × T ( Y ) in (4) has the fol lowing pr op erties. (i). This b c is a natu r al tr ansformation, and it c ommutes with any m onad map σ : T → S , as in: T ( X + Y ) b c / / T ( f + g )   T ( X ) × T ( Y ) T ( f ) × T ( g )   T ( X + Y ) b c / / σ X + Y   T ( X ) × T ( Y ) σ X × σ Y   T ( U + V ) b c / / T ( U ) × T ( V ) S ( X + Y ) b c / / S ( X ) × S ( Y ) (ii). It also c ommutes with the monoidal isomorphisms (for pr o ducts and c o- pr o ducts in C ): T ( X + 0) b c / / T ( ρ ) ∼ = & & M M M M M M M M M M M T ( X ) × T (0) ρ ∼ =   T ( X + Y ) b c / / T ([ κ 2 ,κ 1 ]) ∼ =   T ( X ) × T ( Y ) h π 2 ,π 1 i ∼ =   T ( X ) T ( Y + X ) b c / / T ( Y ) × T ( X ) T (( X + Y ) + Z ) b c / / T ( α ) ∼ =   T ( X + Y ) × T ( Z ) b c × id / / ( T ( X ) × T ( Y )) × T ( Z ) α ∼ =   T ( X + ( Y + Z )) b c / / T ( X ) × T ( Y + Z ) id × b c / / T ( X ) × ( T ( Y ) × T ( Z )) (iii). The map b c inter acts with η and µ in the fol lowing manner: X + Y η   h p 1 ,p 2 i ' ' O O O O O O O O O O O T ( X + Y ) b c / / T ( X ) × T ( Y ) 14 T 2 ( X + Y ) µ / / T ( b c )   T ( X + Y ) b c   T ( T ( X ) + T ( Y )) b c / / T ([ T ( κ 1 ) ,T ( κ 2 )])   T 2 ( X ) × T 2 ( Y ) µ × µ   T ( T ( X ) × T ( Y )) h T ( π 1 ) ,T ( π 2 ) i   T 2 ( X + Y ) µ   T 2 ( X ) × T 2 ( Y ) µ × µ / / T ( X ) × T ( Y ) T ( X + Y ) b c / / T ( X ) × T ( Y ) (iv). If C is a distributive c ate gory, b c c ommutes with str ength st as fol lows: T ( X + Y ) × Z b c × id / / st   ( T ( X ) × T ( Y )) × Z dbl / / ( T ( X ) × Z ) × ( T ( Y ) × Z ) st × st   T (( X + Y ) × Z ) ∼ = / / T (( X × Z ) + ( Y × Z )) b c / / T ( X × Z ) × T ( Y × Z ) wher e dbl is the “double” map h π 1 × id , π 2 × id i : ( A × B ) × C → ( A × C ) × ( B × C ) . Pro of Thes e prop erties ar e easily verified, using Lemma 1 4 and the fact that the pro jections p i are na tural, b oth in C and in K ℓ ( T ).  The definition of the map b c also makes sense for arbitra ry set-indexed (co)pro ducts (see [13]), but her e we only consider finite o nes. Such gener alised b c -maps also satisfy (suitable generalisa tions of ) the prop erties in Lemma 15 ab ov e. W e will study monads for which the ca nonical map b c is an isomorphism. Such mo nads will be called ‘additive monads’. Definition 16 A m onad T o n a c ate gory C with fi nite pr o ducts ( × , 1) and finite c opr o du ct s (+ , 0) wil l b e c al le d additive if T (0) ∼ = 1 and if the c anonic al map bc : T ( X + Y ) → T ( X ) × T ( Y ) fr om (4) is an isomorph ism. W e write AMnd ( C ) for the ca tegory of additive mo nads on C with monad morphism be tw een them, and similarly A CMnd ( C ) for the catego ry of additive and commutativ e monads on C . A basic result is tha t additive mo nads T induce a comm utative monoid structure on ob jects T ( X ). T his result is sometimes taken as definition of additivity of monads ( cf . [9]) . Lemma 17 L et T b e an additive monad on a c ate gory C and X an obje ct of C . Ther e is an additio n + on T ( X ) given by + def =  T ( X ) × T ( X ) b c − 1 / / T ( X + X ) T ( ∇ ) / / T ( X )  , wher e ∇ = [id , id] . Then: 15 (i). t his + is c ommut ative and asso ciative, (ii). and has unit 0 1 ,X : 1 → T ( X ) ; (iii). t his monoid structur e is pr eserve d by maps T ( f ) as wel l as by multiplic a- tion µ ; (iv). the mappi ng ( T , X ) 7→ ( T ( X ) , + , 0 1 ,X ) yields a functor A d : AMnd ( C ) × C → CMon ( C ) . Pro of The first three statements follow by the prop erties o f b c from Lemma 15. F or instance, 0 is a (right) unit for + a s demonstrated in the follo wing diagram. T ( X ) ρ − 1 ∼ = / / ∼ = T ( ρ − 1 ) ) ) R R R R R R R R R R R R R R R T ( X ) × T (0) id × T (!) / / b c − 1   T ( X ) × T ( X ) b c − 1   + x x T ( X + 0) T (id+ !) / / T ( ρ ) ∼ = * * T T T T T T T T T T T T T T T T T T ( X + X ) T ( ∇ )   T ( X ) Regarding (iv) we define, for a pair of morphisms σ : T → S in AMnd ( C ) and f : X → Y in C , A d (( σ , f )) = σ ◦ T ( f ) : T ( X ) → S ( Y ) , which is equa l to S ( f ) ◦ σ by natura lit y of σ . Pr eserv ation of the unit by A d (( σ , f )) follows from Lemma 14. The following dia gram demonstrates tha t addition is preserved. T ( X ) × T ( X ) T ( f ) × T ( f ) / / b c − 1   T ( Y ) × T ( Y ) σ × σ / / b c − 1   S ( Y ) × S ( Y ) b c − 1   T ( X + X ) T ( f + f ) / / σ * * T T T T T T T T T T T T T T T T T ( ∇ )   T ( Y + Y ) σ ( ( P P P P P P P P P P P P S ( X + X ) S ( f + f ) / / S ( ∇ )   S ( Y + Y ) S ( ∇ )   T ( X ) σ / / S ( X ) S ( f ) / / S ( Y ) where we use p oint (i) of Lemma 15 a nd the naturality o f σ . It is ea sily chec ked that this mapping defines a functor.  By Lemma 2, for a mo nad T on a ca tegory C with finite copro ducts, the Kleisli construction yields a c ategory K ℓ ( T ) with finite copro ducts. Below w e 16 will prove that, under the a ssumption that C also has pro ducts, these c o pro ducts form bipro ducts in K ℓ ( T ) if and only if T is additiv e. Again, as in Le mma 13, a rela ted result holds for the c a tegory Alg ( T ). Definition 18 A catego ry with bipro ducts is a c ate gory C with a zer o obje ct 0 ∈ C , such that, for any p air of obje cts A 1 , A 2 ∈ C , ther e is an obje ct A 1 ⊕ A 2 ∈ C that is b oth a pr o duct with pr oje ctions π i : A 1 ⊕ A 2 → A i and a c opr o duct with c opr oje ctions κ i : A i → A 1 ⊕ A 2 , such that π j ◦ κ i = ( id A i if i = j 0 A i ,A j if i 6 = j. Theorem 19 F or a monad T on a c ate gory C with fi n ite pr o duct s ( × , 1) and c opr o ducts (+ , 0) , the fol lowing ar e e quivalent. (i). T is addi tive; (ii). the c opr o ducts in C form bipr o ducts in the Kleisli c ate gory K ℓ ( T ) ; (iii). t he pr o ducts in C yield bipr o ducts in t he c ate gory of Eilenb er g-Mo or e al- gebr as Alg ( T ) . Here we shall only use this result for K leisli categor ies, but we include the result for algebras for completeness. Pro of Fir st w e as sume that T is additive and show that (+ , 0) is a pro duct in K ℓ ( T ). As pro jections we take the maps p i from (5). F or Kleisli maps f : Z → T ( X ) and g : Z → T ( Y ) there is a tuple via the map b c , as in h f , g i K ℓ def =  Z h f ,g i / / T ( X ) × T ( Y ) b c − 1 / / T ( X + Y )  . One obtaines p 1 • h f , g i K ℓ = µ ◦ T ( p 1 ) ◦ b c − 1 ◦ h f , g i = π 1 ◦ bc ◦ b c − 1 ◦ h f , g i = π 1 ◦ h f , g i = f . Remaining details are left to the reader. Conv erse ly , a ssuming that the copr o duct (+ , 0 ) in C forms a bipro duct in K ℓ ( T ), we hav e to show that the bicartesia n map b c : T ( X + Y ) → T ( X ) × T ( Y ) is an isomor phism. As + is a bipro duct, there exist pr o jection maps q i : X 1 + X 2 → X i in K ℓ ( T ) satis fying q j • κ i = ( id X i if i = j 0 X i ,X j if i 6 = j. F rom these co nditio ns it fo llows that q i = p i , where p i is the map defined in (5). The or dinary pro jection maps π i : T ( X 1 ) × T ( X 2 ) → T ( X i ) are maps T ( X 1 ) × T ( X 2 ) → X i in K ℓ ( T ). Hence, a s + is a pro duct, ther e exists a unique map h : T ( X 1 ) × T ( X 2 ) → X 1 + X 2 in K ℓ ( T ), i.e. h : T ( X 1 ) × T ( X 2 ) → T ( X 1 + X 2 ) in C , suc h that p 1 • h = π 1 and p 2 • h = π 2 . It is r eadily check ed that this map h is the inv ers e of b c . 17 T o prove the equiv a lence of (i) and (iii) , fir st assume that the monad T is additive. In the categ o ry Alg ( T ) o f algebra s there is the standar d pro duct  T ( X ) α / / X  ×  T ( Y ) β / / Y  def =  T ( X × Y ) h α ◦ T ( π 1 ) ,β ◦ T ( π 2 ) i / / X × Y  . In order to show tha t × also for ms a co pr o duct in Alg ( T ), we first show that for an a rbitrary a lgebra γ : T ( Z ) → Z the ob ject Z car ries a comm utative monoid structure. W e do so b y a dapting the structure (+ , 0) o n T ( Z ) from Lemma 1 7 to (+ Z , 0 Z ) on Z via + Z def =  Z × Z η × η / / T ( Z ) × T ( Z ) + / / T ( Z ) γ / / Z  0 Z def =  1 0 / / T ( Z ) γ / / Z  This mono id structure is pre s erved by homomorphisms of algebra s. No w, we can form copro jections k 1 = h id , 0 Y ◦ ! i : X → X × Y , and a cotuple of alge- bra ho momorphisms ( T X α → X ) f − → ( T Z γ → Z ) and ( T Y β → X ) g − → ( T Z γ → Z ) given b y [ f , g ] Alg def =  X × Y f × g / / Z × Z + Z / / Z  . Again, rema ining details are left to the reader. Finally , to show tha t (iii) implies (i) , consider the a lgebra morphisms :  T 2 ( X i ) µ / / T ( X i )  T ( κ i ) / /  T 2 ( X 1 + X 2 ) µ / / T ( X 1 + X 2 )  . The free functor C → Alg ( T ) preser ves copro ducts, so these T ( κ i ) fo rm a copro duct diagram in Alg ( T ). As × is a copro duct in Alg ( T ), b y assumption, the cotuple [ T ( κ 1 ) , T ( κ 2 )] : T ( X 1 ) × T ( X 2 ) → T ( X 1 + X 2 ) in Alg ( T ) is an isomorphism. The copr o jections ℓ i : T ( X i ) → T ( X 1 ) × T ( X 2 ) satisfy ℓ 1 = h π 1 ◦ ℓ 1 , π 2 ◦ ℓ 2 i = h id , 0 i , and similarly , ℓ 2 = h 0 , id i . Now w e co mpute: b c ◦ [ T ( κ 1 ) , T ( κ 2 )] ◦ ℓ 1 = h µ ◦ T ( p 1 ) , µ ◦ T ( p 2 ) i ◦ T ( κ 1 ) = h µ ◦ T ( p 1 ◦ κ 1 ) , µ ◦ T ( p 2 ◦ κ 1 ) i = h µ ◦ T ( η ) , µ ◦ T (0) i = h id , 0 i = ℓ 1 . Similarly , b c ◦ [ T ( κ 1 ) , T ( κ 2 )] ◦ ℓ 2 = ℓ 2 , so that b c ◦ [ T ( κ 1 ) , T ( κ 2 )] = id, making b c an isomorphism.  It is well-known (see for instance [15, 1]) that a category with finite bipro d- ucts ( ⊕ , 0) is enric hed ov er commutativ e monoids: each homset carries a com- m utative monoid structure (+ , 0), and this structure is preser ved by pre- and 18 po st-comp osition. The addition oper ation + on homsets is obtained as f + g def =  X h id , id i / / X ⊕ X f ⊕ g / / Y ⊕ Y [id , id] / / Y  . (6) The zero map is neutral ele men t for this addition. One ca n als o des crib e a monoid structur e on ea ch o b ject X as X ⊕ X [id , id] / / X 0 . 0 o o (7) W e have just s een that the Kleis li c a tegory o f an additive mona d ha s bipro d- ucts, using the addition op era tion from Lemma 17. When we a pply the sum description (7) to such a Kleisli category its bipro ducts, we obtain pr ecisely the original addition fro m Le mma 17, since the codiag onal ∇ = [id , id] in the Kleisli category is giv en T ( ∇ ) ◦ b c − 1 . 4.1 Additiv e commutativ e monads In the remainder of this section we fo cus on the category ACMnd ( C ) of monads that are b oth additive and commutativ e on a distributive ca tegory C . As usual, we simply write A CMnd for A CMnd ( Sets ). F or T ∈ ACMnd ( C ), the Kleisli category K ℓ ( T ) is b o th symmetric monoida l—with ( × , 1) as monoidal structure, see Lemma 2—and has biproducts (+ , 0). Moreover, it is not hard to see that this mo noidal structure distributes ov er the bipro ducts via the cano nical map ( Z × X ) + ( Z × Y ) → Z × ( X + Y ) tha t can be lifted from C to K ℓ ( T ). W e shall write SMBLaw ֒ → SMLaw for the categ o ry of symmetric monoidal Lawv ere theories in which (+ , 0 ) fo r m not o nly copro ducts but bipro ducts. No- tice that a pro jection π 1 : n + m → n is necessarily of the for m π 1 = [id , 0], where 0 : m → n is the ze r o map m → 0 → n . The tensor ⊗ distributes ov er (+ , 0) in SMBLa w , as it already do es so in SMLa w . Morphisms in SM BLa w are functors that strictly preserve a ll the s tructure. The following result extends Corolla r y 3. Lemma 20 The (finitary) Kleisli c onstruction on a m onad yields a funct or K ℓ N : ACMnd → SMBLaw . Pro of It follows from Theorem 19 that (+ , 0) form bipro ducts in K ℓ N ( T ), for T an additive co mm utative monad (on Sets ). This structure is preserved by functors K ℓ N ( σ ), for σ : T → S in A CMnd .  W e have already seen in Le mma 12 that the functor T : La w → Mnd defined in Lemma 7 res tricts to a functor b etw een s y mmetric monoidal Lawvere theories and comm uta tive monads. W e now sho w that it also r estricts to a functor b e- t ween symmetric monoidal Lawv ere theories with bipr o ducts and commutative additive monads. Ag a in, this res triction is left adjoint to the finitary Kleisli construction. 19 Lemma 21 The functor T : SMLa w → CMnd fr om L emma 12 r estricts to SMBLa w → A CMnd . F u rther, this r estriction is left adjoint t o the finitary Kleisli c onstruction K ℓ N : ACMnd → SMBLaw . Pro of Fir st note that T L (0) is final: T L (0) = ` i L (1 , i ) × 0 i ∼ = L (1 , 0) × 0 0 ∼ = 1 , where the last isomorphism follows from the fact that (+ , 0) is a biproduct in L and hence 0 is terminal. The resulting zero ma p 0 X,Y : X → T ( Y ) is given b y x 7→ [ κ 0 (! : 1 → 0 , ! : 0 → Y )] . T o prov e that the bicar tesian map b c : T L ( X + Y ) → T L ( X ) × T L ( Y ) is a n isomorphism, we introduce some notation. F or [ κ i ( g , v )] ∈ T L ( X + Y ), wher e g : 1 → i and v : i → X + Y , w e fo rm the pullbac ks (in Sets ) i X v X   / / _  i v   i Y v Y   o o  _ X κ 1 / / X + Y Y κ 2 o o By universalit y of copr o ducts we can write i = i X + i Y and v = v X + v Y : i X + i Y → X + Y . Then we can also w r ite g = h g X , g Y i : 1 → i X + i Y . Hence, for [ k i ( g , v )] ∈ T L ( X + Y ), b c ([ κ i ( g , v )]) =  [ κ i X ( g X , v X )] , [ κ i Y ( g Y , v Y )]  . (8) It then easily follows that the map T L ( X ) × T L ( Y ) → T L ( X + Y ) defined b y ([ κ i ( g , v )] , [ κ j ( h, w )]) 7→ [ κ i + j ( h g , h i , v + w )] is the in verse of b c . Checking that the unit o f the adjunction T : SM La w ⇆ CMnd : K ℓ N pre- serves the pro duct structure is left to the reader. This prov es that also the restricted functor s form an adjunction.  In the next tw o sections we will see how additive commutativ e mo na ds and symmetric monoidal Lawv e r e theories with bipro ducts r elate to commutativ e semirings. 5 Semirings and monads This s e ction starts with so me clarification ab out semirings a nd mo dules. Then it shows how semirings g ive rise to certain “multiset” monads, whic h are b oth commutativ e and additive. I t is shown that the “ev alua te at unit 1”- functor yields a map in the reverse dir ection, g iving rise to an adjunction, as b efore. 20 A commutativ e semiring in Sets c onsists of a set S together with tw o com- m utative monoid structures, one a dditive (+ , 0) and one multiplicativ e ( · , 1 ), where the latter dis tributes o ver the former: s · 0 = 0 and s · ( t + r ) = s · t + s · r . F or more information on semir ings, s ee [8]. Her e we only co nsider commuta- tive ones. Typical examples ar e the natural num b ers N , or the non-negative rationals Q ≥ 0 , o r the rea ls R ≥ 0 . One wa y to describ e semir ing s catego rically is by consider ing the additive monoid ( S, + , 0) as an ob ject of the category CMo n o f commu tative monoids, carrying a multiplicativ e monoid structure I 1 → S · ← S ⊗ S in this catego r y CMon . The tensor guar antees that multiplication is a bihomomo rphism, and th us distributes o ver additions. In the present c o ntext o f categories with finite pro ducts we do not need to use these tens o rs and can give a dir ect categor ical formulation o f such s emirings, as a pair of monoids 1 0 → S + ← S × S and 1 1 → S · ← S × S making the following distributivity diagrams commute. S × 1 id × 0 / / !   S × S ·   ( S × S ) × S dbl / / + × id   ( S × S ) × ( S × S ) ·×· / / S × S +   1 0 / / S S × S · / / S where dbl = h π 1 × id , π 2 × id i is the do ubling map that was a lso used in Lemma 1 5. With the o bvious notion of homomorphism betw een semir ing s this yields a cat- egory CSR ng ( C ) of (commutativ e) semirings in a category C with finite pro d- ucts. Asso ciated with a s emiring S there is a notion o f mo dule ov er S . It consists of a comm utative monoid ( M , 0 , +) together with a (multiplicativ e) action ⋆ : S × M → M that is an additiv e bihomomorphism, that is, the action preserves the additive str ucture in each a rgument separ ately . W e recall that the prop erties of an action ar e given categorically by ⋆ ◦ ( · × id) = ⋆ ◦ (id × ⋆ ) ◦ α − 1 : ( S × S ) × M → M and ⋆ ◦ (1 × id) = π 2 : 1 × M → M . The fact tha t ⋆ is an additiv e bihomomorphism is expressed by S × ( M × M ) dbl ′ / / id × +   ( S × M ) × ( S × M ) ⋆ × ⋆   ( S × S ) × M dbl o o + × id   M × M +   S × M ∗ / / M S × M ∗ o o where dbl ′ is the o bvious duplica tor of S . Preserv ation of zeros is simply ⋆ ◦ (0 × id) = 0 ◦ π 1 : 1 × M → M and ⋆ ◦ (id × 0) = 0 ◦ π 2 : S × 1 → M . W e shall assemble s uch s e mir ings and mo dules in o ne categ ory M od ( C ) with tr iple s ( S, M , ⋆ ) as ob jects, where ⋆ : S × M → M is an action as ab ov e . A morphism ( S 1 , M 1 , ⋆ 1 ) → ( S 2 , M 2 , ⋆ 2 ) consists of a pair of morphisms f : S 1 → S 2 and g : M 1 → M 2 in C such tha t f is a map of semirings, f is a map o f monoids, and the actions interact appr opriately: ⋆ 2 ◦ ( f × g ) = g ◦ ⋆ 1 . 21 5.1 F rom semirings to monads T o constr uct an adjunction b etw een semirings and additiv e comm utative mon- ads we start b y defining, fo r ea ch commutativ e semiring S , the so-called multiset monad on S a nd sho w that this monad is b oth c o mm utative and additive. Definition 22 F or a semiring S , define a “multiset” functor M S : Sets → Sets on a set X by M S ( X ) = { ϕ : X → S | supp( ϕ ) is fin ite } , wher e supp( ϕ ) = { x ∈ X | ϕ ( x ) 6 = 0 } is c al le d the supp ort of ϕ . F or a function f : X → Y one defines M S ( f ) : M S ( X ) → M S ( Y ) by: M S ( f )( ϕ )( y ) = P x ∈ f − 1 ( y ) ϕ ( x ) . Such a multiset ϕ ∈ M S ( X ) ma y b e written as for mal sum s 1 x 1 + · · · + s k x k , where supp( ϕ ) = { x 1 , . . . , x k } and s i = ϕ ( x i ) ∈ S descr ibe s the “ mult iplicit y” of the element x i . In this notatio n one can write the applica tion of M S on a map f as M S ( f )( P i s i x i ) = P i s i f ( x i ). F unctor iality is then ob vio us . Lemma 23 F or e ach semiring S , the mult iset functor M S forms a c ommutative and addi tive monad, with unit and multiplic ation: X η / / M S ( X ) M S ( M S ( X )) µ / / M S ( X ) x  / / 1 x P i s i ϕ i  / / λx ∈ X . P i s i ϕ i ( x ) . Pro of The verification that M S with these η and µ indeed forms a monad is left to the reader. W e men tio n that for commutativit y and additivity the relev ant maps ar e given b y: M S ( X ) × M S ( Y ) dst / / M S ( X × Y ) M S ( X + Y ) b c / / M S ( X ) × M S ( Y ) ( ϕ, ψ )  / / λ ( x, y ) . ϕ ( x ) · ψ ( y ) χ  / / ( χ ◦ κ 1 , χ ◦ κ 2 ) . Clearly , b c is an is o morphism, making M S additive.  Lemma 24 The assignment S 7→ M S yields a funct or M : CSRng → A CMnd . Pro of E very semiring homomo rphism f : S → R , gives rise to a monad mor- phism M ( f ) : M S → M R with comp onents defined by M ( f ) X ( P i s i x i ) = P i f ( s i ) x i . It is left to the reader to chec k that M ( f ) is indeed a monad morphism.  F or a semiring S , the ca tegory Alg ( M S ) of a lgebras of the multiset monad M S is (equiv a lent to) the ca tegory M od S ( C ) ֒ → M od ( C ) of mo dules over S . This is not used her e, but just mentioned as background information. 22 5.2 F rom monads to semirings A co mmutative additiv e monad T on a categor y C gives rise to tw o commutativ e monoid structures on T (1), namely the multiplication defined in Lemma 10 a nd the addition defined in Lemma 1 7 (considered for X = 1). In case the categ ory C is distributiv e these tw o o pe rations turn T (1) into a semiring. Lemma 25 Each c ommutative additive monad T on a distributive c ate gory C with terminal obj e ct 1 gives rise to a semiring E ( T ) = T (1) in C . The map ping T 7→ E ( T ) yields a functor A CMnd ( C ) → CSRng ( C ) . Pro of F o r a commutativ e additive monad T on C , addition on T (1) is given by T ( ∇ ) ◦ b c − 1 : T (1) × T (1) → T (1) with unit 0 1 , 1 : 1 → T (1 ) a s in Lemma 17, the multiplication is g iven by µ ◦ T ( λ ) ◦ st : T (1) × T (1) → T (1) with unit η 1 : 1 → T (1) as in Lemma 10. It was s hown in the lemmas just mentioned that b oth addition and multipli- cation define a commutativ e monoid structure on T (1). The following diagram prov es distributivity of m ultiplication over addition. ( T (1) × T (1)) × T (1) b c − 1 × id / / dbl   T (1 + 1) × T (1) T ( ∇ ) × id / / st   T (1) × T (1 ) st   ( T (1) × T (1)) × ( T (1) × T (1)) st × st   T ((1 + 1) × T (1)) T ( ∇× id ) / / ∼ =   T (1 × T (1)) T ( λ )   T (1 × T (1)) × T (1 × T ( X )) b c − 1 / / T ( λ ) × T ( λ )   T (1 × T (1) + 1 × T (1)) T ( λ + λ   T 2 (1) × T 2 (1) µ × µ   b c − 1 / / T ( T (1) + T (1)) T ( ∇ ) ) ) S S S S S S S S S S S S S S S S T ([ T ( κ 1 ) ,T ( κ 2 )])   T 2 (1 + 1) T 2 ( ∇ ) / / µ   T 2 (1) µ   T (1) × T (1) b c − 1 / / T (1 + 1) T ( ∇ ) / / T (1) Here we rely o n Lemma 15 for the comm utativity of the upp er and lower square on the left. In a distributive categor y 0 ∼ = 0 × X , for every ob ject X . In particula r T (0 × T (1 )) ∼ = T (0) ∼ = 1 is final. This is used to obtain commutativit y of the 23 upper -left sq uare of the following diagram proving 0 · s = 0: T (1) ∼ = / / !   T (0) × T (1 ) T (!) × id / / st   T (1) × T (1 ) st   T (0) T (!) / / ∼ = / / T (!) % % L L L L L L L L L L T (0 × T (1)) T ( λ )   T (! × id ) / / T (1 × T (1)) T ( λ )   T 2 (1) id / / T 2 (1) µ   T (1) F or a mo nad morphism σ : T → S , we define E ( σ ) = σ 1 : T (1 ) → S (1). By Lemma 5, σ 1 commutes with the multiplicativ e structure. As σ 1 = T ( id ) ◦ σ 1 = A d (( σ, id )), it follows from Lemma 1 7 that σ 1 also commutes with the additive structure and is therefore a CSRng -homo morphism.  5.3 Adjunction b etw een monads and semirings The functors defined in the Lemmas 24 and 2 5, considered o n C = Sets , form an adjunction M : CSRng ⇆ A CMnd : E . T o prove this adjunction we first show that each pair ( T , X ), where T is a co mm utative a dditive monad on a category C and X an ob ject o f C , giv es ris e to a mo dule on C as defined a t the beg inning of this section. Lemma 26 Each p air ( T , X ) , wher e T is a c ommutative additive monad on a c ate gory C and X is an obje ct of C , gives rise t o a mo dule M od ( T , X ) = ( T (1) , T ( X ) , ⋆ ) . Her e T (1) is t he c ommutative semiring define d in L emma 25 and T ( X ) is the c ommutative monoid define d in L emma 17. The action m ap is given by ⋆ = T ( λ ) ◦ dst : T (1) × T ( X ) → T ( X ) . The mapping ( T , X ) 7→ M od ( T , X ) yields a functor A CMnd ( C ) × C → M od ( C ) . Pro of Checking that ⋆ defines an a ppropriate action requires some work but is essent ially straightforw a rd, using the pro p e rties from Lemma 1 5. F or a pair of maps σ : T → S in A CM nd ( C ) and g : X → Y in C , w e define a map M od ( σ , g ) by ( T (1) , T ( X ) , ⋆ T ) ( σ 1 ,σ Y ◦ T ( g )) / / ( S (1) , S ( Y ) , ⋆ S ) . Note that, b y naturality of σ , one has σ Y ◦ T ( g ) = S ( g ) ◦ σ X . It ea sily follows that this defines a M od ( C )-map and that the assignment is functorial.  Lemma 27 The p air of fu n ctors M : CSRng ⇆ ACMnd : E forms an ad- junction, M ⊣ E . 24 Pro of F o r a semiring S a nd a commutativ e additive monad T on Sets there are (natural) bijectiv e corresp ondence s: M S = M ( S ) σ / / T in CAMnd S f / / E ( T ) = T (1) in CSRng Given σ : M S → T , one defines a s emiring map σ : S → T (1) by σ =  S λs. ( λx.s ) / / M S (1) σ 1 / / T (1)  . Conv erse ly , given a semiring map f : S → T (1), one gets a monad map f : M S → T with compo nents: M S ( X ) f X / / T ( X ) given b y P i s i x i  / / P i f ( s i ) ⋆ η ( x i ) , where the sum on the right hand side is the a ddition in T ( X ) defined in Lemma 17 and ⋆ is the action of T (1) on T ( X ) defined in Lemma 26. Showing that f is indeed a mona d mor phism requires some work. In doing so one may rely on the pro per ties of the a c tion and on Lemma 17. The details are left to the r eader.  Notice that the counit of the ab ov e adjunction E M ( S ) = M S (1) → S is an isomorphism. Hence this adjunction is in fact a reflection. 6 Semirings and La wve re theories In this section we will extend the adjunction b etw een commutativ e monoids and symmetric monoidal Lawv ere theor ies depicted in Figure 3 to a n adjunction betw een co mm uta tive s emirings and symmetrical monoidal Lawv ere theories with bipro ducts, i.e . betw ee n the categor ies CSRng and SMBLa w . 6.1 F rom semirings to La wv er e theories Comp osing the multiset functor M : CSR ng → A CMnd fro m the previo us section with the finitary Kleisli construction K ℓ N yields a functor from CSRng to SMBLa w . This functor may b e describ ed in an a lternative (isomo r phic) wa y by as signing to every semir ing S the Lawvere theory of matric es ov er S , which is defined as follows. Definition 28 F or a semiring S , t he L awver e the ory M at ( S ) of matrices over S has, for n, m ∈ N morphisms (in Se ts ) n × m → S , i. e. n × m matric es over S , as morphisms n → m . The identity id n : n → n is given by the identity matrix: id n ( i, j ) = ( 1 if i = j 0 if i 6 = j. 25 The c omp osition of g : n → m and h : m → p is given by matrix multiplic ation: ( h ◦ g )( i, k ) = P j g ( i, j ) · h ( j, k ) . The c opr oje ctions κ 1 : n → n + m and κ 2 : m → n + m ar e given by κ 1 ( i, j ) = ( 1 if i = j 0 otherwise . κ 2 ( i, j ) = ( 1 if j ≥ n and j − n = i 0 otherwise . Lemma 29 The assignment S 7→ M at ( S ) yields a functor CSRng → La w . The two functors M at E and K ℓ N : ACMnd → La w ar e natur al ly isomorphic. Pro of A map of semirings f : S → R gives rise to a functor M at ( f ) : M at ( S ) → M at ( R ) whic h is the iden tity o n ob jects and which acts on morphisms b y post- comp osition: h : n × m → S in M at ( S ) is ma pped to f ◦ h : n × m → T in M at ( T ). It is easily check ed tha t M a t ( f ) is a morphis m of Lawv ere theor ies and that the assigment is functorial. T o prov e the second claim we define t wo natura l transformations. Fir s t w e define ξ : M at E → K ℓ N with c o mpo nents ξ T : M at ( T (1)) → K ℓ N ( T ) that ar e the identit y o n ob jects and send a morphism h : n × m → T (1) in M a t ( T (1)) to the morphism ξ T ( h ) in K ℓ N ( T ) given by ξ T ( h )=  n h h ( ,j ) i j ∈ m / / T (1) m b c − 1 m / / T ( m )  , where b c − 1 m is the in verse of the generalised bicar tesian map b c m =  T ( m ) = T ( ` m 1) / / T (1) m  . And s e c ondly , in the reverse dir e ction, we define θ : K ℓ N → M at E with com- po nent s θ T : K ℓ N ( T ) → M at ( T (1)) that ar e the identit y on ob jects and send a morphism g : n → T ( m ) in K ℓ N ( T ) to the mo rphism θ T ( g ) : n × m → T (1 ) in M at ( T (1)) g iven by θ T ( g )( i, j ) = ( π j ◦ b c m ◦ g )( i ) . (9) It requires some work, but is relatively straightforward to c heck that the com- po nent s ξ T and θ T are La w - ma ps. T o prove preserv a tio n of the comp osition by ξ T and θ T one uses the definition of addition and m ultiplication in T (1) and (generalisa tions o f ) the prop erties of the map b c listed in Lemma 15. A short computation shows that the functor s are each o ther’s in verses. The naturality of b oth ξ and θ fo llows fro m (a generalisation of ) p oint (i) of Lemma 15.  The pa ir of functors M : CSRng ⇆ ACMnd : E forms a reflectio n, E M ∼ = id (Lemma 27). Com bining this with the previous pro p osition, it follows that also the functors M at, K ℓ N M : CSRng → La w are naturally isomo rphic. Hence, 26 the functor M at : CSRng → Law may be view e d as a functor from commuta- tive semirings to symmetric monoidal Lawvere theories with bipro ducts. F or a commutativ e semiring S the pr o jection maps π 1 : n + m → n and π 2 : n + m → m in M at ( S ) are defined in a similar wa y as the copr o jection maps fro m Def- inition 28. F or a pair o f maps g : m → p , h : n → q , the tensor pro duct g ⊗ h : ( m × n ) → ( p × q ) is the ma p g ⊗ h : ( m × n ) × ( p × q ) → S defined as ( g ⊗ h )(( i 0 , i 1 ) , ( j 0 , j 1 )) = g ( i 0 , j 0 ) · h ( i 1 , j 1 ) , where · is the multiplication fro m S . 6.2 F rom La wvere theories to semirings In Section 3 .1, just after Lemma 11, we ha ve already seen that the homset L (1 , 1) of a Lawv ere theory L ∈ SMLaw is a commutativ e mono id, with multiplication given by comp osition of endomaps on 1. In cas e L als o ha s bipro ducts we hav e, by (6), an addition on this ho mset, which is pr e served by comp osition. Combining those t wo monoid structures yields a semir ing structure on L (1 , 1). This is standard, s ee e.g. [1, 15, 11]. The assignment of the semiring L (1 , 1) to a La w vere theory L ∈ SM BLa w is functorial and w e denote this functor, as in Section 3.1, b y H : SM BLa w → CSRng . 6.3 Adjunction b etw een semirings and Lawv ere theories Our main r esult is the a djunction on the right in the triangle o f adjunctions for semirings, see Figure 4. Lemma 30 The p air of functors M at : CSR ng ⇄ SMBLa w : H , forms an adjunction M at ⊣ H . Pro of F o r S ∈ C SRng and L ∈ SMBLa w there are (natural) bijective corre- sp ondences: M at ( S ) F / / L in SMBLaw S f / / H ( L ) in CSR ng Given F one defines a semir ing map F : S → H ( L ) = L (1 , 1) b y s 7→ F (1 × 1 λx. s − − − → S ) . Note that 1 × 1 λx. s − − − → S is an endomap o n 1 in M at ( S ) whic h is mapp ed b y F to an elemen t of L (1 , 1). Conv erse ly , given f o ne defines a SMBLa w -ma p f : M at ( S ) → L which sends a morphism h : n → m in M at ( S ), i.e. h : n × m → S in Sets , to the following morphism n → m in L , forming an n -cotuple o f m -tuples f ( h ) =  n  f ( h ( i,j ))  j

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment