Combining Semilattices and Semimodules
aa r X i v : . [ c s . C L ] J a n Combining Semilattices and Semimodules ⋆ Filippo Bonchi and Alessio Santamaria( B ) Dipartimento di Informatica, Università degli Studi di Pisa, 56127 Pisa, Italy [email protected], [email protected]
Abstract.
We describe the canonical weak distributive law δ : SP →PS of the powerset monad P over the S -left-semimodule monad S , fora class of semirings S . We show that the composition of P with S bymeans of such δ yields almost the monad of convex subsets previously in-troduced by Jacobs: the only difference consists in the absence in Jacobs’smonad of the empty convex set. We provide a handy characterisation ofthe canonical weak lifting of P to EM ( S ) as well as an algebraic the-ory for the resulting composed monad. Finally, we restrict the composedmonad to finitely generated convex subsets and we show that it is pre-sented by an algebraic theory combining semimodules and semilatticeswith bottom, which are the algebras for the finite powerset monad P f . Keywords: algebraic theories · monads · weak distributive laws.
Monads play a fundamental role in different areas of computer science since theyembody notions of computations [31], like nondeterminism, side effects and ex-ceptions. Consider for instance automata theory: deterministic automata can beconveniently regarded as certain kind of coalgebras on S et [32], nondeterministicautomata as the same kind of coalgebras but on EM ( P f ) [34], and weightedautomata on EM ( S ) [4]. Here, P f is the finite powerset monad, modeling nonde-terministic computations, while S is the monad of semimodules over a semiring S , modelling various sorts of quantitative aspects when varying the underlyingsemiring S . It is worth mentioning two facts: first, rather than taking coalgebrasover EM ( T ) , the category of algebras for the monad T , one can also considercoalgebras over K l( T ) , the Kleisli category induced by T [19]; second, these twoapproaches based on monads have lead not only to a deeper understanding of thesubject, but also to effective proof techniques [6,7,13], algorithms [1,8,21,35,38]and logics [18,20,26].Since compositionality is often the key to master complex structures, com-puter scientists devoted quite some efforts to compose monads [39] or the equiva-lent notion of algebraic theories [23]. Indeed, the standard approach of composingmonads by means of distributive laws [3] turned out to be somehow unsatisfac-tory. On the one hand, distributive laws do not exist in many relevant cases: ⋆ Supported by the Ministero dell’Università e della Ricerca of Italy under Grant No.201784YSZ5, PRIN2017 – ASPRA (
Analysis of Program Analyses ). F. Bonchi and A. Santamaria see [27,40] for some no-go theorems; on the other hand, proving their existenceis error-prone: see [27] for a list of results that were mistakenly assuming theexistence of a distributive law of the powerset monad over itself.Nevertheless, some sort of weakening of the notion of distributive law–e.g.,distributive laws of functors over monads [25]–proved to be ubiquitous in com-puter science: they are GSOS specifications [37], they are sound coinductiveup-to techniques [7] and complete abstract domains [5]. In this paper we willexploit weak distributive laws in the sense of [14] that have been recently shownsuccessful in composing the monads for nondeterminism and probability [16].The goal of this paper is to somehow combine the monads P f and S men-tioned above. Our interest in S relies on the wide expressiveness provided by thepossibility of varying S : for instance by taking S to be the Boolean semiring,one obtains the monad P f ; by fixing S to be the field of reals, coalgebras over EM ( S ) turn out be linear dynamical systems [33].We proceed as follows. Rather than composing P f , we found it convenient tocompose the full , not necessarily finite, powerset monad P with S . In this way wecan reuse several results in [11] that provide necessary and sufficient conditionson the semiring S for the existence of a canonical weak [14] distributive law δ : SP → PS . Our first contribution (Theorem 21) consists in showing thatsuch δ has a convenient alternative characterisation, whenever the underlyingsemiring is a positive semifield , a condition that is met, e.g., by the semirings ofBooleans and non-negative reals.Such characterisation allows us to give a handy definition of the canoni-cal weak lifting of P over EM ( S ) (Theorem 24) and to observe that such lift-ing is almost the same as the monad C : EM ( S ) → EM ( S ) defined by Jacobsin [24] (Remark 25): the only difference is the absence in C of the empty subset.Such difference becomes crucial when considering the composed monads, named CM : S et → S et in [24] and P c S : S et → S et in this paper: the latter maps a set X into the set of convex subsets of S X , while the former additionally requires thesubsets to be non-empty. It turns out that while K l( CM ) is not CPPO -enriched,a necessary condition for the coalgebraic framework in [19], K l( P c S ) indeed is(Theorem 30).Composing monads by means of weak distributive laws is rewarding in manyrespects: here we exploit the fact that algebras for the composed monad P c S coincide with δ -algebras, namely algebras for both P and S satisfying a certainpentagonal law. One can extract from this law some distributivity axioms that,together with the axioms for semimodules (algebras for the monad S ) and thosefor complete semilattices (algebras for the monad P ), provide an algebraic theorypresenting the monad P c S (Theorem 32).We conclude by coming back to the finite powerset monad P f . By replac-ing, in the above theory, complete semilattices with semilattices with bottom(algebras for the monad P f ) one obtains a theory presenting the monad P fc S of finitely generated convex subsets (Theorem 35), which is formally defined as arestriction of the canonical P c S . The theory, displayed in Table 1, consists of the ombining Semilattices and Semimodules 3 Table 1.
The sets of axioms E SL for semilattices (left), E LSM for S -semimodules(right) and E D ′ for their distributivity (bottom). ( x ⊔ y ) ⊔ z = x ⊔ ( y ⊔ z ) ( x + y ) + z = x + ( y + z ) ( λ + S µ ) · x = λ · x + µ · xx ⊔ y = y ⊔ x x + y = y + x S · x = x ⊔ ⊥ = x x + 0 = x ( λµ ) · x = λ · ( µ · x ) x ⊔ x = x λ · ( x + y ) = λ · x + λ · yλ · = λ · ⊥ = ⊥ for λ = 0 S λ · ( x ⊔ y ) = ( λ · x ) ⊔ ( λ · y ) x + ⊥ = ⊥ x + ( y ⊔ z ) = ( x + y ) ⊔ ( x + z ) theory presenting the monad P f and the theory presenting the monad S withfour distributivity axioms. Notation.
We assume the reader to be familiar with monads and their maps.Given a monad ( M, η M , µ M ) on C , EM ( M ) and K l( M ) denote, respectively, theEilenberg-Moore category and the Kleisli category of M . The latter is definedas the category whose objects are the same as C and a morphism f : X → Y in K l( M ) is a morphism f : X → M ( Y ) in C . We write U M : EM ( M ) → C and U M : K l( M ) → C for the canonical forgetful functors, and F M : C → EM ( M ) , F M : C → K l( M ) for their respective left adjoints. Recall, in particular, that F M ( X ) = ( X, µ MX ) and, for f : X → Y , F M ( f ) = M ( f ) . Given n a naturalnumber, we denote by n the set { , . . . , n } . Given two monads S and T on a category C , is there a way to compose themto form a new monad ST on C ? This question was answered by Beck [3] andhis theory of distributive laws , which are natural transformations δ : T S → ST satisfying four axioms and that provide a canonical way to endow the compositefunctor ST with a monad structure. We begin by recalling the classic definition.In the following, let ( T, η T , µ T ) and ( S, η S , µ S ) be two monads on a category C . Definition 1. A distributive law of the monad S over the monad T is a naturaltransformation δ : T S → ST such that the following diagrams commute. T SS ST S SST T T S T ST ST TT S ST T S STT ST S ST T S ST δST µ S Sδ µ S T T δµ T S δT Sµ T δ δT η S η S T η T S Sη T δ δ (1) F. Bonchi and A. Santamaria
One important result of Beck’s theory is the bijective correspondence betweendistributive laws, liftings to Eilenberg-Moore algebras and extensions to Kleislicategories, in the following sense.
Definition 2. A lifting of the monad S to EM ( T ) is a monad ( ˜ S, η ˜ S , µ ˜ S ) where EM ( T ) EM ( T ) C C ˜ SSF T F T commutes, U T η ˜ S = η S U T , U T µ ˜ S = µ S U T . An extension of the monad T to K l( S ) is a monad ( ˜ T , η ˜ T , µ ˜ T ) such that C CK l( S ) K l( S ) TF S F S ˜ T commutes, η ˜ T F S = F S η T , µ ˜ T F S = F S µ T . Böhm [10] and Street [36] have studied various weaker notions of distributivelaw; here we shall use the one that consists in dropping the axiom involving η T in Definition 1, following the approach of Garner [14]. Definition 3. A weak distributive law of S over T is a natural transformation δ : T S → ST such that the diagrams in (1) regarding µ S , µ T and η S commute. There are suitable weaker notions of liftings and extensions which also bijec-tively correspond to weak distributive laws as proved in [10,14].
Definition 4. A weak lifting of S to EM ( T ) consists of a monad ( ˜ S, η ˜ S , µ ˜ S ) on EM ( T ) and two natural transformations U T ˜ S SU T U T ˜ S ι π such that πι = id U T ˜ S and such that the following diagrams commute: U T ˜ S ˜ S SU T ˜ S SSU T U T ˜ S SU Tι ˜ SU T µ ˜ S Sι µ S U T ι U T U T ˜ S SU TU T η ˜ S η S U T ι (2) SSU T SU T ˜ S U T ˜ S ˜ SSU T U T ˜ S Sπµ S U T π ˜ S U T µ ˜ S π U T SU T U T ˜ S η S U T U T η ˜ S π (3) A weak extension of T to K l( S ) is a functor ˜ T : K l( S ) → K l( S ) together with anatural transformation µ ˜ T : ˜ T ˜ T → ˜ T such that F S T = ˜ T F S and µ ˜ T F S = F S µ T . Theorem 5 ([3,10,14]).
There is a bijective correspondence between (weak)distributive laws
T S → ST , (weak) liftings of S to EM ( T ) and (weak) extensionsof T to K l( S ) . ombining Semilattices and Semimodules 5 The Monad P . Let us now consider, as S , the powerset monad ( P , η P , µ P ) ,where η P X ( x ) = { x } and µ P X ( U ) = S U ∈U U . Its algebras are precisely the com-plete semilattices and we have that K l( P ) is isomorphic to the category R el ofsets and relations. Hence, giving a distributive law T P → P T is the same asgiving an extension of T to R el : for this to happen the notion of weak cartesianfunctor and natural transformation is crucial. Definition 6.
A functor T : S et → S et is said to be weakly cartesian if and onlyif it preserves weak pullbacks. A natural transformation ϕ : F → G is said to be weakly cartesian if and only if its naturality squares are weak pullbacks. Kurz and Velebil [28] proved, using an original argument of Barr [2], that anendofunctor T on S et has at most one extension to R el and this happens preciselywhen it is weakly cartesian; similarly a natural transformation ϕ : F → G , with F and G weakly cartesian, has at most one extension ˜ ϕ : ˜ F → ˜ G , precisely whenit is weakly cartesian. The following result is therefore immediate. Proposition 7 ([14, Corollary 16]).
For any monad ( T, η T , µ T ) on S et :1. There exists a unique distributive law of P over T if and only if T , η T and µ T are weakly Cartesian.2. There exists a unique weak distributive law of P over T if and only if T and µ T are weakly Cartesian. The Monad S . Recall that a semiring is a tuple ( S, + , · , , such that ( S, + , is a commutative monoid, ( S, · , is a monoid, · distributes over + and is anannihilating element for · . In other words, a semiring is a ring where not everyelement has an additive inverse. Natural numbers N with the usual operationsof addition and multiplication form a semiring. Similarly, integers, rationals andreals form semirings. Also the booleans B ool = { , } with ∨ and ∧ acting as + and · , respectively, form a semiring.Every semiring S generates a semimodule monad S on S et as follows. Given aset X , S ( X ) = { ϕ : X → S | supp ϕ finite } , where supp ϕ = { x ∈ X | ϕ ( x ) = 0 } .For f : X → Y , define for all ϕ ∈ S ( X ) S ( f )( ϕ ) = (cid:16) y X x ∈ f − { y } ϕ ( x ) (cid:17) : Y → S. This makes S a functor. The unit η S X : X → S ( X ) is given by η S X ( x ) = ∆ x , where ∆ x is the Dirac function centred in x , while the multiplication µ S X : S ( X ) →S ( X ) is defined for all Ψ ∈ S ( X ) as µ S X ( Ψ ) = (cid:16) x X ϕ ∈ supp Ψ Ψ ( ϕ ) · ϕ ( x ) (cid:17) : X → S. F. Bonchi and A. Santamaria
Table 2.
Definition of some properties of a semiring S . Here a, b, c, d ∈ S .Positive a + b = 0 = ⇒ a = 0 = b Semifield a = 0 = ⇒ ∃ x. a · x = x · a = 1 Refinable a + b = c + d = ⇒ ∃ x, y, z, t. x + y = a, z + t = b, x + z = c, y + t = d (A) a + b = 1 = ⇒ a = 0 or b = 0 (B) a · b = 0 = ⇒ a = 0 or b = 0 (C) a + c = b + c = ⇒ a = b (D) ∀ a, b . ∃ x. a + x = b or b + x = a (E) a + b = c · d = ⇒ ∃ t : { ( x, y ) ∈ S | x + y = d } → S such that P x + y = d t ( x, y ) x = a, P x + y = d t ( x, y ) y = b, P x + y = d t ( x, y ) = c. An algebra for S is precisely a left-S-semimodule , namely a set X equipped witha binary operation + , an element and a unary operation λ · for each λ ∈ S ,satisfying the equations in Table 1. Indeed, if X carries a semimodule structurethen one can define a map a : S X → X as, for ϕ ∈ S X , a ( ϕ ) = X x ∈ X ϕ ( x ) · x (4)where the above sum is finite because so is supp ϕ . Vice versa, if ( X, a ) is an S -algebra, then the corresponding left-semimodule structure on X is obtainedby defining for all λ ∈ S and x, y ∈ Xx + a y = a ( x , y , a = a ( ε ) , λ · a x = a ( x λ ) . (5)Above and in the remainder of the paper, we write the list ( x s , . . . , x n s n ) for the only function ϕ : X → S with support { x , . . . , x n } mapping x i to s i and we write the empty list ε for the function constant to . For instance, for a = µ S X : SS X → S X , the left-semimodule structure is defined for all ϕ , ϕ ∈S X and x ∈ X as ( ϕ + µ S ϕ )( x ) = ϕ ( x ) + ϕ ( x ) , µ S ( x ) = 0 , ( λ · µ S ϕ )( x ) = λ · ϕ ( x ) . Proposition 7 tells us exactly when a (weak) distributive law of the form T P → P T exists for an arbitrary monad T on S et . Take then T = S : when arethe functor S and the natural transformations η S and µ S weakly cartesian? Theanswer has been given in [11] (see also [17]), where a complete characterisation inpurely algebraic properties for S is provided. In Table 2 we recall such properties. Theorem 8 ([11]).
Let S be a semiring.1. The functor S is weakly cartesian if and only if S is positive and refinable.2. η S is weakly cartesian if and only if S enjoys (A) in Table 2.3. If S is weakly cartesian, then µ S is weakly cartesian if and only if S enjoys (B) and (E) in Table 2. ombining Semilattices and Semimodules 7 Remark 9.
In [11, Proposition 9.1] it is proved that if S enjoys (C) and (D), then S is refinable; if S is a positive semifield, then it enjoys (B) and (E). In the nextProposition we prove that if S is a positive semifield then it is also refinable,hence S and µ S are weakly cartesian. Proposition 10. If S is a positive semifield, then it is refinable.Proof. Let a , b , c and d in S be such that a + b = c + d . If a + b = 0 , then take x = y = z = t = 0 , otherwise take x = acc + d , y = adc + d , z = bcc + d , t = bdc + d . Then x + y = a, z + t = b, x + z = c, y + t = d . ⊓⊔ Example 11.
It is known that, for S = N , a distributive law δ : SP → PS exists.Indeed one can check that all conditions of Theorem 8 are satisfied, therefore wecan apply Proposition 7.1. In this case, the monad S X is naturally isomorphicto the commutative monoid monad, which given a set X returns the collectionof all multisets of elements of X . The law δ is well known (see e.g. [14,22]): givena multiset h A , . . . , A n i of subsets of X in SP X , where the A i ’s need not bedistinct, it returns the set of multisets {h a , . . . , a n i | a i ∈ A i } . Convex Subsets of Left-semimodules.
Theorem 8 together with Propo-sition 7.1 tell us that whenever the element of S can be decomposed as anon-trivial sum there is no distributive law δ : SP → PS . Semirings with thisproperty abound, for example Q , R , R + with the usual operations of sum anmultiplication, as well as B ool (since ∨ ). Such semirings are preciselythose for which the notion of convex subset of their left-semimodules is non-trivial. For the existence of a weak distributive law, however, this condition on S is not required: convexity will indeed play a crucial role in the definition ofthe weak distributive law. Definition 12.
Let S be a semiring, X an S -left-semimodule and A ⊆ X . The convex closure of A is the set A = ( n X i =1 λ i · a i | n ∈ N , a i ∈ A, n X i =1 λ i = 1 ) ⊆ X. The set A is said to be convex if and only if A = A . Recalling that the category of S -left-semimodules is isomorphic to EM ( S ) ,we can use (4) to translate Definition 12 of convex subset of a semimodule intothe following notion of convex subset of a S -algebra a : S X → X . Definition 13.
Let S be a semiring, ( X, a ) ∈ EM ( S ) , A ⊆ X . The convexclosure of A in ( X, a ) is the set A a = ( a ( ϕ ) | ϕ ∈ S X, supp ϕ ⊆ A, X x ∈ X ϕ ( x ) = 1 ) . F. Bonchi and A. Santamaria A is said to be convex in ( X, a ) if and only if A = A a . We denote by P ac X theset of convex subsets of X with respect to a .Remark 14. Observe that ∅ is convex, because ∅ a = ∅ , since there is no ϕ ∈ S X with empty support such that P x ∈ X ϕ ( x ) = 1 . Example 15.
Suppose S is such that η S is weakly cartesian (equivalently (A)holds: x + y = 1 = ⇒ x = 0 or y = 0 ), for example S = N , and let ( X, a ) ∈ EM ( S ) . A ϕ ∈ S X such that P x ∈ X ϕ ( x ) = 1 and supp ϕ ⊆ A is a function thatassigns to exactly one element of A and to all the other elements of X . Thesefunctions are precisely all the ∆ x for those elements x ∈ A . Since a : S X → X is a structure map for an S -algebra, it maps the function ∆ x into x . Therefore A a = { a ( ∆ x ) | x ∈ A } = { x | x ∈ A } = A . Thus all A ∈ PS X are convex. Example 16.
When S = B ool , we have that S is naturally isomorphic to P f , thefinite powerset monad, whose algebras are idempotent commutative monoidsor equivalently semilattices with a bottom element. So, for ( X, a ) ∈ EM ( S ) , a ϕ ∈ S X such that P x ∈ X ϕ ( x ) = 1 and supp ϕ ⊆ A is any finitely supportedfunction from X to B ool that assigns to at least one element of A . Intuitively,such a ϕ selects a non-empty finite subset of A , then a ( ϕ ) takes the join of allthe selected elements. Thus, A a adds to A all the possible joins of non-emptyfinite subsets of A : A is convex if and only if it is closed under binary joins. δ : SP → P S
Weak extensions of S to K l( P ) = R el only consist of extensions of the functor S and of the multiplication µ S , for which necessary and sufficient conditionsare listed in Theorem 8. Hence for semirings S satisfying those criteria a weakdistributive law δ : SP → PS does exist, and it is unique because there is onlyone extension of the functor S to R el . Theorem 17.
Let S be a positive, refinable semiring satisfying (B) and (E) inTable 2. Then there exists a unique weak distributive law δ : SP → PS definedfor all sets X and Φ ∈ SP X as: δ X ( Φ ) = ( ϕ ∈ S X | ∃ ψ ∈ S ( ∋ X ) . ∀ A ∈ P X. Φ ( A ) = P x ∈ A ψ ( A, x ) ( a ) ∀ x ∈ X. ϕ ( x ) = P A ∋ x ψ ( A, x ) ( b ) ) (6) where ∋ X is the set { ( A, x ) ∈ P X × X | x ∈ A } . The above δ , which is obtained by following the standard recipe of Proposition 7(see the proof in Appendix 8), is illustrated by the following example. Example 18.
Take S = R + with the usual operations of sum and multiplication.Consider X = { x, y, z, a, b } , A = { x, y } , A = { y, z } and A = { a, b } . Let Φ ∈ S ( P X ) be defined as Φ = ( A , A , A ombining Semilattices and Semimodules 9 and Φ ( A ) = 0 for all other sets A ⊆ X , so supp Φ = { A , A , A } . In order tofind an element ϕ ∈ δ X ( Φ ) , we can first take a ψ ∈ S ( ∋ X ) satisfying condition(a) in (6) and then compute the ϕ ∈ S X using condition (b).Among the ψ ∈ S ( ∋ X ) , consider for instance the following: ψ = (cid:18) ( A , x ) A , y ) A , a ) A , y ) A , z ) A , b ) (cid:19) . Since Φ ( A ) = ψ ( A , x ) + ψ ( A , y ) , Φ ( A ) = ψ ( A , y ) + ψ ( A , z ) and Φ ( A ) = ψ ( A , a ) + ψ ( A , b ) , we have that ψ satisfies condition (a) in (6). Condition (b)forces ϕ to be the following: ϕ = ( x , y , z , a , b . Remark 19. If S enjoys (A) in Table 2, then the transformation δ given in (6)is actually a distributive law, and for S = N we recover the well-known δ ofExample 11. Example 18 can be repeated with S = N : then Φ is the multisetwhere the set A occurs five times, A nine times and A thirteen times. Theelements of δ X ( Φ ) are all those multisets containing one element per copy of A , A and A in supp Φ . The ϕ provided indeed contains five elements of A (twocopies of x and three of y ), nine elements of A (four copies of y and five of z ),thirteen elements of A (six copies of a and seven of b ).As Example 18 shows, each element ϕ of δ X ( Φ ) is determined by a function ψ choosing for each set A ∈ supp Φ a finite number of elements x A , . . . , x Am in A and s A , . . . , s Am in S in such a way that P mj =1 s Aj = Φ ( A ) . The function ϕ mapseach x Aj to s Aj if the sets in supp Φ are disjoint ; if however there are x Aj and x Bk such that x Aj = x Bk (like y in Example 18), then x Aj is mapped to s Aj + s Bk .Among those ψ ’s, there are some special, minimal ones as it were, that choosefor each A in supp Φ exactly one element of A , and assign to it Φ ( A ) . The induced ϕ in δ X ( Φ ) can be described as P A ∈ u − { x } Φ ( A ) (equivalently S ( u )( Φ ) ) where u : supp Φ → X is a function selecting an element of A for each A ∈ supp Φ (thatis u ( A ) ∈ A ). We denote the set of such ϕ ’s by c ( Φ ) . c ( Φ ) = {S ( u )( Φ ) | u : supp Φ → X such that ∀ A ∈ supp Φ. u ( A ) ∈ A } (7) Example 20.
Take X , A and A as in Example 18, but a different, smaller, Φ ∈ S ( P X ) defined as Φ = ( A , A . There are only four functions u : supp Φ → X such that u ( A ) ∈ A and thus only four functions ϕ in c ( Φ ) : u = ( A x, A y ) ϕ = ( x , y u = ( A x, A z ) ϕ = ( x , z u = ( A y, A y ) ϕ = ( y u = ( A y, A z ) ϕ = ( y , z Observe that the function ϕ = ( x , y , z belongs to δ X ( Φ ) but notto c ( Φ ) . Nevertheless ϕ can be retrieved as the convex combination · ϕ + · ϕ . More precisely, we should write S ( u )( Φ ′ ) where Φ ′ is the restriction of Φ to supp Φ .0 F. Bonchi and A. Santamaria Our key result states that every ϕ ∈ δ X ( Φ ) can be written as a convexcombination (performed in the S -algebra ( S X, µ S X ) ) of functions in c ( Φ ) , at leastwhen S is a positive semifield, which by Remark 9 and Proposition 10 satisfiesall the conditions that make (6) a weak distributive law. The proof is laboriousand can be found in Appendix 8; we only remark that divisions in S play acrucial role in it. Theorem 21.
Let S be a positive semifield. Then for all sets X and Φ ∈ SP Xδ X ( Φ ) = µ S X ( Ψ ) | Ψ ∈ S X. X ϕ ∈S X Ψ ( ϕ ) = 1 , supp Ψ ⊆ c ( Φ ) = c ( Φ ) µ S X . (8) Remark 22.
If we drop the hypothesis of semifield and only have the minimalassumptions of Theorem 17, then (8) does not hold any more: S = N is acounterexample. Indeed, in this case every subset of S X is convex with respectto µ S X (see Example 15), therefore we would have δ X ( Φ ) = c ( Φ ) , which is false:the function ϕ of Example 18 is an example of an element in δ X ( Φ ) \ c ( Φ ) . Remark 23.
When S = B ool (which is a positive semifield), the monad S coin-cides with the monad P f . The function c ( · ) in (7) can then be described as c ( A ) = {P f ( u )( A ) | u : A → X such that ∀ A ∈ A . u ( A ) ∈ A } for all A ∈ P f P X . It is worth remarking that this is the transformation χ appearing in Example 9 of [26] (which is in turn equivalent to the one in Example2.4.7 of [30]). This transformation was erroneously supposed to be a distributivelaw, as it fails to be natural (see [27]). However, by taking its convex closure, asdisplayed in (8), one can turn it into a weak distributive law. P to EM ( S ) By exploiting the characterisation of the weak distributive law δ (Theorem 21),we can now describe the weak lifting of P to EM ( S ) generated by δ .Recall from Definition 13 that P ac X is the set of convex subsets of X withrespect to the S -algebra a : S X → X . The functions ι ( X,a ) : P ac X → P X and π ( X,a ) : P X → P ac X are defined for all A ∈ P ac X and B ∈ P X as ι ( X,a ) ( A ) = A and π ( X,a ) ( B ) = B a , (9)that is ι ( X,a ) is just the obvious set inclusion and π ( X,a ) performs the convexclosure in a . The function α a : SP ac X → P ac X is defined for all Φ ∈ SP ac X as α a ( Φ ) = { a ( ϕ ) | ϕ ∈ c ( Φ ) } . (10)To be completely formal, above we should have written c ( S ( ι )( Φ )) in placeof c ( Φ ) , but it is immediate to see that the two sets coincide. Proving that α a : SP ac X → P ac X is well defined (namely, α a ( Φ ) is a convex set) and forms an ombining Semilattices and Semimodules 11 S -algebra requires some ingenuity and will be shown later in Section 5.1. Theassignment ( X, a ) ( P ac X, α a ) gives rise to a functor ˜ P : EM ( S ) → EM ( S ) defined on morphisms f : ( X, a ) → ( X ′ , a ′ ) as ˜ P ( f )( A ) = P f ( A ) (11)for all A ∈ P ac X . For all ( X, a ) in EM ( S ) , η ˜ P ( X,a ) : ( X, a ) → ˜ P ( X, a ) and µ ˜ P ( X,a ) : ˜ P ˜ P ( X, a ) → ˜ P ( X, a ) are defined for x ∈ X and A ∈ P α a c ( P ac X ) as η ˜ P ( X,a ) ( x ) = { x } and µ ˜ P ( X,a ) ( A ) = [ A ∈A A . (12) Theorem 24.
Let S be a positive semifield. Then the canonical weak liftingof the powerset monad P to EM ( S ) , determined by (8) , consists of the monad ( ˜ P , η ˜ P , µ ˜ P ) on EM ( S ) defined as in (10) , (11) , (12) and the natural transfor-mations ι : U S ˜ P → P U S and π : P U S → U S ˜ P defined as in (9) . It is worth spelling out the left-semimodule structure on P ac X correspondingto the S -algebra α a : SP ac X → P ac X . Let us start with λ · α a A for some A ∈ P ac X .By (5), λ · α a A = α a ( Φ ) where Φ = ( A λ ) . By (10), α a ( Φ ) = { a ( ϕ ) | ϕ ∈ c ( Φ ) } . Following the definition of c ( Φ ) given in (7), one has to considerfunctions u : supp Φ → X such that u ( B ) ∈ B for all B ∈ supp Φ : if λ = 0 ,then supp Φ = { A } and thus, for each x ∈ A , there is exactly one function u x : supp Φ → X mapping A into x . It is immediate to see that S ( u x )( Φ ) isexactly the function ( x λ ) and thus a ( S ( u x )( Φ )) is, by (5), λ · a x . Now if λ = 0 ,then supp Φ = ∅ , so there is exactly one function u : supp Φ → X and S ( u )( Φ ) is the function mapping all x ∈ X into and thus, by (5), a ( S ( u )( Φ )) = 0 a .Summarising, λ · α a A = ( { λ · a x | x ∈ A } if λ = 0 { a } if λ = 0 (13)Following similar lines of thoughts, one can check that A + α a B = { x + a y | x ∈ A, y ∈ B } and α a = { a } . (14) Remark 25.
By comparing (14) and (13) with (4) and (5) in [24], it is immediateto see that our monad ˜ P coincides with a slight variation of Jacobs’s convexpowerset monad C , the only difference being that we do allow for ∅ to be in P ac X . Jacobs insisted on the necessity of C ( X ) to be the set of non-empty convexsubsets of X , because otherwise he was not able to define a semimodule structureon C ( X ) such that · ∅ = { a } . However, we do manage to do so, since by (13), · A = 0 a for all A and in particular for A = ∅ . At first sight, this may look likean ad-hoc solution, but this is not the case: it is intrinsic in the definition of theunique weak lifting of P to EM ( S ) , as stated by Theorem 24 and shown next. By Theorem 5, the weak distributive law (6) corresponds to a weak lifting ˜ P of P to EM ( S ) , which we are going to show coincides with the data of (9)-(12). Theimage along ˜ P of a S -algebra ( X, a ) will be a set Y together with a structuremap α a that makes it a S -algebra in turn. Garner [14, Proposition 13] givesus the recipe to build Y and α a appropriately. Y is obtained by splitting thefollowing idempotent in S et : e ( X,a ) = P X S ( P X ) P ( S X ) P X η SP X δ X P a (15)as a composite e ( X,a ) = ι ( X,a ) ◦ π ( X,a ) , where π ( X,a ) is the corestriction of e ( X,a ) to its image and ι ( X,a ) is the set-inclusion of the image of e ( X,a ) into P X . Inother words, Y is the set of fixed points of e ( X,a ) . α a is obtained as the composite α a = S Y SP X PS X P X Y. S ι ( X,a ) δ X P a π ( X,a ) Let us, then, fix an S -algebra ( X, a ) . Given A ∈ P X , we have η SP X ( A ) = ∆ A : P X → S , the Dirac-function centred in A . The set δ X ( η SP X ( A )) has asimple description, shown in the next Lemma, whose proof is in Appendix 9. Lemma 26.
For all A ∈ P Xδ X ( η SP X ( A )) = ( ϕ ∈ S X | supp ϕ ⊆ A, X x ∈ X ϕ ( x ) = 1 ) . The image along A of the idempotent e is therefore e ( A ) = P a ( δ X ( η SP X ( A ))) = ( a ( ϕ ) | ϕ ∈ S X, supp ϕ ⊆ A, X x ∈ X ϕ ( x ) = 1 ) = A a . Hence the idempotent e computes the convex closure of elements of P X andits fixed points are precisely the convex subsets of X with respect to the struc-ture map a . Therefore, the carrier set of ˜ P ( X, a ) is precisely P ac X , the naturaltransformations π and ι are, respectively, the convex closure operator and theset-inclusion of P ac X into P X as in (9). P ac X is then equipped with a structure map α a : SP ac X → P ac X given by α a = SP ac X SP X PS X P X P ac X. S ι ( X,a ) δ X P a π ( X,a ) Let us try to calculate α a : given Φ : P ac X → S with finite support, we have that S ( ι ( X,a ) )( Φ ) is just the extension of Φ to P X which assigns to each non-convexsubset of X . If we write ι instead of ι ( X,a ) for short, we have α a ( Φ ) = P a ( δ X ( S ( ι )( Φ ))) a . (16)Next, we can use the following technical result, whose proof is in Appendix 9. ombining Semilattices and Semimodules 13 Proposition 27.
Let ( X, a ) be a S -algebra. If A is a convex subset of ( S X, µ S X ) ,then P a ( A ) is convex in ( X, a ) . Since δ X ( Φ ′ ) is the convex closure of c ( Φ ′ ) in ( S X, µ S X ) for every Φ ′ ∈ SP X ,by Proposition 27 we can avoid to perform the a -convex closure in (16). Therefore α a ( Φ ) = P a ( δ X ( S ( ι )( Φ ))) = P a (cid:0) c ( S ( ι )( Φ )) µ S X (cid:1) . In the next Proposition we show that also the µ S X -convex closure is superfluous,due to the fact that Φ ∈ SP ac X (and not simply SP X ), thus obtaining (10). Proposition 28.
Let S be a positive semifield, ( X, a ) a S -algebra, Φ ∈ SP ac X .Then P a ( δ X ( S ( ι )( Φ ))) = P a ( c ( S ( ι )( Φ ))) .Proof. In this proof we shall simply write Φ instead of the more verbose S ( ι )( Φ ) .We want to prove that P a (cid:0) δ X ( Φ ) (cid:1) = n a ( ψ ) | ψ ∈ S X. ∃ u : supp Φ → X. u ( A ) ∈ A, ∀ x ∈ X. ψ ( x ) = X A ∈ supp Φu ( A )= x Φ ( A ) o (17)where we have, by Theorem 21, that P a (cid:0) δ X ( Φ ) (cid:1) = { a ( µ S X ( Ψ )) | Ψ ∈ S X, X ϕ ∈S X Ψ ( ϕ ) = 1 , supp Ψ ⊆ c ( Φ ) } . First of all, ∅ is not a S -algebra, because there is no map S ( ∅ ) → ∅ given that S ( ∅ ) = {∅ : ∅ → S } , hence X = ∅ . Next, if Φ = ε : P X → S , namely the functionconstant to , then c ( Φ ) = { ε : X → S } therefore one can easily see that theleft-hand side of (17) is equal to { a ( ε : X → S ) } . For the same reason, the right-hand side is also equal to { a ( ε : X → S ) } . Moreover, if Φ ( ∅ ) = 0 , then there isno u : supp Φ → X such that u ( ∅ ) ∈ ∅ , so c ( Φ ) = ∅ and so is the left-hand sideof (17); for the same reason, also the right-hand side is empty.Suppose then, for the rest of the proof, that Φ = 0 and that Φ ( ∅ ) = 0 .For the right-to-left inclusion in (17): given ψ ∈ c ( Φ ) , consider Ψ = η SS X ( ψ ) = ∆ ψ ∈ S X . Then Ψ clearly satisfies all the required properties and µ S X ( Ψ ) = ψ .The left-to-right inclusion is more laborious. Let Ψ ∈ S X be such that P χ ∈S X Ψ ( χ ) = 1 and such that supp Ψ ⊆ c ( Φ ) , that is, for all ϕ ∈ supp Ψ there is u ϕ : supp Φ → X such that u ϕ ( A ) ∈ A for all A ∈ supp Φ and ϕ = S ( u ϕ )( Φ ) . We have to show that a ( µ ( Ψ )) = a ( ψ ) for some ψ ∈ S X of the form P A ∈ supp Φ Φ ( A ) · u ( A ) for some choice function u : supp Φ → X . Notice that thegiven Ψ is a convex linear combination of functions ϕ ’s in S X like the one we haveto produce: the trick will be to exploit the fact that each A ∈ supp Φ is convex.Here we shall only give a sketch of the proof; the detailed version can be found inAppendix 9. Suppose supp Φ = { A , . . . , A n } and supp Ψ = { ϕ , . . . , ϕ m } . Call u j the choice function that generates ϕ j . Then Ψ is of this form: Ψ = u ( A ) Φ ( A ) ... u ( A n ) Φ ( A n ) | {z } ϕ Ψ ( ϕ ) , . . . , u m ( A ) Φ ( A ) ... u m ( A n ) Φ ( A n ) | {z } ϕ m Ψ ( ϕ m ) ! Define the following element of S X : Ψ ′ = u ( A ) Ψ ( ϕ ) ... u m ( A ) Ψ ( ϕ m ) | {z } χ Φ ( A ) , . . . , u ( A n ) Ψ ( ϕ ) ... u m ( A n ) Ψ ( ϕ m ) | {z } χ n Φ ( A n ) ! Observe that u ( A i ) , . . . , u m ( A i ) ∈ A i by definition, and A i is convex by assump-tion: since P mj =1 Ψ ( ϕ j ) = 1 , we have that a ( χ i ) ∈ A i . Set then u ( A i ) = a ( χ i ) and define ψ = S ( a )( Ψ ′ ) : we have ψ ∈ c ( Φ ) with u as the generating choicefunction. It is not difficult to see that µ S X ( Ψ ) = µ S X ( Ψ ′ ) , therefore we have a ( ψ ) = a (cid:0) S ( a )( Ψ ′ ) (cid:1) = a (cid:0) µ S X ( Ψ ′ ) (cid:1) = a (cid:0) µ S X ( Ψ ) (cid:1) as desired. ⊓⊔ The rest of the proof of Theorem 24, concerning the action of ˜ P on morphismsand the unit and multiplication of the monad ˜ P , consists in following the recipeprovided by Garner [14]; the details can be found in Appendix 9. We can now compose the two monads P and S by considering the monad arisingfrom the composition of the following two adjunctions: S et EM ( S ) EM ( ˜ P ) F S U S F ˜ P U ˜ P ⊥ ⊥ Direct calculations show that the resulting endofunctor on S et , which we call P c S , maps a set X and a function f : X → Y into, respectively, P c S X = P µ S X c ( S X ) and P c S ( f )( A ) = {S ( f )( Φ ) | Φ ∈ A} (18)for all A ∈ P c S X . For all sets X , η P c S X : X → P c S X and µ P c S X : P c SP c S X →P c S X are defined as η P c S X ( x ) = { ∆ x } and µ P c S X ( A ) = [ Ω ∈ A α µ S X ( Ω ) (19)for all x ∈ X and A ∈ P c SP c S X . ombining Semilattices and Semimodules 15 Theorem 29.
Let S be a positive semifield. Then the canonical weak distribu-tive law δ : SP → PS given in Theorem 21 induces a monad P c S on S et withendofunctor, unit and multiplication defined as in (18) and (19) . Recall from Remark 25 that the monad C : EM ( S ) → EM ( S ) from [24] coin-cides with our lifting ˜ P modulo the absence of the empty set. The same happensfor the composite monad, which is named CM in [24]. The absence of ∅ in CM turns out to be rather problematic for Jacobs. Indeed, in order to use the stan-dard framework of coalgebraic trace semantics [19], one would need the Kleislicategory K l( CM ) to be enriched over CPPO , the category of ω -complete partialorders with bottom and continuous functions. K l( CM ) is not CPPO -enrichedsince there is no bottom element in CM ( X ) . Instead, in P c S X the bottom isexactly the empty set; moreover, K l( P c S ) enjoys the properties required by [19]. Theorem 30.
The category K l( P c S ) is enriched over CPPO and satisfies theleft-strictness condition: for all f : X → P c S Y and Z set, ⊥ Y,Z ◦ f = ⊥ X,Z . It is immediate that every homset in K l( P c S ) carries a complete partial order.Showing that composition of arrows in K l( P c S ) preserves joins (of ω -chains)requires more work: the proof, shown in Appendix 10, crucially relies on thealgebraic theory presenting the monad P c S , illustrated next. An Algebraic Presentation.
Recall that an algebraic theory is a pair T =( Σ, E ) where Σ is a signature , whose elements are called operations , to each ofwhich is assigned a cardinal number called its arity , while E is a class of formal equations between Σ -terms. An algebra for the theory T is a set A together with,for each operation o of arity κ in Σ , a function o A : A κ → A satisfying the equa-tions of E . A homomorphism of algebras is a function f : A → B respecting theoperations of Σ in their realisations in A and B . Algebras and homomorphismsof an algebraic theory T form a category A lg( T ) . Definition 31.
Let M be a monad on S et , and T an algebraic theory. We saythat T presents M if and only if EM ( M ) and A lg( T ) are isomorphic. Left S -semimodules are algebras for the theory LSM = ( Σ LSM , E
LSM ) where Σ S LSM = { + , } ∪ { λ · | λ ∈ S } and E LSM is the set of axioms inTable 1. As already mentioned in Section 3, left S -semimodules are exactly S -algebras and morphisms of S -semimodules coincide with those of S -algebras.Thus, the theory LSM presents the monad S .Similarly, semilattices are algebras for the theory SL = ( Σ SL , E SL ) where Σ SL = {⊔ , ⊥} and E SL is the set of axioms in Table 1. It is well known thatsemilattices are algebras for the finite powerset monad. Actually, this monad ispresented by SL . In order to present the full powerset monad P we need to takejoins of arbitrary arity. A complete semilattice is a set X equipped with joins F x ∈ A x for all–not necessarily finite– A ⊆ X . Formally the (infinitary) theoryof complete semilattices is given as CSL = ( Σ CSL , E
CSL ) where Σ CSL = { F I | Table 3.
The sets of axioms E CSL for complete semilattices: the second axiom gen-eralises the usual idempotency and commutativity properties of finitary ⊔ , while thethird one generalises associativity and neutrality of F ∅ = ⊥ . F i ∈{ } x i = x F j ∈ J x j = F i ∈ I x f ( i ) for all f : I → J surjective F i ∈ I x i = F j ∈ J F i ∈ f − { j } x i for all f : I → J I set } and E CSL is the set of axioms displayed in Table 3 (for a detailed treatmentof infinitary algebraic theories see, for example, [29]).We can now illustrate the theory ( Σ, E ) presenting the composed monad P c S : the operations in Σ are exactly those of complete semilattices and S -semimodules, while the axioms are those of complete semilattices and S -semi-modules together with the set E D of distributivity axioms illustrated below. λ · G i ∈ I x i = G i ∈ I λ · x i for λ = 0 , G i ∈ I x i + G j ∈ J y j = G ( i,j ) ∈ I × J x i + y j (20)In short, Σ = Σ CSL ∪ Σ LSM and E = E CSL ∪ E LSM ∪ E D . Theorem 32.
The monad P c S is presented by the algebraic theory ( Σ, E ) . The presentation crucially relies on the fact that P c S is obtained by com-posing P and S via δ . Indeed, we know from general results in [10,14] that P c S -algebras are in one to one correspondence with δ -algebras [3], namely triples ( X, a, b ) such that a : S X → X is a S -algebra, b : P X → X is a P -algebra andthe following diagram commutes. SP X PS X S X P XX δ X S b P aa b (21)The S -algebra a corresponds to a S -semimodule ( X, + , , λ · ) , the P -algebra b to a complete lattice ( X, F I ) and the commutativity of diagram (21) expressesexactly the distributivity axioms in (20). The proof is given in Appendix 10. Example 33.
Let S be R + and let [ a, b ] with a, b ∈ R + denote the set { x ∈ R + | a ≤ x ≤ b } and [ a, ∞ ) the set { x ∈ R + | a ≤ x } . For { x } , P c S (1) = {∅} ∪{ [ a, b ] | a, b ∈ R + } ∪ { [ a, + ∞ ) | a ∈ R + } . The P c S -algebra µ P c S : P c SP c S → ombining Semilattices and Semimodules 17 P c S induces a δ -algebra where the structure of complete lattice is given as G i ∈ I A i = ( [inf i ∈ I , a i , sup i ∈ I b i ] if, for all i ∈ I, A i = [ a i , b i ] ∧ sup i ∈ I b i ∈ R + [inf i ∈ I a i , ∞ ) otherwiseThe R + -semimodule is as expected, e.g., [ a , b ] + [ a , b ] = [ a + a , b + b ] . Finite Joins and Finitely Generated Convex Sets.
We now consider thealgebraic theory ( Σ ′ , E ′ ) obtained by restricting ( Σ, E ) to finitary joins. Moreprecisely, we fix Σ ′ = Σ SL ∪ Σ LSM E ′ = E SL ∪ E LSM ∪ E D ′ where ( Σ SL , E SL ) is the algebraic theory for semilatices, ( Σ LSM , E
LSM ) is theone for S -semimodules, and E D ′ is the set of distributivity axioms illustrated inTable 1. Thanks to the characterisation provided by Theorem 32, we easily obtaina function translating Σ ′ -terms into convex subsets (the proof is in Appendix 10). Proposition 34.
Let T Σ ′ ,E ′ ( X ) be the set of Σ ′ -terms with variables in X quo-tiented by E ′ . Let [[ · ]] X : T Σ ′ ,E ′ ( X ) → P c S ( X ) be the function defined as [[ x ]] = { ∆ x } for x ∈ X [[0]] = { µ S } [[ ⊥ ]] = ∅ [[ λ · t ]] = ( { λ · µ S f | f ∈ [[ t ]] } if λ = 0 { µ S } otherwise [[ t + t ]] = { f + µ S f | f ∈ [[ t ]] , f ∈ [[ t ]] } [[ t ⊔ t ]] = [[ t ]] ∪ [[ t ]] µ S Let [[ · ]] : T Σ ′ ,E ′ → P c S be the family { [[ · ]] X } X ∈| S et | . Then [[ · ]] : T Σ ′ ,E ′ → P c S is amap of monads and, moreover, each [[ · ]] X : T Σ ′ ,E ′ ( X ) → P c S ( X ) is injective. We say that a set
A ∈ P c S ( X ) is finitely generated if there exists a finite set B ⊆ S ( X ) such that B = A . We write P fc S ( X ) for the set of all A ∈ P c S ( X ) that are finitely generated. The assignment X
7→ P fc S ( X ) gives rise to a monad P fc S : S et → S et where the action on functions, the unit and the multiplicationare defined as for P c S . The reader can find a proof of this, as well as of thefollowing Theorem, in Appendix 10. Theorem 35.
The monads T Σ ′ ,E ′ and P fc S are isomorphic. Therefore ( Σ ′ , E ′ ) is a presentation for the monad P fc S .Example 36. Recall P c S (1) for S = R + from Example 33. By restricting tothe finitely generated convex sets, one obtains P fc S (1) = {∅} ∪ { [ a, b ] | a, b ∈ R + } , that is the sets of the form [ a, ∞ ) are not finitely generated. Table 4illustrates the isomorphism [[ · ]] : T Σ ′ ,E ′ (1) → P c S (1) . It is worth observing thatevery closed interval [ a, b ] is denoted by a term in T Σ ′ ,E ′ (1) for { x } : indeed, For the sake of brevity, we are ignoring the case where some A i = ∅ .8 F. Bonchi and A. Santamaria Table 4.
The inductive defintion of the function [[ · ]] : T Σ ′ ,E ′ (1) → P c S (1) for { x } . [[ x ]] = [1 , , ⊥ ]] = ∅ [[ λ · t ]] = [ λ · a, λ · b ] if λ = 0 , [[ t ]] = [ a, b ] ∅ if λ = 0 , [[ t ]] = ∅ [0 , otherwise [[ t + t ]] = ( [ a + a , b + b ] if [[ t i ]] = [ a i , b i ] ∅ otherwise [[ t ⊔ t ]] = [ min a i , max b i ] if [[ t i ]] = [ a i , b i ][ a , b ] if [[ t ]] = [ a , b ] , [[ t ]] = ∅ [ a , b ] if [[ t ]] = [ a , b ] , [[ t ]] = ∅∅ otherwise [[( a · x ) ⊔ ( b · x )]] = [ a, b ] . For { x, y } , P fc S (2) is the set containing all convexpolygons: for instance the term ( r · x + s · y ) ⊔ ( r · x + s · y ) ⊔ ( r · x + s · y ) denote a triangle with vertexes ( r i , s i ) . For n = { x , . . . x n − } , it is easy to seethat P fc S ( n ) contains all convex n -polytopes. Our work was inspired by [16] where Goy and Petrisan compose the monads ofpowerset and probability distributions by means of a weak distributive law inthe sense of Garner [14]. Our results also heavily rely on the work of Clementinoet al. [11] that illustrates necessary and sufficient conditions on a semiring S for the existence of a weak distributive law δ : SP → PS . However, to the bestof our knowledge, the alternative characterisation of δ provided by Theorem 21was never shown.Such characterisation is essential for giving a handy description of the lifting ˜ P : EM ( S ) → EM ( S ) (Theorem 24) as well as to observe the strong relationshipswith the work of Jacobs (Remark 25) and the one of Klin and Rot (Remark 23).The weak distributive law δ also plays a key role in providing the algebraictheories presenting the composed monad P c S (Theorem 24) and its finitaryrestriction P fc S (Theorem 35). These two theories resemble those appearing in,respectively, [16] and [9] where the monad of probability distributions plays therole of the monad S in our work.Theorem 30 allows to reuse the framework of coalgebraic trace semantics [19]for modelling over K l( P c S ) systems with both nondeterminism and quantitativefeatures. The alternative framework based on coalgebras over EM ( P c S ) directlyleads to nondeterministic weighted automata . A proper comparison with thosein [12] is left as future work. Thanks to the abstract results in [7], languageequivalence for such coalgebras could be checked by means of coinductive up-to techniques. It is worth remarking that, since δ is a weak distributive law, ombining Semilattices and Semimodules 19 then thanks to the work in [15], up-to techniques are also sound for “convex-bisimilarity” (in coalgebraic terms, behavioural equivalence for the lifted functor ˜ P : EM ( S ) → EM ( S ) ).We conclude by recalling that we have two main examples of positive semi-fields: B ool and R + . Booleans could lead to a coalgebraic modal logic and tracesemantics for alternating automata in the style of [26]. For R + , we hope thatexploiting the ideas in [33] our monad could shed some lights on the behaviourof linear dynamical systems featuring some sort of nondeterminism. References
1. Barlocco, S., Kupke, C., Rot, J.: Coalgebra learning via duality. In: InternationalConference on Foundations of Software Science and Computation Structures. pp.62–79. Springer (2019)2. Barr, M.: Relational algebras. In: MacLane, S., Applegate, H., Barr, M., Day, B.,Dubuc, E., Phreilambud, Pultr, A., Street, R., Tierney, M., Swierczkowski, S. (eds.)Reports of the Midwest Category Seminar IV. pp. 39–55. Lecture Notes in Mathe-matics, Springer, Berlin, Heidelberg (1970). https://doi.org/10.1007/BFb00604393. Beck, J.: Distributive laws. In: Appelgate, H., Barr, M., Beck, J., Lawvere, F.W.,Linton, F.E.J., Manes, E., Tierney, M., Ulmer, F., Eckmann, B. (eds.) Seminar onTriples and Categorical Homology Theory. pp. 119–140. Lecture Notes in Mathe-matics, Springer, Berlin, Heidelberg (1969). https://doi.org/10.1007/BFb00830844. Bonchi, F., Bonsangue, M.M., Boreale, M., Rutten, J.J.M.M., Silva, A.: A coalge-braic perspective on linear weighted automata. Inf. Comput. , 77–105 (2012).https://doi.org/10.1016/j.ic.2011.12.0025. Bonchi, F., Ganty, P., Giacobazzi, R., Pavlovic, D.: Sound up-to techniquesand complete abstract domains. In: Dawar, A., Grädel, E. (eds.) Proceed-ings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Sci-ence, LICS 2018, Oxford, UK, July 09-12, 2018. pp. 175–184. ACM (2018).https://doi.org/10.1145/3209108.32091696. Bonchi, F., König, B., Petrisan, D.: Up-to techniques for behavioural metrics viafibrations. In: Schewe, S., Zhang, L. (eds.) 29th International Conference on Con-currency Theory, CONCUR 2018, September 4-7, 2018, Beijing, China. LIPIcs,vol. 118, pp. 17:1–17:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2018).https://doi.org/10.4230/LIPIcs.CONCUR.2018.177. Bonchi, F., Petrisan, D., Pous, D., Rot, J.: Coinduction up-to in a fibrationalsetting. In: Henzinger, T.A., Miller, D. (eds.) Joint Meeting of the Twenty-ThirdEACSL Annual Conference on Computer Science Logic (CSL) and the Twenty-Ninth Annual ACM/IEEE Symposium on Logic in Computer Science (LICS),CSL-LICS ’14, Vienna, Austria, July 14 - 18, 2014. pp. 20:1–20:9. ACM (2014).https://doi.org/10.1145/2603088.26031498. Bonchi, F., Pous, D.: Hacking nondeterminism with induction and coinduction.Commun. ACM (2), 87–95 (2015). https://doi.org/10.1145/27131679. Bonchi, F., Sokolova, A., Vignudelli, V.: The theory of traces for systems withnondeterminism and probability. In: 2019 34th Annual ACM/IEEE Symposiumon Logic in Computer Science (LICS). pp. 1–14. IEEE (2019)10. Böhm, G.: The weak theory of monads. Advances in Mathematics (1), 1–32(Sep 2010). https://doi.org/10.1016/j.aim.2010.02.0150 F. Bonchi and A. Santamaria11. Clementino, M.M., Hofmann, D., Janelidze, G.: The monads of classical algebraare seldom weakly cartesian. Journal of Homotopy and Related Structures (1),175–197 (Apr 2014). https://doi.org/10.1007/s40062-013-0063-212. Droste, M., Kuich, W., Vogler, H.: Handbook of weighted automata. Springer Sci-ence & Business Media (2009)13. Erkens, R., Rot, J., Luttik, B.: Up-to techniques for branching bisimilarity. In:International Conference on Current Trends in Theory and Practice of Informatics.pp. 285–297. Springer (2020)14. Garner, R.: The Vietoris Monad and Weak Distributive Laws.Applied Categorical Structures (2), 339–354 (Apr 2020).https://doi.org/10.1007/s10485-019-09582-w15. Goy, A., Petrisan, D.: Combining weak distributive laws: Application to up-totechniques. CoRR abs/2010.00811 (2020), https://arxiv.org/abs/2010.00811
16. Goy, A., Petrişan, D.: Combining probabilistic and non-deterministic choicevia weak distributive laws. In: Proceedings of the 35th Annual ACM/IEEESymposium on Logic in Computer Science. pp. 454–464. LICS ’20, As-sociation for Computing Machinery, New York, NY, USA (Jul 2020).https://doi.org/10.1145/3373718.339479517. Gumm, H.P., Schröder, T.: Monoid-labeled transition systems. Elec-tronic Notes in Theoretical Computer Science (1), 185–204 (May 2001).https://doi.org/10.1016/S1571-0661(04)80908-318. Hasuo, I.: Generic weakest precondition semantics from monads enriched withorder. Theoretical Computer Science , 2–29 (2015)19. Hasuo, I., Jacobs, B., Sokolova, A.: Generic trace semantics via coinduction. Log.Methods Comput. Sci. (4) (2007). https://doi.org/10.2168/LMCS-3(4:11)200720. Hasuo, I., Shimizu, S., Cîrstea, C.: Lattice-theoretic progress measures and coalge-braic model checking. In: Bodík, R., Majumdar, R. (eds.) Proceedings of the 43rdAnnual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Lan-guages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016. pp. 718–732.ACM (2016). https://doi.org/10.1145/2837614.283767321. van Heerdt, G., Kupke, C., Rot, J., Silva, A.: Learning weighted automata overprincipal ideal domains. In: International Conference on Foundations of SoftwareScience and Computation Structures. pp. 602–621. Springer, Cham (2020)22. Hyland, M., Nagayama, M., Power, J., Rosolini, G.: A category theoretic formula-tion for engeler-style models of the untyped lambda. Electron. Notes Theor. Com-put. Sci. , 43–57 (2006). https://doi.org/10.1016/j.entcs.2006.04.02423. Hyland, M., Plotkin, G.D., Power, J.: Combining effects: Sum and tensor. Theor.Comput. Sci. (1-3), 70–99 (2006). https://doi.org/10.1016/j.tcs.2006.03.01324. Jacobs, B.: Coalgebraic Trace Semantics for Combined Possibilitistic and Proba-bilistic Systems. Electronic Notes in Theoretical Computer Science (5), 131–152(Jun 2008). https://doi.org/10.1016/j.entcs.2008.05.02325. Klin, B.: Bialgebras for structural operational semantics: An in-troduction. Theor. Comput. Sci. (38), 5043–5069 (2011).https://doi.org/10.1016/j.tcs.2011.03.02326. Klin, B., Rot, J.: Coalgebraic trace semantics via forgetful logics. In: Pitts, A.M.(ed.) Foundations of Software Science and Computation Structures - 18th Interna-tional Conference, FoSSaCS 2015, Held as Part of the European Joint Conferenceson Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015.Proceedings. Lecture Notes in Computer Science, vol. 9034, pp. 151–166. Springer(2015). https://doi.org/10.1007/978-3-662-46678-0_10ombining Semilattices and Semimodules 2127. Klin, B., Salamanca, J.: Iterated covariant powerset is not a monad. In: Sta-ton, S. (ed.) Proceedings of the Thirty-Fourth Conference on the MathematicalFoundations of Programming Semantics, MFPS 2018, Dalhousie University, Hal-ifax, Canada, June 6-9, 2018. Electronic Notes in Theoretical Computer Science,vol. 341, pp. 261–276. Elsevier (2018). https://doi.org/10.1016/j.entcs.2018.11.01328. Kurz, A., Velebil, J.: Relation lifting, a survey. Journal of Logicaland Algebraic Methods in Programming (4), 475–499 (Jun 2016).https://doi.org/10.1016/j.jlamp.2015.08.00229. Manes, E.G.: Algebraic Theories, Graduate Texts in Mathematics, vol. 26.Springer, New York, NY (1976). https://doi.org/10.1007/978-1-4612-9860-130. Manes, E., Mulry, P.: Monad compositions. i: General constructions and recursivedistributive laws. Theory and Applications of Categories [electronic only] , 172–208 (2007)31. Moggi, E.: Notions of computation and monads. Inf. Comput. (1), 55–92 (1991).https://doi.org/10.1016/0890-5401(91)90052-432. Rutten, J.J.M.M.: Automata and coinduction (an exercise in coalgebra). In: San-giorgi, D., de Simone, R. (eds.) CONCUR ’98: Concurrency Theory, 9th In-ternational Conference, Nice, France, September 8-11, 1998, Proceedings. Lec-ture Notes in Computer Science, vol. 1466, pp. 194–218. Springer (1998).https://doi.org/10.1007/BFb005562433. Rutten, J.J.M.M.: A tutorial on coinductive stream calculus andsignal flow graphs. Theor. Comput. Sci. (3), 443–481 (2005).https://doi.org/10.1016/j.tcs.2005.06.01934. Silva, A., Bonchi, F., Bonsangue, M.M., Rutten, J.J.M.M.: Generalizing deter-minization from automata to coalgebras. Log. Methods Comput. Sci. (1) (2013).https://doi.org/10.2168/LMCS-9(1:9)201335. Smolka, S., Foster, N., Hsu, J., Kappé, T., Kozen, D., Silva, A.: Guarded kleenealgebra with tests: verification of uninterpreted programs in nearly linear time.Proceedings of the ACM on Programming Languages (POPL), 1–28 (2019)36. Street, R.: Weak Distributive Laws. Theory and Applications of Categories (12),313–320 (2009),
37. Turi, D., Plotkin, G.: Towards a mathematical operational semantics. In: Pro-ceedings of Twelfth Annual IEEE Symposium on Logic in Computer Science. pp.280–291. IEEE (1997)38. Urbat, H., Schröder, L.: Automata learning: An algebraic approach. In: Proceedingsof the 35th Annual ACM/IEEE Symposium on Logic in Computer Science. pp.900–914 (2020)39. Varacca, D., Winskel, G.: Distributing probability over non-determinism. Math. Struct. Comput. Sci. (1), 87–113 (2006).https://doi.org/10.1017/S096012950500507440. Zwart, M., Marsden, D.: No-Go Theorems for Distributive Laws. In: 2019 34thAnnual ACM/IEEE Symposium on Logic in Computer Science (LICS). pp. 1–13(Jun 2019). https://doi.org/10.1109/LICS.2019.8785707 Proof of Theorem 17 . We calculate δ by first analysing the canonical exten-sion e S of S to R el and then by following the proof of Theorem 5. The formula to extend the functor S to R el is the following: on objects itbehaves like S ; if R ⊆ A × B is a relation and π A : R → A and π B : R → B arethe two projections, we have that e S ( R ) = Γ ( S ( π B )) ◦ Γ ( S ( π A )) − (composition performed in R el ) where Γ computes the graph of a function. Now,for all ψ : R → S S ( π A )( ψ ) = (cid:16) a X r ∈ π − A { a } ψ ( r ) (cid:17) = (cid:16) a X b ∈ BaRb ψ ( a, b ) (cid:17) and similarly for S ( π B )( ψ ) . So, e S ( R ) = n(cid:16)(cid:0) a X b ∈ BaRb ψ ( a, b ) (cid:1) , (cid:0) b X a ∈ AaRb ψ ( a, b ) (cid:1)(cid:17) | ψ : R → S, supp ψ finite o . From this we obtain a weak distributive law as follows. Recall the identity-on-objects isomorphism of categories F : K l( P ) → R el where for f : X → P ( Y ) in S et , F ( f ) = { ( x, y ) | y ∈ f ( x ) } ⊆ X × Y and for R ⊆ X × Y , F − ( R ) =( x
7→ { y ∈ Y | x R y } ) : X → P ( Y ) . Consider id P X : P X → P X in S et . Thisis a Kleisli map id P X : P X → X in K l( P ) , which corresponds to the relation ∋ X : P X → X = { ( A, x ) | x ∈ A } . Then we have e S ( ∋ X ) = n(cid:16)(cid:0) A X x ∈ A ψ ( A, x ) (cid:1) , (cid:0) x X A ∋ x ψ ( A, x ) (cid:1)(cid:17) | ψ ∈ S ( ∋ X ) o . Remember that e S and S coincide on objects. This relation, seen back as a Kleislimap e SP X → e S X , gives us the X -th component of the desired weak distributivelaw, which is indeed (6). ⊓⊔ The Proof of Theorem 21.
We need a lemma that generalises the distribu-tivity property in an arbitrary semiring. The statement of the following Lemmamakes sense only for commutative semirings, but it can be adapted for arbitrarysemirings by restricting it to sets L only of the form n = { , . . . , n } . Lemma 37.
For all n ∈ N , L ⊂ N such that | L | = n , for all ( s k ) k ∈ L ∈ N n , forall ( λ kj ) k ∈ Lj ∈ s k family of elements of S : X w ∈ Q k ∈ L s k Y k ∈ L λ kw k = Y k ∈ L s k X j =1 λ kj . (22) Proof.
By induction on n . If n = 0 , both sides of (22) are . ombining Semilattices and Semimodules 23 Let now n ≥ , suppose that the statement of the Lemma holds for n , let usconsider a L ⊂ N such that | L | = n + 1 , ( s k ) k ∈ L ∈ N n +1 , ( λ kj ) k ∈ Lj ∈ s k . Without lossof generality we can assume that L = n + 1 . Then we have: X w ∈ n +1 Q k =1 s k n +1 Y k =1 λ kw k = s n +1 X j =1 (cid:18) X w ′ ∈ n Q k =1 s k (cid:16) ( n Y k =1 λ kw ′ k ) · λ n +1 j (cid:17)(cid:19) = s n +1 X j =1 (cid:18)(cid:16) X w ′ ∈ n Q k =1 s k n Y k =1 λ kw ′ k (cid:17) · λ n +1 j (cid:19) = s n +1 X j =1 (cid:18)(cid:16) n Y k =1 s k X u =1 λ ku (cid:17) · λ n +1 j (cid:19) = (cid:16) n Y k =1 s k X u =1 λ ku (cid:17) · (cid:16) s n +1 X j =1 λ n +1 j (cid:17) = n +1 Y k =1 s k X j =1 λ kj . ⊓⊔ Theorem 38. If S is a positive, refinable semifield, then for all X set and Φ ∈ SP X , δ X ( Φ ) = c ( Φ ) µ S X .Proof. We shall discuss first some preliminary cases involving the empty set,excluding each time all the cases previously covered. Recall that δ X ( Φ ) = ( ϕ ∈ S ( X ) | ∃ ψ ∈ S ( ∋ ) . ( ∀ A ∈ P X. Φ ( A ) = P x ∈ A ψ ( A, x ) ∀ x ∈ X. ϕ ( x ) = P A ∋ x ψ ( A, x ) ) and write, within the scope of this proof, δ ′ X ( Φ ) = c ( Φ ) µ S X , that is: δ ′ X ( Φ ) = µ S X ( Ψ ) | Ψ ∈ S X. X χ ∈S X Ψ ( χ ) = 1 , supp Ψ ⊆ c ( Φ ) where c ( Φ ) = { χ ∈ S X | ∃ u ∈ Y A ∈ supp Φ A. ∀ x ∈ X. χ ( x ) = X A ∈ supp Φx = u A Φ ( A ) } (this is of course an equivalent formulation of (7)). Case 1: Φ ( ∅ ) = 0 . We have that δ X ( Φ ) = ∅ because there is no ψ ∈ S ( ∋ ) suchthat Φ ( ∅ ) = P x ∈∅ ψ ( A, x ) = 0 . At the same time, also δ ′ X ( Φ ) = ∅ , because c ( Φ ) = ∅ –since Q A ∈ supp Φ A = ∅ –hence there is no Ψ ∈ S X with empty supportthat can satisfy P χ ∈S X Ψ ( χ ) = 1 . Case 2: X = ∅ . (We also assume that Φ ( ∅ ) = 0 from now on.) We have that SP∅ = { Ω : {∅} → S } , therefore Φ = 0 : {∅} → S . Moreover, ∋ ⊆ P ( ∅ ) × ∅ = ∅ and S ( ∅ ) = {∅ : ∅ → S } is the singleton of the empty map, so δ ∅ ( Φ ) = { ϕ ∈ S ( ∅ ) | ∃ ψ ∈ S ( ∅ ) . ∀ A ⊆ ∅ . Φ ( A ) = X x ∈∅ ψ ( A, x ) } = { ϕ ∈ S ( ∅ ) | Φ ( ∅ ) = 0 } = {∅ : ∅ → S } because, by assumption, Φ ( ∅ ) = 0 . On the other hand, we have that, since supp Φ = ∅ , c ( Φ ) = { χ ∈ S ( ∅ ) | ∃ u ∈ Y A ∈∅ A } = S ( ∅ ) because the zero-ary product is a choice of a terminal object of S et , a singleton.So, δ ′∅ ( Φ ) = { µ ( Ψ ) | Ψ ∈ S ∅ , X χ ∈S∅ Ψ ( χ ) = 1 } = { µ ( S ( ∅ ) ∋ ∅ 7→ } = {∅ : ∅ → S } . Case 3: Φ = 0 : P X → S . (We also assume that X = ∅ from now on.) We havethat the only ψ ∈ S ( ∋ ) such that for all P x ∈ A ψ ( A, x ) = 0 for all A ⊆ X is thenull function, therefore δ X (0 : P X → S ) = { X → S } . On the other hand, wehave that supp Φ = ∅ , so c ( Φ ) = { χ ∈ S X | ∃ u ∈ Y A ∈∅ A. ∀ x ∈ X. χ ( x ) = X A ∈∅ Φ ( A ) } = { X → S } . It follows then that δ ′ X (0 : P S → S ) = { µ ( Ψ ) | Ψ ∈ S X, X χ ∈S X Ψ ( χ ) = 1 , supp Ψ ⊆ { X → S }} = { µ ( S X ∋ } = { ( S ∋ x · } = { X → S } . We have now discussed all the preliminary cases. For the rest of the proof,we shall assume that X = ∅ , Φ = 0 : P X → S and Φ ( ∅ ) = 0 .We first prove δ X ( Φ ) ⊆ δ ′ X ( Φ ) . To this end, let ϕ ∈ S X and ψ ∈ S ( ∋ ) suchthat Φ ( A ) = P x ∈ A ψ ( A, x ) for all A ∈ P X and ϕ ( x ) = P A ∋ x ψ ( A, x ) for all x ∈ X . Observe that: ombining Semilattices and Semimodules 25 – for all ( A, x ) ∈ supp ψ we have that A ∈ supp Φ and x ∈ supp ϕ ∩ A , – for all A ∈ supp Φ there is x ∈ supp ϕ ∩ A such that ( A, x ) ∈ supp ψ , – for all x ∈ supp ϕ there exists A ∈ supp Φ such that A ∋ x and ( A, x ) ∈ supp ψ .Hence the first elements of pairs in supp ψ range over all and only elements of supp Φ , and the second entries of pairs in supp ψ range over all and only elementsof supp ϕ . In other words, say supp Φ = { A , . . . , A n } : then we have supp ψ = n ( A , x ) , . . . , ( A , x s ) , . . . , ( A n , x n ) , . . . , ( A n , x ns n ) o where S ni =1 { x i , . . . , x is i } = supp ϕ . Notice that for all i ∈ n , u, v ∈ s i , if u = v then x iu = x iv , but we may have x ia = x jb if i = j , because the A i ’s are distinctbut not disjoint . We can then write:(I) Φ ( A i ) = s i P j =1 ψ ( A i , x ij ) for all i ∈ n (II) ϕ ( x ) = P i ∈ n ∃ j ∈ s i .x = x ij ψ ( A i , x ) for all x ∈ X .We want to find a convex linear combination Ψ of elements of S X of the form P ni =1 Φ ( A i ) a i for some a i ∈ A i such that µ ( Ψ ) = ϕ . Now, for every i ∈ n , wehave many candidates for a i , namely x i , . . . , x is i . Given that every χ ∈ supp Ψ can only involve one x ij for every i , we shall have as many χ ’s as the number ofways to pick one element of { x i , . . . , x is i } for each i : let then w ∈ Q ni =1 s i (it isa tuple of indexes w i which we are going to use as j ’s). Define χ w as χ w ( x w ) = Φ ( A ) , . . . , χ w ( x nw n ) = Φ ( A n ) with the understanding that if x iw i = x jw j then χ w ( x iw i ) = Φ ( A i )+ Φ ( A j ) . Writtenmore precisely, we define for all x ∈ Xχ w ( x ) = X i ∈ nx = x iwi Φ ( A i ) . We now define Ψ ∈ S X with supp Ψ = { χ w | w ∈ Q ni =1 s i } that assigns to each χ w a number such that P w Ψ ( χ w ) = 1 . We shall use the previous Lemma toshow that by defining Ψ ( χ w ) = Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) for all w , or more precisely by defining Ψ ( χ ) = X w ∈ Q ni =1 s i χ = χ w Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) for all χ ∈ S X we indeed have that Ψ satisfies the conditions of δ ′ X ( Φ ) and ϕ = µ ( Ψ ) . First we prove that Ψ is in fact a convex linear combination: X χ ∈ supp Ψ Ψ ( χ ) = 1 Q ni =1 Φ ( A i ) X w ∈ Q s i n Y i =1 ψ ( A i , x iw i )= 1 Q ni =1 Φ ( A i ) n Y i =1 s i X j =1 ψ ( A i , x ij ) Lemma 37 = 1 Q ni =1 Φ ( A i ) n Y i =1 Φ ( A i ) because of (I) = 1 . Next, notice that for every w the vector u ∈ Q ni =1 A i required by the definitionof δ ′ X ( Φ ) is exactly ( x w , . . . , x nw n ) . Finally, we compute µ ( Ψ )( x ) for an arbitrary x ∈ X . The equations marked with ( ∗ ) will be explained later. µ S X ( Ψ )( x ) = X χ ∈ supp Ψ Ψ ( χ ) · χ ( x )= X w ∈ Q nk =1 s k " Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) X i ∈ nx = x iwi Φ ( A i ) ( ∗ )= X w ∈ Q nk =1 s k X i ∈ nx = x iwi " Q nk =1 ψ ( A k , x kw k ) Q nk =1 Φ ( A k ) Φ ( A i ) = X i ∈ n X w ∈ Q nk =1 s k x = x iwi " Q nk =1 ψ ( A k , x kw k ) Q nk =1 Φ ( A k ) Φ ( A i ) = X i ∈ n ∃ j ∈ s i .x = x ij X w ∈ Q nk =1 s k x = x iwi " Φ ( A i ) ψ ( A i , x iw i ) Q nk =1 Φ ( A k ) Y k ∈ nk = i ψ ( A k , x kw k ) ( ∗ )= X i ∈ n ∃ j ∈ s i .x = x ij Φ ( A i ) · ψ ( A i , x ) Q nk =1 Φ ( A k ) · X w ∈ Q nk =1 s k x = x iwi Y k ∈ nk = i ψ ( A k , x kw k ) Now, use Lemma 37 with L = { , . . . , i − , i + 1 , . . . , n } and λ kj = ψ ( A k , x kj ) inthe following chain of equations: X w ∈ Q nk =1 s k x = x iwi Y k ∈ nk = i ψ ( A k , x kw k ) = X w ′ ∈ Q k ∈ L s k Y k ∈ L ψ ( A k , x kw ′ k ) ombining Semilattices and Semimodules 27 = Y k ∈ L s k X j =1 ψ ( A k , x kj )= Y k ∈ nk = i s k X j =1 ψ ( A k , x kj )= Y k ∈ nk = i Φ ( A k ) Therefore, we obtain µ S X ( Φ ) = X i ∈ n ∃ j ∈ s i .x = x ij Φ ( A i ) · ψ ( A i , x ) Q nk =1 Φ ( A k ) · Y k ∈ nk = i Φ ( A k )= X i ∈ n ∃ j ∈ s i .x = x ij ψ ( A i , x )= ϕ ( x ) because of (II) . It remains to explain equations ∗ and ∗ above. The latter is simply due to thefact that if i is such that there is no j for which x = x ij , then there is not a w such that x = x iw i either, and vice versa. The former is more delicate. It may bethe case that χ w = χ w ′ for w = w ′ . So, let us write supp Ψ = { χ w , . . . , χ w m } where the χ w l are now all distinct. Then we have X χ ∈ supp Ψ Ψ ( χ ) · χ ( x ) = m X l =1 Ψ ( χ w l ) · χ w l ( x )= m X l =1 X wχ wl = χ w Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) ! χ w l ( x )= m X l =1 X wχ wl = χ w Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) χ w l ( x )= m X l =1 X wχ wl = χ w Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) χ w ( x )= X w Q ni =1 ψ ( A i , x iw i ) Q ni =1 Φ ( A i ) χ w ( x ) which is the right-hand side of ( ∗ ) . The other inclusion, δ ′ X ( Φ ) ⊆ δ X ( Φ ) , is easier. Let Ψ ∈ S X be such that P χ ∈S X Ψ ( χ ) = 1 and supp Ψ ⊆ { χ ∈ S X | ∃ u ∈ Y A ∈ supp Φ A. ∀ x ∈ X. χ ( x ) = X A ∈ supp Φx = u A Φ ( A ) } . Write again supp Φ = { A , . . . , A n } and let supp Ψ = { χ , . . . , χ m } . For all j ∈ m , let u j ∈ Q ni =1 A i be such that χ j ( x ) = P i ∈ nx = u ji Φ ( A i ) . Then we have µ S X ( Ψ )( x ) = m X j =1 Ψ ( χ j ) χ j ( x ) = m X j =1 Ψ ( χ j ) X i ∈ nx = u ji Φ ( A i ) . Define then ψ ( B, x ) = P j ∈ mx = u ji Ψ ( χ j ) Φ ( A i ) ∃ (!) i ∈ n. B = A i otherwiseWe have supp ψ = { ( A i , u ji ) | i ∈ n, j ∈ m } is finite and so ψ ∈ S ( ∋ ) . We nowverify the two conditions required in the definition of δ X ( Φ ) . For all x ∈ X : X A ∋ x ψ ( A, x ) = n X i =1 ψ ( A i , x ) = n X i =1 X j ∈ mx = u ji Ψ ( χ j ) Φ ( A i ) = m X j =1 X i ∈ nx = u ji Ψ ( χ j ) Φ ( A i )= µ S X ( Ψ )( x ) while for all A ⊆ X , if A / ∈ supp Φ , then P x ∈ A ( ψ ( A, x )) = 0 = Φ ( A ) by definitionand, for all i ∈ n : X x ∈ A i Ψ ( A i , x ) = X x ∈ A i X j ∈ mx = u ji ψ ( χ j ) Φ ( A i ) ∗ = m X j =1 Ψ ( χ j ) Φ ( A i ) = Φ ( A i ) m X j =1 Ψ ( χ j )= Φ ( A i ) where equation ∗ holds because for all j ∈ m the addend Ψ ( χ j ) Φ ( A i ) appearson the left-hand side exactly once, when in the first sum we are using, as x ,precisely u ji ∈ A i . In other words, given j , there is a unique x ∈ A i such that x = u ji , so Ψ ( χ j ) Φ ( A i ) appears in the left-hand side of ∗ and it does so onlyonce. Therefore µ S X ( Ψ ) ∈ δ X ( Φ ) , and the proof is complete. ⊓⊔ Proof of Lemma 26.
First of all, if A = ∅ , then the left-hand side is empty,because there is no ψ ∈ S ( ∋ ) such that ∆ ∅ ( ∅ ) = P x ∈∅ ψ ( B, x ) = 0 , and so ombining Semilattices and Semimodules 29 is the right-hand side, as the only function whose support is empty is the nullfunction, which cannot satisfy P x ∈ X ϕ ( x ) = 1 .Suppose then that A = ∅ . For the left-to-right inclusion: observe first of allthat supp ϕ = ∅ , because otherwise we would have that ψ ( B, x ) = 0 for all x ∈ X and for all B ∋ x due to the fact that S is a positive semiring. Thiswould then lead to the contradiction ∆ A ( A ) = P x ∈ A ψ ( A, x ) = 0 . Letthen x ∈ supp ϕ : then ϕ ( x ) = 0 , hence there exists B ∋ x such that ψ ( B, x ) =0 . It is necessarily the case, however, that B = A , because if B = A , then ∆ A ( B ) = P y ∈ B ψ ( B, y ) ≥ ψ ( B, x ) = 0 , which is a contradiction. Thus supp ϕ ⊆ A . Moreover, X x ∈ X ϕ ( x ) = X x ∈ A ϕ ( x ) = X x ∈ A X B ∋ x ψ ( B, x ) ∗ = X x ∈ A ψ ( A, x ) = ∆ A ( A ) = 1 where equation ∗ holds because for all B = A and for all y ∈ B we have ψ ( B, y ) = 0 , hence the only addend of P B ∋ x ψ ( B, x ) which is possibly not-nullis the “ A -th one”: ψ ( A, x ) .Vice versa, let ϕ : X → S such that supp ϕ is finite and contained in A andsatisfying P x ∈ X ϕ ( x ) = 1 . Then the map ∋ R + ( B, x ) ( ϕ ( x ) B = A otherwise ψ has finite support, as it is in bijective correspondence with supp ϕ ; for all B ∈P X , if B = A then P x ∈ B ψ ( B, x ) = 0 , otherwise X x ∈ B ψ ( B, x ) = X x ∈ A ϕ ( x ) = X x ∈ X ϕ ( x ) = 1; and finally, for all x ∈ X , P B ∋ x ψ ( B, x ) = ψ ( A, x ) = ϕ ( x ) . ⊓⊔ The proof of Proposition 27.
We actually state and prove a more preciseresult, that implies Proposition 27.
Proposition 39.
Let ( X, a ) be a S -algebra and let A ⊆ S X . Then P a (cid:16) A µ S X (cid:17) = P a ( A ) a . Proof.
We have P a (cid:16) A µ S X (cid:17) = { a ( µ S X ( Ψ )) | Ψ ∈ S X, X ψ ∈S X Ψ ( ψ ) = 1 , supp Ψ ⊆ A} while P a ( A ) a = { a ( ϕ ) | ϕ ∈ S X, X x ∈ X ϕ ( x ) = 1 , supp ϕ ⊆ { a ( ψ ) | ψ ∈ A}} . For the left-to-right inclusion: let Ψ ∈ S X be such that P ψ ∈S X Ψ ( ψ ) = 1 andwith supp Ψ ⊆ A . Define ϕ = S ( a )( Ψ ) . Then x ∈ supp ϕ if and only if thereexists ψ ∈ supp Ψ such that x = a ( ψ ) . Hence, if x ∈ supp ϕ , then x = a ( ψ ) forsome ψ ∈ A . Moreover, X x ∈ X ϕ ( x ) = X x ∈ X X ψ ∈ supp Ψa ( ψ )= x Ψ ( ψ ) = X ψ ∈S X Ψ ( ψ ) = 1 . Since a ( µ S X ( Ψ )) = a ( S ( a )( Ψ )) by the properties of ( X, a ) as S -algebra, and S ( a )( Ψ ) = ϕ by definition, we conclude.Vice versa, given ϕ ∈ S X such that P x ∈ X ϕ ( x ) = 1 and with supp ϕ = { a ( ψ ) , . . . , a ( ψ n ) } where ψ , . . . , ψ n ∈ A , define Ψ = ψ ϕ ( a ( g )) ... ... ψ n ψ ( a ( f n )) Then P ψ ∈S X Ψ ( ψ ) = 1 and a ( µ S X ( Ψ )) = a ( S ( a )( Ψ )) = a ( ϕ ) because S ( a )( Ψ ) = ϕ . ⊓⊔ Details of the Proof of Proposition 28.
In the same notations set up in theproof of Theorem 28, let A ∈ supp Φ . Define for all x ∈ X : χ A ( x ) = X ϕ ∈ supp Ψx = u ϕ ( A ) Ψ ( ϕ ) . Then supp χ A = { u ϕ ( A ) | ϕ ∈ supp Ψ } is finite, hence χ A ∈ S X . Let now u ( A ) = a ( χ A ) . We have that X x ∈ X χ A ( x ) = X x ∈ X X ϕ ∈ supp Ψx = u ϕ ( A ) Ψ ( ϕ ) = X ϕ ∈ supp Ψ Ψ ( ϕ ) = 1 , ombining Semilattices and Semimodules 31 hence u ( A ) ∈ A because A is convex. Define, for all x ∈ X : ψ ( x ) = X A ∈ supp ϕx = a ( χ A ) Φ ( A ) . Then supp ψ = { u ( A ) | A ∈ supp Φ } so ψ ∈ S X . To conclude, we have to provethat a ( µ S X ( Ψ )) = a ( ψ ) . To that end, let for all χ ∈ S XΨ ′ ( χ ) = X A ∈ supp ϕχ A = χ Φ ( A ) . Then supp Ψ ′ = { χ A | A ∈ supp Φ } is finite. Then we have for all x ∈ X that µ S X ( Ψ ′ )( x ) = X χ ∈ supp Ψ ′ Ψ ′ ( χ ) · χ ( x ) ∗ = X A ∈ supp Φ Φ ( A ) · X ϕ ∈ supp Ψx = u ϕ ( A ) Ψ ( ϕ )= X ϕ ∈ supp Ψ Ψ ( ϕ ) · X A ∈ supp Φx = u ϕ ( A ) Φ ( A )= X ϕ ∈S X Ψ ( ϕ ) · ϕ ( x )= µ S X ( Ψ )( x ) where equation ∗ is explained in a similar way than ( ∗ ) in the proof of Theo-rem 38. We also have that S ( a )( Ψ ′ )( x ) = X χ ∈ a − { x } Ψ ′ ( χ ) = X χ ∈S Xa ( χ )= x X A ∈ supp Φχ A = χ Φ ( A ) = X A ∈ supp Φa ( χ A )= x Φ ( A ) = ψ ( x ) . Therefore, a ( ψ ) = a (cid:0) S ( a )( Ψ ′ ) (cid:1) = a (cid:0) µ S X ( Ψ ′ ) (cid:1) = a (cid:0) µ S X ( Ψ ) (cid:1) . Continuation of the Proof of Theorem 24.
We continue the proof of The-orem 24 from p. 14, by analising the action of ˜ P on morphisms and the unit andthe multiplication of ˜ P .First of all, technically for f : ( X, a ) → ( X ′ , a ′ ) in EM ( S ) , ˜ P ( f ) is defined as ˜ P ( f )( A ) = P ( f )( A ) a ′ for all A ∈ P ac X ,however it is not difficult to see that P ( f )( A ) is convex in ( X ′ , a ′ ) using the factthat f is a morphism of S -algebras. The unit of the monad ˜ P is given, for every ( X, a ) object of EM ( S ) , as theunique morphism η ˜ P ( X,a ) : ( X, a ) → ˜ P ( X, a ) that makes the two triangles of (2)and (3) commute, which are in our case: X P X P ac X η P X U S ( η ˜ P ( X,a ) ) ι ( X,a ) X P ac X P X U S ( η ˜ P ( X,a ) ) η P X ( − ) a By definition of ι and η P , the only arrow that makes the left triangle abovecommutative is necessarily ( X, a ) ( P ac X, α a ) x { x } η ˜ P ( X,a ) and this makes also the right triangle commutative, since { x } a = { x } . Simi-larly, the multiplication µ ˜ P is defined, for every S -algebra ( X, a ) , as the uniquemorphism making the two rectangles of (2) and (3) commute. These are in ourcase: P α a c (cid:0) P ac X (cid:1) P ( P ac X ) PP X P ac X P X ιµ ˜ P ( X,a ) P ι µ P X ι PP X P ( P ac X ) P α a c ( P ac X ) P X P ac X P ( − ) a µ P X ( − ) αa µ ˜ P ( X,a ) ( − ) a By definition of ι and µ P , the only arrow that makes the left rectangle abovecommutative is necessarily P α a c ( P ac X ) P ac X A S A ∈A A µ ˜ P ( X,a ) for all ( X, a ) ∈ EM ( S ) . The reader may wonder why such morphism is welldefined, namely why µ ˜ P ( X,a ) ( A ) is in P ac X . This is the case because the abstractresults guarantee existence and uniqueness of a such morphism. The interestedreader may find next a more concrete proof of this and also the fact that this µ ˜ P makes the right rectangle commutative. Proposition 40.
Let ( X, a ) be a S -algebra and A ∈ P α a c (cid:0) P ac X (cid:1) . Then S A ∈A A is convex in ( X, a ) .Proof. We want to prove the following equality: [ A ∈A A = { a ( ϕ ) | ϕ ∈ S X, X x ∈ X ϕ ( x ) = 1 , supp ϕ ⊆ [ A ∈A A } . ombining Semilattices and Semimodules 33 The left-to-right inclusion is trivial: for all A ∈ A and x ∈ A , x = a ( ∆ x ) . Viceversa, let ϕ ∈ S X be such that P x ∈ X ϕ ( x ) = 1 and supp ϕ ⊆ S A ∈A A . We wantto find an element A ∈ A such that a ( ϕ ) ∈ A . Suppose supp ϕ = { x , . . . , x n } . Then for all i ∈ n there exists A i ∈ A such that x i ∈ A i . Notice that if i = j then it is not necessarily the case that A i = A j . Define Φ ∈ S ( P ac X ) as Φ ( B ) = X i ∈ nB = A i ϕ ( x i ) for all B ∈ P ac X . Then supp Φ = { A i | i ∈ n } is finite and X B ∈P ac X Φ ( B ) = X B ∈P ac X X i ∈ nB = A i ϕ ( x i ) = X i ∈ n ϕ ( x i ) = 1 . Since A is convex in ( P ac X, α a ) , we have that α a ( Φ ) ∈ A . This is going to beour desired A : we shall prove that a ( ϕ ) ∈ α a ( Φ ) .We have α a ( Φ ) = P a ( δ X ( S ( i )( Φ ))) , hence, if we prove that ϕ ∈ δ X ( S ( i )( Φ )) ,we have finished. To this end, recall the characterisation of δ X using elements of S ( ∋ ) , for ∋ ⊆ P X × X : δ X ( S ( i )( Φ )) = ( a ( χ ) | χ ∈ S X. ∃ ψ ∈ S ( ∋ ) . ( ∀ B ⊆ X. S ( i )( Φ )( B ) = P x ∈ B ψ ( B, x ) ∀ x ∈ X. χ ( x ) = P B ∋ x ψ ( B, x ) ) . Define, for all ( B, x ) ∈ P X × X such that B ∋ x : ψ ( B, x ) = X i ∈ n ( B,x )=( A i ,x i ) ϕ ( x i ) . Then supp ψ = { ( A i , x i ) | i ∈ n } is finite, for all B ⊆ X X x ∈ B ψ ( B, x ) = X x ∈ B X i ∈ n ( B,x )=( A i ,x i ) ϕ ( x i ) = X i ∈ nB = A i ϕ ( x i ) = S ( i )( Φ )( B ) and, for all x ∈ X , X B ∋ x ψ ( B, x ) = X B ∋ x X i ∈ n ( B,x )=( A i ,x i ) ϕ ( x i ) = ( ∀ i ∈ n. x = x i ϕ ( x i ) ∃ (!) i ∈ n. x = x i = ϕ ( x ) where if there is i such that x = x i , then such i is unique due to the fact thatthe x j ’s are distinct. This proves that ϕ ∈ δ X ( S ( i )( Φ )) . ⊓⊔ Proposition 41.
The following diagram commutes. PP X P ( P ac X ) P α a c ( P ac X ) P X P ac X P ( − ) a µ P X ( − ) αa µ ˜ P ( X,a ) ( − ) a Proof.
In this proof we shall simply write A for A a for any A ⊆ X , because thereis no risk of confusion. We have to show that { a ( ϕ ) | ϕ ∈ S X, X x ∈ X ϕ ( x ) = 1 , supp ϕ ⊆ [ U ∈U U } = [ Φ ∈SP ac X P Φ ( C )=1 supp Φ ⊆{ U | U ∈U} α a ( Φ ) . For the left-to-right inclusion: let ϕ ∈ S X such that P x ∈ X ϕ ( x ) = 1 , and suppose supp ϕ = { x , . . . , x n } . We have that for all i ∈ n there exists A i ∈ U such that x i ∈ A i . While the x i ’s are distinct, the A i ’s need not be. Define, for all B ∈ P ac X , Φ ( B ) = X i ∈ nB = A i ϕ ( x i ) . Then supp Φ = { A , . . . , A n } hence Φ ∈ SP ac X . One can then prove that a ( ϕ ) ∈ α a ( Φ ) in the same way as showed in the proof of Proposition 40.Vice versa, an element of the right-hand side is of the form a ( ψ ) for some Φ ∈ SP ac X such that P B ∈P ac X Φ ( B ) = 1 , supp Φ = { A , . . . , A n } with A i ∈ U for all i ∈ n and for some ψ ∈ S X and u ∈ Q ni =1 A i such that ψ ( x ) = X i ∈ nx = u i Φ ( A i ) . We want to prove that a ( ψ ) = a ( ϕ ) for an appropriate ϕ ∈ S X such that P x ∈ X ϕ ( x ) = 1 and supp ϕ ⊆ S U ∈U U .Since u i ∈ A i , we have that u i = a ( ϕ i ) for some ϕ i ∈ S X such that P x ∈ X ϕ i ( x ) = 1 and supp ϕ i ⊆ A i . These ϕ i ’s are not necessarily distinct.Let then, for all ϕ ∈ S X , Ψ ( ϕ ) = X i ∈ nϕ = ϕ i Φ ( A i ) . Then supp Ψ = { f , . . . , f n } so Ψ ∈ S X and it is easy to prove, by means ofdirect calculations, that ψ = S ( a )( Φ ) , P x ∈ X µ S X ( Ψ ) = 1 and that supp µ S X ( Ψ ) ⊆ S U ∈U U . Then we have that a ( ψ ) = a ( S ( a )( Ψ )) = a ( µ S X ( Ψ )) , and µ S X ( Ψ ) is the ϕ we were looking for. ⊓⊔ ombining Semilattices and Semimodules 35
10 Appendix for Section 6
The Presentation of P c S . For δ : SP → PS given in (8), we have that a δ -algebra is a set X together with a S -algebra structure a : S X → X and a P -algebra-structure b : P X → X such that pentagon (21) commutes. A mor-phism of δ -algebras is a morphism of P - and S -algebra simultaneously by defi-nition. Hence, by defining + a , λ · a and a as in (5), we have that X is a S -left-semimodule; moreover, if we define for each set I b G i ∈ I x i = b ( { x i | i ∈ I } ) (23)then X is also a complete semilattice. This means that X satisfies all the equa-tions in E CSL and E LSM ; moreover, every morphism of δ -algebras preserves allthe operations in Σ . The commutativity of pentagon (21) will instead ensurethat the equations in E D listed in (20) are satisfied, as we prove in the following.For A ⊆ X , we shall sometimes write F b A for F bx ∈ A x . Proposition 42.
Let ( X, a : S X → X, b : P X → X ) be a δ -algebra. For each A ⊆ X , b G x ∈ A x = b G x ∈ A a x. Proof.
Let Φ = η SP X ( A ) = ∆ A ∈ SP X . Then a (cid:0) S b ( Φ ) (cid:1) = a (cid:0) S b ( ∆ A ) (cid:1) = a (cid:0) ∆ F A (cid:1) = G A while δ X ( ∆ A ) = { ϕ ∈ S X | supp ϕ ⊆ A, X x ∈ X ϕ ( x ) = 1 } because of Lemma 26, hence P a (cid:0) δ X ( ∆ A ) (cid:1) = A a . By the commutativity of diagram (21), we have that F A = F A a . ⊓⊔ We can then prove that every δ -algebra satisfies the equations in E D . Theorem 43.
Let ( X, a : S X → X, b : P X → X ) be a δ -algebra. Then for all A, B ⊆ X and for all λ ∈ S \ { S } : λ · b G x ∈ A x = b G x ∈ A λ · x, b G x ∈ A x + a b G y ∈ B y = b G ( x,y ) ∈ A × B x + a y. Proof.
Let Φ = ( A λ ) ∈ SP X . We prove that the images along the two legsof pentagon (21) of Φ coincide with the two sides of the first equation in thestatement. It holds that a ( S ( b )( Φ )) = a ( x X U ∈ b − { x } Φ ( U ))= a ( b ( A ) λ )= a ( b G x ∈ A x λ ) Definition of b G (23) = λ · a b G x ∈ A x Definition of λ · a (5)On the other hand we have that b (cid:16) P a (cid:0) δ X ( Φ ) (cid:1)(cid:17) = b G P a (cid:0) c ( Φ ) µ S X (cid:1) Theorem 21 = b G P a (cid:0) c ( Φ ) (cid:1) a Proposition 39 = b G P a (cid:0) c ( Φ ) (cid:1) Proposition 42Following the discussion after Theorem 24, c ( Φ ) = { ( x λ ) | x ∈ A } if λ = 0 . Therefore, if λ = 0 , then P a (cid:0) c ( Φ ) (cid:1) = { a ( x λ ) | x ∈ A } which by (5)is exactly { λ · a x | x ∈ A } .Therefore b (cid:16) P a (cid:0) δ X ( Φ ) (cid:1)(cid:17) = b G x ∈ A λ · a x. We then conclude by using the commutativity of diagram (21). Using the func-tion Φ ′ = ( A , B ∈ SP X and a similar argument, one shows thesecond equation as well. ⊓⊔ Vice versa, we want to prove that every algebra for the theory ( Σ, E ) isalso a δ -algebra. To this end, let ( X, + , λ · , X , F I ) be a ( Σ, E ) -algebra. Then ( X, + , λ · , X ) is a S -left-semimodule, ( X, F I ) is a complete sup-semilattice. Bydefining S X Xf P x ∈ supp f f ( x ) · x a P X XA F x ∈ A x b we have that ( X, a ) ∈ EM ( S ) and ( X, b ) ∈ EM ( P ) . We now have to check thatpentagon (21) commutes. Given A ⊆ X , we define its convex closure A in theusual way: A = { n X i =1 p i · a i | n ∈ N , ( p i ) i ∈ n ∈ S n , ( a i ) i ∈ n ∈ A n } ombining Semilattices and Semimodules 37 where S n = { ( p i ) i ∈ n ∈ S n | P ni =1 p i = 1 } . Also, we shall denote by F A theelement b ( A ) ∈ X for any A ⊆ X . Then pentagon (21) commutes if and only iffor all Φ ∈ SP X : X A ∈ supp Φ Φ ( A ) · G A = G n X A ∈ supp Φ Φ ( A ) · u ( A ) | u : supp Φ → X. ∀ A. u ( A ) ∈ A o where the left-hand side is a ( S ( b )( Φ )) and the right-hand side is b ( P ( a )( δ X ( Φ ))) .In the following Lemma we prove that if X is a ( Σ, E ) -algebra and A ⊆ X ,then F A = F A . Using this fact and the distributivity property (20) we willhave shown the commutativity of pentagon (21). Lemma 44.
Let ( X, + , λ · , X , F I ) be a ( Σ, E ) -algebra. Then for all A ⊆ X G A = G A. Proof.
Let n ∈ N . Define S n = { ( p , . . . , p n ) ∈ S n | P ni =1 p i = 1 } . Let ( p i ) i ∈ n ∈ S n . Then G A = 1 · G A = ( n X i =1 p i ) · G A = n X i =1 (cid:0) p i · G A (cid:1) = Gn n X i =1 p i · a i | ( a i ) i ∈ n ∈ A n o because of the properties of S -semimodule and the distributivity (20). Let ≤ be the partial order determined by the complete semilattice structure of X . Wehave that ∀ n ∈ N , ∀ ( p i ) ∈ S n , ∀ ( a i ) ∈ A n . n X i =1 p i · a i ≤ Gn n X i =1 p i · b i | ( b i ) i ∈ n ∈ A n o = G A hence G A = Gn n X i =1 p i · a i | n ∈ N , ( p i ) ∈ S n , ( a i ) i ∈ n A n o ≤ G A while the other inequality is trivial because A ⊆ nP ni =1 p i · a i | n ∈ N , ( p i ) ∈ S n , ( a i ) i ∈ n ∈ A n o . ⊓⊔ Finally, again a morphism of ( Σ, E ) -algebras is a morphism respecting allthe operations of Σ , which means of Σ LSM (thus is a morphism of EM ( S ) ) andof Σ CSL (thus is a morphism of EM ( P ) ) at the same time. We have thereforeproved the following theorem. Theorem 45.
The category EM ( δ ) of δ -algebras is isomorphic to the category A lg( Σ, E ) of ( Σ, E ) -algebras. Since EM ( δ ) is canonically isomorphic to EM ( P c S ) ([10,14]), we have provedTheorem 32. The Kleisli Category of P c S . In this section we aim to prove, using thealgebraic presentation of the monad P c S , that its Kleisli category satisfies theconditions required to perform a coalgebraic trace semantics, as stated in [19]. ( P c S X, µ P c S X ) is a P c S -algebra, hence P c S X has a structure of semimoduleand complete lattice where, via the canonical isomorphism EM ( P c S ) → EM ( δ ) ,we have A + B = { ϕ + ψ | ϕ ∈ A , ψ ∈ B} λ · A = { λ · ϕ | ϕ ∈ A} G i ∈ I A i = [ i ∈ I A i for all A , B ∈ P c S X and λ ∈ S , λ = 0 .Consider now the Kleisli category K l( P c S ) . Each homset K l( P c S )( X, Y ) of functions f : X → P c S ( Y ) is partially ordered point-wise and inherits thestructure of complete semilattice from P c S Y , in particular its bottom element ⊥ X,Y is the constant function mapping x to ∅ for all x ∈ X . Given a function g : Y → P c S Z , its Kleisli extension g ♯ : P c S Y → P c S Z is given by µ P c S Z ◦ P c S g ,which for all A ∈ P c S Y computes: g ♯ ( A ) = G ϕ ∈A X y ∈ supp ϕ ϕ ( y ) · g ( y )= [ ϕ ∈A n X y ∈ supp ϕ ϕ ( y ) · ψ y | ∀ y ∈ supp ϕ. ψ y ∈ g ( y ) o . Composition of a function f : X → P c S Y and g : Y → P c S Z is therefore givenas ( g ◦ f )( x ) = g ♯ ( f ( x )) = G ϕ ∈ f ( x ) X y ∈ supp ϕ ϕ ( y ) · g ( y ) ∈ P c S Z. Theorem 46.
The category K l( P c S ) is enriched over the category of directed-complete partial orders and satisfies the left-strictness condition: ⊥ Y,Z ◦ f = ⊥ X,Z for all f : X → P c S Y and Z set.Proof. Let f : X → P c S Y and { g i | i ∈ I } a directed subset of K l( P c S )( Y, Z ) .Then: (cid:16) ( G i ∈ I g i ) ◦ f (cid:17) ( x ) = G ϕ ∈ f ( x ) X y ∈ supp ϕ ϕ ( y ) · ( G i ∈ I g i )( y )= G ϕ ∈ f ( x ) X y ∈ supp ϕ ϕ ( y ) · G i ∈ I ( g i ( y ))= G ϕ ∈ f ( x ) X y ∈ supp ϕ G i ∈ I ϕ ( y ) · g i ( y ) ombining Semilattices and Semimodules 39 ∗ = G ϕ ∈ f ( x ) G ( i y ) ∈ I supp ϕ { X y ∈ supp ϕ ϕ ( y ) · ψ i y ,y | ∀ y. ψ i y ,y ∈ g i ( y ) } † = G ϕ ∈ f ( x ) G i ∈ I { X y ∈ supp ϕ ϕ ( y ) · ψ i,y | ∀ y. ψ i,y ∈ g i ( y ) } = G ϕ ∈ f ( x ) G i ∈ I X y ∈ supp ϕ ϕ ( y ) · g i ( y )= G i ∈ I G ϕ ∈ f ( x ) X y ∈ supp ϕ ϕ ( y ) · g i ( y )= G i ∈ I ( g i ◦ f )( x ) . Equation ( ∗ ) holds because of the distributivity of addition over joins (20), while ( † ) holds because the family { g i | i ∈ I } is directed.Given, instead, an arbitrary subset { f i | i ∈ I } of K l( P c S )( X, Y ) and a g : Y → P c S Z , we have (cid:16) g ◦ ( G i ∈ I f i ) (cid:17) ( x ) = g ♯ (cid:16)G i ∈ I f i ( x ) (cid:17) ‡ = G i ∈ I g ♯ ( f i ( x ))= G i ∈ I ( g ◦ f )( x ) where equation ( ‡ ) holds because g ♯ is a morphism of P c S -algebras (as it is givenby the universal property of the free algebra P c S Y ), hence it preserves arbitrarysuprema. Finally, ( ⊥ Y,Z ◦ f )( x ) = G ϕ ∈ f ( x ) X y ∈ supp ϕ ϕ ( y ) · ∅ = G ϕ ∈ f ( x ) X y ∈ supp ϕ ∅ = G ϕ ∈ f ( x ) ∅ = ∅ (notice that ϕ ( y ) · ∅ = ∅ because ϕ ( y ) = 0 when y ∈ supp ϕ ). ⊓⊔ The Term Monad for ( Σ, E ) . The algebraic theory ( Σ, E ) described inTheorem 32 determines a monad on S et T Σ,E where, for any set X , T Σ,E ( X ) is the set of all Σ -terms with variables in X quotiented by the equations in E .Recall that a Σ -term with variables in X is defined inductively as: – every variable x is a Σ -term, – if o is an operation in Σ with arity κ and t , . . . , t κ are Σ -terms, then o ( t , . . . , t κ ) is a Σ -term.If f : X → Y is a function, T Σ,E ( f ) : T Σ,E ( X ) → T Σ,E ( Y ) sends a term t in t [ f ( x ) /x ] , where every variable x is substituted by its image f ( x ) . The unit η T is simply defined as η TX ( x ) = x , while the multiplication is defined by inductionas: T Σ,E (cid:0) T Σ,E ( X ) (cid:1) T Σ,E ( X ) t ∈ T Σ,E to κ ( t , . . . , t κ ) o κ ( µ TX ( t ) , . . . , µ TX ( t κ )) µ TX This construction is standard for finitary algebraic theories, where every opera-tion in Σ has finite arity. The fact that it makes sense also for our case, wherewe have an operation for every cardinal, is ensured by the fact that our ( Σ, E ) is tractable in the sense of [29, Definition 1.5.44], because we proved in Theorem 32that it presents a monad on S et , namely P c S . Tractability ensures that the class of Σ -terms, once quotiented by E , is forced to be a set. Notice, moreover, that ifwe represent a Σ -term, as usual, as a tree whose nodes are operation symbols in Σ , which have each as many branches as their arity, and whose leaves are vari-ables, then we end up with a tree with infinite branches but finite height. Thishelps in giving an intuition of why we can define functions ϕ : T Σ,E ( X ) → Y byinduction on the complexity of terms.Now, the category of Eilenberg-Moore algebras for the monad T Σ,E is, infact, isomorphic to A lg( Σ, E ) , hence also to EM ( P c S ) , via a functor F suchthat EM ( P c S ) EM ( T Σ,E ) S et S et U P c S F U T id S et commutes. This generates an isomorphism of monads ϕ : T Σ,E → P c S where, forall X set, ϕ X = F ( µ P c S X ) ◦ T Σ,E ( η P c S X ) , thanks to the following general result: Theorem 47.
Let ( S, η S , µ S ) and ( T, η T , µ T ) be monads on a category C . Sup-pose EM ( S ) and EM ( T ) are isomorphic via a functor F : EM ( S ) → EM ( T ) suchthat U T F = U S . Then T and S are isomorphic as monads, that is, there is anatural isomorphism ϕ : T → S such that id C T T S S η T η S ϕ µ T ϕ ∗ ϕµ S commutes, where ϕ ∗ ϕ = ϕS ◦ T ϕ = Sϕ ◦ ϕT . Specifically, ϕ X is given asthe unique morphism of T -algebras (hence, a morphism in C ) granted by the ombining Semilattices and Semimodules 41 universal property of ( T X, µ TX ) as the free T -algebra on X , induced by η SX : T T X T SXT X SXX µ TX T ( ϕ X ) F ( µ SX ) ∃ ! ϕ X η TX η SX ϕ X = F ( µ SX ) ◦ T ( η SX ) . Direct calculations show that our ϕ X : T Σ,E ( X ) → P c S ( X ) = P µ S X c S X actsas follows: ϕ X ( x ) = { ∆ x } for x ∈ Xϕ X (0) = { X → S } ϕ X ( t + t ) = ϕ X ( t ) + ϕ X ( t ) ϕ X ( λ · t ) = λ · ϕ X ( t ) ϕ X ( G I { t i | i ∈ I } ) = [ i ∈ I ϕ ( t i ) µ S X where ϕ X ( t )+ ϕ X ( t ) is the result of adding up in the S -algebra ( P µ S X c S X, α µ S X ) (see Theorem 28) seen as a S -semimodule the convex subsets ϕ X ( t ) and ϕ X ( t ) of S X . Similarly λ · ϕ X ( t ) is the scalar-product in P µ S X c S X . Hence: ϕ X ( t + t ) = n µ S X (cid:16) f f (cid:17) | f ∈ ϕ X ( t ) , f ∈ ϕ X ( t ) o λ · ϕ X ( t ) = { λ · f | f ∈ ϕ X ( t ) } . It is clear, then, that if we restrict the action of ϕ X to all those terms involvingonly finite suprema, we obtain exactly the function [[ · ]] X of Proposition 34. Since ϕ X is a bijection, its restriction [[ · ]] X is injective. This proves Proposition 34. The Restriction of P c S to P fc S . The aim of this section is to prove thatif we restrict the image of the functor P c S on a set X to those convex subsets A ⊆ S X that are finitely generated, then all the remaining structure of themonad P c S still works with no adaptation. This means that we have to provethat: – for f : X → Y , P c S ( f ) : P c S ( X ) → P c S ( Y ) restricts and corestricts to P fc S ( X ) → P fc S ( Y ) , – η P c S X can be corestricted to P fc S ( X ) (trivial), – µ P c S X restricts and corestricts to P fc SP fc S X → P fc S X . We do so in the next few results. From now on, if
B ⊆ S X , we shall simplywrite B in lieu of B µ S X . Proposition 48.
Let f : X → Y , A ⊆ S X such that A = B for some finite B ⊆ A . Then {S f ( ϕ ) | ϕ ∈ A} = {S f ( ψ ) | ψ ∈ B} . Proof.
For the left to right inclusion: let ϕ ∈ A = B . Then there exists Ψ ∈ S X such that P χ ∈S X Ψ ( χ ) = 1 , supp Ψ ⊆ B , ϕ = µ S X ( Ψ ) . We have to prove thatthere is a Ψ ′ ∈ S Y such that P χ ∈S Y Ψ ′ ( χ ) = 1 , supp Ψ ′ ⊆ {S f ( ψ ) | ψ ∈ B} , µ S Y ( Ψ ′ ) = ϕ .Now, because of the naturality of µ S , we have S f ( ϕ ) = S f ( µ S X ( Ψ )) = µ S Y ( S f ( Ψ )) . One can easily see that S f ( Ψ ) works for our desired Ψ ′ .Vice versa, let Ψ ′ ∈ S Y be such that P χ ∈S Y Ψ ′ ( χ ) = 1 and supp Ψ ′ ⊆{S f ( ψ ) | ψ ∈ B} . We have to show that there is ϕ ∈ A such that µ S Y ( Ψ ′ ) = S f ( ϕ ) .We have that Ψ ′ is of the form S f ( ψ ) Ψ ′ ( S f ( ψ )) ... ... S f ( ψ n ) Ψ ′ ( S f ( ψ n )) Then that means that Ψ ′ = S ( S f )( Ψ ) where Ψ is defined as Ψ = ψ Ψ ( S f ( ψ )) ... ... ψ n Ψ ( S f ( ψ n )) ∈ S X Then, again by naturality of µ S , we have µ S Y ( Ψ ′ ) = µ S Y ( S f ( Ψ )) = S f ( µ S X ( Ψ )) and ϕ = µ S X ( Ψ ) is indeed in A because A = B . ⊓⊔ This tells us that P fc S is an endofunctor on S et . Next, η P c S X ( x ) = { ∆ x } and { ∆ x } is obviously finitely generated, therefore η P c S corestricts to P fc S . Howabout µ P c S ?Recall that µ P c S X : P c SP c S X → P c S X is defined, for every A convex subsetof S (cid:0) P c ( S X ) (cid:1) , as µ P c S X ( A ) = [ Ω ∈ A { µ S X ( F ) | F ∈ c ( Ω ) } ombining Semilattices and Semimodules 43 where c ( Ω ) = { F ∈ S X | ∀A ∈ supp Ω. ∃ u A ∈ A . ∀ ϕ ∈ S X. F ( ϕ ) = X A∈ supp Φϕ = u A Ω ( A ) } We aim to prove that S Ω ∈ A { µ S X ( F ) | F ∈ c ( Ω ) } is, in fact, finitely generatedin the hypothesis that A ∈ P fc SP fc S X . We will achieve this in three steps. – Step 1 : let B be a finite subset of A such that A = B . Then we provethat [ Ω ∈ A { µ S X ( F ) | F ∈ c ( Ω ) } = [ Θ ∈ B { µ S X ( G ) | G ∈ c ( Θ ) } µ S X showing therefore that we can reduce ourselves to a finite union. – Step 2 : we prove that each { µ S X ( G ) | G ∈ c ( Θ ) } as of Step 1 is convex andfinitely generated. – Step 3 : we prove that the convex closure of a finite union of convex andfinitely generated sets is in turn finitely generated.The next three Lemmas will perform each step. Lemma 49.
Let A ∈ P fc SP fc S X and let B be a finite subset of A such that A = B . Then [ Ω ∈ A { µ S X ( F ) | F ∈ c ( Ω ) } = [ Θ ∈ B { µ S X ( G ) | G ∈ c ( Θ ) } µ S X . Proof.
Let Ω ∈ A = A . We have that Ω = µ SP c S X Θ σ ... ... Θ t σ t where Θ i ∈ B and P tl =1 σ l = 1 . Notice that supp Ω = S tl =1 supp Θ l . Now, if supp Ω = {A , . . . , A n } say, we have that any F ∈ c ( Ω ) is of the form F = ϕ Ω ( A ) = P tl =1 σ l · Θ l ( A ) ... ... ϕ n Ω ( A n ) = P tl =1 σ l · Θ l ( A n ) where each ϕ i ∈ A i ⊆ S X . This leads us to define, for each l ∈ t , a function G l ∈ S X as: G l = ϕ Θ l ( A ) ... ... ϕ n Θ l ( A n ) Notice that, in fact, G l ∈ c ( Θ l ) . Indeed, fixed l , we have that supp Θ l ⊆ supp Ω ,so it can be the case that Θ l ( A i ) = 0 for some i ∈ n , in which case we have G l ( ϕ i ) = 0 . Nonetheless, for each A i in supp Θ l , the function G l chooses one ofits elements and associates to it Θ l ( A i ) .Define then H = µ S X ( G ) σ ... ... µ S X ( G t ) σ t Then clearly P χ ∈S X H ( χ ) = 1 , and supp χ ⊆ t [ l =1 { µ S X ( G ) | G ∈ c ( Θ l ) } ⊆ [ Θ ∈ B { µ S X ( G ) | G ∈ c ( Θ ) } . It is a matter of direct calculation to show that µ S X ( F ) = µ S X ( H ) . This provesthe left-to-right inclusion. The vice versa is immediate to see, recalling that weknow that the left-hand side is convex. ⊓⊔ Applying the following Lemma for the S -algebra ( S X, µ S X ) , we obtain Step 2. Lemma 50.
Let ( X, a ) in EM ( S ) . Then for all Φ ∈ SP acf X we have that { a ( ϕ ) | ϕ ∈ c ( Φ ) } = { a ( ψ ) | ψ ∈ c ( Φ ′ ) } a where, if supp Φ = { A , . . . , A n } say, and for all i A i = B ia with B i ⊆ A i finite,then Φ ′ = ( B Φ ( A ) , . . . , B n Φ ( A n )) . Proof.
Let ϕ ∈ c ( Φ ) . Then we can write ϕ as ϕ = ( u Φ ( A ) , . . . , u n Φ ( A n ) where u i ∈ A i for all i . Notice that it is possible for u i = u j for i = j : in thatcase, the notation above implicitly says that u i Φ ( A i ) = Φ ( A j ) . Now, since A i = B ia , we have that u i = a ( χ i ) for some χ i ∈ S X such that P χ i ( x ) = 1 and supp χ i ⊆ B i . So: ϕ = ( a ( χ ) Φ ( A ) , . . . , a ( χ n ) Φ ( A n ))= S ( a ) (cid:0) χ Φ ( A ) , . . . , χ n Φ ( A n ) (cid:1) ombining Semilattices and Semimodules 45 Call Ψ = (cid:0) χ Φ ( A ) , . . . , χ n Φ ( A n ) (cid:1) . Then we just said that ϕ = S ( a )( Ψ ) .We can write Ψ more explicitly, by listing down the action of each χ i : Ψ = χ = x λ ... x s λ s Φ ( A ) ... ... χ n = x n λ n ... x ns n λ ns n Φ ( A n ) where, for each k = 1 , . . . , n , P s k j =1 λ kj = 1 and for all j = 1 , . . . , s k we have x kj ∈ B k .Now, define for all w ∈ Q nk =1 s k , a n -tuple whose j -th entry is a numberbetween and s j , the function ψ w = (cid:0) x w Φ ( A ) , . . . , x nw n Φ ( A n ) (cid:1) , i.e. ψ w ( x ) = X i ∈ nx = x iwi Φ ( A i ) . Define also Ψ ′ = ( ψ w n Y k =1 λ kw k ) w ∈ Q s k i.e. Ψ ′ ( ψ ) = X w ∈ Q s k ψ = ψ w n Y k =1 λ kw k . Notice that, by Lemma 37, we have that X w ∈ Q s k n Y k =1 λ kw k = n Y k =1 s k X j =1 λ kj = n Y k =1 . This immediately implies that P ψ ∈S X Ψ ′ ( ψ ) = 1 . Next, we show that µ S X ( Ψ ′ ) = µ S X ( Ψ ) . µ S X ( Ψ ′ )( x ) = X ψ ∈S X Ψ ′ ( ψ ) · ψ ( x )= X w h n Y k =1 λ kw k · X i ∈ nx = x iwi Φ ( A i ) i = X w X i ∈ nx = x iwi h ( n Y k =1 λ kw k ) · Φ ( A i ) i = X i ∈ n X wx = x iwi h Φ ( A i ) · λ iw i |{z} = χ i ( x iwi )= χ i ( x ) · Y k ∈ nk = i λ kw k i = n X i =1 Φ ( A i ) · χ i ( x ) · X wx = x iwi Y k = i λ kw k | {z } = Q k = i P skj =1 λ kj =1 = µ S X ( Ψ )( x ) . Hence: a ( ϕ ) = a (cid:0) S ( a )( Ψ ) (cid:1) = a ( µ S X ( Ψ )) = a ( µ S X ( Ψ ′ )) = a ( S ( a )( Ψ ′ )) where a ( S ( a )( Ψ ′ )) indeed belongs to { a ( ψ ) | ψ ∈ c ( Φ ′ ) } a because supp ( S ( a )( Ψ ′ )) = { a ( ψ w ) | w ∈ Y k =1 n s k } ⊆ { a ( ψ ) | ψ ∈ c ( Φ ′ ) } and the sum of all its images is P w Q nk =1 λ kw k = 1 . ⊓⊔ Notice that if Φ ′ ∈ SP X is such that supp Φ ′ ⊆ P f ( X ) , then c ( Φ ′ ) is finite.Finally, the next Lemma, when A and B are finite, proves Step 3. Lemma 51.
Let ( X, a ) be in EM ( S ) , A, B ⊆ X . Then A ∪ B = A ∪ B .Proof. We have: A ∪ B = { a ( ϕ ) | ϕ ∈ S X, X x ϕ ( x ) = 1 , supp ϕ ⊆ A ∪ B } A ∪ B = { a ( ψ ) | ψ ∈ S X, X x ψ ( x ) = 1 , supp ψ ⊆ A or supp ψ ⊆ B } A ∪ B = { a ( χ ) | χ ∈ S X, X x χ ( x ) = 1 , supp χ ⊆ A ∪ B } . Let then x ∈ A ∪ B . Then x = a ( ϕ ) = a a ( ψ ) ϕ ( a ( ψ )) ... a ( ψ n ) ϕ ( a ( ψ n )) = a ( S ( a )( Φ )) = a ( µ S X ( Φ )) where Φ = ( ψ ϕ ( a ( ψ )) , . . . , ψ n ϕ ( a ( psi n )) . Calling χ = µ S X ( Φ ) , one caneasily check that P x χ ( x ) = 1 and that supp χ ⊆ A ∪ B , hence A ∪ B ⊆ A ∪ B .The other inlusion is obvious, given that A ∪ B ⊆ A ∪ B . ⊓⊔ ombining Semilattices and Semimodules 47 Proof of Theorem 35.
We first observe that the function [[ · ]] X : T Σ ′ ,E ′ ( X ) → P c S ( X ) factors as T Σ ′ ,E ′ ( X ) P fc S ( X ) P c S ( X ) [[ · ]] ′ X ι X where ι X : P fc S ( X ) → P c S ( X ) is the obvious set-inclusion. This can be easilychecked by induction on T Σ ′ ,E ′ ( X ) .Observe that, since [[ · ]] X is injective by Proposition 34, then also [[ · ]] ′ X isinjective. We conclude by showing that it is also surjective.Let A ∈ P fc S ( X ) . Since A is finitely generated there exists a finite set B ⊆ S ( X ) such that B = A . If A = ∅ , then [[ ⊥ ]] ′ X = A . If B = { ϕ , . . . , ϕ n } with ϕ i ∈ S ( X ) then, for all i , we take the term t i = ϕ i ( x ) · x + · · · + ϕ i ( x m ) · x m where { x , . . . , x m } is the support of ϕ i . It is easy to check that [[ t i ]] ′ X = { ϕ i } .Then by the inductive definition of [[ · ]] ′ X , one can easily verify that [[ t ⊔ · · · ⊔ t n ]] ′ X = { ϕ , . . . ϕ n } = A . ⊓⊔ Open Access
This chapter is licensed under the terms of the Creative CommonsAttribution 4.0 International License ( http://creativecommons.org/licenses/by/4.0/http://creativecommons.org/licenses/by/4.0/