Polar: An Algebraic Analyzer for (Probabilistic) Loops
Marcel Moosbrugger, Julian Müllner, Ezio Bartocci, Laura Kovács
TL;DR
Polar tackles the automated analysis of classical and probabilistic loops by translating loop semantics into linear recurrences over moments and solving them to produce closed-forms. This enables automatic generation of the strongest polynomial invariants and the sensitivities of moments with respect to unknown parameters, under well-defined computability restrictions. The framework handles loops with if-statements, polynomial arithmetic, and common distributions, and provides incomplete but sound methods for analyzing loops that violate certain restrictions. By open-sourcing the tool and grounding its methodology in $C$-finite recurrences and exponential-polynomial closed-forms, Polar offers a practical, rigorous avenue for invariant and sensitivity analysis in probabilistic programming and stochastic modeling.
Abstract
We present the Polar framework for fully automating the analysis of classical and probabilistic loops using algebraic reasoning. The central theme in Polar comes with handling algebraic recurrences that precisely capture the loop semantics. To this end, our work implements a variety of techniques to compute exact closed-forms of recurrences over higher-order moments of variables, infer invariants, and derive loop sensitivities with respect to unknown parameters. Polar can analyze probabilistic loops containing if-statements, polynomial arithmetic, and common probability distributions. By translating loop analysis into linear recurrence solving, Polar uses the derived closed-forms of recurrences to compute the strongest polynomial invariant or to infer parameter sensitivity. Polar is both sound and complete within well-defined programming model restrictions. Lifting any of these restrictions results in significant hardness limits of computation. To overcome computational burdens for the sake of efficiency, Polar also provides incomplete but sound techniques to compute moments of combinations of variables.
