 Hello everybody and greetings from Scotland. It's Radu Mardaris speaking from the sunny Glasgow. Let me start by thanking the organizer to invite me to give this talk. I'm very sorry that we could not have done this in Paris. I miss you all very much. I miss our conferences, our discussions, so I hope soon all this madness will be over and we'll be able again to meet in our conferences. Today I'm going to tell you about quantitative algebras and the perspective of a metrized theory of algebraic effects. This is a project that I initiated back in 2016 together with Prakash Panangardhan and Gordor Blotkin and recently Giorgio Bacci joined our efforts and we have written a couple of papers about this subject and today I'm going to summarize you the main ideas and a couple of examples, hopefully to convince you that this is an interesting field to proceed and study. So the motivation behind this work is the need of studying the foundation of computational theory when one speaks about probabilistic computation and probabilistic programming. With respect to the classic computation, probabilistic computation is bringing new challenges. First of all, because the concept of exact behavior of a program is not so much the important point. So if we are looking, for instance, to the application of probabilistic programming in cyber physical systems, their probabilistic system is using the probabilistic stochastic information to abstract uncertainty. And for this reason, the exact value of a probability is not so important. A small epsilon difference between two systems is not so relevant. If we are thinking, for instance, to application in deep learning we are expecting, for instance, to see that to prove that the learning algorithm applied successively is producing a sequence of convergent models to the target model. This convergence, again, is requiring some kind of way of thinking about approximations, some kind of way of thinking about topology in the semantics. So for this reason, it appears as important to start base the semantic of probabilistic phenomena, not on a congruence base semantics as we did in the classic case, but rather on a metric base semantics. So there are many who in the last 10 years or so propose various kind of behavioral metrics to replace the classic concepts of bisimulation, observational equivalences in order to propose a way to evaluate to compare programs which are not equivalent. So if one replaces the congruence base semantics with a metric base semantics, at the logical level of the analysis of programs level, one is expecting to replace the Boolean reasoning with some kind of quantitative reasoning. So this is the motivation that is behind our work we are trying to realize such a semantic and develop this kind of reasoning. If we speak about computational effects, they were introduced by Moji in 80s as a way to incorporate into denotational semantic monads, and monads were in his view the right way of speaking about computational effects. Decade later, plotkin and power and then many others started to look to computational effects from an algebraic perspective, looking to monads as being given by operations and equations. If we take the point of view of category theory, we move from monads to lovier theories and the equational theories are seen as lovier theories. However, the classic equational theory and the classic programming paradigms are usually looking to monads in set, and this is not really what we need if we want to provide a metric semantics. Lovier, even before the concept of monad being invented, was speaking about a monad of great interest, which is the monad of the category of probabilistic mappings. And later in 80s, Giri proposed what we call today the Giri monad, the monad on measure spaces that can also be instantiated over polished spaces over completely separate metric spaces. However, probabilistic reasoning requires measure theory, but measure theory works best when we are in the presence of metric and especially polished spaces. So if we are looking, for instance, on the work of Panangarden and his collaborators on the concept of label Markov processes, we see that putting at the center of this concept a polish or an analytic space instead of just a measurable space is appropriate and gives one of the a nice logical characterization. So there are many arguments for looking rather to polish spaces and definitely to metric spaces rather than just to measurable spaces. However, metric ideas, let me remind you that we're present from the beginning of semantics if we're looking to Heiko Debaker school and so on. So this is not a new idea. So our challenge here is to develop a metrice theory of computational effects and the idea is that we should define generalized concept of universal algebra so that the algebras are not supported by a set only but by a metric space and the metric structure should properly interact with algebraic structure. So from a from an equational perspective, if in the classical reasoning we have equations of type s equal t, we want to replace them in what we're going to call quantitative reasoning with equations of type s equal epsilon t for epsilon some positive reals. With the intention of interpreting this as s is within distance epsilon from t or epsilon is an upper bound of the distance between s and t. So if classic equations are producing an equivalence that is congruence with respect to the algebraic structure so produce a congruence over over the terms of the algebra, such quantitative equations are not producing an equivalence but the metric pseudo metric on terms so there are terms that can be a distance zero without being identical and if we quotient them with respect to the distance zero then we get a metric, a proper metric on terms. So while in the classic case such a congruence produce always a monad of on sets, starting from quantitative equations what we're going to get is a monad on the category imet which is the category of extended metric spaces. Extended metric spaces are metric spaces that might have points a distance plus infinity of each other so why we choose this category instead of the category of metric spaces is for various reasons. For first of all I forgot to say what are the morphes so the morphes that we consider in imet are non-expansive maps between metric spaces. So from an algebraic perspective we should have imet because if we cannot derive in a theory a equation between two terms these two terms must be a distance plus infinity so we must put a distance between them and instead of just randomly choosing an upper bound of the space we can simply choose a plus infinity. Then another reason is that with respect to the category of metric spaces the category of extended metric spaces has a lot of nice properties. It is symmetric monoidal closed, it is locally countably presentable, it is essentially the co-produced completion of the category of metric spaces so a lot of nice properties that we can use later. So our running example will be the barycentric algebra which is an algebra introduced by stony49 to speak about probabilistic distribution. So the signature of this algebra is a set of binary operators plus indexed with some number in zero one. They satisfy a class of axioms so to understand these axioms let's take a look first to one model of this. So if we are starting from a measurable space x sigma let delta of x sigma the space of probability distributions over this measurable space. And we can organize now delta as a barycentric algebra by interpreting plus epsilon as the epsilon convex combination of the two distributions. So now if we are looking to the axiom b1, b2 and so on we see that this interpretation of convex combinations is exactly what these axioms are describing. So the first one is says that one zero convex combination of the anti prime is the same thing with t that an epsilon combination of t with itself is t. This represents the skew commutativity. This is the so-called skew associativity so expected results. So this is a classic algebra. But on the set delta we have some meaningful metrics such as Kantorovich metric for instance or total variation metric or there are a couple of others. So if we want now to turn this algebra into an algebra that will start to axiomotize such a metric we will have then to have equations of type equilepsilon between distributions. First of all our axioms will all replace equality with equal zero. But we will then have to find some axioms that are properly speaking about equilepsilon equations for epsilons which are not only zero. And this is what we're going to do. Now let's take a deeper look to see what that requires on the meta theoretical part. So in the classic equation theory we have a set of deduction rules. Here I have listed four for you. So the first three for instance are encoding the fact that equality is an equivalence. The last one encodes the fact that any function in the signature is a congruence and so on so forth. All this will have to be adapted to the quantitative case. So the fact all equilepsilons are reflexive and symmetric. But for instance equilepsilons are not transitive. Instead the transitivity will be replaced by a rule that is encoding the triangle inequality. The same about the congruence rule. So if we replace equal in the congruence rule with equilepsilons what we encode here is the fact that any function in our signature is non-expansive. And so on so forth we can have a couple of more deduction rules that will define a quantitative equation of theory. What is a quantitative algebra? So a quantitative algebra is a construction of this type where A omega represents a classic omega algebra. A d is a metric space so the omega algebra is supported not by a set A only as in the case of universal algebra but by a metric space where d is an extended metric so it might have the value plus infinite. And moreover the algebraic structure properly interacts with the metric in the sense that all functions in omega are non-expansive. What is a morphism of quantitative algebras is just a morphism of omega algebras which in addition is also a non-expansive map on the supported metric spaces. So now let's denote by qA of omega the category of omega quantitative algebras. So now if we if we get a signature omega under set x of variables we can construct all the terms within this signature and this set of variables let's call this omega hat x and then we can write down quantitative judgments which will be sets of hypotheses sets of quantitative equations proving another quantitative equation. And now if we have an quantitative algebra A we can speak about when such an algebra satisfies such a judgment and that will happen when for any assignment alpha of terms to elements in algebra I have that every time the set of hypotheses is satisfied so the distance between the interpretation of s e and t is smaller equal epsilon e for all e and i this implies that the interpretation of s and t is upper bounded by epsilon as well. With this definition we can easily prove a completeness result. So given a quantitative equational theory u over omega x let's qA of u denote the set of all models of the theory u then we can prove that a judgment gamma proves s e to epsilon t is in u if and only if for all algebras in qA of u this judgment is satisfied. Next we can construct a concept of term algebra so if we start from the signature and a quantitative equational theory at the first step we can construct an omega algebra in the classic way and then using u we can define pseudo metric over the terms so the distance between s and t will be just the infimum of all epsilon such that the equation x equal epsilon t is provable in u. And with this we can now obtain a quantitative algebra over the omega structure and not only but this quantitative algebra is actually a model of u. Very important result. We can also freely generating models so again we start with the quantitative equational theory u over omega hat x and if we have a metric space md we will use it as a generator to induce now a metric space over the terms I can construct from m so first of all we construct all the terms we can from m and the signature omega and this omega hat will be now an omega algebra and then we can use u to define a metric over the terms in omega hat m so the distance between two such terms will be the infimum of all epsilon so that I can find an assignment alpha and two terms s and t in omega x so that m and n are the interpretation of an s and t and actually s equal epsilon t is provable in u. Exactly as you would expect this to be done with this in mind now we can define the freely generated model I will call it from now on omega u md which is not only a quantitative algebra but is actually a quantitative algebra that's satisfied that they were u so it is the freely generated model and in fact this freely generated model has indeed the universal mapping property for the metric space md to the forgetful factor that is taking any quantitative algebra satisfying u and is forgetting the algebraic structure so returns the support metric space the natural transformation here eta that is mapping md in its in the in the extended metric space is actually taking any m to itself any element in m to itself so with these results we actually have a nice landscape observed that omega u that I just defined is an end of factor that defines a model a monad on the category of extended metric spaces so if we are starting with a quantitative equation of theory u on one hand we can define the monad of the factor omega u which is a monad on imet on the other hand we can define the the the category of models of u and one and we could prove that the category of models of u is actually isomorphic with the category of omega u eilember more algebras this is a very interesting result so now if we go back to the barycentric algebra i put this slide to remind you what that was let's try to turn it into a quantitative algebra so we take the axioms b1 b2 skew commutativity skew associatives before and i am proposing you now a new axiom i call it ib which is coming from interpolative barycentric this is how i'm going to call this algebra interpolative barycentric uh interpolative barycentric algebras so this axiom is reflecting what the geometric fact that i draw for you here so if the term s1 is a distance epsilon one of term t2 s2 is a distance epsilon two of term t2 then if i'm taking the r convex combination of s1 and s2 which is s1 plus rs2 and uh the r convex combination t1 and t2 here then their distance is the r convex combination of epsilon one and epsilon two this is what this axiom's i axiom ib is saying so let's call i curly i this theory that is axiomotized by b1 b2 s csa and ib so this is definitely a metric and we can interpret it over the distributions as as stone did so given a matrix space md let pi of m for now be definitively supported probability measures on the bore algebra of md and now for two distribution mu and nu in pi of m let's define plus epsilon as the convex combination as we did it before we can have various kind of metrics on this i want to show you for this example the kantorovich metric induced by d which is a metric over these distributions within its support and it is defined in this way you can find it in literature it's a it's a metric with a long history in mathematics the important thing is that we can prove that the finitely supported probability measures on m on md with this signature so with the interpretation of plus epsilon as the convex combination and with kantorovich distance is actually a model of the equational theory i just showed you of equational theory i and not only but in fact this model is isomorphic with the freely generated model from md where the map is i'm so i'm associating to each element in m its direct distribution here so this says that in fact the axiomatic system i is indeed an axiomatic system that characterizes kantorovich distance this is how i'm reading this this result because since this model is isomorphic with the freely generated one and the freely generated one is the model containing the minimum algebraic and metric information that one can derive from that axiomatic system this means that axiomatic system indeed axiomotizes this metric so in other words if we are going back this four axioms i am claiming that are the axioms of kantorovich distance which is our result there is a problem in this moment which is that we are looking only to finitely supported probability measures and i'm going to try to fix this so i'm i'm aiming to go to the general um measures here and for this reason i need actually to move from arbitrary metric spaces to poly spaces to complete separable metric spaces so for this we introduce first the concept of complete quantitative algebra so giving a quantitative algebra a its completeness it's another quantitative algebra in which what we are doing is firstly we are completing the metric space so we are adding as elements or the limits of course g sequence sequences and then for each such limit we are lifting the algebraic structure so for each function in the signature we are lifting this function to properly go to the limit of uh quasi sequences and this we will call uh a completeness of a of a quantitative and the result will be a complete quantitative algebra we also have the concept of continuous judgment so continuous judgment is a quantitative judgment thus before so that the index of the equality in the conclusion is a continuous function in the indices of the hypothesis so f is a continuous function in all variables and its variables are this epsilon so if a quantitative algebra satisfies continuous judgment so does its completion this is a very important result and secondly if u is an omega quantitative equational theory that can be axiomatized using only continuous judgment and md is a metric space then the completion of the freely generated model is actually isomorphic with the model that we obtain by first completing the metric space taking the freely generated model and completing it again so we're going to use this to to to go to in uh to continuous models for for our example before what is important is that by doing this we are actually going from uh emet to the category of complete separable metric metric spaces extended metric spaces which is uh a proper subcategory of emet but a category of a lot of nice properties as you're gonna see so let me just show you what is happening with interpolative barycentric algebra on polyspaces so given a complete separable metric space md let pi of m be the finitely supported borel probability measures on mds we had in the slide before and let now delta of m be the general borel probability measures on md on delta of m we have a weak topology the weak topology is again a topology with a long history of mathematics and it is a topology that is uh definers uh if i'm taking the limit of a sequence of measures mu i and that limit is mu then for all bounded continuous functions from f f from m to the reals the integrals convert the the integral of f on d mu i converges to integral f of d mu so here um the lubricant integrals uh and this converges in is in reals so this is the definition of weak topology and the fact is that if md is a complete separable metric space and pi then pi m which is the finitely supported borel probability measures on md is actually a dense set in delta of m with respect to this weak topology and moreover this weak topology is actually metrized by kantorovich metric k d so we're going to explore this fact so remember that we have proved that the model of probabilities with um um finite support and kantorovich metric is actually isomorphic with a freely generated model from the signature b by the equational theory ai now if md is is separable so is uh b hat m and d i but md being complete doesn't guarantee that this space is complete so we're gonna complete this space b hat m and once we do this we can prove that if md is a complete and separable metric space then the model of borel probability distributions in general with the signature b and kantorovich metric is actually isomorphic with the completion of the freely generated model uh in the theory i in particular the quantitative algebra of general borel probability measure is actually the completion of the algebra of distributions within its work with kantorovich metric and this is the way we are using this completion apparatus and this is happening because all the axioms of i are actually continuous judgments so this is more or less what i wanted to show you will find in our papers a lot of other examples of metrics and a lot of other axiomatization for instance for total variation distance for house north metric and for many many others there are a lot of other results published and some of them are still under development so for instance we are looking these days on on what is happening with we are combining more notes so um the fact that imet is uh is um symmetric monoidal close category allows us to speak about the way of defining this joint union tensorial products of monads which correspond to various kind of combination of axiomatic theories and we combine these results to axiomatize more complex situations so for instance we did this to to axiomatize the kantorovich distance on on mark of processes one can look to exception states quantitative analog of input output trace base semantics we are working now on mark of decision processes and their behavioral distance which requires variants of tensorial products we have also uh looking to birkhoff kind of theorems and we have results that generalize both the varieties and quasi varieties theorems of birkhoff for this quantitative case there is work on a multi sorted algebras that can for instance exam for example encode the situation in which the category of metric spaces is not supported by non-expansive maps but maybe by some kind of contractive functors like contractive operators like lip sheets operators or this kind of stuff so there are a lot of work i know that this this meeting so valeria vinudelli will make a presentation about an application of of quantitative algebras to treat a combination of probabilities and non-determinism looking forward to see her talk well this is all thank you very much for watching and i hope i will meet you soon at the discussion session good bye