an algebraic theory of markov processespeople.cs.aau.dk/~mardare/papers/markalg.pdfbarycentric...
TRANSCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
An Algebraic Theory of Markov ProcessesGiorgio Bacci
Aalborg University, DenmarkRadu Mardare
Aalborg University, Denmark
Prakash PanangadenMcGill University, Montreal, Canada
Gordon PlotkinUniversity of Edinburgh, UK
AbstractMarkov processes are a fundamental model of probabilistic tran-sition systems and are the underlying semantics of probabilisticprograms.We give an algebraic axiomatization of Markov processesusing the framework of quantitative equational logic introducedin [14]. We present the theory in a structured way using work ofHyland et al. [10] on combining monads. We take the interpolativebarycentric algebras of [14] which captures the Kantorovich metricand combine it with a theory of contractive operators to give therequired axiomatization of Markov processes both for discrete andcontinuous state spaces. This work apart from its intrinsic interestshows how one can extend the general notion of combining effectsto the quantitative setting.
Keywords Markov processes, equational logic, quantitative rea-soning, combining monads
1 IntroductionThe theory of effects began with the pioneering work of Moggi [16,17] on an algebraic treatment of programming languages via thetheory of monads. This allowed a compositional treatment of var-ious semantic phenomena such as state, IO, exceptions etc. Thiswork was followed up by the program of Plotkin and Power [19, 20]on understanding the monads as arising from operations and equa-tions; see also the survey of Hyland and Power [11]. A fundamentalcontribution, due to Hyland et al. [10], was a way of combiningeffects by taking the “sum” of theories.
In the present paper we use the framework of [14] which in-troduced the quantitative analogue of equational logic and thetechniques of [10] to develop an algebraic theory of Markov pro-cesses. In [14] it was shown how a certain set of equations gave asfree algebras the space of probability distributions with the Kan-torovich metric. A challenge at the time was to extend this to thetheory of Markov processes, which are dynamically evolving prob-ability distributions. Instead of developing an equational theory inan ad-hoc way, we use the ideas of [10] to obtain a very generaltheory of probability distributions equipped with additional oper-ators. Markov processes (or labelled Markov processes [18]) arejust a very special instance of these where there is a set of unaryoperators for the transitions.
It is very pleasing that one can obtain the axiomatisation ofMarkov processes in this systematic way. Some effort is involvedin showing that the techniques apply to the quantitative setting; inthat sense our results go beyond the example of Markov processesas they can be seen as an example of a general paradigm of formingsums of quantitative theories. Overall, we see our work as a firststep towards a full-blown theory of quantitative effects.
LICS’18, July 09–12, 2018, Oxford, UK2018.
The main conceptual advance we feel we have attained is uni-fying an algebraic presentation of Markov processes with theirwell-known coalgebraic presentation. On the one hand, one seesthem as algebras arising from a very natural quantitative theory;on the other hand, they arise from the theory of quantitative bisim-ulation via final coalgebras of behaviour functors. This all comesabout as we have a coincidence of initial and final coalgebras. Sucha coincidence is known in domain theory [21, 22] but seems not tohave been developed in the metric case.
As far as we are aware, the algebraic and coalgebraic viewpointsin semantics have largely developed independently. We feel ourwork contributes to building a bridge between the two and we hopein future work to use this unified perspective in applications.
Technical summaryIn [14] it is shown that any quantitative equational theory U in-duces a monad TU on Met (the category of metric spaces), namelythe monad assigning to an arbitrary space M the quantitative al-gebra freely generated over M and satisfying the quantitative in-ferences (conditional equations) ofU . One can readily show thatif one considers a signature Σ and the empty theory, the inducedmonad is the free monad Σ∗ over the signature endofunctor (alsocalled Σ) inMet.
Similarly, suppose that with each operator f ∈ Σ of arity n weassociate a contractive factor 0 < c < 1 (written f : ⟨n, c⟩ ∈ Σ) andadd, for each δ ≥ cε , the axiom
{x1 =ε y1, . . . ,xn =ε yn } ⊢ f (x1, . . . ,xn ) ≡δ f (y1, . . . ,yn )
obtaining the quantitative theory of contractive operators O(Σ). Thenthe induced monad is the free monad Σ̃∗ on the endofunctor Σ̃ =∐
f : ⟨n,c ⟩∈Σ c · Idn (where c ·X is the space X with metric rescaled
by a factor of c).In [14], the monad induced by the quantitative equational theory
B of interpolative barycentric algebras was shown to be the monadΠ of finitely supported Borel probabilitymeasureswith Kantorovichmetric. By taking the (disjoint) union of the axioms of interpolativebarycentric algebras and of the algebra of contractive operatorsfor Σ, one obtains B + O(Σ), the quantitative theory of interpolativebarycentric algebras with contractive operators in Σ.
We show that the free monad induced by B+O(Σ) is isomorphicto the sum of monads Σ̃∗+Π. Because of this characterisation, by us-ing results in [10], we can show thatTB+O(Σ) assigns to an arbitrarymetric spaceM the initial solution of the functorial equation
XM � Π(Σ̃XM +M) .
We obtain analogous results for complete separable metric spaces bytaking the completion of the monad. In this case the monad assignsto any complete separable metric space M the unique solution ofthe functorial equation
YM � ∆(Σ̃YM +M) .
1
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
where ∆ is the Giry monad of Borel probability measures withKantorovich metric.
By observing that the maps from left to right of the above iso-morphisms are coalgebra structures, we can algebraically recoverMarkov processes by using as the signature Σ which has a con-stant symbol 0, representing termination, and a unary operator⋄(t), representing the capability of performing a transition to t .
The above findings fit into a more general pattern: we show thatunder certain assumptions on the quantitative theories U , U ′, thefree monad TU+U ′ that arises from the disjoint union U + U ′
of the two theories is the categorical sum TU + TU ′ of the freemonads onU andU ′, respectively. The only requirement on thetheories is that they can be axiomatised by a set of quantitativeinferences involving only quantitative equations between variablesas hypotheses. In [15] this type of theory is called simple.
For simple quantitative theories we have another main result:the quantitative algebras satisfying a simple theoryU are in one-to-one correspondence with the Eilenberg-Moore algebras for the freemonad TU . This result generalises the classical isomorphism be-tween the algebras of a functor F and the Eilenberg-Moore algebrasof the free monad F ∗ on F [3].
2 PreliminariesThe basic structures with which we work are metric spaces ofvarious kinds. A metric induces a topology on M , and differentmetrics can induce the same topology. In particular, for any metricd , the 1-bounded function d ′(x ,y) =def d(x ,y)/(1+d(x ,y)) is also ametric and yields the same topology as d . We henceforth restrict to1-bounded metrics. If a metric space has a countable dense subsetwe say it is separable; this is equivalent to having a countable basefor the topology. A sequence (xi ) in a metric space is said to beCauchy if ∀ϵ > 0,∃N ,∀i, j ≥ N ,d(xi ,x j ) ≤ ϵ . If every Cauchysequence converges we say, the space is said to be complete. If aspace is not complete it can be isometrically embedded in a completespace by adding the limits of Cauchy sequences, this is a standardconstruction [8]. If (X ,d) is a metric space we write (X ,d) or justX for its completion.
Completeness is a metric concept: the same topological spacecan be described by two different metrics, one complete and theother one not. If, for a given topology, there is some metric thatis complete we say that the topology is completely metrizable.Topological spaces underlying complete separable metric space arecalled Polish.
The categories of metric spaces that we consider areMet: met-ric spaces, CMet: complete metric spaces and CSMet: completeseparable metric spaces (recall that all the spaces we considerare 1-bounded). The morphisms are the non-expansive maps, i.e.the f : (X ,dX ) → (Y ,dY ) such that dY (f (x), f (y)) ≤ dX (x ,y).These categories have all countable products and coproducts. Onecan define products by taking the set theoretic product and defin-ing the metric to be the sup of the pointwise metrics, i.e. given{(Mi ,di )|i ∈ I } the metric on ΠiMi is
d((x1, . . . ,xn , . . .), (y1, . . . ,yn , . . .)) =def supi
di (xi ,yi ).
We assume that the reader is familiar with the basic notions ofσ -algebras, measurable functions and measures. Given a topologythe σ -algebra generated is called its Borel algebra and its elementsare called Borel sets. A probability measure defined on the Borel
sets is a Borel probability measure. Given a topological space withits Borel σ -algebra, we define the support of a measure to be thecomplement of the union of all open sets with zero measure. Ameasure is said to be finitely supported if its support is a finite set.A finitely supported probability measure is just a convex sum ofpoint measures; i.e. measures whose support is a single point.
We assume the reader is familiar with monads and with algebrasof a monad (the Eilenberg-Moore algebras of a monad).
2.1 Kantorovich MetricWe review some well-known facts about metrics between spacesof probability distributions.
LetM be a metric space. The Kantorovich metric1 between Borelprobability measures µ,ν overM is defined as:
K(dM )(µ,ν ) = supf ∈ΦM
����∫ f dµ −∫
f d��� .
with supremum ranging over the set ΦM of positive 1-boundednon-expansive real-valued functions f : M → [0, 1].
Under suitable restrictions on the type of measures, the abovedistance has a well-known dual characterization, based on the no-tion of coupling. A coupling for a pair of Borel probability measures(µ,ν ) overM , is a Borel probability measureω on the product spaceM ×M , such that, for all Borel sets E ⊆ M
ω(E ×M) = µ(E) and ω(M × E) = ν (E) .
A Borel probability measure µ overM is Radon if for any Borelset E ⊆ M , µ(E) is the supremum of µ(K) over all compact subsetsK of E. We write C(µ,ν ) for the set of Radon couplings for a pairof Borel probability measures (µ,ν ).
Theorem 2.1 (Kantorovich-Rubinstein Duality [27, Thm. 5.10]).LetM be a metric space. Then, for arbitrary Radon probability mea-sures µ,ν overM
K(dM )(µ,ν ) = min{∫
d dω | ω ∈ C(µ,ν )
}.
Examples of Radon probability measures are finitely supportedBorel probability measures on any metric space and generic Borelprobability measures over complete separable metric spaces.
We write ∆(M) for the space of Borel probability measures overM with the Kantorovich metric and Π(M) for the subspace of ∆(M)
of the finitely supported Borel probability measures overM .
Lemma 2.2. Let M be a separable metric space. Then, the Cauchycompletion of Π(M) is isomorphic to the set of Borel probability mea-sures over the Cauchy completion ofM , i.e., Π(M) � ∆(M).
3 Quantitative Equational TheoriesQuantitative equations were introduced in [14]. In this frameworkequalities t ≡ε s are indexed by a positive rational number, tocapture the idea that t is “within ε” of s . This informal notion isformalized in a manner analogous to traditional equational logicand it is shown that one can axiomatize quantitative analogues ofalgebras. Analogues of Birkhoff’s completeness theorem [14] andvariety theorem [15] were established. The collection of equation-ally defined quantitative algebras form the algebras for monads onsuitable categories of metric spaces. In this section we review thisformalism.1Sometimes called the Wasserstein-1 metric.
2
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
LICS’18, July 09–12, 2018, Oxford, UK
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
Let Σ be an algebraic signature of function symbols f : n ∈ Σ ofarity n ∈ N. Let X be a countable set of variables, ranged over byx ,y, z, . . . . We write T(Σ,X ) for the set of Σ-terms freely generatedover X , ranged over by t , s,u, . . ..
A substitution of type Σ is a function σ : X → T(Σ,X ) that ishomomorphically extended to terms as
σ (f (t1, . . . , tn )) = f (σ (t1), . . . ,σ (tn ));
we write S(Σ) for the set of substitutions of type Σ.A quantitative equation of type Σ over X is an expression of
the form t ≡ε s , for t , s ∈ T(Σ,X ) and a positive rational numberε ∈ Q≥0. We write E(Σ,X ) for the set of quantitative equations oftype Σ over X , and its subsets will be ranged over by Γ,Θ,Π, . . .
Fix X a countable set of metavariables. A quantitative deductionsystem of type Σ is a relation ⊢ ⊆ 2E(Σ,X ) × E(Σ,X ) from the pow-erset of E(Σ,X ) to E(Σ,X ) satisfying the following meta-axioms,for each f : n ∈ Σ
(Refl) ∅ ⊢ x ≡0 x ,
(Symm) {x ≡ε y} ⊢ y ≡ε x ,
(Triang) {x ≡ε z, z ≡ε ′ y} ⊢ x ≡ε+ε ′ y ,
(1-Bdd) ∅ ⊢ x ≡1 y ,
(Max) {x ≡ε y} ⊢ x ≡ε+ε ′ y , for all ε ′ > 0 ,(Arch) {x ≡ε ′ y | ε ′ > ε} ⊢ x ≡ε y ,
(f -NE) {x1 =ε y1, . . . ,xn =ε yn } ⊢ f (x1, . . . ,xn ) ≡ε f (y1, . . . ,yn ) ,
(Subst) If Γ ⊢ t ≡ε s , then σ (Γ) ⊢ σ (t) ≡ε σ (s), for all σ ∈ S(Σ) ,
(Cut) If Γ ⊢ Θ and Θ ⊢ t ≡ε s , then Γ ⊢ t ≡ε s ,
(Assum) If t ≡ε s ∈ Γ, then Γ ⊢ t ≡ε s ,
where we write Γ ⊢ Θ to mean that Γ ⊢ t ≡ε s holds for allt ≡ε s ∈ Θ and σ (Γ) = {σ (t) ≡ε σ (s) | t ≡ε s ∈ Γ}.
The rules (Subst), (Cut), (Assum) are the usual rules of equationallogic. The axioms (Refl), (Symm), (Triang) correspond, respectively,to reflexivity, symmetry, and the triangle inequality; (Max) repre-sents inclusion of neighborhoods of increasing diameter; (Arch) isthe Archimedean property of the reals w.r.t. a decreasing chain ofneighborhoods with converging diameters; and (f -NE) expressesnonexpansivness of the f ∈ Σ. We have added the axiom (1-Bdd) toensure that the algebras we get also have 1-bounded metrics. Thisis a minor variation of the theory presented in [14]. The resultsthat we use from that paper all hold with this change.
A quantitative equational theory of type Σ over X is a set Uof universally quantified quantitative inferences over E(Σ,X ), (i.e.,expressions of the form
{t1 ≡ε1 s1, . . . , tn ≡εn sn } ⊢ t ≡ε s ,
with a finite set of hypotheses) closed under ⊢-deducibility.A set A of quantitative inferences axiomatises a quantitative
equational theoryU , ifU is the smallest quantitative equationaltheory containing A.
The models of quantitative equational theories are universalΣ-algebras equipped with a metric, called quantitative algebras.
Definition 3.1. A quantitative Σ-algebra is a tuple A = (A, ΣA ),where A is a metric space and ΣA = { f A : An → A | f : n ∈ Σ} isa set of non-expansive interpretations for the algebraic operators inΣ, i.e., satisfying the following, for all 0 ≤ i ≤ n and ai ,bi ∈ A,
maxi
dA(ai ,bi ) ≥ dA(fA (a1, . . . ,an ), f
A (b1, . . . ,bn )) .
The morphisms between quantitative Σ-algebras are non-expan-sive Σ-homomorphisms. Quantitative Σ-algebras and their mor-phism form a category QA(Σ).
A quantitative algebra A = (A, ΣA ) satisfies the quantitativeinference Γ ⊢ t ≡ε s over E(Σ,X ), written Γ |=A t ≡ε s , if for anyassignment ι : X → A,(for all t ′ ≡ε ′ s ′ ∈ Γ, dA(ι(t ′), ι(s ′)) ≤ ε ′
)implies dA(ι(t), ι(s)) ≤ ε ,
where ι(t) is the homomorphic interpretation of t ∈ T(Σ,X ) in A.A quantitative algebra A is said to satisfy (or be a model for) the
quantitative theory U , if Γ |=A t ≡ε s whenever Γ ⊢ t ≡ε s ∈ U .We write K(Σ,U) for the collection of models of a theory U oftype Σ.
Sometimes it is convenient to consider quantitative Σ-algebraswhose carrier is a complete metric space. This class of algebrasforms a full subcategory of QA(Σ), written CQA(Σ). Similarly, wewrite CK(Σ,U) for the full subcategory of quantitative Σ-algebrasin CQA(Σ) which are models ofU .
The following definition lifts the Cauchy completion of metricspaces to quantitative algebras.
Definition 3.2. The Cauchy completion of a quantitative Σ-algebraA = (A, ΣA ), is the quantitative Σ-algebra A = (A, ΣA ), where Ais the Cauchy completion ofA and ΣA = { f A : An → A | f : n ∈ Σ}is such that for Cauchy sequences (bij )j converging to b
i ∈ A, for1 ≤ i ≤ n, we have:
f A (b1, . . . ,bn ) = limj
f A (b1j , . . . ,bnj ) .
The above extends to a functor C : QA(Σ) → CQA(Σ) which isthe left adjoint to the functor embedding CQA(Σ) into QA(Σ).
The completion of quantitative Σ-algebras extends also to a func-tor from K(Σ,U) to CK(Σ,U), whenever U can be axiomatisedby a collection of continuous schemata of quantitative inferences,i.e., by axiom schemata of the form
{x1 ≡ε1 x1, . . . ,xn ≡εn yn } ⊢ t ≡ε s , for all ε ≥ f (ε1, . . . , εn ),
where f : R≥0 → R≥0 is a continuous real-valued function, andxi ,yi ∈ X . We call such a theory continuous.
Free Monads on Quantitative Theories. Recall that to every sig-nature Σ, one can associate a signature endofunctor (also called Σ)on Met by:
Σ =∐f :n∈Σ
Idn .
It is easy to see that, by couniversality of the coproduct, quantitativeΣ-algebras correspond to Σ-algebras for the functor Σ in Met, andthe morphisms between them to non-expansive homomorphismsof Σ-algebras. Below we pass between the two points of view asconvenient.
In [14] it is shown that any quantitative theory U of type Σinduces a monad TU on Met, called the free monad on U . Therelevant results leading to its definition are summarized in thefollowing theorem.
Theorem 3.3 (Free Algebra). Let U be a quantitative theory oftype Σ. Then, for any X ∈ Met there exists a metric space TX ∈ Met,a non-expansive map ηUX : X → TX , and a quantitative Σ-algebra(TX ,ψ
UX ) satisfying U , such that, for any quantitative Σ-algebra
(A,α) in K(Σ,U) and non-expansive map β : X → A, there exists3
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
a unique homomorphism h : TX → A of quantitative Σ-algebrasmaking the following diagram commute
X TX ΣTX
A ΣAβ
ηUX
h
ψUX
Σhα
The map h is also called the homomorphic extension of α along β .
The universal property above says that (TX ,ψUX ) is the free quan-
titative Σ-algebra for X in K(Σ,U). From Theorem 3.3, one can de-fine the monad (TU ,η
U , µU ) as follows: the functor TU : Met →Met associates to X ∈ Met the carrier TX of the free quantitativeΣ-algebra for X in K(Σ,U); the maps ηUX form the components ofthe unit ηU : Id ⇒ TU ; and the multiplication µU : TUTU ⇒ TUis defined at X as the unique map that, by Theorem 3.3, satisfiesµUX ◦ ηUX = id and µUX ◦ψU
TUX = ψUX ◦ ΣµUX .
A similar free construction also holds for quantitative algebrasin CQA(Σ) for continuous quantitative equational theories:
Theorem 3.4 (Free Complete Algebra). Let U be a continuousquantitative theory of type Σ. Then, for any X ∈ CMet, quantitativeΣ-algebra (A,α) in CK(Σ,U) and non-expansive map β : X → A,there exists a unique homomorphism h : CTU → A of quantitativeΣ-algebras making the following diagram commute
X CTUX ΣCTUX
A ΣAβ
CηUX
h
CψUX
Σhα
The above is equivalent to saying that the forgetful functor fromCK(Σ,U) to CMet has a left adjoint. In particular, CTU is the freemonad on U in CMet, provided that the quantitative theory iscontinuous.
4 Disjoint Union of Quantitative TheoriesOne of the advantages of the approach followed in [10] is that itallows one to combine different computational phenomena in asmooth way. In our setting we need to combine quantitative theo-ries. The major example discussed in this paper is the combinationof interpolative barycentric algebras (which we had shown [14] toaxiomatize probability distributions with the Kantorovich metric)and the algebras that give a transition structure. This combinationgives us the usual theory of Markov processes, but now enrichedwith metric reasoning principles for the underlying probabilitydistributions.
In this section we develop the theory of the disjoint union ofquantitative equational theories. Let Σ, Σ′ be two disjoint signa-tures. The disjoint union of two quantitative equational theoriesU ,U ′ of respective types Σ and Σ′, writtenU +U ′, is the smallestquantitative theory containingU andU ′. Following Kelly [13], weshow that any model for U +U ′ is a ⟨U ,U ′⟩-bialgebra: a metricspace A with both a Σ-algebra structure α : ΣA → A satisfyingU
and a Σ′-algebra structure β : Σ′A → A satisfyingU ′. Formally, letK((Σ,U) ⊕ (Σ′,U ′)) be the category of ⟨U ,U ′⟩-bialgebras withnon-expansive maps that preserve their two algebraic structures.Then, the following isomorphism of categories holds.
Proposition 4.1. K(Σ + Σ′,U +U ′) � K((Σ,U) ⊕ (Σ′,U ′)).
We already saw that any quantitative equational theory inducesa free monad on Met. Next, we would like show that under certainassumptions on the theories, the free monadTU+U ′ on the disjointunionU +U ′ corresponds to the categorical sumTU +TU ′ of thefree monads onU andU ′, respectively.
The only requirement we ask is that the theories can be ax-iomatised by a set of simple quantitative inferences, i.e., inferenceshaving as hypothesis only equations of the form x ≡ε y, for x ,y ∈ X .As in [15], we call these theories simple. Note that any continuousquantitative theory is simple.
Let T -Alg be the category of Eilenberg-Moore T -algebras of amonad T . Then, we have:
Theorem 4.2. For any simple quantitative equational theory U oftype Σ, TU -Alg � K(Σ,U).
Proof. The isomorphism is given by the following pair of functors
TU -Alg K(Σ,U)
H
K
both mapping morphisms essentially to themselves and on objectsacting as follows: for (A,α) ∈ TU -Alg and (B, β) ∈ K(Σ,U),
H (A,α) = (A,α ◦ψUA ◦ ΣηUA ) , K(B, β) = (B, β♭) ,
where β♭ : TUB → B is the unique map that, by Theorem 3.3,satisfies the equations β♭ ◦ ηUB = idB and β♭ ◦ψU
B = β ◦ Σβ♭ .To show that K is well defined, we need to prove that the unit
and associativity laws for the TU -algebra hold. The unit law fol-lows directly by definition of β♭ . The associativity law followsby Theorem 3.3, since both β♭ ◦ µUB and β♭ ◦ TU β♭ fit as theunique homomorphic extension of β along ηUB . Given any mor-phism h : (B, β) → (B′, β ′) of quantitative Σ-algebras in K(Σ,U),K(h) = h is proved to be a TU -homomorphism by showing thatboth (β ′)♭ ◦TUh and h ◦ β♭ fit as the unique homomorphic exten-sion ofψU
B′ along h. Functoriality of K follows similarly, using theuniversal property in Theorem 3.3.
To show that H is well defined, we need to show that for any(A,α) ∈ TU -Alg, H (A,α) satisfies U . Since, by hypothesis, U isa simple quantitative theory, it is axiomatised by a set A ⊆ U ofsimple quantitative inferences. Thus, H (A,α) is a model forU iff itsatisfies all the quantitative inference in A. To this end, note thatfor any assignment ι : X → A of the metavariables, the followingdiagram commutes
X T(Σ,X ) ΣT(Σ,X )
A TUA ΣTUA
A TUA ΣTUA ΣA
ηΣX
ι TΣι
ψ ΣX
ΣTΣιηUA
idα
ψUA
Σαα ψU
A ΣηUA
(1)
where the commutativity of the bottom-right square is proven asfollows, by naturality of the maps, by the monad laws, and the unit
4
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
LICS’18, July 09–12, 2018, Oxford, UK
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
and associativity laws of (A,α) ∈ TU -Alg
TUA ΣTUA ΣTUA
TUA TUTUA ΣTUTUA ΣTUA
A TUA ΣTUA ΣA
ΣA
id
ψUA id
idΣTU ηUA
α
µUA
TU αµUA
ΣµUA
(ψUTU )AΣµUA
ΣTU α
Σα
α ψUA
Σα
idΣηUA
By the commutativity of (1) and uniqueness of homomorphic ex-tension, we have that the homomorphic extension ι♯ : T(Σ,X ) → A
of ι on (A,α) can be factorised as ι♯ = α ◦TU ι. MoreoverTΣι, is thehomomorphic extension of ηUA ◦ ι : X → TUA on (TUA,ψU
A ).Let Γ ⊢ t ≡ε s ∈ A and ι : X → A be an assignment of the
metavariables. Assume that, for all x ≡δ y ∈ Γ, dA(ι♯(x), ι♯(y)) ≤ δ .Since x ,y ∈ X , then we have dA(ι(x), ι(y)) ≤ δ .
By Theorem 3.3, (TUA,ψUA ) satisfies U , so that, because TΣι is
the homomorphic extension of ηUA ◦ ι : X → TUA on (TUA,ψUA ),
we have that(for all x ≡δ y ∈ Γ, dTUA(η
UA ◦ ι(x),ηUA ◦ ι(y)) ≤ δ
)implies (2)
dTUA(TΣι(t),TΣι(s)) ≤ ε .
By definition of dTUA, we have that dTUA(ηUA ◦ ι(x),ηUA ◦ ι(y)) =
dA(ι(x), ι(y)), hence, by (2), we get dTUA(TΣι(t),TΣι(s)) ≤ ε . Thus,
ε ≥ dTUA(TΣι(t),TΣι(s))
≥ dA(α ◦TΣι(t),α ◦TΣι(s)) (α non-expansive)
≥ dA(ι♯(t), ι♯(s)) . (α ◦TΣι = ι
♯ )
Therefore H (A,α) satisfiesU . Note the crucial role played by therequirement of simple equations. This allows us to have only vari-ables on the left-hand side and we know these are isometricallyembedded by η.
It remains to show that K and H are inverses of each other. Onmorphisms this is clear. As for objects, for (A,α) ∈ TU -Alg and(B, β) ∈ K(Σ,U), we have
KH (A,α) = (A, (α ◦ψUA ◦ ΣηUA )♭) ,
HK(B, β) = (B, β♭ ◦ψUB ◦ ΣηUB ) ,
thus, we need to show β♭◦ψUB ◦ΣηUB = β and (α ◦ψ
UA ◦ΣηUA )♭ = α .
These are proved by the commutativity of the following diagrams
TUB ΣTUB ΣB
B ΣB
β ♭
ψUB
Σβ ♭
ΣηUB
id
β
A TUA ΣTUA
TUTUA
A TUA ΣA
ηUA
idα
ψUA
(θTU )AΣα
µUA
TU α
α θA
where θ = ψU ◦ ΣηU . In particular, the second one proves that αsatisfies the equalitiesα◦ηUA = idA andα◦ψU
A = α◦ψUA ◦ΣηUA ◦Σα
which, by Theorem 3.3, are uniquely satisfied by (α ◦ψUA ◦ ΣηUA )♭ .
Hence, (α ◦ψUA ◦ ΣηUA )♭ = α . □
When the quantitative equational theoriesU ,U ′ are simple, byTheorem 4.2, we get a refinement of Proposition 4.1 as follows.
LetT ,G be two monads on a category C. A ⟨T ,G⟩-bialgebra is anobject A ∈ C with Eilenberg-Moore algebra structures α : TA → Aand β : GA → A. We write ⟨T ,G⟩-biAlg for the category of ⟨T ,G⟩-bialgebras with morphisms those in C preserving the two algebraicstructures.
Corollary 4.3. LetU ,U ′ be simple quantitative equational theo-ries. Then K(Σ + Σ′,U +U ′) � ⟨TU ,TU ′⟩-biAlg.
Proof. Immediate from Theorem 4.2 and Proposition 4.1. □
Now we are ready to state the main theorem of the section.
Theorem 4.4. LetU ,U ′ be simple quantitative theories. Then, themonad TU+U ′ in Met is the sum of monads TU +TU ′ .
Proof. By Corollary 4.3 and Theorem 3.3 the obvious forgetful func-tor from ⟨TU ,TU ′⟩-biAlg to Met has a left adjoint. The monadgenerated by this adjunction is isomorphic toTU+U ′ . Thus, by [13](cf. also [1, Proposition 2.8]), the monad TU+U ′ is also isomorphicto TU +TU ′ . □
The above constructions do not use any specific property ofthe category Met, apart from requiring its morphisms to be non-expansive. Thus, under mild restrictions on the type of theories andconditions on the free monad induced by them, we can reformulatealternative versions of Theorem 4.4 which are valid on specific fullsubcategories ofMet.
The first one applies to CMet, provided that the quantitativeequational theories are continuous. Recall that, the disjoint unionU + U ′ of two continuous quantitative theories U ,U ′ is alsocontinuous, so that, by Theorem 3.4, the free monad on it in CMetis CTU+U ′ . Moreover, continuous theories are simple.
Theorem 4.5. LetU ,U ′ be continuous quantitative theories. Then,the monad CTU+U ′ in CMet is the sum of CTU and CTU ′ .
Note that, for a continuous quantitative theoryU , if the functorTU preserves separability of the metric spaces, then the free monadon U in CSMet is given by CTU . This is the case, for example, forcountable signatures (see Lemma A.3 in the appendix). Thus, underan additional condition on the free monads, the theorem above canalso be stated for the case of complete separable metric spaces.
Corollary 4.6. LetU ,U ′ be continuous quantitative theories andassume TU+U ′ , TU , and TU ′ preserve separability of metric spaces.Then, the monad CTU+U ′ in CSMet is the sum of CTU and CTU ′ .
5 Interpolative Barycentric AlgebrasInterpolative barycentric algebras [14] are the quantitative algebrasfor the signature
ΣB = {+e : 2 | e ∈ [0, 1]}
having a binary operator +e , for each e ∈ [0, 1] (a.k.a. barycentricsignature), and satisfying the following axioms
(B1) ⊢ x +1 y ≡0 x ,
(B2) ⊢ x +e x ≡0 x ,
(SC) ⊢ x +e y ≡0 y +1−e x ,
(SA) ⊢ (x +e y) +e ′ z ≡0 x +ee ′ (y + e′−ee′1−ee′
z) , for e, e ′ ∈ [0, 1) ,
(IB) {x ≡ε y,x′ ≡ε ′ y
′} ⊢ x +e x′ ≡δ y +e y
′, for δ ≥ eε + (1 − e)ε ′.5
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
The quantitative theory induced by the axioms above, written B, iscalled interpolative barycentric quantitative equational theory. Theaxioms (B1), (B2), (SC), (SA) are those of barycentric algebras (a.k.a.abstract convex sets) due to M. H. Stone [24] where (SC) standsfor skew commutativity and (SA) for skew associativity. (IB) is theinterpolative barycentric axiom introduced in [14].
5.1 On Metric SpacesLet Π : Met → Met be the functor assigning to each X ∈ Met themetric space Π(X ) of finitely supported Borel probability measureswith Kantorovich metric and acting on morphisms f ∈ Met(X ,Y )as Π(f )(µ) = µ ◦ f −1, for µ ∈ Π(X ).
This functor has a monad structure, with unit δ : Id ⇒ Π andmultiplicationm : Π2 ⇒ Π, given as follows, for x ∈ X , Φ ∈ Π2(X ),and Borel subset E ⊆ X
δX (x) = δx , m(Φ)(E) =
∫evE dΦ ,
where δx is the Dirac distribution at x ∈ X , and evE : Π(X ) → [0, 1]is the evaluation function, taking µ ∈ Π(X ) to µ(E) ∈ [0, 1]. Thismonad is also known as the finite distribution monad.
For any X ∈ Met, one can define a quantitative ΣB-algebra(Π(X ),ϕX ) as follows, for arbitrary µ,ν ∈ ΠX
ϕX : ΣBΠX → ΠX ϕX (in+e (µ,ν )) = eµ + (1 − e)ν .
This quantitative algebra satisfies the interpolative barycentrictheory B [14, Theorem 10.4]) and is universal in the followingsense.
Theorem 5.1 ([14, Th. 10.5]). For any ΣB -algebra (A,α) satisfyingB and non-expansive map β : X → A, there exists a unique homomor-phism h : ΠX → A of quantitative ΣB -algebras making the diagrambelow commute
X ΠX ΣBΠX
A ΣBAβ
δX
h
ϕX
ΣBh
α
From this we obtain that Π is isomorphic to the monad TB onthe quantitative theory B of interpolative barycentric algebras.
Theorem 5.2. The monads TB and Π in Met are isomorphic.
The proof is given in the appendix.
5.2 On Complete Separable Metric SpacesDefine the functor ∆ : CSMet → CSMet assigning to each X ∈
CSMet the complete separable metric space ∆(X ) of Borel proba-bility measures with Kantorovich metric and acting on morphismsf ∈ CSMet(X ,Y ) as ∆(f )(µ) = µ ◦ f −1, for µ ∈ ∆(X ). This func-tor has a monad structure, defined similarly to the one for Π. It isknown as the metric Giry monad.
Note that Cauchy completion preserves separability. Thus theCauchy completion functor C : Met → CMet restricts to separablespaces. By Lemma 2.2 and the fact that CC � C, one can verify thatthe canonical monad structure on CΠ is isomorphic to the one on ∆in CSMet. In [14], it has been proven thatTB preserves separability.Hence, by Theorem 5.2, we obtain the following.
Theorem 5.3. The monads CTB and ∆ in CSMet are isomorphic.
Note that, since B is axiomatised by a continuous schema ofquantitative inferences, the free monad on B in CSMet is exactlygiven by CTB . Therefore, Theorem 5.3 provides an algebraic char-acterisation of the metric Giry monad.
6 Algebras of Contractive OperatorsA signature of contractive operators Σ is a signature of functionsymbols f : n ∈ Σ with associated contractive factor 0 < c < 1. Wewrite this as f : ⟨n, c⟩ ∈ Σ.
The quantitative equational theory of contractive operators asso-ciated to a signature Σ, written O(Σ), is the quantitative equationaltheory satisfying, for each f : ⟨n, c⟩ ∈ Σ, the axioms
(f -Lip) {x1 =ε y1, . . . ,xn =ε yn } ⊢ f (x1, . . . ,xn ) ≡δ f (y1, . . . ,yn ) ,
for all rationals δ ≥ cε . The axiom (f -Lip) requires the interpreta-tion of f to be c-Lipschitz continuous.
6.1 On Metric SpacesFor a contractive signature Σ, we define a modification of the sig-nature endofunctor onMet by:
Σ̃ =∐
f : ⟨n,c ⟩∈Σc · Idn
where c · Id is the rescaling functor, mapping a metric space (X ,dX )to (X , c · dX ).
Next we show that quantitative Σ-algebras satisfying O(Σ) arein one-to-one correspondence with universal Σ̃-algebras; moreover,this correspondence lifts the identity functor onMet (cf. [12]).
Lemma 6.1. There exists an isomorphism of categories betweenΣ̃-Alg and K(Σ,O(Σ)) making the following diagram commute
Σ̃-Alg � K(Σ,O(Σ))
MetUΣ̃ UΣ
The proof is given in the appendix.In virtue of Lemma 6.1, by an abuse of notation, we will denote
by the same name the algebras in Σ̃-Alg and K(Σ,O(Σ)).Next we show that the free monad TO(Σ) is isomorphic to the
free monad on Σ̃. For this result, we first need some discussion offree and initial algebras and free monads.
Given any endofunctorH on a category C, we write (µy.Hy,αH )
for the initial H -algebra, if it exists. If C has binary coproducts,the free H -algebra on X ∈ C with its unit can be identified with(µy.(Hy +X ),αH+X ), and the one exists if and only the other does.These free algebras exist if, for example, C is locally countablypresentable and H has countable rank.
A free monad onH is a monadH∗ on C and a natural transforma-tion γ : H ⇒ H∗ that is initial among all such pairs (S, λ : H ⇒ S).If the forgetful functor from H -Alg to C has a left adjoint (equiv-alently, any C-object has a free H -algebra with unit), then theresulting monad on C is free on H and is said to be algebraic [3]. IfH∗ exists and is algebraic, the categoryH∗-Alg of Eilenberg-Moorealgebras for the monad H∗ is isomorphic to the category H -Alg ofuniversal algebras for the endofunctor H .
We see from the above that, if C has binary sums, then H∗ canbe identified with µy.(Hy + −) and the former exists if and onlyif the other does. We further see that if C is locally countably
6
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
LICS’18, July 09–12, 2018, Oxford, UK
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
presentable and H has countable rank, then H∗ exists and hascountable rank [13].
Therefore, sinceMet is locally countably presentable [2] and Σ̃has countable rank, the free algebra for Σ̃ exists and so does thefree monad Σ̃∗. Let κX : Σ̃Σ̃∗X → Σ̃∗X be the free Σ̃-algebra onX ∈ Met with unit χ : Id ⇒ Σ̃∗.
Then, the next result follows by Lemma 6.1 and freeness of Σ̃∗.
Corollary 6.2. Let Σ be a signature of contractive operators. Then,for any quantitative Σ-algebra (A,α) satisfying O(Σ) and non-expan-sive map β : X → A, there exists a unique homomorphism h : Σ̃∗X →
A of quantitative Σ-algebras making the diagram below commute
X Σ̃∗X ΣΣ̃∗X
A ΣAβ
χX
h
κX
Σhα
By freeness of TO(Σ) and Corollary 6.2, the following holds:
Theorem 6.3. The monads TO(Σ) and Σ̃∗ in Met are isomorphic.
6.2 On Complete Metric SpacesThe category CMet has coproducts and finite products. Moreover,since rescaling a metric by a factor 0 < c < 1 preserves Cauchycompleteness, the rescaling functor c · Id can be restricted to anendofunctor on CMet. Hence, for any contractive signature Σ, theendofunctor Σ̃ =
∐f : ⟨n,c ⟩∈Σ c · Id
n is well defined in CMet.By repeating the construction in Lemma 6.1 we get the following.
Lemma 6.4. There exists an isomorphism of categories betweenΣ̃-Alg and K(Σ,O(Σ)) making the following diagram commute
Σ̃-Alg � CK(Σ,O(Σ))
CMetUΣ̃ UΣ
Because O(Σ) is a continuous quantitative theory, by Theo-rem 3.4, the free monad on O(Σ) in CMet is given by CTO(Σ).
Note that, also CMet is locally countably presentable [2], andsince Σ̃ is of countable rank, we have that the free monad on Σ̃exists in CMet too. Therefore, by repeating the same argument weused before, by Lemma 6.4 and freeness of Σ̃ and CTO(Σ) we obtain:
Theorem 6.5. The monads CTO(Σ) and Σ̃∗ in CMet are isomorphic.
6.3 On Complete Separable Metric SpacesThe category CSMet has countable coproducts and finite products.Moreover, since the operation of rescaling a metric by a constantfactor 0 < c < 1, preserves both Cauchy completeness and separa-bility, the endofunctor c · Id can be restricted to CSMet.
Hence, provided that the contractive signature Σ consists of onlya countable set of operators, Σ̃ =
∐f : ⟨n,c ⟩∈Σ c ·Id
n is a well definedendofunctor on CSMet. Hereafter, we assume the signature Σ to becountable.
Unlike CMet, the category CSMet is not locally countably pre-sentable, because is not cocomplete (it does not have uncountablecoproducts). However, CSMet has all ℵ1-filtered colimits, and sinceevery separable space in CMet is a countably presentable (or ℵ1-presentable) object [2, Corollary 2.9], CSMet is ℵ1-accessible. SinceΣ̃ is of countable rank (i.e., ℵ1-accessible), by [9, Lemma 3.4] thefree monad Σ̃∗ on Σ̃ exists in CSMet and is algebraic.
The functor Σ∗ inMet preserves separability of the metric spaces.Thus, by Theorem 6.3, so does TO(Σ). Moreover, since the quantita-tive equational theory O(Σ) is continuous, by Theorem 3.4, the freemonad on O(Σ) in CSMet is given by CTO(Σ). Thus, by freeness ofΣ̃∗ and Lemma 6.1, the following holds:
Theorem 6.6. The monadsCTO(Σ) and Σ̃∗ inCSMet are isomorphic.
7 Interpolative Barycentric Algebras withContractive Operators
In this section we study a variation of interpolative barycentricquantitative algebras where we add operations from a contractivesignature Σ assumed to be disjoint from ΣB .
These are quantitative algebras for the signature
ΣB + Σ = {+e : 2 | e ∈ [0, 1]} ∪ Σ ,
satisfying the disjoint union of the axioms of interpolative barycen-tric quantitative theory, namely (B1), (B2), (SC), (SA), and (IB), and,for each f ∈ Σ, the axiom (f -Lip) from the quantitative theory ofcontractive operators.
The quantitative equational theory induced by these axioms willbe called interpolative barycentric theory with contractive operatorsin Σ, and it coincides with the disjoint union B + O(Σ) of theories.
7.1 On Metric SpacesWe have already noted that the quantitative theories B and O(Σ)are simple. Thus, by Theorem 4.4, the free monad TB+O(Σ) on Metinduced by B + O(Σ) is the sum of TB and TO(Σ). Moreover, byTheorems 5.2 and 6.3, it is also isomorphic to Π + Σ̃∗.
In the following we will prove an alternative characterisation ofTB+O(Σ), that will eventually reveal the connection between inter-polative barycentric algebras with operators and Markov processes.
Depending on the type of monads, several specific conditions ofexistence and constructions appear in the literature [1] for the sumof monads. One of these, due to Hyland, Plotkin, and Power [10],recalled below for convenience, characterises the sum of a monadwith a free one.
Theorem 7.1 ([10, Theorem 4]). Given an endofunctor F and amonad T on a category C, if the free monads F ∗ and (FT )∗ exist andare algebraic, then the sum of monads T + F ∗ exists in the categoryof monads over C and is given by a canonical monad structure on thecomposite T (FT )∗.
In terms of the above result, given that TB+O(Σ) is isomorphicto Π + Σ̃∗, if we prove that the free monad (Σ̃Π)∗ inMet exists andis algebraic, then TB+O(Σ) would be also isomorphic to Π(Σ̃Π)∗.For this reason, in the following we characterise (and hence provethe existence of) the free algebra on Σ̃Π. relevant For arbitraryX ∈ Met, let PX be the smallest set such that• if x ∈ X , then x ∈ PX ;• if µ1, . . . , µn ∈ Π(PX ) and f : n ∈ Σ, then f ⟨µ1, . . . , µn⟩ ∈ PX .We define the metric dPX : PX × PX → [0, 1] by induction on
the complexity on the structure of the elements in PX as follows2,for arbitrary x ,x ′ ∈ X , µ1, . . . , µn ,ν1, . . . ,νk ∈ Π(PX ), and distinctoperators f ,д ∈ Σ of arity f : n and д : k such that n ≤ k , where
2The symmetric cases are omitted and defined as expected.
7
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
we assume f : ⟨n, c⟩ ∈ Σ.
dPX (x ,x′) = dX (x ,x
′) ,
dPX (f ⟨µ1, . . . , µn⟩, f ⟨ν1, . . . ,νn⟩) = c ·nmaxi=1
K(dPX )(µi ,νi ) ,
dPX (f ⟨µ1, . . . , µn⟩,д⟨ν1, . . . ,νk ⟩) = 1 ,dPX (x , f ⟨µ1, . . . , µn⟩) = 1 .
Proposition 7.2. For any X ∈ Met, dPX is a well defined metric.
For X ∈ Met, define ϱX : X → PX and ϑX : Σ̃ΠPX → PX asfollows, for arbitrary x ∈ X , f : n ∈ Σ, and µ1, . . . , µn ∈ Π(PX )
ϱX (x) = x , ϑX (inf (µ1, . . . , µn )) = f ⟨µ1, . . . , µn⟩ .
By definition of dPX , it is straightforward to show that both ϱXand ϑX are non-expansive maps (actually, are isometric injections),thus they are morphisms in Met. In particular, ϑX is a universalΣ̃Π-algebra on PX inMet.
Theorem 7.3 (Free Algebra). For any X ∈ Met, Σ̃Π-algebra (A,α),and non-expansive map β : X → A, there exists a unique Σ̃Π-homo-morphism h : PX → A making the diagram below commute
X PX Σ̃ΠPX
A Σ̃ΠAβ
ϱX
h
ϑX
Σ̃Πh
α
The proof is given in the appendix.Theorem 7.3 states that ϑX is the free Σ̃Π-algebra for X ∈ Met,
or equivalently, that the forgetful functor from the category ofΣ̃Π-algebras to Met has a left adjoint. Thus, the free monad (Σ̃Π)∗
on Σ̃Π inMet exists and is algebraic. Moreover, it acts on objectsX ∈ Met as (Σ̃Π)∗X = PX .
Corollary 7.4. The monads TB+O(Σ) and Π(Σ̃Π)∗ in Met are iso-morphic.
Proof. Direct consequence of Theorems 4.4, 5.2, 6.3, 7.1, and 7.3. □
As observed in [10], the monadT (FT )∗ of Theorem 7.1 is simplyanother form of the generalised resumptions monad transformerof Cenciarelli and Moggi [5], sending T to µy.T (Fy + −). Hence, bythe characterisation above and guided by the same observationsthat lead to [10, Corollary 2], we obtain the following isomorphism.
Theorem 7.5. The monad TB+O(Σ) in Met is isomorphic to thecanonical monad structure on µy.Π(Σ̃y + −).
Proof. By [23, Proposition 5.3], it is easy to show that µy.Π(Σ̃y +−)exists if and only if (Σ̃Π)∗ does, and that Π(Σ̃Π)∗ and µy.Π(Σ̃y +−)are then isomorphic. □
7.2 On Complete Separable Metric SpacesWe would like to apply Corollary 4.6 to provide a characterisationof the free monad on B + O(Σ) in the category CSMet as the sumof monads CTB + CTO(Σ).
To this end we have to verify that the conditions required bythe corollary are satisfied. We already noted that the quantitativetheories B and O(Σ) are continuous and that the functors TB andTO(Σ) preserve separability of the metric spaces. We are only leftto prove that also TB+O(Σ) preserves separability.
Lemma 7.6. The functor TB+O(Σ) in Met preserves separability.
The proof is given in the appendix.Thus, we can apply Corollary 4.6 to obtain the desired result.
Corollary 7.7. The monad CTB+O(Σ) in CSMet is the sum of CTBand CTO(Σ).
An immediate consequence of the characterisation above andTheorems 5.3 and 6.6 is the following.
Corollary 7.8. The monad CTB+O(Σ) in CSMet is isomorphic to∆ + Σ̃∗.
According to the above and similarly to what we have done inSection 7.1, we would like to prove for the free monad CTB+O(Σ)on B + O(Σ) in CSMet corresponding results to Corollary 7.4 andTheorem 7.5.
We will proceed again by using Theorem 7.1. Thus, as we did inSection 7.1, we need to show that the free monad on Σ̃∆ in CSMetexists and is algebraic. We already noted that the category CSMetis accessible and that Σ̃ is an accessible endofunctor on it. Moreover,by [26, Corollary 22], we also have that ∆ on CSMet is accessible,so that their composition Σ̃∆ is accessible too. Therefore, by [9,Lemma 3.4] the free monad (Σ̃∆)∗ exists and is algebraic.
This observation, then leads to the desired characterisations.
Corollary 7.9. The monad CTB+O(Σ) in CSMet is isomorphic tothe monads Π(Σ̃Π)∗ and µy.∆(Σ̃y + −) with the canonical monadstructures.
8 The Algebras of Markov ProcessesIn this section we show how interpolative barycentric quantitativetheories with operators can be used axiomatise the probabilisticbisimilarity distance of Desharnais et al. [7] over Markov processes.
For any 0 < c < 1, we define the finite signature of contractiveoperators
Mc = {0 : ⟨0, c⟩} ∪ {⋄ : ⟨1, c⟩} ,consisting of one constant symbol 0, representing termination, anda unary operator ⋄(t) expressing the capability of doing a transitionto t . Both operators are associated with the same contractive factor.
The interpolative barycentric quantitative theory with opera-tors inMc , given as the disjoint union B + O(Mc ) of theories isgenerated by the following set of axioms
(B1) ⊢ x +1 y ≡0 x ,
(B2) ⊢ x +e x ≡0 x ,
(SC) ⊢ x +e y ≡0 y +1−e x ,
(SA) ⊢ (x +e y) +e ′ z ≡0 x +ee ′ (y + e′−ee′1−ee′
z) , for e, e ′ ∈ [0, 1) ,
(IB) {x ≡ε y,x′ ≡ε ′ y
′} ⊢ x +e x′ ≡δ y +e y
′, for δ ≥ eε + (1 − e)ε ′,(⋄-Lip) {x =ε y} ⊢ ⋄(x) ≡δ ⋄(y) , for δ ≥ cε .
Note that, the constant 0 has no explicit associated axiom, since itis derivable from (Refl).
8.1 Markov Processes over Metric SpacesWe briefly recall the definitions of Markov processes over metricspaces and discounted probabilistic bisimilarity distance on them,presented following the pattern proposed in [26, Section 6].
Definition 8.1. A (sub-probabilistic) Markov process over a metricspace is a tuple (X ,τ ) consisting of a metric space X of states andnon-expansive Markov kernel τ : X → ∆(1 + X ).
8
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
LICS’18, July 09–12, 2018, Oxford, UK
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
It is clear that these structures correspond to the coalgebras forthe (sub-probabilistic) Giry functor ∆(1 + Id) inMet.
In [26], van Breugel et al. proved that the final coalgebra for∆(1 + Id) in Met exists and they characterised the probabilisticbisimilarity distance on Markov processes as the pseudometricinduced by the unique homomorphism to the final coalgebra.
We will do the same here slightly extended their approach fordealing with the case when the probabilistic bisimilarity distanceis discounted by a factor 0 < c < 1. Explicitly, the only differenceconsists in considering coalgebras for the functor ∆(1 + c · Id) inMet. For simplicity we call these structures c-Markov processes.Note that Markov processes is a proper subclass: one can turn anyMarkov process into a c-Markov process as (X ,∆(1 + idcX ) ◦ τ ),where idc : Id ⇒ c · Id is the obvious natural transformation actingas the identity on the elements of the metric space and allowingfor the change of “type”.
The final coalgebra (Zc ,ωc ) for ∆(1 + c · Id) exists by similar ar-guments of [26, Section 6]. Then, for an arbitrary c-Markov process(X ,τ ), the c-discounted probabilistic bisimilarity pseudometric on(X ,τ ) is defined as the function dcτ : X × X → [0, 1] given as
dcτ (x ,x′) = dZc (h(x),h(x
′)) ,
where h : X → Zc is the unique homomorphism of coagebras from(X ,τ ) to (Zc ,ωc ).
Since terminal objects are unique up to isomorphism, the defini-tion of the distance function dcτ does not depend on which terminal∆(1 + c · Id)-coalgebra is chosen. Clearly, since dZc is a 1-boundedmetric, then dcτ is a well defined 1-bounded pseudometric.
Proposition 8.2 ([26]). Let (X ,τ ) be a c-Markov process. Then, forall x ,x ′ ∈ X , dcτ (x ,x ′) = 0, if and only if, x and x ′ are probabilisti-cally bisimilar.
We can show that this distance has a characterisation as theleast fixed point of a monotone function on a complete lattice of1-bounded pseudometrics.
Theorem8.3 ([26]). The c-discounted probabilistic bisimilarity pseu-dometric dcτ on (X ,τ ) is the least fixed point of the following operatoron the complete lattice of 1-bounded pseudometrics d onX with point-wise order ⊑, such that d ⊑ dX ,
Ψcτ (d)(x ,x
′) = supf ∈Φ1+c ·X
����∫ f dτ (x) −∫
f dτ (x ′)���� ,
with supremum ranging over the set Φ1+c ·X of non-expansive positive1-bounded real valued functions f : 1 + c · X → [0, 1].
8.2 On Metric SpacesIn this section we want to relate c-Markov processes and theirc-discounted probabilistic bisimilarity pseudometric with the freemonad arising from the quantitative theory B + O(Mc ) inMet.
First note that the functor associated to the signatureMc is
M̃c = 1 + c · Id .
where 1 is the terminal object in Met (i.e., the singleton metricspace)3. Thus, by Theorem 7.5, the free monad on B + O(Mc )
corresponds to the canonical monad structure on µy.Π(1+c ·y+−).
3Here we are implicitly applying the isomorphism 1 � c · 1.
Explicitly, this means that, the free monad onB+O(Mc ) assignsto an arbitrary metric space M ∈ Met the initial solution of thefollowing functorial equation inMet
FPM � Π(1 + c · FPM +M) .
In particular, whenM = 0 is the empty metric space (i.e., the initialobject) the above corresponds to the isomorphism on the initialΠ(1+c · Id)-algebra. This gives rise to a Π(1+c · Id)-coalgebra struc-ture on FP0, which in turn can be converted into a c-Markov processvia a post-composition with the subspace inclusion Π(−) ↪→ ∆(−).Let us write this c-Markov process as
(FP,α : FP → ∆(1 + c · FP)) .
The following states that the metric on FP corresponds to thec-discounted probabilistic bisimilarity (pseudo)metric on (FP,α).
Lemma 8.4. dFP = dcα
Proof. By Theorem 8.3 we need to prove that dFP is the least fixedpoint of Ψc
α . This follows trivially by definition of the functor Π(1+c · Id) and because (FP,α−1) is the initial Π(1 + c · Id)-algebra. □
Next we would like to give a more explicit characterisation of theelements in FP. By recalling the characterisation of the metric termmonad in [14], the elements in FP can be represented by equivalenceclasses of terms generated by the following grammar
f ::= 0 | ⋄(f ) | f +e f . for e ∈ [0, 1]
with respect to the kernel of the distance. In this specific case thedistance corresponds to dcα , with transition probability function αdefined as follows:
α(0) = δ⊥ , α(⋄(f )) = δf , α(f +e д) = α(f ) +e α(д) .
Thus, by Lemma 8.2, we can interpret the element in FP as pointed(or rooted) Markov processes constructed over the above grammarand quotiented by bisimilarity. It is not difficult to see that thesestructures correspond to the class of rooted acyclic finite Markovprocesses from [6].
8.3 On Complete Separable Metric SpacesWe would like to relate c-Markov processes and the c-discountedprobabilistic bisimilarity pseudometric with the free monad inCSMet.
By Corollary 7.9, we know that the free monad on B + O(Mc )
in CMet corresponds to the canonical monad structure on µy.∆(1+c · y + −).
Explicitly, this means that, for the case of complete metric spacesthe free monad on B+O(Mc ) assigns to any arbitrary metric spaceM ∈ CSMet the initial solution of the following functorial equationin CSMet
MPM � ∆(1 + c ·MPM +M) .
Observe that the map ωM : MPM → ∆(1 + c ·MPM +M) arisingfrom the above isomorphism is a coalgebra structure for the functor∆(1 + c · Id + M). Next we show that (MPM ,ωM ) is actually thefinal coalgebra in CSMet.
We will do this by using the following result from [25, Section 7].
Theorem 8.5 ([25]). Every locally contractive endofunctor H onCMet has a unique fixed point which is both an initial algebra and afinal coalgebra for H .
9
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
Note that if the fixed point lies in a subcategory of CMet, it isunique also in that subcategory. Hence, our goal is to prove that, foranyM ∈ CMet, the functor ∆(1 + c · Id +M) is locally contractive.
In CMet the homsets CMet(X ,Y ) are themselves complete sepa-rable metric spaces, with distance
dX→Y (f ,д) = supx ∈X
dY (f (x),д(x)) .
An endofunctor H on CMet is locally c-Lipschitz continuous if forall X ,Y ∈ CMet and non-expansive maps f ,д : X → Y ,
dHX→HY (H (f ),H (д)) ≤ c · dX→Y (f ,д) .
We say that H is locally non-expansive if is locally 1-Lipschitz con-tinuous, and locally contractive if is locally c-Lipschitz continuous,for some 0 ≤ c < 1.
Examples of locally contractive functors are the constant func-tors and the rescaling functor c · Id , for 0 ≤ c < 1. Locally contrac-tiveness is preserved by products and coproducts and composition.Moreover, if H is locally non-expansive andG is locally contractive,then FG is locally contractive.
Lemma 8.6. The endofunctor ∆ on CMet is locally non-expansive.
Thus, for the free monad on B+O(Mc ) in CSMet, the followingholds.
Theorem 8.7. For everyM ∈ CSMet, (MPM ,ωM ) is the final coal-gebra of the functor ∆(1 + c · Id +M) in CSMet.
Proof. This is a direct consequence of Theorem 8.5 and Lemma 8.6,since, 1 + c · Id +M is locally contractive and the composition ofa locally contractive functor with a locally non-expansive one islocally contractive. □
Note that, whenM = 0 is the empty metric space, the coalgebrasof this functor correspond to the final c-Markov process we haveused in Section 8.1 to characterise the c-discounted probabilisticbisimilarity distance. When M is not the empty space we have akind of Markov process that terminates in the states inM ; one canview the states ofM as absorbing states.
Hence, in the light of the Theorem 8.7, we have shown thatB+O(Mc ), for the case of complete metric spaces, axiomatises thec-probabilistic bisimilarity distance on the final Markov process.
9 ConclusionsThe main contribution of this paper was extending the notion of“sum of theories” from [10] to the quantitative setting. This, wefeel opens the way to developing combinations of quantitativeeffects just as [10] did for combining effects in the ordinary sense.The Markov process example developed in this paper is of interestin its own right as it is the underlying operational semantics forprobabilistic programming languages.
A significant novelty of this paper is a treatment of Markov pro-cesses that presents them both as algebras and as coalgebras. Thealgebra structure arises by combining the quantitative equationaltheory of probability distributions equipped with the Kantorovichmetric whereas the coalgebra structure corresponds to the finalcoalgebra equipped with the discounted probabilistic bisimilaritydistance. Such algebra-coalgebra duality has been used before [4]for automata but much more could be done and in future work wehope to use this connection to reason about properties of proba-bilistic programs.
AcknowledgmentsThis research was supported by grants from the Danish ResearchCouncil and from NSERC (Canada).
References[1] Jirí Adámek, StefanMilius, Nathan Bowler, and Paul Blain Levy. 2012. Coproducts
of Monads on Set. In LICS 2012. IEEE Computer Society, 45–54. https://doi.org/10.1109/LICS.2012.16
[2] Jirí Adámek, Stefan Milius, and Lawrence S. Moss. 2012. On Finitary Functors andTheir Presentations. In CMCS 2012 (Lecture Notes in Computer Science), Vol. 7399.Springer, 51–70. https://doi.org/10.1007/978-3-642-32784-1_4
[3] Michael Barr. 1970. Coequalizers and free triples. Mathematische Zeitschrift 116,4 (1970), 307–322. https://doi.org/10.1007/BF01111838
[4] Filippo Bonchi, Marcello M. Bonsangue, Helle Hvid Hansen, Prakash Panangaden,Jan J. M. M. Rutten, and Alexandra Silva. 2014. Algebra-coalgebra duality inBrzozowski’s minimization algorithm. ACM Trans. Comput. Log. 15, 1 (2014),3:1–3:29. https://doi.org/10.1145/2490818
[5] Pietro Cenciarelli and Eugenio Moggi. 1993. A Syntactic Approach to Modularityin Denotational Semantics. Technical report. CWI. Proc. 5th. Biennial Meetingon Category Theory and Computer Science.
[6] Josee Desharnais, Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden.2003. Approximating labelled Markov processes. Inf. Comput. 184, 1 (2003),160–200. https://doi.org/10.1016/S0890-5401(03)00051-8
[7] Josee Desharnais, Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden.2004. Metrics for labelled Markov processes. Theoretical Computer Science 318, 3(2004), 323–354.
[8] J. Dugundji. 1966. Topology. J. Wiley.[9] Neil Ghani, Christoph Lüth, Federico De Marchi, and John Power. 2001. Algebras,
Coalgebras, Monads and Comonads. Electr. Notes Theor. Comput. Sci. 44, 1 (2001),128–145. https://doi.org/10.1016/S1571-0661(04)80905-8
[10] Martin Hyland, Gordon D. Plotkin, and John Power. 2006. Combining effects:Sum and tensor. Theor. Comput. Sci. 357, 1-3 (2006), 70–99. https://doi.org/10.1016/j.tcs.2006.03.013
[11] Martin Hyland and John Power. 2007. The Category Theoretic Understandingof Universal Algebra: Lawvere Theories and Monads. Electronic Notes in Theor.Comp. Sci. 172 (2007), 437–458.
[12] Peter T. Johnstone. 1975. Adjoint Lifting Theorems for Categories of Algebras.Bulletin of the London Mathematical Society 7, 3 (1975), 294–297. https://doi.org/10.1112/blms/7.3.294
[13] G.M. Kelly. 1980. A unified treatment of transfinite constructions for free al-gebras, free monoids, colimits, associated sheaves, and so on. Bulletin of theAustralian Mathematical Society 22, 1 (1980), 1–83. https://doi.org/10.1017/S0004972700006353
[14] Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. 2016. QuantitativeAlgebraic Reasoning. In LICS. ACM, 700–709. https://doi.org/10.1145/2933575.2934518
[15] Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. 2017. On theaxiomatizability of quantitative algebras. In LICS 2017. IEEE Computer Society,1–12. https://doi.org/10.1109/LICS.2017.8005102
[16] Eugenio Moggi. 1988. The partial lambda calculus. Ph.D. Dissertation. Universityof Edinburgh. College of Science and Engineering. School of Informatics.
[17] Eugenio Moggi. 1991. Notions of computation and monads. Information andcomputation 93, 1 (1991), 55–92.
[18] Prakash Panangaden. 2009. Labelled Markov Processes. Imperial College Press.[19] Gordon Plotkin and John Power. 2001. Semantics for algebraic operations. Elec-
tronic Notes in Theoretical Computer Science 45 (2001), 332–345.[20] Gordon Plotkin and John Power. 2002. Notions of computation determine monads.
In Foundations of Software Science and Computation Structures. Springer, 342–356.[21] Dana Scott. 1970. Outline of a mathematical theory of computation. Technical
Monograph PRG-2. Oxford University Computing Laboratory.[22] Dana Scott. 1972. Lattice Theory, Data Types and Semantics. In NYU Symposia
in Computer Science, Randall Rustin (Ed.). 65–106.[23] Alex K. Simpson and Gordon D. Plotkin. 2000. Complete Axioms for Categorical
Fixed-Point Operators. In LICS 2000. IEEE Computer Society, 30–41. https://doi.org/10.1109/LICS.2000.855753
[24] Marshall H. Stone. 1949. Postulates for the barycentric calculus. Annali diMatematica Pura ed Applicata 29, 1 (1949), 25–30.
[25] Daniele Turi and Jan J. M. M. Rutten. 1998. On the Foundations of Final CoalgebraSemantics. Mathematical Structures in Computer Science 8, 5 (1998), 481–540.
[26] Franck van Breugel, Claudio Hermida, Michael Makkai, and James Worrell. 2007.Recursively defined metric spaces without contraction. Theor. Comput. Sci. 380,1-2 (2007), 143–163. https://doi.org/10.1016/j.tcs.2007.02.059
[27] Cédric Villani. 2008. Optimal transport: old and new. Springer-Verlag.
10
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
LICS’18, July 09–12, 2018, Oxford, UK
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
A Proofs from Section 4Here is the proof of Proposition 4.1.
Proposition A.1. K(Σ + Σ′,U +U ′) � K((Σ,U) ⊕ (Σ′,U ′)).
Proof. The isomorphism is given by the following pair of functors
K(Σ + Σ′,U +U ′) K((Σ,U) ⊕ (Σ′,U ′))
H
K
defined, for an arbitrary quantitative (Σ + Σ′)-algebra (A,γ ) sat-isfying U + U ′ and a ⟨U ,U ′⟩-bialgebra (B,α , β), respectivelyas
H (A,γ ) = (A,γ ◦ inl ,γ ◦ inr ) , K(B,α , β) = (B, [α , β]) ,
where [α , β] is the unique map induced by α and β by couniversalityof the coproduct ΣA + Σ′A. On morphisms both functors map amorphism to itself; it is easy to see that a homomorphism in onesense is also a homomorphism in the other.
The fact that the functors are inverses is clear: H ◦ K = Id andK ◦ H = Id follow immediately from the couniversal property ofcoproducts. We are done, provided we show that the functors areindeed well defined. In order to show that the functors are welldefined, we need to prove that the functors preserve the relevantquantitative equations.
To show that H is well defined we need to prove that whenever(A,γ ) satisfies U +U ′, then (A,γ ◦ inl ) and (A,γ ◦ inr ) satisfy U
andU ′, respectively. We will prove only that (A,γ ◦inl ) satisfiesU ,since the other follows similarly. Let Γ ⊢ t ≡ε s ∈ U and ι : X → Abe an arbitrary assignment of the variables. Since U ⊆ U +U ′,we have: (
for all t ′ ≡ε ′ s ′ ∈ Γ, dA(ι♯(t ′), ι♯(s ′)) ≤ ε ′)
implies (3)
dA(ι♯(t), ι♯(s)) ≤ ε ,
where ι♯ : T(Σ + Σ′,X ) → A is the homomorphic extension of ιon (A,γ ).
Note that, by definition of coproduct of functors and homomor-phic extension, we have that the following diagram commutes
X T(Σ,X ) ΣT(Σ,X )
T(Σ+Σ′,X ) (Σ+Σ′)T(Σ+Σ′,X ) ΣT(Σ+Σ′,X )
A (Σ+Σ′)A ΣA
ηΣ+Σ′
X
ηΣX
ι
i
ψ ΣX
Σi
ι♯
ψ Σ+Σ′
(Σ+Σ′)ι♯
inl
Σι♯
γ inl
where i is the canonical inclusion of Σ-terms in T(Σ + Σ′,X ). Theabove implies also that ι♯ ◦ i is the homomorphic extension of ιon (A,γ ◦ inl ). Recall that U is of type Σ. Thus in Γ ⊢ t ≡ε s canoccur only terms in T(Σ,X ). Therefore, (3) implies that (A,γ ◦ inl )satisfies Γ ⊢ t ≡ε s . This argument is general so it applies to thewhole theoryU .
For K , we need to show that whenever (A,α) satisfies U and(A, β) satisfies U ′, then (A, [α , β]) satisfies U +U ′. By the defi-nition of the disjoint union of quantitative theories, it suffices toprove that (A, [α , β]) is a model for bothU andU ′. We show theformer case, since the other follows similarly. Let Γ ⊢ t ≡ε s ∈ U
and ι : X → A be an arbitrary assignment of the variables. Since(A,α) satisfiesU , we have that(
for all t ′ ≡ε ′ s ′ ∈ Γ, dA(ι♯(t ′), ι♯(s ′)) ≤ ε ′)
implies (4)
dA(ι♯(t), ι♯(s)) ≤ ε ,
where ι♯ : T(Σ,X ) → A is the homomorphic extension of ι on (A,α).Note that, by definition of coproduct of functors and homomorphicextension, we have that the following diagram commutes
X T(Σ,X ) ΣT(Σ,X )
T(Σ+Σ′,X ) (Σ+Σ′)T(Σ+Σ′,X ) ΣT(Σ+Σ′,X )
A (Σ+Σ′)A ΣA
ηΣ+Σ′
X
ηΣX
ι
i
ψ ΣX
Σi
ι♭
ψ Σ+Σ′
(Σ+Σ′)ι♭
inl
Σι♭
[α,β ] inl
where i is the canonical inclusion of Σ-terms in T(Σ+Σ′,X ), andι♭ is the homomorphic extension of ι on (A, [α , β]). Since [α , β] ◦inl = α , the above implies also that ι♭ ◦ i = ι♯ . SinceU is of typeΣ, then Γ ⊢ t ≡ε s contains only terms in T(Σ,X ). Therefore, (4)implies that (A, [α , β]) satisfies Γ ⊢ t ≡ε s; again this implies theresult for all ofU . □
This is the proof of Theorem 4.5
TheoremA.2. LetU ,U ′ be continuous quantitative theories. Then,the monad CTU+U ′ in CMet is the sum of CTU and CTU ′ .
Proof. By Theorem 3.4, the monads CTU+U ′ , CTU , and CTU ′ are,respectively, the free monads onU +U ′, U , and U ′ in CMet.
Similarly to Corollary 4.3, one obtains that CK(Σ + Σ′,U +U ′)
and ⟨CTU ,CTU ′⟩-biAlg are isomorphic. Thus, by Theorem 3.4the forgetful functor from ⟨CTU ,CTU ′⟩-biAlg to Met has a leftadjoint, and the monad generated by this adjunction is isomorphicto CTU+U ′ . Thus, by [13] (cf. also [1, Proposition 2.8]), CTU+U ′
is is the sum of CTU and CTU ′ . □
Lemma A.3. LetU be a quantitative theory of type Σ. If Σ is count-able, then TU preserves separability of the metric spaces.
Proof. Let U 0 be the quantitative theory induced without extraaxioms (i.e., satisfying only the meta-axioms of quantitative equa-tional theories). Hence, any quantitative Σ-algebra is a model ofU 0, that is, K(Σ,U 0) = Σ-Alg.
SinceMet is locally countably presentable [2] and Σ has count-able rank the free monad Σ∗ exists and is algebraic. In particular,Σ∗-Alg � Σ-Alg. By Theorem 4.2, TU 0 -Alg � K(Σ,U 0). Thus themonads TU 0 and Σ∗ coincide. Since Σ is countable, it preservesseparability of the metric spaces. Thus, TU 0 does it too.
Let U be any quantitative theory. Since U 0 ⊆ U , any modelof U is of course a model of U 0. Thus, for any X ∈ Met, since(TUX ,ψU
X ) ∈ K(Σ,U 0), by Theorem 3.3, there exist a uniquehomomorphismh : TU 0X → TUX such that the following diagramcommute
X TU 0X ΣTU0X
TUX ΣTUXηU
ηU 0X
h
ψU 0X
ΣhψUX
11
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
LICS’18, July 09–12, 2018, Oxford, UK Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon Plotkin
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
In particular, h is non-expansive (hence, continuous).IfX is a separable metric space, then sinceTU 0 preserves separa-
bility, there exists a countable dense subsetD ⊆ TU 0X . Because h isa continuous function, then h(D) is a dense subset inTUX . Clearly,h(D) is countable, because D is so. Thus, TU preserves separabilityof metric spaces. □
B Proofs from Sections 5, 7 and 8This is the proof of Theorem 5.2.
Theorem B.1. The monads TB and Π in Met are isomorphic.
Proof. In the following we write ΣB and TB simply as Σ and T ,respectively. Similarly, we drop the superscript B for the relevantnatural maps. We need to show that there exist a natural isomor-phism σ : T ⇒ Π such that σ ◦η = δ and σ ◦ µ =m ◦σσ . We defineσ at X ∈ Met as the unique map σX that, by Theorem 3.3, makesthe following diagram commute
X TX ΣTX
ΠX ΣΠXδX
ηX
σX
ψX
ΣσXϕX
That σ is an isomorphism follows by Theorem 3.3 and Theorem 5.1.The equality σ ◦ η = δ follows by definition of σ . The equalityσ ◦ µ =m ◦ σσ follows by Theorem 3.3 and the commutativity ofthe following diagrams
T TT ΣTT
T ΣT
Π ΣΠ
id
ηT
σ
µ
ψT
Σµ
σ
ψ
Σσϕ
T TT ΣTT
Π ΠΠ ΣΠΠ
Π ΣΠ
ηT
σ σσ
ψT
Σµ
id
δΠ
m
ϕΠ
Σmϕ
All but one of the squares above commute by definition or by theunit law of monads, whereas the equalitym ◦ϕΠ = ϕ ◦ Σm followsby definitions ofm and ϕ and linearity of Lebesgue integral. □
This is the proof of Theorem 7.3
Theorem B.2 (Free Algebra). For any X ∈ Met, Σ̃Π-algebra (A,α),and non-expansive map β : X → A, there exists a unique Σ̃Π-homo-morphism h : PX → A making the diagram below commute
X PX Σ̃ΠPX
A Σ̃ΠAβ
ϱX
h
ϑX
Σ̃Πh
α
Proof. LetX ∈ Met. Given a Σ̃Π-algebra (A,α) and the non-expansivemap β : X → A, we define the function h : PX → A by induction ofthe complexity of the structure of the elements in PX as follows,for arbitrary x ∈ X , f : n ∈ Σ, and µ1, . . . , µn ∈ Π(X ),
h(x) = β(x) ,
h(f ⟨µ1, . . . , µn⟩) = α(inf (µ1 ◦ h−1, . . . , µn ◦ h−1)) .
The equality h ◦ ϱX = β follows by definition, because ϱX (x) = x .
For arbitrary f : n ∈ Σ and µ1, . . . , µn ∈ Π(PX ), we have
h◦ϑX (inf (µ1, . . . , µn )) =
= h(f ⟨µ1, . . . , µn⟩) (def. ϑX )
= α(inf (µ1 ◦ h−1, . . . , µn ◦ h−1)) (def. h)
= α(inf (Π(h)(µ1), . . . ,Π(h)(µn ))) . (def. Π)
By couniversality of the coproduct, from the above we get therequired equality h ◦ ϑX = α ◦ Σ̃Πh. If h′ : PX → A is anotherhomomorphism such that h′◦ϱX = β , then the following equalitieshold, for arbitrary x ∈ X , f : n ∈ Σ, and µ1, . . . , µn ∈ Π(PX ),
h′(x) = β(x) ,
h′(f ⟨µ1, . . . , µn⟩) = α(inf (Π(h′)(µ1), . . . ,Π(h
′)(µn ))) .
Then, by an easy induction on the complexity of the structure ofthe elements in PX we get that h = h′: the base case is trivial; theinductive case follows by
h′(f ⟨µ1, . . . , µn⟩) =
= α(inf (Π(h′)(µ1), . . . ,Π(h
′)(µn ))) . (h′ homomorphism)
= α(inf (µ1 ◦ (h′)−1, . . . , µn ◦ (h′)−1)) (def. Π)
= α(inf (µ1 ◦ h−1, . . . , µn ◦ h−1)) (by inductive hp.)
= h(f ⟨µ1, . . . , µn⟩) . (def. h)
It only remains to prove that h is non-expansive. We proceed byinduction. The base case follows trivially by definition h and dPX ,and non-expansiveness of β . As for the inductive case, by definitionof dPX , as the metric dA is 1-bounded, the only interesting case tocheck is the following, for f : ⟨n, c⟩ ∈ Σ
dPX (f ⟨µ1, . . . , µn⟩, f ⟨ν1, . . . ,νn⟩) =
= c ·nmaxi=1
K(dPX )(µi ,νi ) (def. dPX )
≥ c ·nmaxi=1
K(dPX )(µi ◦ h−1,νi ◦ h
−1) (inductive hp.)
≥ dA(α(inf (µ1, . . . , µn )),α(inf (ν1, . . . ,νn ))) (α , inf non-exp.)= dA(h(f ⟨µ1, . . . , µn⟩),h
′(f ⟨ν1, . . . ,νn⟩)) . (def. h)
This concludes the proof. □
This is the proof of Lemma 7.6 from Subsection 7.2.
Lemma B.3. The the functorTB+O(Σ) inMet preserves separability.
Proof. It is known that Π with Kantorovich metric preserves sepa-rability (cf. [27, Theorem 6.18]). For convenience, we briefly recallthe argument here. Let X be a separable metric space and D ⊆ X acountable dense subset of X . For any subset A ⊆ X , written Θ(A)the set of Borel probability distributions expressed as finite convexsums of the form
∑ni=1 qi · δai , where δai is the Dirac distribution
at ai ∈ D, and∑ni=1 qi = 1 for qi ∈ Q≥0. Clearly, Θ(A) ⊆ Π(A) and,
if A is countable, so is Θ(A). By a standard limiting argument , ifA is dense in X , so is Θ(A) in Π(X ) w.r.t. the Kantorovich metricK(dX ). Therefore Θ(D) is a countable dense subset of Π(X ).
Next we show that also (Σ̃Π)∗ preserves separability. Let X bea separable metric space and D ⊆ X a countable dense subset ofX . From Section 7.1, we know that (Σ̃Π)∗X = PX . We define thesubsets SnX ⊆ PX , by induction on n ∈ N as follows
• if d ∈ D, then d ∈ S0X ;• if µ1, . . . , µn ∈ Θ(SnX ) and f : n ∈ Σ, then f ⟨µ1, . . . , µn⟩ ∈ Sn+1X ,
12
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
LICS’18, July 09–12, 2018, Oxford, UK
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
where Θ(−) is defined as above. By an easy induction on n ∈ N, oneproves that SnX is countable. The base case is trivial. Assume thatSnX is countable. Then Θ(SnX ) is countable and since the signatureΣ is assumed to be countable, we have that also Sn+1X is countable.
Consequently, the set SX =⋃n S
nX is countable. Moreover, by an
easy induction on the complexity of the structure of the elementsin PX , the one shows that any element in PX is arbitrarily close tosome element in SX w.r.t. the metric dPX . Hence, (Σ̃Π)
∗ preservesseparability.
By Corollary 7.4, TB+O(Σ) � Π(Σ̃Π)∗. Thus, TB+O(Σ) preservesseparability of the metric spaces. □
Here is the proof of Lemma 8.6.
Lemma B.4. The endofunctor ∆ on CMet is locally non-expansive.
Proof. We need to check that for all f ,д ∈ CMet(X ,Y ),
supx ∈X
dY (f (x),д(x)) ≥ supµ ∈∆(X )
K(dY )(∆f (µ),∆д(µ)) . (5)
Write ΦY for the set of non-expansive functions k : Y → [0, 1], i.e.,those functions such that ∀y,y′. |k(y) − k(y′)| ≤ dY (y,y
′). Then,for any µ ∈ ∆(X ),
K(dY )(∆f (µ),∆д(µ)) =
= supk ∈ΦY
����∫ k d∆f (µ) −∫k d∆д(µ)
���� (def. K(dY ))
= supk ∈ΦY
����∫ k d(µ ◦ f −1) −
∫k d(µ ◦ д−1)
���� (def. ∆)
= supk ∈ΦY
����∫ k ◦ f dµ −∫k ◦ д dµ
���� (change of var.)
= supk ∈ΦY
����∫ (k ◦ f ) − (k ◦ д) dµ���� (linearity of
∫)
≤ supk ∈ΦY
∫|(k ◦ f ) − (k ◦ д)| dµ (subadd. of | · |)
≤
∫dY ◦ ⟨f ,д⟩ dµ (monotonicity of
∫)
≤
∫supx ∈X
dY (f (x),д(x)) dµ (monotonicity of∫)
= supx ∈X
dY (f (x),д(x)) . (µ probability measure)
By the above, supx ∈X dY (f (x),д(x)) is an upper bound of the set{K(dY )(∆f (µ),∆д(µ)) | µ ∈ ∆(X )}. Hence, this implies (5). □
13