    # Modular Runtime Complexity Analysis of Probabilistic While Programs

We are concerned with the average case runtime complexity analysis of a prototypical imperative language endowed with primitives for sampling and probabilistic choice. Taking inspiration from known approaches from to the modular resource analysis of non-probabilistic programs, we investigate how a modular runtime analysis is obtained for probabilistic programs.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Preliminaries

### Multisets

A (possibly infinite) multiset over a set is a mapping . The union of a countably many multisets is defined by

 \pa[]⨄i∈IMi(a)\defeq∑i∈IMi(a)

which forms a multiset if and only if is finite for every . The sum of a multiset with respect to is defined by

 ∑a∈Mf(a)\defeq∑a∈AM(a)⋅f(a)

We use set-like notations for multisets: denotes the empty multiset , is the multiset with , and is its special case where is finite.

### Weighted Abstract Reduction Systems

A weighted ARS over state space is a ternary relation . We write meaning . We define the ARS induced by at cost , by the following inference rules:

 \infera→0a\infera→cba→\ATcb\infera→c+dba→ca′a′→db

We say is a normal form with respect to if there exists no with . The set of normal forms with respect to is denoted by . The potential of with respect to is defined by . The weighted ARS is called strongly bounded on , , if for every , there exists such that implies ; This is equivalent to saying that for every .

### Weighted Probabilistic Abstract Reduction Systems

A multidistribution on a set is a multiset of pairs of and , written , satisfying . We denote the set of multidistributions on by . Multidistributions are closed under convex multiset unions for every finite or countable infinite index set

with , where scalar multiplication is defined by for .

The restriction of a multidistribution to a set is defined by . For a function , we denote by its homomorphic extension defined by

 \fmapf(\prmspi:ai∣i∈I)\defsym\prmspi:f(ai)∣i∈I\tpkt

For , we define the expectation of a function as . Notice that .

###### Definition 1.

A weighted probabilistic ARS over is a set . As before, we may write for . We define the weighted ARS over induced by as follows:

For a weighted probabilistic ARS , let us define . A weighted probabilistic ARS over is strongly bounded on a set if , i.e., for all .

## 2 Probabilistic While

We consider an imperative language in the spirit of Dijkstra’s Guarded Command Language [Dijkstra75], endowed with primitives for sampling from discrete distributions as well as non-deterministic and probabilistic choice. Let denote a finite set of integer-valued variables . We denote by the set of stores, that associate variables with their integer contents. The syntax of program commands over is given by the following grammar.

 (\Cmd) \cmd,\cmdtwo \bnfdef\skipc effectless operation ∣\tickcr resource consumption ∣\haltc termination ∣\var\passign\expd probabilistic assignment ∣