## Section: New Results

### Probabilistic Systems and Resource Control

Participants : Martin Avanzini, Mario Bravetti, Raphaelle Crubillé, Ugo Dal Lago, Francesco Gavazzo, Gabriele Vanoni, Akira Yoshimizu.

#### Probabilistic Programming and Static Analysis

In FoCUS, we are interested in studying probabilistic higher-order
programming languages and, more generally, the fundamental properties
of probabilistic computation when placed in an interactive scenario,
for instance concurrency. One of the most basic but nevertheless
desirable properties of programs is of course termination. Termination
can be seen as a minimal guarantee about the time complexity of the
underlying program. When probabilistic choice comes into play,
termination can be defined by stipulating that a program is
terminating if its probability of convergence is 1, this way giving
rise to the notion of *almost sure termination*. Alternatively, a
probabilistic program is said to be *positively* almost surely
terminating if its average runtime is finite. The latter condition
easily implies the former. Termination, already undecidable for
deterministic (universal) programming languages, remains so in the
presence of probabilistic choice, even becoming provably harder.

The FoCUS team has been the first in advocating the use of types to
guarantee probabilistic termination, in the form of a monadic
sized-type system [17]. Developed in
collaboration with Grellois by Dal Lago, this system substantially
generalises usual sized-types, and allows this way to capture
probabilistic, higher-order programs which terminate almost surely.
Complementary, in collaboration with Ghyselen, Avanzini and Dal Lago
have recently defined a formal system for reasoning about the
*expected runtime* of higher-order probabilistic programs,
through a *refinement type system* capable of *modeling
probabilistic effects* with exceptional
accuracy [26]. To the best of our knowledge,
this provides the first formal methodology for *average case
complexity analysis* of higher-order programs. Remarkably, the
system is also *extensionally complete*.

In 2018, we have started to investigate the foundations for
*probabilistic abstract reduction systems* (*probabilistic
ARSs*), which constitute a general framework to study fundamental
properties of probabilistic computations, such as termination or
confluence. In 2019, we have significantly revised this initial
development [11]. Particularly, we have
refined Lyapunov ranking functions by conceiving them as
*probabilistic embeddings*. The ramifications of this work are
two-fold. First, we obtain a sound and complete method for reasoning
about strong positive almost sure termination. Second, this method
has been instantiated in the setting of (first-order)
*probabilistic rewrite systems*, giving rise to the notion of
*barycentric algebras*, generalising the well-known
interpretation method. Barycentric algebras have been integrated in
the termination prover *NaTT* (See
https://www.trs.css.i.nagoya-u.ac.jp/NaTT/.), confirming the
feasibility of the approach.

We have also worked on higher-order model checking as a way to prove termination of probabilsitic variations on higher-order recursion schemes [36], obtaining encouraging results. More specifically, an algorithm for approximating the probability of convergence of any such scheme has been designed and proved sound, although the problem of precisely computing the probability of convergence is shown to be undecidable at order 2 or higher. Finally, we have published a new version of a contribution we wrote in 2017 about how implicit computational complexity could help in proving that certain cryptographic constructions have the desired complexity-theoretic properties [12].

#### Higher-Order end Effectful Programs: Relational Reasoning

In FoCUS, we are also interested in relational reasoning about programs written in higher-order programming languages. In the recent years, this research has been directed to effectful programs, namely programs whose behaviour is not purely functional. Moreover, there has recently been a shift in our interests, driven by the projects REPAS and DIAPASoN, towards quantitative kinds of relational reasoning, in which programs are not necessarily dubbed equivalent (or not), but rather put at a certain distance.

The first contribution we had in this direction is due to Dal Lago and Gavazzo [31], who generalized the so-called open normal-form bisimilarity technique to higher-order programs exhibiting any kind of monadic effect. The key ingredient here is that of a relator, and allows to lift relations on a set to relations on monadic extensions to the same set. This allows to define open normal-form bisimilarity, and to prove it correct. This, together, with other contributions, have also appeared in Gavazzo's PhD Thesis, which has been successfully defended in April 2019 [10], and which has been awarder the Prize for the Best PhD Thesis in Theoretical Computer Science by the Italian Chapter of the EATCS.

We have also given the notion of differential logical
relations [33], a generalization of Plotkin's
logical relations in which programs are dubbed being at a certain
*distance* rather than being just *equivalent*. Noticeably,
this distance is not necessarily numeric, but is itself functional
if the compared programs have a non-ground type. This allows to
evaluate the distance between programs taking into account the possible
actions the environment can make on the compared programs.

#### Alternative Probabilistic Models

We are also interested in exploring probabilistic models going beyond the usual ones, in which determinisitic programming languages are endowed with discrete probabilistic choice.

We have first of all studied bayesian $\lambda $-calculi, namely
$\lambda $-calculi in which not only an operator for probabilistic
choice is available, but also one for *scoring*, which serves as
the basis to model conditioning in probabilistic programming. We give
a geometry of interaction model for such a typed
$\lambda $-calculus [34], namely a paradigmatic
calculus for higher-order Bayesian programming in the style of
PCF. The model is based on the category of measurable spaces and
partial measurable functions, and is proved adequate with respect to
both a distribution-based and a sampling-based operational semantics.

We have also introduced a probabilistic extension of a framework to specify and analyze software product lines [15]. We define a syntax of the language including probabilistic operators and define operational and denotational semantics for it. We prove that the expected equivalence between these two semantic frameworks holds. Our probabilistic framework is supported by a set of scripts to show the model behavior.