一句话:提出基于类型的概率程序期望执行成本上界分析,支持高阶函数与归纳数据类型,并将推断归约为线性约束求解。
本文提出一种基于类型的分析,自动推导概率程序期望执行成本的上界。方法基于摊销分析的势方法,扩展面向确定性程序的 AARA,支持高阶函数与归纳数据类型,且对成本模型参数化。局部类型规则将上界推断归约为线性约束求解;所得边界为关于数据结构的多元多项式,并可含符号概率。文章在基于分布的操作成本语义下证明可靠性,该语义涵盖非平凡发散;对时间等成本模型,边界意味着以概率 1 终止。作者在 Resource Aware ML 中实现该分析,支持多项式边界与自定义数据结构,并用离散分布样本复杂度及结合统计方法的确定性程序平均情况估计进行评估。
This article presents a type-based analysis for deriving upper bounds on the expected execution cost of probabilistic programs. The analysis is naturally compositional, parametric in the cost model, and supports higher-order functions and inductive data types. The derived bounds are multivariate polynomials that are functions of data structures. Bound inference is enabled by local type rules that reduce type inference to linear constraint solving. The type system is based on the potential method of amortized analysis and extends automatic amortized resource analysis (AARA) for deterministic programs. A main innovation is that bounds can contain symbolic probabilities, which may appear in data structures and function arguments. Another contribution is a novel soundness proof that establishes the correctness of the derived bounds with respect to a distribution-based operational cost semantics that also includes nontrivial diverging behavior. For cost models like time, derived bounds imply termination with probability one. To highlight the novel ideas, the presentation focuses on linear potential and a core language. However, the analysis is implemented as an extension of Resource Aware ML and supports polynomial bounds and user defined data structures. The effectiveness of the technique is evaluated by analyzing the sample complexity of discrete distributions and with a novel average-case estimation for deterministic programs that combines expected cost analysis with statistical methods.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{WangKH20,
title = {Raising expectations: automating expected cost analysis with types},
author = {Di Wang and David M. Kahn and Jan Hoffmann},
journal = {Proceedings of the ACM on Programming Languages},
volume = {4},
number = {ICFP},
year = {2020},
doi = {10.1145/3408992}
}