The Expectation Monad in Quantum Foundations
The expectation monad is introduced abstractly via two composable adjunctions, but concretely captures measures. It turns out to sit in between known monads: on the one hand the distribution and ultrafilter monad, and on the other hand the continuati…
Authors: Bart Jacobs (Radboud University Nijmegen), Jorik M, emaker (Radboud University Nijmegen)
Bart Jacobs, Peter Selinger , and Bas Spitters (Eds.): 8th International W o rkshop on Quantum Physics and Logic (QPL 2011) EPTCS 95, 2012, pp. 143–182, doi:10.4204/EPTCS.95.12 The Expectat ion Monad in Quantum F oundatio ns Bart Jacobs and Jorik Mandemaker Institute for Computing and Information Sciences (iCIS), Radboud Univ ersity Nijmegen, The Netherlands. { B.Jacobs ,J.Mandemaker } @cs.ru.nl The e xpectatio n monad is introduced abstractly via two composable adjunction s, but concretely cap- tures measures. It turns out to sit in be tween known monads: on the o ne hand the distribution and ultrafilter mo nad, and o n th e other hand the continuation monad. This expectatio n monad is used in two probabilistic analogues of fundamental results of Manes and Gelfand fo r the ultrafilter monad: algebras of th e e xpe ctation monad ar e con vex compact Hausdorff spaces, and are du ally equiv alent to so-called Banach effect algebras. The se structures capture states an d ef fects in quantum f ounda - tions, and also the duality between them. Moreover , the appr oach leads to a ne w re-for mulation of Gleason’ s theorem, expressing that ef fects on a Hilbert space are free ef fect modules on pro jections, obtained via tensoring with the unit interval. 1 Introd uction T echniq ues that hav e been dev eloped over the last decade s for the semantics of programming language s and progr amming logics gain wider significa nce. In this way a new interdiscip linary area has emerg ed where researchers from mathematic s, (theore tical) ph ysics and (theo retical) computer science collabo- rate, n otably on quantum computation and quantum fou ndations. The article [6] uses t he ph rase “Rosett a Stone” for the langua ge and concepts of categor y theory that form an integral part of this common area. The pres ent a rticle is also pa rt of this ne w field. It uses results from p rogramming semantics, topolo gy and (con vex ) analysis , cat egory theory (esp. monads), logic and probabilit y , and quantum found ations. The origin of this article is an illust ration of the connectio ns in v olved . Pre viously , the authors hav e work ed on effec t algeb ras and ef fect modules [21, 19, 20] from quantu m logic, which are fairly general structu res incorporatin g both logic (Boolean and orth omodular lattices) and p robabili ty (the unit in terv al [ 0 , 1 ] and fuzzy predi cates). By reading completel y differe nt work, on formal method s in compute r securi ty (in particula r the thesis [34]), the expe ctation monad was noticed. The monad is used in [34, 9] to giv e semantics to a proba bilistic pr ogramming l anguage th at helps t o formalize (complex ity) red uction ar guments from securit y proofs in a theorem prove r . In [34] (see also [5, 33]) the expec tation monad is defined in a some what ad hoc manner (see Section 10 fo r details ). Soon it was reali zed that a m ore systemat ic definition of this e xpect ation monad coul d be giv en via the ( dual) adjunct ion between con vex sets and effect modules (elabor ated in Subsectio n 2.4). Subsequ ently the two main parts of the presen t paper emer ged. 1. The expec tation monad turns out to be related to se veral kno wn monads as described in the fol- lo wing diagram. distrib ution D , , , , ❨ ❨ ❨ ❨ ❨ exp ectation E / / / / contin uation C ultrafilte r U F 2 2 2 2 ❡ ❡ ❡ ❡ ❡ (1) 144 The Expectat ion Monad The con tinuation m onad C also co mes from programming semantics . But here we are more in ter- ested in t he connec tion with the dis trib ution and ultra filter monads D and U F . Since the alg ebras of the distrib ution monad are co n vex sets and the algebr as of the ul trafilter mona d are compact Hausdorf f spaces (a result kn own as Manes theorem) it follo ws that t he algeb ras of the exp ectation monad m ust be some subcateg ory of con ve x compact Hausdorf f spaces. One of the main results in this paper , Theorem 5, makes this conne ction preci se. It can be seen as a probab ilistic v ersion of Manes theo rem. It uses basic notions from Choquet theory , notably barycente rs of measures . 2. The adjunctio n that giv es rise to the expe ctation monad E yields a (dual) adjun ction between the catego ry Alg ( E ) of algeb ras a nd the cate gory of ef fect modules. By suitab le res triction this adjunc tion gi ves rise to an eq uiv alence betwee n “observ able” E -algeb ras and “Banach” (complete) ef fect modules, see Theorem 6. These two part s of the paper may be summarized as follo ws. There are classic al results: Alg ( U F ) [Manes] ≃ compact Hausdorf f spaces [Gelf and] ≃ commutati ve C ∗ -algeb ras op Here we gi ve the follo w ing “probabil istic” analog ues: Alg obs ( E ) ≃ con ve x compact Hausdorf f spaces obs ≃ Banach ef fect modules op The subscript ‘obs’ refers to a suitable o bserv ability con dition, see Section 7. The role played by the t wo- element set { 0 , 1 } in these classical results— e .g. as “schizophr enic” objec t—is played in our probabilis tic analog ues by the unit interv al [ 0 , 1 ] . Quantum mechani cs is notorio usly non-intuiti ve. Hence a proper mathematica l understan ding of the rele v ant phenomena is important, certainly within the emer ging fi eld of quantum computation . It seems fair to say that such an all-encompass ing und erstandin g of quantum m echani cs does not exist yet. For instan ce, the cate gorical analysis in [1, 2] describes some of the basic underlyin g structure in terms of monoida l cate gories, dag gers, and compact closure. Howe ver , an inte grated vie w of lo gic a nd pr obability is still m issing. Here w e certainly do not prov ide this integ rated vie w , b ut poss ibly we do cont ribu te a bit. The state s of a Hilb ert spac e H , descr ibed as density matrice s DM ( H ) , fi t within the cate gory of con vex compact Hausdorf f spaces in ve stigated here. Also, the ef fects Ef ( H ) of the space fit in the associ ated dual categor y of Banach Hausdorf f space s. T he duality we obtain between con vex compact Hausdorf f spaces and Banach effe ct algebra s precisely captures the translati ons back and forth between states and ef fects, as express ed by the isomorphis ms: Hom Ef ( H ) , [ 0 , 1 ]) ∼ = DM ( H ) Hom DM ( H ) , [ 0 , 1 ]) ∼ = Ef ( H ) . These isomorphisms (imp licitly) for m th e bas is fo r the quan tum weak est prec ondition calc ulus des cribed in [13]. In this context we shed a bit more light on the relation between quantum logic—as expresse d by the projec tions Pr ( H ) on a Hilbert space—and quantum probabi lity—via its ef fects Ef ( H ) . In S ection 9 it will be shown th at Gleason’ s famous theore m, expressin g that sta tes are proba bility measure s, can equi valent ly be exp ressed as an isomorph ism relating projection s and ef fects: [ 0 , 1 ] ⊗ Pr ( H ) ∼ = Ef ( H ) . This means that the effects form the free ef fect m odule on projections, via the free functor [ 0 , 1 ] ⊗ ( − ) . More loosely formulat ed: qu antum probabil ities are freely obtain ed from quantum predicate s. B. Jacob s & J. Mandemak er 145 W e bri efly descri be the or ganization of the pap er . It s tarts with a quic k recap on monads in Section 2, includ ing descripti ons of the monads relev ant in the rest of the pap er . Section 3 gi ves a brief introductio n to ef fect algebras and eff ect modules. It also establis hes equi v alences between (Banach ) orde r unit spaces and (Banach) Archimedean ef fect modul es. In Section 4 we giv e se ver al descripti ons of the exp ectation monad in terms of effec t algebras and ef fect modules. W e also describe the m ap between the expe ctation monad and the continuat ion m onad here. S ection s 5 and 6 deal with the construc tion of the other two monad maps from Diagram (1): those from the ultrafilter and distrib ution monads to the exp ectation monad. Here we also ex plore some of the implications of these maps. Next, in Section 7, we study the algebras of the expecta tion monad. W e prov e that the categor y of E -algebras is equi v alent to the categ ory compact con vex sets with continuous affine mappings . In Section 8 we establish a dual adjunc tion be tween E -algebras and ef fect modules. W e prov e that w hen restr icted to so-called observ able E -algebras and Banach ef fect modules this adjunction becomes an equi va lence. In S ection 9 we apply this duality to quantu m logic. W e pro ve that the isomorph ism [ 0 , 1 ] ⊗ Pr ( H ) ∼ = Ef ( H ) is an algebraic reformul ation of Gleason’ s theorem. Finally in Section 10 we examine how the exp ectation monad has appear ed in earlier work on programming semantics. W e also suggest how it m ight be used to capture both non-d eterministi c and proba bilistic computatio n simultaneo usly , althoug h the details of th is are left for future work. 2 A r ecap on monads This section recalls the basics of the theory of monads, as neede d here. For more information, see e.g . [29, 8, 28, 10]. Some spe cific example s w ill be elabor ated later on. A monad is a functor T : C → C togethe r w ith two natural transformatio ns: a unit η : id C ⇒ T and multiplic ation µ : T 2 ⇒ T . T hese are requ ired to make the follo w ing diagrams commute, for X ∈ C . T ( X ) η T ( X ) / / ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ T 2 ( X ) µ X T ( X ) T ( η X ) o o ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ T 3 ( X ) µ T ( X ) / / T ( µ X ) T 2 ( X ) µ X T ( X ) T 2 µ X / / T ( X ) Each adjunct ion F ⊣ G giv es rise to a monad GF . Giv en a monad T one can form a categ ory Alg ( T ) of so-called (Eilenber g-Moore) algebras . Obje cts of this categ ory are maps of the form a : T ( X ) → X , making the first two squares belo w commute. X ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ η / / T X a T 2 X µ T ( a ) / / T X a T X a T ( f ) / / T Y b X T X a / / X X f / / Y A homomorphism of algebras ( X , a ) → ( Y , b ) is a map f : X → Y in C between the underlyi ng objects making the diagr am abov e on the right commute. The diagram in the middle thus says that the map a is a homomorphism µ → a . The for getful functor U : Alg ( T ) → C has a left adjoint, mapping an object X ∈ X to the (free) algebra µ X : T 2 ( X ) → T ( X ) w ith carrie r T ( X ) . Each categ ory Alg ( T ) inherit s limits from the category C . In the special case w here C = Sets , the cate gory of sets and functions (our sta ndard univ erse), the cate gory Alg ( T ) is not only comple te bu t also cocompl ete (see [8, § 9.3, Prop. 4]). 146 The Expectat ion Monad A map of monads σ : T ⇒ S is a natural transforma tion that commutes with the units and multipli- cation s, as in: X η X X η X T 2 ( X ) µ X σ T X / / S ( T ( X )) S ( σ X ) / / S 2 ( X ) µ X T ( X ) σ X / / S ( X ) T ( X ) σ X / / S ( X ) (2) Such a map of monads σ : T ⇒ S indu ces a functor ( − ) ◦ σ : Alg ( S ) → Alg ( T ) between catego ries of algebr as that commutes with the forget ful functors. Lemma 1. Assume a map o f m onads σ : T ⇒ S. 1. Ther e is a functor ( − ) ◦ σ : Alg ( S ) → Alg ( T ) that commutes with the for getful functor s. 2. If the cate gory Alg ( S ) has suffi ciently many coequa lizers—l ike when the underlying ca te gory is Sets —this functor has a left adjoint Alg ( T ) → Alg ( S ) ; it maps an alg ebra a : T ( X ) → X to the followin g coequaliz er a σ in Alg ( S ) . S 2 ( T X ) S ( T X ) µ ! µ ◦ S ( σ ) / / S ( a ) / / S 2 ( X ) S ( X ) µ ! c / / / / S ( X σ ) X σ a σ ! Pro of W e need to establi sh a bijecti ve correspo ndence between algebra maps: S ( X σ ) X σ a σ ! f / / S ( Y ) Y b ! = = = = = = = = = = = = = = = = = = = = = = = T ( X ) X a ! g / / T ( Y ) Y b ◦ σ ! This works as follo w s. Giv en f , one takes f = f ◦ c ◦ η : X → Y . And giv en g one obtains g : X σ → Y becaus e b ◦ T ( g ) : S ( X ) → Y coequ alizes the abo ve parallel pair µ ◦ S ( σ ) and S ( a ) . Remaining details are left to the interes ted reader . 2.1 The Distribu tion mo nad W e shall write D for the discrete prob ability distrib ution monad on Sets . It maps a set X to the set of formal con ve x combinati ons r 1 x 1 + · · · + r n x n , where x i ∈ X and r i ∈ [ 0 , 1 ] with ∑ i r 1 = 1. Alternati vely , D ( X ) = { ϕ : X → [ 0 , 1 ] | supp ( ϕ ) is fi nite, and ∑ x ϕ ( x ) = 1 } , where supp ( ϕ ) ⊆ X is the support of ϕ , conta ining al l x with ϕ ( x ) 6 = 0. The functor D : Sets → Sets forms a monad with the Dirac functio n as unit in: X η / / D X D D X µ / / D X x ✤ / / 1 x = λ y . ( 1 if y = x 0 if y 6 = x Ψ ✤ / / λ y . ∑ ϕ ∈ D X Ψ ( ϕ ) · ϕ ( y ) . B. Jacob s & J. Mandemak er 147 [Here we use the “lambda” notation from the lambda calculus [7]: the expre ssion λ x . · · · is used for the functi on x 7→ · · · . W e also use the asso ciated applicatio n rule ( λ x . f ( x ))( y ) = f ( y ) .] Objects of the ca tegory Alg ( D ) of (Eilenb erg -Moore) algebras of this mon ad D can be identified as con ve x sets , in which sums ∑ i r i x i of con ve x combination s exists. Morph isms are so-called af fine functi ons, preserv ing such con vex sums, see [19]. Hence we also write Alg ( D ) = Conv , where Con v is the cate gory of con ve x sets and affine f unctions . The prime ex ample of a con vex set is the u nit interv al [ 0 , 1 ] ⊆ R of probab ilities. Also, for an arbitrary set X , the set of functio ns [ 0 , 1 ] X , or fuzzy predica tes on X , is a con ve x set, via pointwise con ve x sums. 2.2 The ultrafilter monad A particul ar monad that plays an important role in this paper is the ultrafilter m onad U F : Sets → Sets , gi ven by: U F ( X ) = { F ⊆ P ( X ) | F is an ultrafilter } ∼ = { f : P ( X ) → { 0 , 1 } | f is a homomorphi sm of Boolean algeb ras } (3) Such an ultrafilte r F ⊆ P ( X ) satisfies, by definition, the follo w ing three propertie s. • It is an upse t: V ⊇ U ∈ F ⇒ V ∈ F ; • It is clos ed under finite interse ctions: X ∈ F and U , V ∈ F ⇒ U ∩ V ∈ F ; • For each se t U either U ∈ F or ¬ U = { x ∈ X | x 6∈ U } ∈ F , but not both. As a consequenc e, / 0 6∈ F . For a fun ction f : X → Y one obtai ns U F ( f ) : U F ( X ) → U F ( Y ) by: U F ( f )( F ) = { V ⊆ Y | f − 1 ( V ) ∈ F } . T aking ultrafilters is a monad, with unit η : X → U F ( X ) gi ven by so- called princip al ultrafilters: η ( x ) = { U ⊆ X | x ∈ U } . The multipli cation µ : U F 2 ( X ) → U F ( X ) i s: µ ( A ) = { U ⊆ X | D ( U ) ∈ A } where D ( U ) = { F ∈ U F ( X ) | U ∈ F } . The set U F ( X ) of ultrafilter s on a set X is a topologica l space with basic (compact) clopens gi ven by subsets D ( U ) = { F ∈ U F ( X ) | U ∈ F } , for U ⊆ X . T his mak es U F ( X ) int o a compact H ausdor ff space. The unit η : X → U F ( X ) is a dense embeddi ng. The follo wing result sho ws the importance of the ultrafilter monad, see e.g . [27], [22, III.2], or [10, V ol. 2, Prop. 4.6.6]. Theor em 1 (Manes) . Alg ( U F ) ≃ CH , i.e. the cate gory of a lgebr as of the ultrafilt er monad is equival ent to the cate gory CH of compact Hausdorf f spaces and contin uous maps. 148 The Expectat ion Monad The proof is complicated and w ill not be reprod uced here. W e only extract the basic construc tions. For a compact Hausdorf f space Y one uses denseness of the unit η to define a unique continuous exten- sions f # as in: X / / η / / f ) ) ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ U F ( X ) f # ✤ ✤ Y (4) One defines f # ( F ) to be the unique element in T { V | V ⊆ Y with f − 1 ( V ) ∈ F } . This inter section is a singleton pre cisely because Y is a compact Haus dorf f space . In such a way one o btains an algebra U F ( Y ) → Y as exten sion of the identity . Con versel y , assuming an algebra ch X : U F ( X ) → X one defines U ⊆ X to be closed if for all F ∈ U F ( X ) , U ∈ F implies ch ( F ) ∈ U . T his yields a topol ogy on X which is Hausdorf f and comp act. There can be at most one such algebra structu re ch X : U F ( X ) → X on a set X , correspo nding to a compact Hausdorf f topology , because of the follo wing standard result. Lemma 2. Assume a set X carries two topolo gies O 1 ( X ) , O 2 ( X ) ⊆ P ( X ) with O 1 ( X ) ⊆ O 2 ( X ) , O 1 ( X ) is Hausdorf f and O 2 ( X ) is compact, then O 1 ( X ) = O 2 ( X ) . Pro of If U is c losed in O 2 ( X ) , th en it is comp act, and, because O 1 ( X ) ⊆ O 2 ( X ) , a lso c ompact in O 1 ( X ) . Hence it is closed there. W e can apply this r esult to the spac e U F ( X ) of ultrafilters : a s described before Theor em 1, U F ( X ) carries a compact H ausdor ff topology with sets D ( U ) = { F ∈ U F ( X ) | U ∈ F } as clopens . Also, it carries a compact H ausdor ff topolog y via the (free) algeb ra µ X : U F 2 ( X ) → U F ( X ) . It is not hard to see that the subs ets D ( U ) are cl osed in the latte r topology , so the two top ologies on U F ( X ) coincide by Lemma 2. Later w e sha ll use a similar arg ument. Example 1. The unit interv al [ 0 , 1 ] ⊆ R is a stan dard example of a compact Hausdo rff space. Its Eilenber g-Moore algebra ch : U F ([ 0 , 1 ]) → [ 0 , 1 ] can be described con cretely on F ∈ U F ([ 0 , 1 ]) as: ch ( F ) = inf { s ∈ [ 0 , 1 ] | [ 0 , s ] ∈ F } . (5) For the proof, recall that ch ( F ) is the (sole) element of the intersection T { V | V ∈ F } . Hence if [ 0 , s ] ∈ F , then ch ( F ) ∈ [ 0 , s ] = [ 0 , s ] , so ch ( F ) ≤ s . This esta blishes the ( ≤ ) -part of (5 ). Assume nex t that ch ( F ) < inf { s | [ 0 , s ] ∈ F } . Then there is s ome r ∈ [ 0 , 1 ] with ch ( F ) < r < inf { s | [ 0 , s ] ∈ F } . T hen [ 0 , r ] is not in F , so tha t ¬ [ 0 , r ] = ( r , 1 ] ∈ F . But this means ch ( F ) ∈ ( r , 1 ) = [ r , 1 ] , which is impossibl e. Notice that (5) can be strength ened to: ch ( F ) = inf { s ∈ [ 0 , 1 ] ∩ Q | [ 0 , s ] ∈ F } . The secon d important result about compact Hausdorf f spaces is as follo ws. Theor em 2 (Gelfa nd) . CH ≃ C ∗ - Alg op , i.e. the cate gory C H of compact Hausdorf f spaces is equi valent to the opposite of the cate gory of commutativ e C ∗ -alg ebras . This paper presents probabilis tic analogue s of these two basic results (T heorems 1 and 2), in vo lving con ve x compact H ausdor ff spaces (see Theorem 6). 2.3 The continuation monad The so-called continuat ion monad is useful in the context of programming semantic s, where it is em- plo yed for a particu lar style of ev aluation. The monad starts from a fi xed set C and takes the “double dual” of a set, where C is used as dualizin g object. Hence we first form a funct or C : Sets → Sets by: C ( X ) = C ( C X ) and C X f → Y = λ h ∈ C ( C X ) . λ g ∈ C Y . h ( g ◦ f ) . B. Jacob s & J. Mandemak er 149 This functor C forms a monad via: X η / / C ( C X ) C C C ( C X ) µ / / C ( C X ) x ✤ / / λ g ∈ C X . g ( x ) H ✤ / / λ g ∈ C X . H λ k ∈ C ( C X ) . k ( g ) . The follo w ing folklore result w ill be use ful in the present conte xt. Lemma 3. Let T : Sets → Sets be an arb itrary monad and C ( X ) = C ( C X ) be th e continua tion m onad on a set C . Then ther e is a bijective corr espon dence between: T ( C ) a / / C Eilenber g-Moor e alg ebras = = = = = = = = = = = T σ + 3 C maps of monads. Pro of First, giv en an algebra a : T ( C ) → C define σ X : T ( X ) → C ( C X ) by: σ X ( u )( g ) = a T ( g )( u ) . Con versel y , giv en a map of monads σ : T ⇒ C ( C ( − ) ) , define as algebra a : T ( C ) → C , a ( u ) = σ C ( u )( id C ) . T aking C = 2 = { 0 , 1 } to be the two-elemen t set, yields as associa ted continu ation monad C ( X ) = 2 ( 2 X ) ∼ = P ( P ( X )) , the double-po werset monad. For a funct ion f : X → Y we ha ve a map P 2 ( X ) → P 2 ( Y ) , by functorial ity , gi ven by double in verse image: U ⊆ P ( X ) 7− → ( f − 1 ) − 1 ( U ) = { V ⊆ Y | f − 1 ( V ) ∈ U } . It is not hard to see that the inclus ion maps: U F ( X ) ( 3 ) ∼ = / / B A ( 2 X , 2 ) / / 2 ( 2 X ) form a map of monads, from the ultrafilter monad to the continu ation monad (with constant C = 2). 2.4 Monads from composable adjun ctions It is well-kno w n, see e.g . [29, Ch. VI] that each adjunc tion F ⊣ G gi ves rise to a monad GF . The expec- tation monad arises from a slightly more complicated situatio n, in vol ving two composable adjunc tions. This situatio n is captured abstractly in the follo wing result. Lemma 4. Consi der two composab le adjunction s F ⊣ G and H ⊣ K in a situat ion: A F ( ( T = GF S = GK H F E E ⊥ B G h h H ( ( ⊥ C K h h with monads T = G F induced by the adjun ction F ⊣ G and S = GK H F induced by the (compos ite) adjun ction H F ⊣ GK . 150 The Expectat ion Monad Then ther e is a map of monads T ⇒ S given by the unit η of the adjun ction H ⊣ K in: T = GF G η H ⊣ K F / / GK H F = S . (6) It gives rise a fu nctor Alg ( S ) → Alg ( T ) b etween the associ ated cate gories of E ilenbe r g-Moor e algeb ras, and thus to a commuting diag ram: C K / / Alg ( S ) ( − ) ◦ G η F B G ! ! ❈ ❈ ❈ ❈ ❈ ❈ ❈ / / Alg ( T ) U z z t t t t t t t t A (7) wher e the horizont al arr ows ar e the so-called comparison functor s. Pro of Easy . W e unra vel the relev ant ingredients for futur e use. The unit and counit of the composite adjunc tion H F ⊣ GK are: η H F ⊣ G K = G η H ⊣ K F ◦ η F ⊣ G : id = ⇒ GK H F = S ε H F ⊣ G K = ε H ⊣ K ◦ H ε F ⊣ G K : H F GK = ⇒ id . This means that the monads T and S hav e multiplication s: µ T = G ε F ⊣ G F : T 2 = F GF G = ⇒ F G = T µ S = GK ε H ⊣ K H F ◦ GK H ε F ⊣ G K H F : S 2 = G K H F GK H F = ⇒ GK H F = S . The comparis on functor K T : B → Alg ( T ) is: K T ( X ) = T GX = G F GX G ( ε F ⊣ G X ) − − − − → GX . Similarly , K S : A → Alg ( S ) is: K S ( Y ) = SGKY = GK H F GKY GK ( ε H ⊣ K Y ) ◦ GK H ( ε F ⊣ G KY ) − − − − − − − − − − − − − → G KY . Remark 1. Later on in Section 8 we will const ruct a left adjoint to the compariso n functor C → Alg ( S ) in (7). It is already almost there, in this abstract situation, using the composite adjunc tion H F ⊣ K G . Ho wev er , suitable restric tions ha ve to used, which can not be expr essed at this abs tract lev el. In the more concre te setting describe d below , the adjunctio n H ⊣ K is of a speci al kind, in volv ing a dualizing object. The composa ble adjunctio ns that form the basis of the expect ation monad are: Sets D + + ⊥ Alg ( D ) U k k Con v ( − , [ 0 , 1 ]) , , ⊥ EMod op EMod ( − , [ 0 , 1 ]) k k Con v (8) The adjunction on the left is the stan dard adjunctio n between a cate gory of alge bras Alg ( D ) of the distrib ution monad (see Subsectio n 2.1) and its underly ing categ ory . The adjunctio n on the right w ill be descri bed in the next section. B. Jacob s & J. Mandemak er 151 3 Effect modules This section introdu ces the essenti als o f ef fect module s and refers to [19, 21] for further details . Intu - iti vely , ef fect modu les ar e vector spaces, no t with the real or c omplex numbers as scalars, b ut with scalars from the un it interv al [ 0 , 1 ] ⊆ R . Also, the addi tion operation + on v ectors is only par tial; it is written as > . These effect modul es occur in [32] under the name ‘con ve x ef fect algebras’. More precisel y , an effec t module is an ef fect alge bra E w ith an action [ 0 , 1 ] ⊗ E → E for scala r multiplic ation. An effect alge bra E carries both: • a pa rtial commutati ve monoid stru cture ( 0 , > ) ; this means that > is a p artial operation E × E → E which is both commutati ve and associa tiv e, taking suitably account of partiality , w ith 0 as neutral element; • an orthosup plement ( − ) ⊥ : E → E . One writes x ⊥ y if the sum x > y is defined; x ⊥ is then the uniqu e element with x > x ⊥ = 1, w here 1 = 0 ⊥ ; furthe r x ⊥ 1 holds only for x = 0. These effec t algebras carry a partial order gi ven by x ≤ y iff x > z = y , for some element z . T hen x ⊥ y if f x ≤ y ⊥ if f y ≤ x ⊥ . T he unit interv al [ 0 , 1 ] is the prime example of an eff ect algebra w ith partial sum r > s = r + s if r + s ≤ 1; then r ⊥ = 1 − r . A homomorp hism f : E → D of effe ct algebras satisfies f ( 1 ) = 1 and: if x ⊥ x ′ in E , then f ( x ) ⊥ f ( x ′ ) in D and f ( x > x ′ ) = f ( x ) > f ( x ′ ) . It is easy to deduce that f ( x ⊥ ) = f ( x ) ⊥ and f ( 0 ) = 0. This yields a cate gory , written as EA . It carries a symmetric monoidal struct ure ⊗ w ith the 2-element effec t algebra { 0 , 1 } as tensor unit (which is at the same time the initia l obje ct). T he usual multiplica tion of real numbers (p robabilit ies in this case) yield s a m onoid st ructure on [ 0 , 1 ] in the category E A . A n effe ct module is then an effec t algebra with an [ 0 , 1 ] -action [ 0 , 1 ] ⊗ E → E . Explicitl y , it can be described as a scalar multiplic ation ( r , x ) 7→ rx satisfyi ng: 1 x = x ( r + s ) x = r x + sx if r + s ≤ 1 ( rs ) x = r ( sx ) r ( x > y ) = r x > r y if x ⊥ y . In particul ar , if r + s ≤ 1, then a sum r x > sy alway s exists (see [32]). Example 2. The unit interv al [ 0 , 1 ] is again th e p rime e xample, t his t ime for ef fect mo dules. But al so, for an arbitrary set X , the set [ 0 , 1 ] X of all functions X → [ 0 , 1 ] is an effec t m odule, with structure inherited pointwis e from [ 0 , 1 ] . Another example , occurrin g in integ ration theory , is the set [ X → s [ 0 , 1 ]] of simple functi ons X → [ 0 , 1 ] , havi ng only finitely many out put v alues (also kno wn as ‘step functio ns’). A morphism E → D in the catego ry EMod of such effect modules is a function f : E → D between the underl ying sets satisfying: f ( rx ) = r f ( x ) f ( 1 ) = 1 f ( x > y ) = f ( x ) > f ( y ) if x ⊥ y . W e now come to the dual adjunction mentione d in the pre vious section (see [21] for more informa- tion). Pro position 5. F or eac h effe ct m odule E the homset EMod ( E , [ 0 , 1 ]) is a con vex set. In the other dir ec- tion, each con vex set X gives rise to an effe ct module Con v ( X , [ 0 , 1 ]) . This gives the adjunctio n on the right in (8) , with [ 0 , 1 ] as dual izing object 152 The Expectat ion Monad The effe ct algebra structure on the set Con v ( X , [ 0 , 1 ]) of affine maps to [ 0 , 1 ] is obtaine d point wise: f > g is defined if f ( x ) + g ( x ) ≤ 1 for all x ∈ X , and in that case f > g at x ∈ X is f ( x ) + g ( x ) . The orthosu p- plement is also obtained pointwis e: ( f ⊥ )( x ) = 1 − f ( x ) . S calar multiplic ation is done similarly ( r f )( x ) = r ( f ( x )) . In the re verse direction, each eff ect module E gi ves rise to a con ve x set EMod ( E , [ 0 , 1 ]) of ho- momorphis ms, with pointwise con ve x sums. The adjunctio n Conv ( − , [ 0 , 1 ]) ⊣ EMod ( − , [ 0 , 1 ]) arises in the standa rd way , with unit and counit gi ven by e val uation. 3.1 T otalization In this sectio n we prov e that the categ ory of ef fect modules is equi valent to the categ ory o f certain ordered vec tor spaces. For this w e extend a result for effec t algebras from [21]. W e recall the basics belo w but for details and proofs we refer to that paper . The idea is that the parti al opera tion > of ef fect algebras and effect modules is rather dif ficult to work with; therefore we dev elop an embedding into structures with total operati ons. The first result we need is the follo wing one from [21]. Pro position 6. Ther e is a cor eflection EA T o ⊥ , , BCM P a k k (9) wher e B CM is the cate gory of “ barr ed commutative monoids”: its objects are pai rs ( M , u ) , wher e M is a commutative m onoid and u ∈ M is a unit such that x + y = 0 implies x = y = 0 and x + y = x + z = u implies y = z. The morphisms in BC M ar e monoid homomorphis ms that pre serve the unit. As this is a cor eflection every ef fect algeb ra E is isomorphic to P a T o ( E ) . The partia lization functor P a in (9) is defined by: P a ( M , u ) = { x ∈ M | x u } , where x y iff there e xists a z such tha t x + z = y . The operat ion > is defined by x > y = x + y but this is only defined if x + y u , i.e. x + y ∈ P a ( M , u ) . The totaliz ation functor T o in (9) is define d as: T o ( E ) = ( M ( E ) / ∼ , 1 · 1 E ) , where M ( E ) is the free co mmutati ve mon oid on E , consistin g of all fi nite formal sums n 1 · x 1 + · · · + n m · x m , with n i ∈ N and x i ∈ E . Here we identify sums such as 1 · x + 2 · x with 3 · x . And ∼ is the smallest monoid congrue nce such that 1 · x + 1 · y ∼ 1 · ( x > y ) whenev er x > y is defined. Example 3. T otalizatio n of the truth value s { 0 , 1 } ∈ EA and of the probabilit ies [ 0 , 1 ] ∈ E A yields the natura l numbers and the non-neg ati ve reals: T o ( { 0 , 1 } ) ∼ = N and T o ([ 0 , 1 ]) ∼ = R ≥ 0 . Recall that an ef fect modu le E is just an ef fect algebr a together with a scalar prod uct [ 0 , 1 ] ⊗ E → E . No w it turns out that T o is a stron g m onoid al fun ctor , and as a result T o ( E ) ∈ BC M comes equippe d with a scalar prod uct R ≥ 0 ⊗ T o ( E ) → T o ( E ) . This giv es the monoid T o ( E ) the struct ure of a positi ve cone of some partially ordere d vector space. T o make th is exact we gi ve the follo wing definition. B. Jacob s & J. Mandemak er 153 Construc t a catego ry Coneu as follo ws: its objects are pairs ( M , u ) where M is a commutati ve monoid equipp ed with a scalar product • : R ≥ 0 × M → M and u ∈ M such that the follo wing axioms hold. 1 • x = x ( r + s ) • x = r • x + s • ( rs ) • x = r • ( s • x ) r • ( x + y ) = r • x + r • y x + y = 0 implies x = y = 0 x + y = x + z = u impli es y = z , and f or all x ∈ M there e xists an n ∈ N such that x n • u . Because of th is last property we ca ll u a str ong unit. The morphisms of Coneu are monoid homomorph isms that respect both the scalar multiplicat ion and the unit. W e can then extend the coreflection T o ⊣ P a to the categ ories EMod and Coneu . This will actually be an equi valenc e of cate gories. T o prov e this we first need an auxiliary result. Lemma 7. If M ∈ Coneu then the cancelation law holds in M . Pro of Let x , y , z ∈ M and supp ose x + y = x + z . Since u is a stron g unit we can find an n such that x + y nu . Therefore 1 n • x + 1 n • y = 1 n • x + 1 n • z u . Hence we can find an element w ∈ M such that 1 n • x + 1 n • y + w = 1 n • x + 1 n • z + w = u . T hen 1 n • y = 1 n • z . And thus y = ∑ n i = 1 1 n • y = ∑ n i = 1 1 n • z = z . An immediate consequen ce is that the preorder is a partial order; thus we shall write ≤ instead of fro m now on. Lemma 8. The cor eflectio n T o ⊣ P a be tween EMod and Coneu is an equiva lence of cate gories. Pro of W e only need to sho w that the counit of the adjun ction T o ⊣ P a is an isomorphism. So let M ∈ Coneu ; a typica l element of T o P a ( M ) is an e qui vale nce class of formal s ums lik e ∑ n i x i where n i ∈ N and M ∋ x i ≤ u . The counit ε sends the class represente d by this formal sum to its interpretatio n as an actual sum in M . T o show that ε is surjecti ve suppo se x ∈ M . W e can find a natural number n such that x ≤ nu so that 1 n • x ≤ u . This gi ves us: x = n · ( 1 n • x ) = ε ( n ( 1 n • x )) . T o prov e injecti vity suppos e that ε ( ∑ n i x i ) = ε ( ∑ k j y j ) . Define N = ∑ n i + ∑ k j , so that: ∑ n i · ( 1 N • x i ) = ε ( ∑ n i ( 1 N • x i )) = ε ( 1 N • ( ∑ n i x i )) = 1 N • ε ( ∑ n i x i ) = 1 N • ε ( ∑ k j y j ) = ∑ k j ( 1 N • y j ) . Because N is suf ficiently large, the terms > i n i · ( 1 N • x i ) and > j k j · ( 1 N • y j ) a re both defined in P a M and by the pre vious calculation they are equal. This means that ∑ n i ( 1 N • x i ) and ∑ k j ( 1 N • y k ) repr esent equal elements of T o P a M and therefore the equation ∑ n i x i = N • ( ∑ n i ( 1 N • x i )) = N • ( ∑ k j ( 1 N • y j )) = ∑ k j y j . holds in P a T o M . From posit iv e cones it is but a small step to partial ly ordere d vec tor spaces. Define a cate gory poV ectu as fo llo ws; the objects are partially ordered v ector space s ov er R with a st rong order unit u , i.e. a posi tiv e element u ∈ V such that for an y x ∈ V there is a natural number n with x ≤ nu . The morphisms in poV ectu ar e linear maps that prese rve both the order and the unit. 154 The Expectat ion Monad Theor em 3. The cate gory EMod is equiva lent to poV ectu . Pro of W e will pro ve that Coneu is equi v alent to poV ectu ; th e result then follo w s from lemma 8. The functor F : poV ect u → Coneu takes the positi ve cone of a partiall y ordered vect or space . The constr uction of G : Coneu → poV ectu is essentiall y just the usual constructi on of turning a cancella tiv e monoid into a group. In some what more detail : if M ∈ Coneu then define G ( M ) = ( M × M ) / ∼ where ∼ is defined by ( x , y ) ∼ ( x ′ , y ′ ) iff x + y ′ = y + x ′ . W e write [ x , y ] for the equiv alence class of ( x , y ) ∈ M × M . Addition is define d by [ x , y ] + [ x ′ , y ′ ] = [ x + x ′ , y + y ′ ] . If α ∈ R we define α • [ x , y ] as follo ws. If α ≥ 0 the n α [ x , y ] = [ α • x , α • y ] and if α < 0 then α [ x , y ] = [ − α • y , − α • x ] . It’ s easy to che ck that G ( M ) is indeed a v ector space. Moreov er , G ( M ) is partiall y ordered by [ x , y ] ≤ [ x ′ , y ′ ] iff x + y ′ ≤ y + x ′ , and [ u , 0 ] is its strong unit. It’ s easy to see that both constru ctions can be made functori al and that this gi ves an equi va lence of cate gories. W e write ˆ T o : EMod ⇆ poV ectu : ˆ P a for this equi vale nce. For a partially ordered vector space V with a stron g unit u the ef fect module ˆ P a ( V ) consists of all elements x such that 0 ≤ x ≤ u . W ith this equi valenc e of cate gories in hands we can apply te chniques f rom lin ear alge bra to effect modules. B elo w we translate some propertie s of partially ordered vector spaces to the langu age of effec t modules. W e need these results later on. If V ∈ poV ectu and t he unit u is Archimedea n—in the sense that x ≤ ru for all r > 0 implies x ≤ 0— then V is called an or der unit space . T he Archimede an property of the unit can be used to define a norm k x k = inf { r ∈ [ 0 , 1 ] | − ru ≤ x ≤ r u } . W e denote by OUS the full subcatego ry of poV ectu consist ing of all order unit spaces. This Archi medean prope rty can also be exp ressed on the ef fect modul e le vel but some caution is requir ed as effe ct modules contain no elements less than 0 and sums may not be defined. The follo wing formulat ion works: an ef fect module is said to be Archimedean if x ≤ y follo w s from 1 2 x ≤ 1 2 y > r 2 1 for all r ∈ ( 0 , 1 ] . All Archimedean eff ect modules form a full subca tegory AEMod ֒ → EMod . Of course with this definition comes a theorem. Pro position 9. The equivalen ce p oV ect u ≃ EMod , between parti ally or der ed vector spaces with a str ong unit and eff ect m odules , re stricts to an equival ence OUS ≃ A EMod , between or der unit spaces and Ar chimed ean effect modules. Pro of W e only check that if E ∈ AEMod then its totalizati on satisfies ˆ T o ( E ) ∈ OUS ; the rest is left to the reader . Suppose E ∈ A EMod and x ∈ ˆ T o ( E ) is su ch th at x ≤ r u for all r ∈ ( 0 , 1 ] . T he trick is to transfo rm x into an element in the unit interv al [ 0 , u ] ∼ = E . Since u is a strong unit we can find a natural number n such that x + nu ≥ 0, and again using the fact that u is a strong unit we can find a positi ve real number s < 1 such th at sx + nsu ≤ u . Hence sx + nsu ∈ [ 0 , u ] ∼ = E . Now , for r ∈ ( 0 , 1 ] we ha ve sx ≤ x ≤ r u and so s 2 x + ns 2 u ≤ ns 2 u + r 2 u . T hus, by the Archimede an property of E , we get sx + nsu ≤ ns u . Hence sx ≤ 0 and therefore x ≤ 0. Since E ∈ A EMod is isomorp hic to the unit interv al of its to talization ˆ T o ( E ) , E inherits a metric from the normed space ˆ T o ( E ) . This metric can be describ ed wholly in terms of E . Howe ver the partial additi on does forc e us into a s omewhat a wkward definition: for x , y ∈ E their distan ce d ( x , y ) ∈ [ 0 , 1 ] can be defined as: d ( x , y ) = max inf { r ∈ ( 0 , 1 ] | 1 2 x ≤ 1 2 y > r 2 1 } , inf { r ∈ ( 0 , 1 ] | 1 2 y ≤ 1 2 x > r 2 1 } . (10) A tri vial conseque nce is the follo wing lemma. B. Jacob s & J. Mandemak er 155 Lemma 10. A map of ef fect m odules f : M → M ′ between Ar chimed ean ef fect modules M , M ′ is auto- matically non-e xpansive: d ′ ( f ( x ) , f ( y )) ≤ d ( x , y ) , for all x , y ∈ M . Of parti cular interest later in this paper are Archimedean effect module s that are complete in their metric. W e call these B anac h effec t m odules and denote by BEMod the full subcate gory of all Banach ef fect modules. The pre vious lemma implies that each map in BEMod is automatic ally continuous. Since an order unit space is complet e in its metric if and only if its unit interv al is complete we get the follo w ing result. Pro position 11. The equiva lences fr om Pr oposition 9 r estrict furthe r to an equivalence between Bana ch ef fect modules and the full subcate gory BOUS ֒ → OUS of those ord er unit spaces that ar e also Banach spaces : BOUS _ ≃ / / BEMod _ OUS _ ≃ / / AEMod _ poV ectu ≃ V 7→ ([ 0 , u ] ⊆ V ) / / EMod Pro of Like in th e proof of Propo sition 9 one transf orms a Cauchy s equence in ˆ T o ( E ) in to a sequ ence in [ 0 , u ] ∼ = E . Example 4. W e re vie w E xample 2: both the effect modul es [ 0 , 1 ] and [ 0 , 1 ] X are Archimedean , and also Banach effect modules . Norms and distance s in [ 0 , 1 ] are the usual ones, but limits in [ 0 , 1 ] X are defined via the supremum (or unifor m) norm: for p ∈ [ 0 , 1 ] X , we ha ve: k p k = inf { r ∈ [ 0 , 1 ] | p ≤ r · u } where u is the cons tant function λ x . 1 = inf { r ∈ [ 0 , 1 ] | ∀ x ∈ X . p ( x ) ≤ r } = sup { p ( x ) | x ∈ X } = k p k ∞ . The latt er notation k p k ∞ is co mmon for t his supremum no rm. The associated metric on [ 0 , 1 ] X is ac cord- ing to (10): d ( p , q ) = max inf { r ∈ ( 0 , 1 ] | ∀ x ∈ X . 1 2 p ( x ) ≤ 1 2 q ( x ) + r 2 } , inf { r ∈ ( 0 , 1 ] | ∀ x ∈ X . 1 2 q ( x ) ≤ 1 2 p ( x ) + r 2 } . = max sup { p ( x ) − q ( x ) | x ∈ X with p ( x ) ≥ q ( x ) } , sup { q ( x ) − p ( x ) | x ∈ X with p ( x ) ≤ q ( x ) } = sup {| p ( x ) − q ( x ) | | x ∈ X } = k p − q k ∞ . Recall that the subse t [ X → s [ 0 , 1 ]] ⊆ [ 0 , 1 ] X of simple functio ns cont ains those p ∈ [ 0 , 1 ] X that take only finitely man y val ues, i.e . for which the set { p ( x ) | x ∈ X } is fi nite. If we write { p ( x ) | x ∈ X } = { r 1 , . . . , r n } ⊆ [ 0 , 1 ] , then we obtain n dis joint non-empty sets X i = { x ∈ X | p ( x ) = r i } coveri ng X . For a subset U ⊆ X , let 1 U : X → [ 0 , 1 ] be the correspond ing “chara cteristic” simple function, with 1 U ( x ) = 1 156 The Expectat ion Monad if f x ∈ U and 1 U ( x ) = 0 iff x 6∈ U . Hence we can w rite such a simple function p in a normal form in the ef fect module [ X → s [ 0 , 1 ]] of simple fun ctions, namely as finite sum of charact eristic functions : p = > i r i · 1 X i . (11) Hence k p k = max { r 1 , . . . , r n } . These simple functio ns do not form a Ban ach ef fect module, since simple functi ons are not closed under countable suprema. Lemma 12. The inclusion of simple functions on a s et X is dense in the Ban ach effec t module of all fuzzy pr edicates on X : [ X → s [ 0 , 1 ]] / / dense / / [ 0 , 1 ] X Explicitl y , eac h pre dicate p ∈ [ 0 , 1 ] X can be written as limit p = lim n → ∞ p n of simple functio ns p n ∈ [ 0 , 1 ] X with p n ≤ p. Pro of Define for instance: p n ( x ) = 0 . d 1 d 2 · · · d n where d i = the i -th decimal of p ( x ) ∈ [ 0 , 1 ] . Clearly , p n is simple, because it can take at most 10 n dif ferent v alues, since d i ∈ { 0 , 1 , . . . , 9 } . Also, by constr uction, p n ≤ p . For each ε > 0, take N ∈ N such tha t for all decimals d i we ha ve: 0 . 00 · · · 00 | {z } N times d 1 d 2 d 3 · · · < ε . Then for each n ≥ N we ha ve p ( x ) − p n ( x ) < ε , for all x ∈ X , and thus d ( p , p n ) ≤ ε . 3.2 Hahn-Banach style extension for effect modules In th is subsecti on we look at a form of Hahn-Banach theore m for ef fect modules. W e ne ed the fol lowin g ver sion of the Hahn-Banach exte nsion theorem for partia lly ordered vector spaces . Pro position 13. Let E b e a partially or der ed vector space and let F ⊆ E be a cofinal subspace (i.e. for all x ∈ E , x ≥ 0 ther e is y ∈ F with x ≤ y). Suppo se f : F → R is a m onoton ic linear func tion. Then th er e is a monotonic linear functi on g : E → R with g | F = f in: F f " " ❊ ❊ ❊ ❊ ❊ ❊ ❊ / / E ∃ g ✤ ✤ R Pro of W e define p : E → R by: p ( x ) = inf { f ( y ) | y ∈ F and y ≥ x } . Notice that p ( x ) is finite since we can find y , y ′ ∈ F with y ≤ x ≤ y ′ becaus e F is cofinal. W e need to check that p is sublinear . S o let x , x ′ ∈ E and ε > 0 then we can find y , y ′ ∈ F with y ≥ x , y ′ ≥ x ′ , such that f ( y ) < p ( x ) + ε > 0 and f ( y ′ ) < p ( x ′ ) + ε > 0. Therefore: p ( x + x ′ ) ≤ f ( y + y ′ ) = f ( y ) + f ( y ′ ) < p ( x ) + p ( x ′ ) + 2 ε > 0 . B. Jacob s & J. Mandemak er 157 Also for r > 0 it is obvious that p ( r · x ) = r · p ( x ) . Hav ing established that p is subline ar we note that for y ∈ F we hav e p ( y ) = f ( y ) since f is mono- tonic. Hence we can apply the standard (dominat ed) extensio n ver sion of Hahn-Bana ch to find a linear functi on g : E → R w ith g < p and g | F = f . Since if x ≤ 0 th en p ( x ) ≤ 0 becaus e 0 ∈ F , henc e it follo ws that g is monotoni c. This versi on translate s effort lessly to effe ct modules Pro position 14. Let E b e an eff ect module and F ⊆ E a sub effe ct module of E . Su ppose f : F → [ 0 , 1 ] is an ef fect module map, then ther e is an effect module map g : E → [ 0 , 1 ] with g | F = E . Pro of W e translate effec t modules to order unit spaces and apply the pre vious result. Since u ∈ ˆ T o ( F ) it’ s clear that ˆ T o ( F ) is cofinal in ˆ T o ( E ) . Hen ce us ing the pre vious pro position we can e xtend ˆ T o ( f ) to h : ˆ T o ( E ) → R . Hence by restriction to unit interv als [ 0 , u ] , both in ˆ T o ( E ) and in R w e get the map g : E → [ 0 , 1 ] that we are looking for . Unfortun ately the class of effe ct module morphisms is too limited to get a full v ersion of the separa- tion theorem. Consider for example E = [ 0 , 1 ] 2 with the two compact con vex subsets C 1 = { ( r , 1 2 + r ) | r ∈ [ 0 , 1 2 ] } and C 2 = { ( 1 2 + r , r ) | r ∈ [ 0 , 1 2 ] } . If f : E → [ 0 , 1 ] is an effect module morphism then the image f ( C 1 ) is the interv al [ f ( 0 , 1 2 ) , f ( 1 2 , 1 )] , and since f ( 1 2 , 1 2 ) = 1 2 it follo ws th at this int erv al ha s leng th 1 2 . Analogo usly the interv al f ( C 2 ) i s also an interv al of length 1 2 so the two must o verlap . 4 The expectation monad W e no w apply Lemma 4 to the composa ble adjunction s in (8) and tak e a fi rst loo k at th e result s. In particu lar , we in vestigate dif ferent ways of descr ibing the expe ctation monad E that arises in this way . Of the tw o monads r esulting from app lying Lemma 4 to t he compos able adjunction s in Diagram (8), the first one is the well-kno wn distrib ution mon ad D on Sets , arising from the adjunction Sets ⇆ Alg ( D ) = Con v . The second monad on Sets aris es from the composite adjunc tion Sets ⇆ EMod op is less familiar (see Section 10 for m ore informatio n and reference s). It is what w e call the ex pectation monad , written here as E . Follo wing the descriptio n in Lemma 4 this monad is: X 7− → EM od Con v D ( X ) , [ 0 , 1 ] , [ 0 , 1 ] . Since D : Sets → Alg ( D ) = Con v is the free algebra functor , the homset Conv ( D ( X ) , [ 0 , 1 ]) is isomor - phic to the set [ 0 , 1 ] X of all maps X → [ 0 , 1 ] in Sets . Elements of this set [ 0 , 1 ] X can be underst ood as fuzzy predica tes on X . As mention ed, they form a Banach eff ect module via pointwise operations. Thus we describ e the expect ation monad E : S ets → Sets as: E ( X ) = E Mod [ 0 , 1 ] X , [ 0 , 1 ] E X f − → Y = λ h ∈ E ( X ) . λ p ∈ [ 0 , 1 ] Y . h ( p ◦ f ) . (12) The unit η X : X → E ( X ) is giv en by: η X ( x ) = λ p ∈ [ 0 , 1 ] X . p ( x ) . And the multipli cation µ X : E 2 ( X ) → E ( X ) is gi ven on h : [ 0 , 1 ] E ( X ) → [ 0 , 1 ] in EMod by: µ X ( h ) = λ p ∈ [ 0 , 1 ] X . h λ k ∈ E ( X ) . k ( p ) . 158 The Expectat ion Monad It is not hard to see that η ( x ) and µ ( h ) are homomorphis ms of effec t m odules . W e check explic itly that the µ - η laws ho ld and leav e the remaining verification s to the reader . For h ∈ E ( X ) , µ X ◦ η E ( X ) ( h ) = µ X η E ( X ) ( h ) = λ p ∈ [ 0 , 1 ] X . η E ( X ) ( h ) λ k ∈ E ( X ) . k ( p ) = λ p ∈ [ 0 , 1 ] X . λ k ∈ E ( X ) . k ( p ) ( h ) = λ p ∈ [ 0 , 1 ] X . h ( p ) = h µ X ◦ E ( η X ) ( h ) = µ X E ( η X )( h ) = λ p ∈ [ 0 , 1 ] X . E ( η X )( h ) λ k ∈ E ( X ) . k ( p ) = λ p ∈ [ 0 , 1 ] X . h ( λ k ∈ E ( X ) . k ( p )) ◦ η X = λ p ∈ [ 0 , 1 ] X . h λ x ∈ X . η X ( x )( p ) = λ p ∈ [ 0 , 1 ] X . h λ x ∈ X . p ( x ) = λ p ∈ [ 0 , 1 ] X . h ( p ) = h . Remark 2. (1) W e think of elements h ∈ E ( X ) as measures. L ater on, in Theorem 4 , it will be prov en that E ( X ) is isomorphi c to the set of finitely additi ve measures P ( X ) → [ 0 , 1 ] on X . The applicatio n h ( p ) of h ∈ E ( X ) to a function p ∈ [ 0 , 1 ] X may then be understo od as integr ation R p d h , givin g the expec ted v alue of the stochastic var iable/pred icate p for the measure h . (2) T he descri ption E ( X ) = EMod [ 0 , 1 ] X , [ 0 , 1 ] of the expectat ion monad in (12) bears a certain formal resembla nce to the ultrafilter monad U F from Subsection 2.2. Recall from (3) that: U F ( X ) ∼ = B A { 0 , 1 } X , { 0 , 1 } . Thus, the ex pectation m onad E can be seen as a “fuz zy” or “probabilist ic” versi on of the ultrafilter monad U F , in which the set o f Boolean s { 0 , 1 } is rep laced by the set [ 0 , 1 ] of probabilitie s. The r elation between the two monads is furth er in vestigat ed in S ection 5. (3) Usin g th e equ iv alence poV ectu ≃ EMod fr om Propo sition 9 via total ization we may equ iv alently descri be the expectati on monad as the homset: E ( X ) ∼ = poV ectu R X , R . It contains the linear monotone functio ns R X → R that send the unit λ x . 1 ∈ R X to 1 ∈ R . The follo wing result is not a surprise, giv en the resemblan ce between the unit and multiplica tion for the exp ectation monad and the ones for the contin uation monad (see Subsection 2.3). Lemma 15. The in clusion maps: E ( X ) = EMod [ 0 , 1 ] X , [ 0 , 1 ] / / [ 0 , 1 ] ([ 0 , 1 ] X ) form a map o f monad s, fr om the expec tation monad to the con tinuation monad (with the se t [ 0 , 1 ] as consta nt). B. Jacob s & J. Mandemak er 159 W e conclude with an alternati ve descriptio n of the sets E ( X ) , in terms of finitely additi ve measures, descri bed as effect alge bra homomorphisms. It also occurs as [18, Cor . 4.3]. Theor em 4. F or each set X ther e is a bijecti on: E ( X ) = EMod [ 0 , 1 ] X , [ 0 , 1 ] Φ ∼ = / / EA P ( X ) , [ 0 , 1 ] given by Φ ( h )( U ) = h ( 1 U ) . Pro of W e first check that Φ is injecti ve: assume Φ ( h ) = Φ ( h ′ ) , for h , h ′ ∈ E ( X ) . W e need to sho w h ( p ) = h ′ ( p ) for an arbitrary p ∈ [ 0 , 1 ] X . W e first prov e h ( q ) = h ′ ( q ) for a simple funct ion q ∈ [ 0 , 1 ] X . Recall t hat suc h a simple q can be w ritten as q = > i r i 1 X i , lik e in (11), wher e the ( disjoint) sub sets X i ⊆ X cov er X . Since h , h ′ ∈ E ( X ) are maps of ef fect modules we get: h ( q ) = ∑ i r i h ( 1 X i ) = ∑ i r i Φ ( h )( X i ) = ∑ i r i Φ ( h ′ )( X i ) = ∑ i r i h ′ ( 1 X i ) = h ′ ( q ) . For an arbitrary p ∈ [ 0 , 1 ] X we first write p = lim n p n as limit of simple functi ons p n like in Lemm a 12. Lemma 10 implies that h , h ′ are continu ous, and so we get h = h ′ from: h ( p ) = lim n h ( p n ) = lim n h ′ ( p n ) = h ′ ( p ) . For surje cti vity of Φ assu me a finitely addit iv e measure m : P ( X ) → [ 0 , 1 ] . W e need to define a function h ∈ E ( X ) with Φ ( h ) = m . W e define such a h fi rst on a simple funct ion q = > i r i 1 X i as h ( q ) = ∑ i r i m ( X i ) . For an arbitrary p ∈ [ 0 , 1 ] X , written as p = lim n p n , like in Lemma 12, we define h ( p ) = lim n h ( p n ) . Then Φ ( h ) = m , since for U ⊆ X we ha ve: Φ ( h )( U ) = h ( 1 U ) = m ( U ) . The in vers e h = Φ − 1 ( m ) that is constructe d in this proof m ay be understood as an inte gral h ( p ) = R pd m . The precise nature of the bijection Φ re mains u nclear a t this s tage since we hav e no t yet i dentified the (algebraic ) structu re of the sets E ( X ) . But via this bijection w e can understand mapping a set to its finitely additi ve measures , i.e. X 7→ EA ( P ( X ) , [ 0 , 1 ]) , as a monad. Y et an other perspect iv e is useful in this context. The characteri stic functi on mapping: [ 0 , 1 ] × P ( X ) / / [ 0 , 1 ] X gi ven by ( r , U ) ✤ / / r · 1 U is a bihomomorphism of ef fect modules. Hence it gi ves rise t o a m ap of effec t m odules [ 0 , 1 ] ⊗ P ( X ) → [ 0 , 1 ] X , wher e the tensor prod uct [ 0 , 1 ] ⊗ P ( X ) forms a more abs tract descript ion of the ef fect m odule o f simple (step) functions [ X → s [ 0 , 1 ]] fro m Lemma 12 (see also [18, Thm. 5.6]). Lemma 12 says that this map is dense. T his gi ves a quick proof of Theorem 4: E ( X ) = E Mod [ 0 , 1 ] X , [ 0 , 1 ] ∼ = EMod [ 0 , 1 ] ⊗ P ( X ) , [ 0 , 1 ] by dens eness ∼ = EA P ( X ) , [ 0 , 1 ] . This last isomorphi sm is standard, because [ 0 , 1 ] ⊗ P ( X ) is the free ef fect module on P ( X ) . 160 The Expectat ion Monad 5 The expectation and ultrafilter monads In this section we sho w that the sets E ( X ) carry a compac t H ausdorf f struc ture and we identif y its topolo gy . The unit interv al [ 0 , 1 ] plays an important role. It is a compact Hausdorf f space, which means that it carries an algeb ra of the ultrafilte r m onad, see Subsec tion 2.2. W e shall write this algebr a as ch = c h [ 0 , 1 ] : U F ([ 0 , 1 ]) → [ 0 , 1 ] . What this map precisely does is described in Example 1; but m ostly we use it abstrac tly , as an U F -alge bra. The techniq ue we use to define the followin g map of monads is copied from Lemma 3. Pro position 16. Ther e is a map of m onads τ : U F = ⇒ E , given on a n ultr afilter F ∈ U F ( X ) an d p ∈ [ 0 , 1 ] X by: τ X ( F )( p ) = ch U F ( p )( F ) = inf { s ∈ [ 0 , 1 ] | [ 0 , s ] ∈ U F ( p )( F ) } by (5) = inf { s ∈ [ 0 , 1 ] | { x ∈ X | p ( x ) ≤ s } ∈ F } . In this descripti on th e functor U F is appl ied to p, as functio n X → [ 0 , 1 ] , giving U F ( p ) : U F ( X ) → U F ([ 0 , 1 ]) . Pro of W e fi rst hav e to check that τ is well-defined, i.e. that τ X ( F ) : [ 0 , 1 ] X → [ 0 , 1 ] is a m orphism of ef fect modules. • Preserv ation τ X ( F )( r · p ) = r · p τ X ( F ) of multipl ication w ith scala r r ∈ [ 0 , 1 ] . This follo ws by observ ing that multiplicati on r · ( − ) : [ 0 , 1 ] → [ 0 , 1 ] is a conti nuous function, and thus a morphism of algeb ras in the square belo w . U F ([ 0 , 1 ]) U F ( r · ( − )) / / ch U F ([ 0 , 1 ]) ch [ 0 , 1 ] r · ( − ) / / [ 0 , 1 ] Thus: τ ( F )( r · p ) = ch ◦ U F ( r · ( − ) ◦ p ) ( F ) = r · ( − ) ◦ ch ◦ U F ( p ) ( F ) = r · τ ( F )( p ) . • Preserv ation of > , is obtained in the same m anner , using that addition + : [ 0 , 1 ] × [ 0 , 1 ] → [ 0 , 1 ] is contin uous. • Constan t functions λ x . a ∈ [ 0 , 1 ] X , inclu ding 0 and 1, are preserv ed: τ X ( F )( λ x . a ) = ch U F ( λ x . a )( F ) = ch { U ∈ P ([ 0 , 1 ]) | ( λ x . a ) − 1 ( U ) ∈ F } = ch { U ∈ P ([ 0 , 1 ]) | { x ∈ X | a ∈ U } ∈ F } = ch { U ∈ P ([ 0 , 1 ]) | a ∈ U } since / 0 6∈ F = ch ( η ( a )) = a . B. Jacob s & J. Mandemak er 161 W e leav e naturality of τ and commutatio n with units to the reader and check that τ commutes with multiplic ations µ E and µ U F of the e xpectatio n and ult rafilter monads. Thus, for A ∈ U F 2 ( X ) and p ∈ [ 0 , 1 ] X , we calcul ate: µ E ◦ τ ◦ U F ( τ ) ( A )( p ) = µ τ U F ( τ )( A ) ( p ) = τ U F ( τ )( A ) λ k . k ( p ) = ch U F ( λ k . k ( p )) U F ( τ )( A ) = ch U F ( λ F . τ ( F )( p ))( A ) = ch U F ( λ F . ch ( U F ( p )( F )))( A ) = ch U F ( ch ◦ U F ( p ))( A ) = ch ◦ U F ( ch ◦ U F ( p )) ( A ) = ch ◦ U F ( ch ) ◦ U F 2 ( p ) ( A ) = ch ◦ µ U F ◦ U F 2 ( p ) ( A ) = ch ◦ U F ( p ) ◦ µ U F ( A ) = ch U F ( p )( µ U F ( A )) = τ ◦ µ U F ( A )( p ) . Cor ollary 17. T her e is a functo r Alg ( E ) → Alg ( U F ) = C H , by pr e-composit ion: E ( X ) α − → X 7− → U F ( X ) α ◦ τ − − → X . This functor has a left adjoint by L emma 1. In parti cular , the underly ing s et X of each E -algebr a α : E ( X ) → X carries a compact Hausdor ff topolo gy , with U ⊆ X clos ed iff for ea ch F ∈ U F ( X ) with U ∈ F one has α ( τ ( F )) ∈ U , as descri bed in Subsect ion 2.2. W ith respect to this topolog y on E ( X ) , se veral maps are con tinuous. Lemma 18. The fo llowing maps are con tinuous functions. U F ( X ) τ X / / E ( X ) E ( X ) α alge bra / / X E ( X ) E ( f ) / / E ( Y ) E ( X ) e v p = λ h . h ( p ) / / [ 0 , 1 ] . Pro of One sho ws that these maps are morphisms of U F -alge bras. For instance, τ X is continuou s be- cause it is a m ap of monads: c ommutation with multiplicat ions, as require d in (2), precisely says that it is a map of algeb ras, in the square on the left belo w . U F 2 ( X ) µ X U F ( τ X ) / / U F ( E ( X )) µ X ◦ τ E ( X ) U F ( E ( X )) µ X ◦ τ E ( X ) U F ( α ) / / U F ( X ) α ◦ τ X U F ( X ) τ X / / E ( X ) E ( X ) α / / X The rect angle on the right exp resses that an Eilen ber g-Moore algebra α : E ( X ) → X is a continuous functi on. It commutes by naturality of τ : α ◦ τ X ◦ U F ( α ) = α ◦ E ( α ) ◦ τ E ( X ) = α ◦ µ X ◦ τ E ( X ) . 162 The Expectat ion Monad For f : X → Y , continui ty of E ( f ) : E ( X ) → E ( Y ) follows directly from naturalit y of τ . Fin ally , for p ∈ [ 0 , 1 ] X the map e v p = λ h . h ( p ) : E ( X ) → [ 0 , 1 ] is contin uous because for F ∈ U F ( E ( X )) , e v p ◦ µ X ◦ τ E ( X ) ( F ) = µ X τ E ( X ) ( F ) ( p ) = τ E ( X ) ( F )( λ k . k ( p )) = τ E ( X ) ( F )( e v p ) = ch U F ( e v p )( F ) = ch ◦ U F ( e v p ) ( F ) . The next step is to giv e a concrete descriptio n of this compact Hausdorf f topolog y on sets E ( X ) , as induce d by the algebra U F ( E ( X )) → E ( X ) . Pro position 19. F ix a set X . F o r a pr edicate p ∈ [ 0 , 1 ] X and a ra tional number s ∈ [ 0 , 1 ] ∩ Q write: s ( p ) = { h ∈ E ( X ) | h ( p ) > s } . These sets s ( p ) ⊆ E ( X ) form a subbasis for the topolo gy on E ( X ) . Pro of W e reason a s follo ws. The sub sets s ( p ) are ope n in th e compact Hau sdorf f topolo gy induced on E ( X ) by the algebra structure U F ( E ( X )) → E ( X ) . They form a subbasi s for a Hausdor ff topology on E ( X ) . Hence by Lemma 2 this topo logy is the induced one. W e no w elabora te these steps. The Eilenb erg -Moore algebra U F ( E ( X )) → E ( X ) is giv en by µ X ◦ τ E ( X ) . Hence th e assoc iated closed sets U ⊆ E ( X ) are those satisfyi ng U ∈ F ⇒ µ X ( τ E ( X ) ( F )) ∈ U , fo r each F ∈ U F ( E ( X )) , see Subsecti on 2.2. W e wish to sh ow that ¬ s ( p ) = { h | h ( p ) ≤ s } ⊆ E ( X ) is clo sed. W e rea son backw ards, startin g w ith the requi red conclu sion. µ ( τ ( F )) ∈ ¬ s ( p ) ⇐ ⇒ µ ( τ ( F ))( p ) ≤ s ⇐ ⇒ ch U F ( λ k . k ( p ))( F ) ∈ [ 0 , s ] since µ ( τ ( F ))( p ) = τ ( F )( λ k . k ( p )) = ch U F ( λ k . k ( p ))( F ) ⇐ = [ 0 , s ] ∈ U F ( λ k . k ( p ))( F ) since [ 0 , s ] ⊆ [ 0 , 1 ] is close d ⇐ ⇒ ( λ k . k ( p )) − 1 ([ 0 , s ]) ∈ F ⇐ ⇒ { h ∈ E ( X ) | h ( p ) ∈ [ 0 , s ] } = ¬ s ( p ) ∈ F . Hence ¬ s ( p ) ⊆ E ( X ) is closed, making s ( p ) open. Next we need to show that these s ( p ) ’ s gi ve rise to a Hausdorf f topo logy . So ass ume h 6 = h ′ ∈ E ( X ) . Then there must be a p ∈ [ 0 , 1 ] X with h ( p ) 6 = h ′ ( p ) . W ithout loss of generality w e assume h ( p ) < h ′ ( p ) . Find an s ∈ [ 0 , 1 ] ∩ Q with h ( p ) < s < h ′ ( p ) . T hen h ′ ∈ s ( p ) . Also: h ( p ⊥ ) = 1 − h ( p ) > 1 − s > 1 − h ′ ( p ) = h ′ ( p ⊥ ) . Hence h ∈ 1 − s ( p ⊥ ) . These sets s ( p ) and 1 − s ( p ⊥ ) are disjo int, since: k ∈ s ( p ) ∩ 1 − s ( p ⊥ ) if f both k ( p ) > s and 1 − k ( p ) > 1 − s , whi ch is impossible. B. Jacob s & J. Mandemak er 163 As is well-kn own, ultrafilters on a set X can also be under stood a s finitely additi ve measures P ( X ) → { 0 , 1 } . Using Theorem 4 we can expres s m ore precise ly how the expe ctation monad E is a probabilisti c ver sion of the ultrafilter monad U F , namely via the descrip tions: E ( X ) ∼ = EA P ( X ) , [ 0 , 1 ] and U F ( X ) ∼ = EA P ( X ) , { 0 , 1 } . W e ha ve EA P ( X ) , { 0 , 1 } = BA P ( X ) , { 0 , 1 } becaus e in genera l, for Boolean algebras B , B ′ a ho- momorphis m of Boolean algebras B → B ′ is the same as an ef fect algebra homomorphism B → B ′ . Lemma 20. The co mponents τ X : U F ( X ) → E ( X ) ar e injectio ns. Pro of Because there are isomorphisms: U F ( X ) ≀ τ X / / E ( X ) ≀ EA P ( X ) , { 0 , 1 } / / / / EA P ( X ) , [ 0 , 1 ] 6 The expectation and distrib ution monads W e contin ue with the implicati ons of Lemma 4 in th e current situation , especially with the natura l trans- formatio n (6). This leads to con ve x structure on sets E ( X ) . Lemma 21. Ther e is a map of monads: σ : D = ⇒ E given by σ X ( ϕ ) = λ p ∈ [ 0 , 1 ] X . ∑ x ϕ ( x ) · p ( x ) , (13) wher e the dot · d escribes multiplicatio n in [ 0 , 1 ] . All components σ X : D ( X ) → E ( X ) ar e injectio ns. And for finite sets X the compon ent at X is an isomorph ism D ( X ) ∼ = − → E ( X ) . W ith this result we hav e completed the positioning of the expe ctation monad in Diagram (1), in between the distrib ution and ultrafilte r monad on the hand, and the continuati on monad on the other . Pro of By construc tion via (6) the natural transfor mation σ : D ⇒ E is a map of monads. Next, assume X is finite, say X = { x 1 , . . . , x n } . Each p ∈ [ 0 , 1 ] X is determine d by the v alues p ( x i ) ∈ [ 0 , 1 ] . Using the ef fect module structure of [ 0 , 1 ] X , this p can be written as sum of scala r multiplicati ons: p = p ( x 1 ) · 1 x 1 > · · · > p ( x n ) · 1 x n , where 1 x i : X → [ 0 , 1 ] is the characte ristic func tion of the singleton { x i } ⊆ X . A map of ef fect modules h ∈ E ( X ) = EMod ([ 0 , 1 ] X , [ 0 , 1 ]) will thus send such a predic ate p to: h ( p ) = h p ( x 1 ) · 1 x 1 > · · · > p ( x n ) · 1 x n = p ( x 1 ) · h ( 1 x 1 ) + · · · + p ( x n ) · h ( 1 x n ) , since > is + in [ 0 , 1 ] . Hence h is completely determined by these v alues h ( 1 x i ) ∈ [ 0 , 1 ] . But since > i 1 x i = 1 in [ 0 , 1 ] X we also hav e ∑ i h ( 1 x i ) = 1. Hence h can be described by the con vex sum ϕ ∈ D ( X ) 164 The Expectat ion Monad gi ven by ϕ ( x ) = h ( 1 x ) . T hus we hav e a bijection E ( X ) ∼ = D ( X ) . In fact, σ X descri bes (the in verse of) this biject ion, since: σ X ( ϕ )( p ) = ∑ i ϕ ( x i ) · p ( x i ) = ∑ i p ( x i ) · h ( 1 x i ) = h > i p ( x i ) · 1 x i = h ( p ) . Cor ollary 22. Ther e is a functor Alg ( E ) → Alg ( D ) = Con v , by pr e-compos ition: E ( X ) α − → X 7− → D ( X ) α ◦ σ − − → X . It has a left adjoint by Lemma 1. Explicitl y , for each E -algebr a α : E ( X ) → X , the set X is a con ve x set, with sum of a formal con ve x combina tion ∑ i r i x i gi ven by the eleme nt: α σ X ( ∑ i r i x i ) = α λ p ∈ [ 0 , 1 ] X . ∑ i r i · p ( x i ) ∈ X . Lemma 21 implies that if the carrier X is fi nite, the algebra structure α corres ponds p recisely to such con ve x structur e on X . If X is no n-finite we still hav e to fi nd out what α in vo lves. Here is anothe r (easy) consequen ce of Lemma 21. Cor ollary 23. On the first fe w finite sets: empty 0 , single ton 1 , and two-element 2 one has: E ( 0 ) ∼ = 0 E ( 1 ) ∼ = 1 E ( 2 ) ∼ = [ 0 , 1 ] . The isomorp hism in the middle says that E is an affine funct or . Pro of The isomorphisms follo w easily from E ( X ) ∼ = D ( X ) for finite X . Remark 3. (1) The natural transformatio n σ : D ⇒ E from (13) implicitly uses that the unit interv al [ 0 , 1 ] is con ve x. This can be made explic it in the following way . D escribe this con vexi ty via an algebr a cv : D ([ 0 , 1 ]) → [ 0 , 1 ] . Then we can equi va lently describ e σ as: σ X ( ϕ )( p ) = cv D ( p )( ϕ ) . This alternati ve descript ion is similar to the constructi on in Proposition 16, for a natural transformat ion U F ⇒ E (see also Lemma 3). (2) From Coro llaries 17 and 2 2 we kno w that the sets E ( X ) are both c ompact Hausdorf f and con ve x. This means that we can take free extensi ons of the maps τ : U F ( X ) → E ( X ) and σ : D ( X ) → E ( X ) , gi ving maps D ( U F ( X )) → E ( X ) and U F ( D ( X )) → E ( X ) , etc. The latte r m ap is the composite : U F ( D ( X )) U F ( σ ) / / U F ( E ( X )) τ / / E 2 ( X ) µ / / E ( X ) . Using Example 1, it can be describe d more concretely on F ∈ U F ( D ( X )) and p ∈ [ 0 , 1 ] X as: inf { s ∈ [ 0 , 1 ] | { ϕ ∈ D ( X ) | ∑ x ϕ ( x ) · p ( x ) ≤ s } ∈ F } . The nex t result is the af fine analogue of Lemma 18. Lemma 24. The fo llowing maps are af fine function s. D ( X ) / / σ X / / E ( X ) E ( X ) α alge bra / / X E ( X ) E ( f ) / / E ( Y ) E ( X ) e v p = λ h . h ( p ) / / [ 0 , 1 ] . B. Jacob s & J. Mandemak er 165 Pro of V erificat ions are done like in the proof of Lemma 18. W e only do the last one. W e need to prov e that the follo w ing diagram commutes, D ( E ( X )) µ X ◦ σ X D ( ev p ) / / D ([ 0 , 1 ]) cv E ( X ) e v p / / [ 0 , 1 ] where the algebra cv interp rets formal con ve x combinations as actual combinations . For a distrib ution Φ = ∑ i r i h i ∈ D ( E ( X )) we hav e: e v p ◦ µ ◦ σ ( Φ ) = µ σ ( Φ ) ( p ) = σ ( Φ )( e v p ) = ∑ i r i · ev p ( h i ) = cv ∑ i r i e v p ( h i ) = cv D ( ev p )( ∑ i r i h i ) = cv ◦ D ( e v p ) ( Φ ) . The D -algebra s obtained from E -algebras turn out to be con tinuous funct ions. This connects th e con ve x and topolog ical structures in such algebra s. Lemma 25. T he maps σ X : D ( X ) E ( X ) ar e (trivially ) contin uous when we pr ovide D ( X ) with the subsp ace topolo gy with b asic opens s ( p ) ⊆ D ( X ) given by rest riction: s ( p ) = { ϕ ∈ D ( X ) | ∑ x ϕ ( x ) · p ( x ) > s } , for p ∈ [ 0 , 1 ] X and s ∈ [ 0 , 1 ] ∩ Q . F o r each E -alg ebra α : E ( X ) → X the assoc iated D -algebr a α ◦ σ : D ( X ) → X is then also co ntin- uous. Pro of Lemma 18 states that E -algebra s α : E ( X ) → X are continuou s. Hence α ◦ σ : D ( X ) → X , as composi tion of continuous m aps, is also contin uous. The follo w ing property of the map of monads D ⇒ E will play a crucia l role. Pro position 26. The inclus ions σ X : D ( X ) E ( X ) ar e dense: the topolo gical closur e of D ( X ) is the whole of E ( X ) . Pro of W e need to sho w that for each non-empty open U ⊆ E ( X ) there is a distrib ution ϕ ∈ D ( X ) with σ ( ϕ ) ∈ U . By Propositio n 19 we may assume U is of the form U = s 1 ( p 1 ) ∩ · · · ∩ s m ( p m ) , for certa in s i ∈ [ 0 , 1 ] ∩ Q and p i ∈ [ 0 , 1 ] X . For con venien ce we do the proof for m = 2. S ince U is non-empty there is some inhabitan t h ∈ s 1 ( p 2 ) ∩ s 2 ( p 2 ) . Thus h ( p i ) > s i . W e claim there are simple functions q i ≤ p i with h ( q i ) > s i . In general, this works as follo ws. If h ( p ) > s , write p = lim n p n for simple functio ns p n ≤ p , like in Lemma 12. T hen h ( p ) = lim n h ( p n ) > s . Hence h ( p n ) > s for some simple p n ≤ p . In a ne xt step we write the simple f unctions as weighte d sum of characteri stic functions , like in (11). Thus, let q 1 = > j r j 1 U j and q 2 = > k t k 1 V k , where these U j ⊆ X and V k ⊆ X form non-empt y partitions, each cov ering X . W e form a ne w , refined partiti on ( W ℓ ⊆ X ) ℓ ∈ L consis ting of the non-empty intersecti ons U j ∩ V j , and choose x ℓ ∈ W ℓ . Then: 166 The Expectat ion Monad • ∑ ℓ h ( 1 W ℓ ) = h ( > ℓ 1 W ℓ ) = h ( 1 X ) = 1 . • There are subs ets L j ⊆ L so that each U j ⊆ X can be written as disjo int union U j = S ℓ ∈ L j W ℓ . • Similarly , V k = S ℓ ∈ L k W ℓ for subsets L k ⊆ L . W e take as distrib ution ϕ = ∑ ℓ ∈ L h ( 1 W ℓ ) x ℓ ∈ D ( X ) . Then σ ( ϕ ) ∈ s i ( p i ) . W e do the proof for i = 1. σ ( ϕ )( p 1 ) = ∑ ℓ ∈ L ϕ ( x ℓ ) · p 1 ( x ℓ ) ≥ ∑ ℓ ∈ L h ( 1 W ℓ ) · q 1 ( x ℓ ) = ∑ j ∑ ℓ ∈ L j h ( 1 W ℓ ) · q 1 ( x ℓ ) = ∑ j ∑ ℓ ∈ L j h ( 1 W ℓ ) · r j = ∑ j h ( > ℓ ∈ L j 1 W ℓ ) · r j = ∑ j h ( 1 U j ) · r j = h ( > j r j · 1 U j ) = h ( p 1 ) > s 1 . Cor ollary 27. Each map U F ( D ( X )) → E ( X ) , described in Example 3.(3), is onto (surjec tive). Pro of Since D ( X ) E ( X ) is dense, eac h h ∈ E ( X ) is a limit of elements in D ( X ) . Such limits can be desc ribed for instance via nets or via ultrafilters. In the prese nt contex t we choose the lat- ter approach. Thus there is an ultrafilter F ∈ U F ( D ( X )) such that h is the limit of this ultrafilt er U F ( σ )( F ) ∈ U F ( E ( X )) , when map ped to E ( X ) . The limit is exp ressed via the ul trafilter algeb ra µ ◦ τ : U F ( E ( X )) → E ( X ) . This means that ( µ ◦ τ ◦ U F ( σ ))( F ) = h . 7 Algebras of the expectation monad This sec tion descri bes algebras of t he ex pectation monad via bary centers of measur es. It leads to an equi valenc e of categorie s between ‘observ able’ algebra s and ‘observ able’ con vex compact Hausdo rff spaces . W e sha ll write CCH fo r the categ ory of these con vex compact Hausdorf f spaces, with affine contin uous maps between them. W e start with the unit interv al [ 0 , 1 ] . It is both compa ct Hausdorf f and con vex. Hence it carrie s algebr as U F ([ 0 , 1 ]) → [ 0 , 1 ] an d D ([ 0 , 1 ]) → [ 0 , 1 ] . This i nterv al also carrie s an algebra stru cture for the exp ectation monad. Lemma 28. The un it interval [ 0 , 1 ] carries an E -algebr a structur e: E ([ 0 , 1 ]) e v id / / [ 0 , 1 ] by h ✤ / / h ( id [ 0 , 1 ] ) . Mor e gener ally , for an arbitr ary set A the set of (all) functions [ 0 , 1 ] A carrie s an E -algebr a structur e: E ([ 0 , 1 ] A ) / / [ 0 , 1 ] A namely h ✤ / / λ a ∈ A . h λ f ∈ [ 0 , 1 ] A . f ( a ) . B. Jacob s & J. Mandemak er 167 Pro of It is easy to see that the e val uation-at -identity map ev id : E ([ 0 , 1 ]) → [ 0 , 1 ] is an algebra . W e exp licitly check the details: e v id ◦ η ( x ) = ev id η ( x ) = η ( x )( id ) = id ( x ) = x e v id ◦ E ( e v id ) ( H ) = ev id E ( e v id )( H ) = E ( ev id )( H )( id ) = H ( id ◦ ev id ) = H λ k ∈ E ([ 0 , 1 ]) . k ( id ) = µ ( H )( id ) = ev id µ ( H ) = e v id ◦ µ ( H ) . Since Eilenber g-Moore algeb ras are closed under products, there is also an E -algebra on [ 0 , 1 ] A . From Corolla ries 17 and 22 w e know that the underlyi ng set X of an a lgebra E ( X ) → X is both compact Hausdo rff and c on vex. A dditio nally , Lemm a 25 says that the algeb ra D ( X ) → X is continuou s. W e first characte rize algeb ra maps. Lemma 29. Conside r Eilenber g-Moor e algebr as ( E ( X ) α − → X ) and ( E ( Y ) β − → Y ) . A function f : X → Y is an alge bra homomorphism if and only if it is both continu ous and affine , that is, iff the followin g two dia grams commute. U F ( X ) α ◦ τ U F ( f ) / / U F ( Y ) β ◦ τ D ( X ) α ◦ σ D ( f ) / / D ( Y ) β ◦ σ X f / / Y X f / / Y Thus, the functo r Alg ( E ) → CCH is full and faithfu l. Pro of If f is an algebra homomorphis m, then f ◦ α = β ◦ E ( f ) . Hence the two rectangles abov e commute by natural ity of τ and σ . For the (if) part we use the property from Proposition 26 that the maps σ X : D ( X ) E ( X ) are dens e monos. T his means that for each m ap g : D ( X ) → Z into a H ausdor ff space Z there is at most one contin uous h : E ( X ) → Z with h ◦ σ = g . W e use this property as follo ws. D ( X ) / / σ dense / / % % ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ E ( X ) β ◦ E ( f ) f ◦ α Y The triang le commutes for both maps since f is affine: f ◦ α ◦ σ = β ◦ σ ◦ D ( f ) = β ◦ E ( f ) ◦ σ . Also, both ve rtical maps are con tinuous, by Lemma 18. Hence f ◦ α = β ◦ E ( f ) , so that f is an alg ebra homomorph ism. 168 The Expectat ion Monad For con vex compact H ausdor ff spaces X , Y ∈ CCH one (standar dly) writes A ( X , Y ) = CCH ( X , Y ) for the homset of affine contin uous functions X → Y . In light of the previ ous result, we shall also use this notation A ( X , Y ) w hen X , Y are carrier s of E -algebras, in case the algebra structure is clear from the conte xt. The next result gi ves a better und erstandin g of E -algeb ras: it sho ws that such algebras send meas ures to barycen ters (like for instance in [24]). Pro position 30. Assume an E -alg ebr a E ( X ) α − → X . F or each (alg ebra ) m ap q ∈ A ( X , [ 0 , 1 ]) the follo w- ing dia gram commutes. E ( X ) α e v q = λ h . h ( q ) ( ( ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ X q / / [ 0 , 1 ] This says that x = α ( h ) ∈ X is a barycent er for h ∈ E ( X ) , in the sense that q ( x ) = h ( q ) for all affi ne contin uous q : X → [ 0 , 1 ] . Pro of Since ev q = ev id ◦ E ( q ) the abov e triangle can be morphed into a rectangle expres sing that q is a map of algebra s: E ( X ) α e v q ) ) ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ ❙ E ( q ) / / E ([ 0 , 1 ]) e v id X q / / [ 0 , 1 ] where e v id is the E -algebra on [ 0 , 1 ] from Lemma 28. No w that we hav e a reasonab le grasp of E -algebra s, namely as con vex compact Hausdorf f spaces with a barycent ric operatio n, we wish to comprehen d how suc h algebras arise . W e first observe that measures in E ( X ) in the images of D ( X ) E ( X ) and U F ( X ) E ( X ) hav e barycenters, if X carries approp riate structure. Lemma 31. Assume X is a con vex compact Hausdorf f space , described via D - and U F -alg ebra struc- tur es cv : D ( X ) → X a nd ch : U F ( X ) → X . T hen: 1. cv ( ϕ ) ∈ X is a bary center of σ ( ϕ ) ∈ E ( X ) , for ϕ ∈ D ( X ) ; 2. ch ( F ) ∈ X is a barycenter of τ ( F ) ∈ E ( X ) , for F ∈ U F ( X ) . Pro of W e write cv [ 0 , 1 ] : D ([ 0 , 1 ]) → [ 0 , 1 ] and ch [ 0 , 1 ] : U F ([ 0 , 1 ]) → [ 0 , 1 ] for the con ve x and compact Hausdorf f structure on the unit interv al. Then for q ∈ A ( X , [ 0 , 1 ]) , q cv ( ϕ ) = cv [ 0 , 1 ] D ( q )( ϕ ) since q is af fine = cv [ 0 , 1 ] ∑ i r i q ( x i ) if ϕ = ∑ i r i x i = ∑ i r i · q ( x i ) = σ ( ϕ )( q ) q ch ( F ) = ch [ 0 , 1 ] U F ( q )( F ) since q is contin uous = τ ( F )( q ) . B. Jacob s & J. Mandemak er 169 W e call a con ve x compact Hausdorf f space X obser vable if the collection of af fine continuous maps X → [ 0 , 1 ] is joi ntly monic. This means that x = x ′ holds if q ( x ) = q ( x ′ ) for all q ∈ A ( X , [ 0 , 1 ]) . In a similar manner we call an E -algebra obse rvab le if its underlyin g con vex compact Hausdorf f space is observ able. This yield s full subcate gories CC H obs ֒ → CC H and Alg obs ( E ) ֒ → Alg ( E ) . By definition, [ 0 , 1 ] is a coge nerator in these catego ries CCH obs and Alg obs ( E ) . Pro position 32. Assume X is a co n vex compact Hau sdorf f spac e, describ ed via D - an d U F -alg ebra struct ur es cv : D ( X ) → X and ch : U F ( X ) → X . 1. V ia the Axiom of Choice one obta ins a function α : E ( X ) → X suc h that α ( h ) ∈ X is a baryc enter for h ∈ E ( X ) ; th at is, q ( α ( h )) = h ( q ) for each q ∈ A ( X , [ 0 , 1 ]) . 2. If X is obse rvable , ther e is pr ecisely one such α : E ( X ) → X ; mor eover , it is an E -alge bra; and its indu ced con vex and topolo gical stru ctur es ar e the original ones on X , as e xpr essed via the commuting tria ngles: D ( X ) / / σ / / cv % % ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ E ( X ) α U F ( X ) o o τ o o ch x x q q q q q q q q q X This yield s a functor CCH obs → Alg obs ( E ) . Pro of Recall from Corollary 27 that the functio n µ ◦ τ ◦ U F ( σ ) : U F ( D ( X )) → E ( X ) is surjecti ve. Using the Axio m of Choice we choose a sectio n s : E ( X ) → U F ( D ( X )) w ith µ ◦ τ ◦ U F ( σ ) ◦ s = id E ( X ) . W e no w obtain, via the choice of s , a map α : E ( X ) → X in: U F ( D ( X )) µ ◦ τ ◦ U F ( σ ) / / / / ch ◦ U F ( cv ) + + E ( X ) α = ch ◦ U F ( cv ) ◦ s s u u X W e sho w that α ( h ) ∈ X is a bar ycenter for the measure h ∈ E ( X ) . For each q ∈ A ( X , [ 0 , 1 ]) one has: h ( q ) = µ ◦ τ ◦ U F ( σ ) ◦ s ( h )( q ) = µ ( τ ◦ U F ( σ ) ◦ s )( h ) ( q ) = τ ◦ U F ( σ ) ◦ s ( h )( e v q ) = ch [ 0 , 1 ] ◦ U F ( ev q ) ◦ U F ( σ ) ◦ s ( h ) = ch [ 0 , 1 ] ◦ U F ( λ ϕ . ev q ( σ ( ϕ ))) ◦ s ( h ) = ch [ 0 , 1 ] ◦ U F ( λ ϕ . cv [ 0 , 1 ] ( D ( q )( ϕ ))) ◦ s ( h ) s ee Remark 3.(1) = ch [ 0 , 1 ] ◦ U F ( cv [ 0 , 1 ] ◦ D ( q )) ◦ s ( h ) = ch [ 0 , 1 ] ◦ U F ( q ◦ cv ) ◦ s ( h ) since q is af fine = q ◦ ch ◦ U F ( cv ) ◦ s ( h ) since q is contin uous = q ◦ α ( h ) = q ( α ( h )) . For the second point, assume the collection of maps q ∈ A ( X , [ 0 , 1 ]) is jointly monic. Baryc enters are then unique, since if both x , x ′ ∈ X satisfy q ( x ) = h ( q ) = q ( x ′ ) for all q ∈ A ( X , [ 0 , 1 ]) , then x = x ′ . 170 The Expectat ion Monad Hence the function α : E ( X ) → X picks barycente rs, in a unique manner . W e need to prov e the algebra equati ons ( see the beg inning of Section 2). They are obtaine d via the barycen tric proper ty q ( α ( h )) = h ( q ) and observ ability . First, the equatio n α ◦ η = id holds, since for each x ∈ X and q ∈ A ( X , [ 0 , 1 ]) , q ( α ◦ η )( x )) = q α ( η ( x )) = η ( x )( q ) = q ( x ) = q id ( x ) . In the same way we obta in the equation α ◦ µ = α ◦ E ( α ) . For H ∈ E 2 ( X ) we hav e: q ◦ α ◦ µ ( H ) = q α ( µ ( H )) = µ ( H )( q ) = H λ k ∈ E ( X ) . k ( q ) = H λ k ∈ E ( X ) . q ( α ( k )) = H q ◦ α = E ( α )( H )( q ) = q α ( E ( α )( H )) = q ◦ α ◦ E ( α ) ( H ) . W e need to sho w that α induce s the original con vexity and topologi cal structu res. Sinc e barycenters are unique , the equations α ( σ ( ϕ )) = cv ( ϕ ) and α ( τ ( F )) = ch ( F ) foll ow directl y from Lemm a 29. Finally , we need to check functo riality . So assume f : X → Y is a map in C CH obs , and let α : E ( X ) → X and β : E ( Y ) → Y be the induce d alg ebras ob tained by picking barycent ers. W e need to prov e β ◦ E ( f ) = f ◦ α . Of course we use that Y is observ able. For h ∈ E ( X ) , one has for all q ∈ A ( Y , [ 0 , 1 ]) , q β ( E ( f )( h ) ) = E ( f )( h )( q ) = h q ◦ f = ( q ◦ f )( α ( h )) = q f ( α ( h )) . In the approach foll owed abov e barycenters are obta ined via the Axiom of Choice. Alternati vely , the y can be obtained via the Hahn-Banac h theorem, see for instance [3, Prop. I.2.1]. Theor em 5. Ther e is an isomorphism Alg obs ( E ) ∼ = CCH obs between the ca te gories of ob servable E - alg ebras and observab le con vex compact Hausdorf f spaces in a situa tion: Alg obs ( E ) _ ∼ = 1 1 CCH obs q q _ Alg ( E ) full & faith ful / / CCH Pro of Obviousl y the full a nd faith ful functor Alg ( E ) → CCH from L emma 2 9 restric ts to Alg obs ( E ) → CCH obs . W e need to sho w that it is an in vers e to the functor CCH obs → Alg obs ( E ) from Proposi- tion 32.(2). • Starting from an algebra α : E ( X ) → X , we know by Propositio n 30 that α ( h ) is a barycente r for h ∈ E ( X ) . The underl ying set X is an obs erv able con vex compact Hausdorf f space. This structure gi ves by Proposition 32. (2) rise to an algebra α ′ : E ( X ) → X such that α ′ ( h ) is barycenter for h . Since X is observ able, barycenters are unique, and so α ′ ( h ) = α ( h ) . B. Jacob s & J. Mandemak er 171 • Starting from an observ able con ve x compact Hau sdorf f spac e X , w e obtain a n alg ebra α : E ( X ) → X by Proposition 32.(2), whose induced con vex and topol ogical structure is the original one. Thus we ha ve charac terized observab le E -algebras. The chara cterizatio n of arbit rary E -algebras remains op en. Possibl y the functo r Alg ( E ) → CCH is (also) an iso morphism. For the dua lity in th e next sectio n the characteri zation of observ able algebras is sufficien t. W e conclude this section with some furth er results on o bserv ability . W e show that ob servable con vex compact Hausdorf f spaces can be considered as part of an en vel oping locally con vex topolo gical vector space. This is the m ore common way o f describing such structures, see e.g. [3, 4]. Lemma 33. L et X be a con vex compact Hausdorf f space ; write A = A ( X , [ 0 , 1 ]) . If X is obse rvable , ther e is (by definition ) an injectio n: X / / x 7→ e v x / / [ 0 , 1 ] A wher e e v x = λ q ∈ A . q ( x ) . 1. This map is both af fine and continuo us—wher e [ 0 , 1 ] A carrie s the pr oduct topolog y . 2. Hence i f X is the ca rrier of an E -alg ebra , this map i s a homomorp hism of alge bras—whe r e [ 0 , 1 ] A carrie s the E -algebr a structur e fr om Lemma 28. Pro of The second point follo ws fro m the first one via Lemm a 29, so we only do point 1. Obviou sly , x 7→ ev x is affine. In order to see that it is also continu ous, assume we hav e a basic open set U ⊆ [ 0 , 1 ] A . The product topolo gy says that U is of the form U = ∏ q ∈ A U q , with U q ⊆ [ 0 , 1 ] open and U q 6 = [ 0 , 1 ] for only finitely many q ’ s, say q 1 , . . . , q n . Thus: e v − 1 ( U ) = { x | q 1 ( x ) ∈ U q 1 ∧ · · · ∧ q n ( x ) ∈ U q n } = T i q − 1 i ( U q i ) . This intersec tion of opens is clearly an open set of X . Pro position 34. Each observ able con vex compact Hausdorf f space X ∈ CCH obs occur s as subspace of a locall y con ve x topolo gical vector space , namely via: X / / / / [ 0 , 1 ] A / / R A wher e A = A ( X , [ 0 , 1 ]) like in the pr evious lemma. Pro of It is standard that the vector space R A with product topol ogy is locally con vex. W e write O ( X ) for the original compact Hausdorf f topology on X and O i ( X ) for the topolo gy indu ced by the injection X R A . The latter contai ns basic opens of the form q − 1 1 ( U 1 ) ∩ · · · ∩ q − 1 n ( U n ) for q i ∈ A = A ( X , [ 0 , 1 ]) and U i ⊆ R open. Thus O i ( X ) ⊆ O ( X ) . W e wish to use L emma 2 to prov e the equality O i ( X ) = O ( X ) . Since O ( X ) is compac t we only need to sh ow that the in duced top ology O i ( X ) is H ausdor ff. T his is easy since X is observ able: if x 6 = x ′ for x , x ′ ∈ X , then there is a q ∈ A ( X , [ 0 , 1 ]) with q ( x ) 6 = q ( x ′ ) in [ 0 , 1 ] ⊆ R . Hence there are disjoint opens U , U ′ ⊆ R with q ( x ) ∈ U and q ( x ′ ) ∈ U ′ . Thus q − 1 ( U ) , q − 1 ( U ′ ) ∈ O i ( X ) are disjoin t (induced) opens containin g x , x ′ . 8 Algebras of the expectation monad and effect modules In this secti on we relate algebra s of the expe ctation m onad to ef fect modules via a (dua l) adjunctio n. By suitab le restriction this adjunc tion gi ves rise to an equi vale nce (duality) between observ able E -algebras 172 The Expectat ion Monad and Banach effect modules . V ia a combinati on with Theorem 5 we then get our main duality result (see Theorem 6 belo w ). W e first return to Section 2.4. When w e apply L emma 4 to the adjunctio ns in volv ing con vex sets and eff ect module s in Diagram (8), the (upper) comparison functor in (7 ) says that each effect module M ∈ EMod giv es rise to a E -algebra on the homset EMod ( M , [ 0 , 1 ]) , namely: E EMod ( M , [ 0 , 1 ]) α M / / EMod ( M , [ 0 , 1 ]) h ✤ / / λ y ∈ M . h λ k ∈ EMod ( M , [ 0 , 1 ]) . k ( y ) (14) In order to simply notatio n w e write: S M = EMod ( M , [ 0 , 1 ]) for the set of “states” of M α M ( h )( y ) = h ( ev y ) where e v y = λ k . k ( y ) . Thus, Diagram (7) becomes: EMod op S ( − ) ' ' ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ S ( − ) / / Alg ( E ) ( − ) ◦ σ x x q q q q q q q q Alg ( D ) = Con v Sets (15) Pro position 35. Conside r for an effec t module M , the E -algeb ra structu r e (14) on the homset of states S M = E Mod ( M , [ 0 , 1 ]) . 1. The induc ed topolo gy is like the weak-* topolo gy , with subbasic opens s ( y ) = { g ∈ S M | g ( y ) < s } , wher e y ∈ M and s ∈ [ 0 , 1 ] ∩ Q . It thus gen eraliz es the topolo gy on E ( X ) = EMod ([ 0 , 1 ] X , [ 0 , 1 ]) in Pr oposition 19. 2. This con ve x compact Hausdorf f space EMod ( M , [ 0 , 1 ]) is obser vable. Hence the states functor S ( − ) at the top of (15) r estricts to E Mod op → Alg obs ( E ) . Pro of The proof of P roposi tion 19 generalizes directly from an effec t module of the form [ 0 , 1 ] X to an arbitra ry effect modu le M . Next suppose f , g ∈ S M = EMod ( M , [ 0 , 1 ]) satisfy q ( f ) = q ( g ) for each affine continuo us q : S M → [ 0 , 1 ] . This appli es espec ially to the functions ev y = λ k . k ( y ) , which are both continuo us and affine. Hence f ( y ) = e v y ( f ) = ev y ( g ) = g ( y ) for each y ∈ M , and thus f = g . W e can also form a functor Alg ( E ) → EMod op , in the rev erse direction in (15), by “homming” into the unit inter val [ 0 , 1 ] . Recall that this interv al carries an E -algeb ra, identi fied in L emma 28 as ev aluation- at-iden tity ev id . For an algebra α : E ( X ) → X we kno w that the algebra homomorphis ms X → [ 0 , 1 ] are precis ely the af fine continuo us maps X → [ 0 , 1 ] , by L emma 29. W e shall be a bit slopp y in our notation B. Jacob s & J. Mandemak er 173 and wri te th e homse t Alg ( E )( α , ev id ) = { q : X → [ 0 , 1 ] | q ◦ α = e v id ◦ E ( q ) } of algebras map in v arious ways, namely as: Alg ( E )( α , [ 0 , 1 ]) leav ing the algebr a struct ure e v id on [ 0 , 1 ] implicit, Alg ( E )( X , [ 0 , 1 ]) also leav ing the algebra structure α on X imp licit, A ( X , [ 0 , 1 ]) as set of af fine continuo us functio ns, via Lemma 29. Pro position 36. The states fun ctor S ( − ) = EMod ( − , [ 0 , 1 ]) : EMod op → Alg ( E ) fr om (15) has a left adjoin t, also given by “ homming into [ 0 , 1 ] ”: EMod op S ( − ) = EMod ( − , [ 0 , 1 ]) , , ⊤ Alg ( E ) Alg ( E )( − , [ 0 , 1 ]) l l Pro of Assume an E -algeb ra α : E ( X ) → X . W e should first check that the set of af fine continu ous func- tions is a sub-ef fect module: Alg ( E )( α , [ 0 , 1 ]) = A ( X , [ 0 , 1 ]) ֒ → [ 0 , 1 ] X . The top and bottom elements 1 = λ y . 1 and 0 = λ y . 0 are clearly in A ( X , [ 0 , 1 ]) . Also, A ( X , [ 0 , 1 ]) is closed under (partial) sums > and scalar multiplicatio n with r ∈ [ 0 , 1 ] . Ne xt, if w e hav e a m ap of algebras g : X → Y , from E ( X ) α → X to E ( Y ) β → Y . Then we get a map of ef fect m odules g ∗ = ( − ) ◦ g : A ( X , [ 0 , 1 ]) → A ( Y , [ 0 , 1 ]) . This is easy because g is itself af fine and continu ous, by Lemma 29. W e come to the a djunction Alg ( E )( − , [ 0 , 1 ]) ⊣ EMod ( − , [ 0 , 1 ]) . For M ∈ EM od and ( E ( X ) α → X ) ∈ Alg ( E ) the re is a bijecti ve corresp ondence: E ( X ) α E ( f ) / / E ( S M ) α M X f / / S M = = = = = = = = = = = = = = = = = = = = M g / / Alg ( E )( α , [ 0 , 1 ]) = A ( X , [ 0 , 1 ] W e proceed as follo ws. • Gi ven an alg ebra map f : X → S M = EM od ( M , [ 0 , 1 ]) as indicated , define f : M → A ( X , [ 0 , 1 ]) by f ( y )( x ) = f ( x )( y ) . W e lea ve it to the reader to check that f is a map of ef fect m odules , b ut we do ver ify that f ( y ) is an alg ebra m ap X → [ 0 , 1 ] ; so for h ∈ E ( X ) , e v id ◦ E ( f ( y )) ( h ) = E ( f ( y ) )( h )( id ) = h ( id ◦ f ( y )) = h ( f ( y )) = h λ x . f ( x )( y ) = h ( λ k . k ( y )) ◦ f = E ( f )( h ) λ k . k ( y ) = α M E ( f )( h ) ( y ) = f α ( h ) ( y ) since f is an algebra map = f ( y ) ◦ α ( h ) . 174 The Expectat ion Monad • No w assume we hav e a m ap of ef fect module s g : M → Alg ( E )( α , [ 0 , 1 ]) = A ( X , [ 0 , 1 ]) . W e turn it into a m ap of algebras g : X → S M , again by twisting ar guments: g ( x )( y ) = g ( y )( x ) . V ia calcul ations as abov e one checks that g is a map of algebras . Clearly f = f and g = g . Let’ s write the unit and counit of this adjunction as η ⊣ and ε ⊣ , in order make a distinctio n with the unit η of the monad E , see belo w . The unit and coun it are maps: X η ⊣ / / EMod Alg ( E )( α , [ 0 , 1 ]) , [ 0 , 1 ] in Alg ( E ) Alg ( E ) EMod ( M , [ 0 , 1 ]) , [ 0 , 1 ] ε ⊣ / / M in EMod op both gi ven by poin t ev aluation: η ⊣ ( x ) = λ f ∈ A ( X , [ 0 , 1 ]) . f ( x ) ε ⊣ ( y ) = λ g ∈ E Mod ( M , [ 0 , 1 ]) . g ( y ) (16) The uni t of th is adjunct ion is rela ted to the unit of the m onad E , written ex plicitly as η E in th e follo w ing way . EMod A ( X , [ 0 , 1 ]) , [ 0 , 1 ] X η ⊣ 1 1 ❝ ❝ ❝ ❝ ❝ ❝ ❝ ❝ ❝ ❝ ❝ η E - - ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ ❬ E ( X ) = EMod [ 0 , 1 ] X , [ 0 , 1 ] O O Lemma 37. Consid er the unit η ⊣ in (16 ) of the adju nction fr om P r oposition 36, at an algeb ra E ( X ) α → X . 1. This unit is inje ctive if and only if X is o bservabl e. 2. In fact, it is an isomor phism if and only if X is obs ervable . Hence the adjunctio n Alg ( E ) ⇆ EMod op fr om Pr oposition 36 r estric ts to a cor eflection Alg obs ( E ) ⇆ EMod op . Pro of The first statement holds by definition of ‘observ able’. So for the se cond state ment it suffices to assume that X is obser vab le and sho w tha t η ⊣ : X EMod A ( X , [ 0 , 1 ]) , [ 0 , 1 ] is surjec tiv e. This unit is by con struction affine and c ontinuou s. Hence it s image in the space EMod A ( X , [ 0 , 1 ]) , [ 0 , 1 ] is compact, and thus closed. W e are done if η ⊣ is dense. Thus we assume a non-empty open set U ⊆ EMod A ( X , [ 0 , 1 ]) , [ 0 , 1 ] and need to prov e that there is an y ∈ X with η ⊣ ( y ) ∈ U . By P roposit ion 35 we may assume U = s 1 ( q 1 ) ∩ · · · ∩ s n ( q n ) , for q i ∈ A ( X , [ 0 , 1 ]) and s i ∈ [ 0 , 1 ] ∩ Q . Thus w e may assume a map of effect modules h : A ( X , [ 0 , 1 ]) → [ 0 , 1 ] inh abiting all these ’ s. Hence h ( q i ) < s i . Since ι : A ( X , [ 0 , 1 ]) ֒ → [ 0 , 1 ] X is a sub-e ffec t module, by extens ion, see Propositio n 14, we get a map of effe ct modules h ′ : [ 0 , 1 ] X → [ 0 , 1 ] with h ′ ◦ ι = h . Thus, we can tak e the in verse image of the open set U along the contin uous map: E ( X ) = EMod [ 0 , 1 ] X , [ 0 , 1 ] ( − ) ◦ ι / / EMod A ( X , [ 0 , 1 ]) , [ 0 , 1 ] The result ing open set is: V def = ( − ) ◦ ι − 1 ( U ) = { k ∈ E ( X ) | k ◦ ι ∈ U } = { k ∈ E ( X ) | ∀ i . k ( ι ( q i )) < s i } . B. Jacob s & J. Mandemak er 175 This subse t V ⊆ E ( X ) c ontains h ′ and is th us non-empty . Since σ : D ( X ) E ( X ) is dense, by Propo si- tion 26, there is a distrib ution ϕ = ( ∑ j r j x j ) ∈ D ( X ) with σ ( ϕ ) ∈ V . W e take x = ∑ j r j x j ∈ X to be the interp retation of ϕ in X , using that X is con ve x. W e claim η ⊣ ( x ) ∈ U . Indeed, η ⊣ ( x ) ∈ s ( q i ) , for each i , since: η ⊣ ( x )( q i ) = q i ( x ) = q i ( ∑ j r j x j ) = ∑ j r j · q i ( x j ) sinc e q i : X → [ 0 , 1 ] is affine = σ ( ϕ )( ι ( q i )) < s i since σ ( ϕ ) ∈ V . W e turn to the counit (16) of the adjunctio n in Propositio n 36. Lemma 38. F or an ef fect module M consider the counit ε ⊣ : M → A ( S M , [ 0 , 1 ]) , wher e, as befor e, S M = E Mod ( M , [ 0 , 1 ]) is the con vex compact Hausdorf f space of states. 1. The ef fect module A ( S M , [ 0 , 1 ]) is “Banach ”, i.e. complete . 2. The couni t map ε ⊣ is a dens e embedding of M into this Banac h effe ct module A ( S M , [ 0 , 1 ]) . 3. Hence it is an isomorp hism if and only if M is a Banach ef fect module. Pro of Completeness of A ( S M , [ 0 , 1 ]) is inheri ted from [ 0 , 1 ] , since its norm is the supremum norm, like in Example 4. For the second point we use the corres ponding resul t for order unit spaces, via the equiv alence ˆ T o : AEMod ≃ − → OU S from Proposition 9. If ( V , u ) is an order unit space then it is well kno wn (see [4]) that the ev aluation map θ : V → A ( S , R ) is a dense embeddi ng. Here S = OUS ( V , R ) is the state space of V . Howe ver i f we take V to be the totaliz ation ˆ T o ( M ) of M , then θ is preci sely ˆ T o ( ε ⊣ ) , sinc e: ˆ T o ( M ) = V / / dense θ / / A ( S , R ) = A OUS ( V , R ) , R ∼ = A EMod ( M , [ 0 , 1 ]) , R ∼ = ˆ T o A EMod ( M , [ 0 , 1 ] , [ 0 , 1 ]) . and both θ and ˆ T o ( ε ⊣ ) a re the ev aluatio n map. For the third point, one direc tion is easy: if the couni t is an isomorphism, then M is isomorphic to the co mplete ef fect modul e A S M , [ 0 , 1 ]) , and thus comple te itself. In the other di rection, denseness of M A S M , [ 0 , 1 ]) means that each h ∈ A S M , [ 0 , 1 ]) can be express ed as limit h = lim n ε ⊣ ( x n ) of elements x n ∈ M . But if M is complete, the re is alrea dy a limit x = lim n x n ∈ M . Hence ε ⊣ ( x ) = h , making ε ⊣ an isomorphi sm. Combining lemmas 38 and 37 gi ves us the main result of this paper . Theor em 6. The adjuncti on Alg ( E ) ⇆ EMod op fr om Pr opositio n 36 res tricts to a duality Alg obs ( E ) ≃ BEMod op between observa ble E -algebr as and B anac h effec t modules. In combination with Theor em 5 we obtain : CCH obs ∼ = Alg obs ( E ) ≃ BEMod op . This result can be seen as a probabilist ic version of fundamental results of Manes (Theorem 1) and Gelfan d (Theorem 2). 176 The Expectat ion Monad 9 A new f ormulation of Gleason’ s theorem Gleason’ s theorem in quantu m mechanic s says that ev ery state on a Hilbert space of dimension three or greate r corresp onds to a density matrix [17]. In this section we introduc e a reformulat ion of Gleason’ s theore m, and prov e the equi va lence via Banach ef fect m odules (esp. Lemma 38). This ref ormulation says that effe cts are the free effect m odule on projections. In formulas: Ef ( H ) ∼ = [ 0 , 1 ] ⊗ Pr ( H ) , for a Hilbert space H . Gleason’ s th eorem is not easy to pro ve (see e.g . [14]). Ev en proofs using elementary methods are quite in volv ed [12]. A state on a Hilbert space H is a certain probability distrib ution on the projections Pr ( H ) of H . These project ions Pr ( H ) form an orthomodular lattic e, and thus an ef fect algebra [15, 21]. In our curr ent cont ext these are e xactly the ef fect algebra maps Pr ( H ) → [ 0 , 1 ] . So Gleason’ s (origin al) theorem states: EA Pr ( H ) , [ 0 , 1 ] ∼ = DM ( H ) . (17) This isomorphism, from right to left, sends a density m atrix M to the map p 7→ tr ( M p ) —where tr is the trace map acting on opera tors. Recall that Ef ( H ) is the set of po siti ve operators on H bel ow the identity . It is a B anach ef fect module. One can also consider the ef fect module m aps Ef ( H ) → [ 0 , 1 ] . For these maps there is a “light weight” version of Gleason’ s theorem: EMod Ef ( H ) , [ 0 , 1 ] ∼ = DM ( H ) . (18) This isomorphis m in v olves the same trace computation as (17). T his statement is significantl y easier to pro ve than Gleason’ s theorem itself, see [11]. Because Gleason’ s ori ginal theor em (17) is so much harder to p rov e th an th e lig htweight v ersion (18) one could won der what Gleason’ s theorem states that Gleason light doesn ’t. In Theore m 7 we will sho w that the dif ference amounts exactly to the statemen t: [ 0 , 1 ] ⊗ Pr ( H ) ∼ = Ef ( H ) , (19) where ⊗ is the tenso r of ef fect algebra s (see [21]). A general result, see [29, VII, § 4], sa ys that the tensor produ ct [ 0 , 1 ] ⊗ Pr ( H ) is the free ef fect module on Pr ( H ) . The follo w ing table giv es an ov ervie w of the var ious formulations of G leason ’ s theorem. Description For mulation Label origin al Gleason, for project ions EA Pr ( H ) , [ 0 , 1 ] ∼ = DM ( H ) (17) lightweig ht version , for ef fects EMod Ef ( H ) , [ 0 , 1 ] ∼ = DM ( H ) (18) ef fects as free module on projec tions [ 0 , 1 ] ⊗ Pr ( H ) ∼ = Ef ( H ) (19) In this section we shall prov e (17) ⇐ ⇒ (19), in presence of (18), see T heorem 7. Since (17) is true, for dimensio n ≥ 3, the same then holds for (19). W e first prov e a general result based on the duality from th e previ ous sect ion. T here we used the shorth and S M for the algebra of states EMod ( M , [ 0 , 1 ]) . W e no w ext end this notation to ef fect algebras B. Jacob s & J. Mandemak er 177 and write S D = E A ( D , [ 0 , 1 ]) , w here D is an eff ect algebra . W e recal l from S ection 3 that S D is a con vex set. W e will topol ogize it via the weakest topolo gy that makes all point e val uations continuo us. Since the te nsor product [ 0 , 1 ] ⊗ D of effe ct algebras is the free effect module on D it follows that there is an isomorphi sm: EA D , [ 0 , 1 ] ∼ = d ( − ) / / EMod [ 0 , 1 ] ⊗ D , [ 0 , 1 ] with b f ( s ⊗ x ) = s · f ( x ) S D S [ 0 , 1 ] ⊗ D (20) Lemma 39. The mapp ing d ( − ) : S D ∼ = − → S [ 0 , 1 ] ⊗ D in (20) is an af fine homeomorphi sm. Pro of W e only sho w that d ( − ) is a homeomorphism. For an arbitrary element > i r i ⊗ x i ∈ [ 0 , 1 ] ⊗ D we ha ve in [ 0 , 1 ] , b f > i r i ⊗ x i = ∑ i r i · f ( x i ) . Since the maps f 7→ f ( x i ) are continuo us by definition of the topolo gy on S D , and since addition a nd mul- tiplica tion on [ 0 , 1 ] are continuous , it follo w s that f 7→ b f > i r i ⊗ x i is continuous . H ence by definitio n of the topolog y on S [ 0 , 1 ] ⊗ D we see that the mappin g d ( − ) is contin uous. Similarly , the in verse , say written as g ( − ) : S [ 0 , 1 ] ⊗ D → S D , is continuous . It is gi ven by e k ( x ) = k ( 1 ⊗ x ) . Continui ty again follo ws from the definition of the topolo gy on S [ 0 , 1 ] ⊗ D . Lemma 40. Suppose f : D → E is an effec t alge bra m ap between an ef fect a lgebr a D and a B anac h ef fect module E suc h that the following hold. • The induc ed map b f : [ 0 , 1 ] ⊗ D → E is surje ctive—obta ined like in (20) as b f ( s ⊗ x ) = s • f ( x ) . • The “pr ecompose with f ” map − ◦ f : S E → S D is a homeomor phism. The map b f is the n an isomorph ism between [ 0 , 1 ] ⊗ D and E . Pro of Using Lemma 38, there are for the Banach ef fect m odule E and for the (free) ef fect module [ 0 , 1 ] ⊗ D , m aps ε E and φ D in: E ε E ∼ = / / A S E , [ 0 , 1 ] [ 0 , 1 ] ⊗ D / / ε [ 0 , 1 ] ⊗ D dense / / φ D , , A S [ 0 , 1 ] ⊗ D , [ 0 , 1 ] ∼ = h 7→ h ( d ( − )) A S D , [ 0 , 1 ] The operat ion d ( − ) o n the right is as in (20). W e cla im that the follo wing diagram commutes. [ 0 , 1 ] ⊗ D / / dense φ D / / b f A S D , [ 0 , 1 ] ∼ = k 7→ k ( −◦ f ) E ε E ∼ = / / A S E , [ 0 , 1 ] If this is indeed true the map b f is an embedding follo wed by two isomorphism and there fore injecti ve (and thus an isomorphism). T o prove the cl aim, we assume > i r i ⊗ x i ∈ [ 0 , 1 ] ⊗ D and g ∈ S E and c ompute 178 The Expectat ion Monad first the east-so uth direction: ( λ k . k ( − ◦ f )) ◦ φ D > i r i ⊗ x i ( g ) = φ D > i r i ⊗ x i ( g ◦ f ) = ε [ 0 , 1 ] ⊗ D > i r i ⊗ x i \ ( g ◦ f ) = \ ( g ◦ f ) > i r i ⊗ x i = ∑ i r i · g ( f ( x i )) = g > i r i • f ( x i ) since g is af fine = g b f > i r i ⊗ x i = ε E b f > i r i ⊗ x i ( g ) = ε E ◦ b f > i r i ⊗ x i ( g ) . As a consequen ce we obtain the isomorph ism (19). W e w ill sho w nex t that it is equi val ent to Glea- son’ s (original) theorem. Theor em 7. (17) ⇐ ⇒ (19) , in pr esence of (18) . That is, using Gleason light (18 ) the follo wing statements ar e equivalen t. (17) : EA ( Pr ( H ) , [ 0 , 1 ]) ∼ = DM ( H ) , i.e. Gleas on’ s origin al theor em; (19) : The canoni cal map [ 0 , 1 ] ⊗ Pr ( H ) → Ef ( H ) is an iso morphism. Pro of Assuming [ 0 , 1 ] ⊗ Pr ( H ) ∼ = − → Ef ( H ) we get Gleason’ s theorem: EA Pr ( H ) , [ 0 , 1 ] ∼ = EMod [ 0 , 1 ] ⊗ Pr ( H ) , [ 0 , 1 ] by freen ess ∼ = EMod Ef ( H ) , [ 0 , 1 ] by assu mption ∼ = DM ( H ) by Gleaso n light (18). In the o ther direction a ssume S Pr ( H ) = EA ( Pr ( H ) , [ 0 , 1 ]) ∼ = DM ( H ) . W e apply the pre vious lemma to the inclusio n f : Pr ( H ) ֒ → Ef ( H ) . T hen indeed : • the induced map b f : [ 0 , 1 ] ⊗ P r ( H ) → Ef ( H ) is surje ctiv e: each effect A ∈ E f ( H ) can be written as con vex combinatio n of projectio ns A = ∑ i r i P i , via the spectr al theorem. • the pre compositio n − ◦ f : S Ef ( H ) → S Pr ( H ) is an isomorph ism since: S Ef ( H ) (18) ∼ = DM ( H ) (17) ∼ = S Pr ( H ) . Since both these isomorphisms in vo lve the same trace computation, this i somorphism is in fact the map induc ed by the inclusion f : Pr ( H ) ֒ → Ef ( H ) . Thus the conditio ns of L emma 40 are met and so [ 0 , 1 ] ⊗ Pr ( H ) ∼ = Ef ( H ) . 10 The expectation monad f or pr ogram sema ntics This paper uses the expect ation monad E ( X ) = EM od ([ 0 , 1 ] X , [ 0 , 1 ]) in characteriz ation and duality re- sults for con ve x compa ct Hausdo rff spaces. Elements of E ( X ) are ch aracterize d as (finitely additi ve) measures (see esp. Theore m 4). The way the monad E is defined , via the adjun ction Sets ⇆ EMod op , is ne w . This approac h deals effec tiv ely with the rather subtle preserv ation properties for maps h ∈ E ( X ) = B. Jacob s & J. Mandemak er 179 EMod ([ 0 , 1 ] X , [ 0 , 1 ]) , namely preserv ation of the structur e of ef fect modules (with non-e xpansi veness, and thus continui ty , as consequ ence, see Lemma 10). Measures hav e bee n cap tured via monads before, first by Giry [16] follo w ing id eas o f La wvere. Such a description in terms of monads is useful to provide semantics for probabi listic p rograms [26, 23, 30, 31]. The term ‘e xpectat ion monad’ seems to occu r first in [33], where it is formali zed in Haskell. Such a formaliza tion in a funct ional language is only partial, becau se the rele vant equatio ns and restri ctions are omitted , so that ther e is not real ly a dif ference w ith th e continuat ion monad X 7→ [ 0 , 1 ] ([ 0 , 1 ] X ) . A formaliza tion of what is also called ‘expecta tion monad’ in the theorem prov er Coq occurs in [5] and is more informati ve. It in vo lves maps h : [ 0 , 1 ] X → [ 0 , 1 ] which are required to be monotone , co ntinuous , linear (preserv ing par tial s um > and scalar multiplicati on) and compatib le with in verses—meani ng h ( 1 − p ) ≤ 1 − h ( p ) . This comes very close to the notion of homomorphism of ef fect module t hat is use d here, b ut effe ct modules themselv es are not mentioned in [5]. This Coq formalizat ion is used for instance in the semantics of game-based programs for the certification of cryptograph ic proof s in [9] (see [34] for an over vie w of this line of work). Finally , in [25] a m onad is used of maps h : [ 0 , 1 ] X → [ 0 , 1 ] that are (Scott) contin uous and sublinear — i.e. h ( p > q ) ≤ h ( p ) > h ( q ) , and h ( r · p ) = r · h ( p ) . The definition E ( X ) = E Mod ([ 0 , 1 ] X , [ 0 , 1 ]) of the expect ation monad that is us ed here has good creden tials to be the right definition, because: • The mona d E arises in a systematic (not ad hoc ) manner , namely via the comp osable adjunc- tions (8). • The sets E ( X ) as defined here form a stable collec tion, in the sense that its elements can be char - acteriz ed in sev eral other ways, namely as finitely additi ve measures (T heorem 4) or as maps of partial ly ordered vector spac es with strong unit (via Proposition 5, see Remark 2 (3)). • Its (observ able) algebras correspond to well-beh av ed mathematical structures (con vex compact Hausdorf f spaces), via the isomorphis m Alg obs ( E ) ∼ = CCH obs in Theorem 5. • There is a dual equi v alence Alg obs ( E ) ≃ BEMod op that can be exploit ed for program logics, see [13]. It is thus worth while to systematic ally dev elop a program semantics and logic based on the exp ec- tation monad and its duality . This is a project on its own. W e conclude by ske tching some ingred ients, focusi ng on the program constructs that can be used. First we include a small exampl e. Suppose we ha ve a set of states S = { a , b , c } with probabil istic transit ions between them as described on the left below . a 1 2 } } ③ ③ ③ ③ ③ ③ ③ 1 2 ! ! ❈ ❈ ❈ ❈ ❈ ❈ ❈ b 2 3 / / 1 3 < < c 1 b b S / / D ( S ) a ✤ / / 1 2 b + 1 2 c b ✤ / / 1 3 b + 2 3 c c ✤ / / 1 c On the right is the same system descri bed as a functi on, namely as coalgebra of the distrib ution monad D . It maps each state to the corresp onding di screte probab ility dis trib ution. W e can also descr ibe th e same system as coalgeb ra S → E ( S ) of the expec tation monad, via the map D E . Then it looks as 180 The Expectat ion Monad follo w s: S / / E ( S ) a ✤ / / λ q ∈ [ 0 , 1 ] S . 1 2 q ( b ) + 1 2 q ( c ) b ✤ / / λ q ∈ [ 0 , 1 ] S . 1 3 q ( b ) + 2 3 q ( c ) c ✤ / / λ q ∈ [ 0 , 1 ] S . q ( c ) Thus, via the E -monad we obtain a probabili stic continuatio n style semantics. Let’ s consider this from a more general perspecti ve. Assume w e now hav e an arbitra ry , unspecified set of states S , for which we consider programs as functi ons S → E ( S ) , i.e. as Kle isli endomaps or as E - coalge bras. In a standard way th e monad structure pro vides a monoid struct ure on these maps S → E ( S ) for sequential compositio n, with the unit S → E ( S ) as neutra l element ‘skip’. W e briefly sk etch some other algebra ic structure on such programs (coalgebras) , see also [31]. Programs S → E ( S ) are closed under con vex combinations : if we ha ve programs P 1 , . . . , P n : S → E ( S ) an d probabil ities r i ∈ [ 0 , 1 ] with ∑ i r i = 1, then we c an form a ne w progra m P = ∑ i r i P i : S → E ( S ) . For q ∈ [ 0 , 1 ] S , P ( s )( q ) = ∑ i r i · P i ( s )( q ) . Since the sets S → E ( S ) carries a pointwise order with supre ma o f ω -chain s we can also gi ve meaning to iteration const ructs like ‘while’ and ’for . . . do’. Further we can also do “probabili stic assignment”, written for instance as n : = ϕ , w here n is a v ariable, say of integer type int , and ϕ is a distrib ution of type D ( int ) . The intended meaning of such an assignment n : = ϕ is that after wards the vari able n has v alue m : i nt with probability ϕ ( m ) ∈ [ 0 , 1 ] . In order to model this we assume an update function upd n : S × int → S , which we lea ve un specified (similar functions exist for other var iables). The interpr etation [ [ n : = ϕ ] ] of the probabi listic assignment is a function S → E ( S ) , defined as follo w s. [ [ n : = ϕ ] ]( s ) = E up d n ( s , − ) σ ( ϕ ) = λ q ∈ [ 0 , 1 ] S . ∑ i r i · q ( up d n ( m i )) , if ϕ = ∑ i r i m i . It ap plies the functo r E to the function up d n ( s , − ) : i nt → S and uses t he natur al transformatio n σ : D ⇒ E from (6). Refer ences [1] S. Abram sky & B. Coecke ( 2004) : A categorical semantics of quantu m pr otocols . In: Logic in Compu ter Science , IEEE, Computer Science Press, pp. 415–425 , d oi:10.1 109/LI CS.2004.1319636 . [2] S. Abramsky & B. Coecke (2 009) : A cate gorical semantics o f quantum pr otocols . In K. Engesser, Dov M. Gabbai & D. Lehmann , editors: Handbo ok of Quantum Logic and Quan tum Stru ctures , North Holland, Elsevier , Computer Science Press, pp. 261–3 23. [3] E.M. Alfsen ( 1971) : Compact Conve x Sets and Bou ndary Integr als . Ergebnisse der Mathem atik un d ihrer Grenzgeb iete 57, Springe r . [4] L. Asimow & A.J. Ellis (198 0): Conve xity Theory and its App lications in Fu nctional Ana lysis . Academic Press, New Y ork. [5] P . Audebaud & C. Paulin-Moh ring (2009 ): Pr oo fs of rando mized algorithms in Coq . Science of Comput. Progr . 74(8) , pp. 568–589, doi:10. 1016/j. scico.200 7.09.002 . B. Jacob s & J. Mandemak er 181 [6] J. Baez & M. Stay (2011 ): Physics, topology , logic and compu tation: a Rosetta Stone . New structures for physics , pp. 95–17 2doi:10 .100 7/978-3-642-12821-9 2. [7] H.P . Barendregt (1984): The Lambda Calculus. I ts Syntax an d Semantics , 2 nd rev . edition. No rth-Hollan d, Amsterdam. [8] M. B arr & Ch. W ells (1985): T oposes, T riples an d Theories . Spring er , Berlin. Revised and corrected version av ailable from URL: www.cw ru.ed u/artsci/math/wells/pub/ttt.html . [9] G. Barthe, B. Gr ´ egoir e & S. Zanella B ´ eguelin ( 2009 ): F ormal certification of cod e-based cryptographic pr o ofs . In: Principles of Program ming Langu ages , A CM Press, pp. 90–10 1, doi:10.1145/1 480881.1480894 . [10] F . Borceu x (1994): Handbook of Cate g orical Algebra . Encyclopedia of Mathematics 50, 51 and 52 , Cam- bridge Univ . Press, doi:10 .1017 /CBO978051 1525858 . [11] P . Busch (2003): Quantum states and gene ralized observab les: a simple p r oo f of Gleason’s theor e m . Phys. Re view Letters 91(12 ):1204 03, pp. 1–4, doi:10. 1103/Ph ysRevLett.91.120403 . [12] R. Cookea, M. K eanea & W . Morana (1985): Stably con tinuou s frames . Math. Proc. Cambridge Phil. Soc. 98, pp. 117–1 28. [13] E. D’Hon dt & P . Panangaden (2006): Qua ntum weakest pr econditio ns . Math. Stru ct. in Comp. Sci. 16(3) , pp. 429– 451, doi:10.1017 /S0960129506005 251 . [14] A. Dvure ˇ censkij (1992) : Glea son’s Theo r em and Its Application s . Mathematics and its Applicatio ns 60, Kluwer Acad. Publ., Dordrech t. [15] A. Dvure ˇ censkij & S. Pulman nov ´ a (2 000): New T r ends in Qua ntum Structur es . Kluwer Acad. Publ., Dor- drecht. [16] M. Giry (1982 ): A categorical appr oa ch to pr o bability theo ry . In B. Banaschewski, editor: Cat- egorical Aspects of T opolo gy and Analysis , Lect. Notes Math. 915, Spr inger, Berlin , pp . 68–8 5, doi:10.1 007/BFb0 092872 . [17] A. Gleason (1957 ): Measures on the closed subspaces of a Hilbert sp ace . Journ. Math. Mech. 6, p p. 885– 893. [18] S. Gud der (1 998): Morphisms, tensor pr oducts an d σ -effect algebras . Reports on Math. Phys. 42, pp. 321– 346, doi:10.1 016/S00 34-487 7(99)80003-2 . [19] B. Jacobs (2010) : Con v exity , dua lity , and effects . In C.S. Calude & V . Sassone, edito rs: IFIP Theo- retical Computer Science 2010 , IFIP Adv . in Inf . and Comm. T ech n. 82(1) , Springer , Boston, pp. 1– 19, doi:10.1 007/9 78-3-642- 15240-5 1. [20] B. Jacobs ( 2011 ): Pr ob abilities, Distrib ution Monad s, and Conve x Cate g ories . Theor . Comp . Sci. 412(2 8), pp. 3323 –333 6, doi:1 0.101 6/j.tcs.201 1.04.005 . [21] B. Jacob s & J. Mand emaker (2012): Cor efl ections in Algebraic Quantum Logic . Found. of Physics From: Quantum Physics and Logic (QPL) 2010. [22] P .T . Johnstone (198 2): Stone Spa ces . Cambridge Studies in Advanced Mathem atics 3, Cam bridge Univ . Press. [23] C. Jones & G.D. Plotkin (198 9): A pr o babilistic power doma in of evaluations . In: Logic in Computer Science , IEEE, Computer Science Press, pp. 186–19 5, doi:10.1109 /LICS.1989.3 9173 . [24] K. K eime l ( 2009 ): Abstract or der ed compact conve x sets and algebras o f the (sub)pr obab ilistic power do main mona d over or der ed compact spaces . Algebra and Log ic 48(5) , pp. 33 0–34 3, doi:10.1 007/s10 469- 009-9065-x . [25] K. K eimel, A. Rosenbusch & T . Streicher (2011 ): Relating direct an d p r edicate transformer partial cor- r ectness semantics for an imperative pr obabilistic-no ndeterministic language . Theor . Com p. Sci. 412, pp. 2701– 2713 . [26] D. K ozen ( 1981 ): Semantics of pr ob abilistic pr ograms. Journ. Comp. Syst. Sci 22(3) , p p. 3 28–35 0, doi:10.1 016/0 022-0000(81)9 0036-2 . 182 The Expectat ion Monad [27] E.G. Manes (19 69): A triple-the or etic construction of comp act algebras . In B. Eckm an, editor: Sem- inar o n T riples an d Categorical Homolgy T heory , Lect. No tes Math . 80, Sp ringer, Berlin, p p. 91 –118 , doi:10.1 007/BFb0 083083 . [28] E.G. Manes (1974 ): Algebr aic Theories . Spring er , B erlin, do i:10.10 07/978 -1-4612-9860-1 . [29] S. Mac Lane (1971 ): Cate g ories for the W o rking Mathe matician . Sp ringer, Berlin. [30] A. McIver & C. Morgan (20 04): Abstraction, r efinement and pr oof for pr obab ilistic s ystems . M onogr aphs in Comp. Sci., Springer . [31] P . P anangad en (2009): Labelled Mark ov Pr oce sses . Imperial College Press, doi:10.114 2/978 1848162891 . [32] S. Pulma nnov ´ a & S. Gud der (199 8): Repr esentation theo r em for conve x effect algebras . Commentation es Mathematicae Universitatis Caro linae 39(4) , pp. 645–6 59. A vailable from htt p://d ml.cz /dmlcz/119041 . [33] N. Ramsey & A. Pfeffer (2 002) : Stochastic lam bda calculu s and mo nads of pr obab ility distributions . In: Principles of Program ming Langu ages , A CM Press, pp. 154–1 65, doi:10.1 145/5 03272.5 03288 . [34] S. Zanella B ´ eguelin (201 0): F ormal Certification of Game-Ba sed Cryptogr aphic Pr o ofs . Ph.D. th esis, ´ Ecole Nationale Sup ´ erieur e des Mines de Paris.
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment