programming languages

The Best of Times, the Worst of Times: Moment-Based Analysis of Probabilistic Cost Structures

arXiv:2607.25361

summary

The paper introduces a compositional static analysis that computes mean, variance, and higher moments of cost distributions for probabilistic programs whose costs involve additive, min, and max operations, using hierarchical cost expressions and surrogate distributions.

Abstract

This paper studies how to compute the moments -- mean, variance, and beyond -- of the cost (e.g., running time) of certain probabilistic programs, in which local costs combine not only additively but also via the extremal operations and . Such costs arise naturally -- for instance, the number of rounds of a contention-resolution protocol, the waiting time of a quantum repeater, and the completion time of a fork-join computation -- but fall outside the scope of moment-based analyses developed for additive costs. The difficulty is that and are nonlinear: the moments of are not determined by those of and , so propagating moments alone fails. In contrast, propagating full distributions would suffice, but is computationally intractable. We present a compositional cost analysis for a family of probabilistic programs whose cost structure can be represented as a hierarchical cost expression. The analysis proceeds bottom-up through the hierarchical structure, solving local recurrence equations at each node and summarizing each subproblem with a surrogate distribution. Each surrogate consists of an exact short-time prefix and a compact parametric tail. Our approach computes the mean of the cost distribution with a sound error bound, and systematically lifts to second and higher moments. In addition, precision can be increased by refining the surrogate representation, trading additional computation for tighter bounds. We implemented our method in a tool, called DICKENS, and evaluated its capabilities on three problems: quantum repeater waiting times, RFID collision resolution, and completion times of fork-join computations.

65 pages

Topics & keywords

The Best of Times, the Worst of Times: Moment-Based Analysis of Probabilistic Cost Structures · wovepaper