从带循环和条件化的概率程序生成经过形式化验证的采样器
Formally Verified Samplers From Probabilistic Programs With Loops and Conditioning
AI总结:
本文提出 Zar 编译器流水线,将含无界循环和条件化的 cpGCL 程序经 choice-fix 树与交互树转换为随机位模型中的可执行采样器,并在 Coq 中完整验证其等分布正确性。
摘要:
我们提出 Zar:一个经过形式化验证的编译器流水线,可将使用条件概率卫式命令语言(cpGCL)编写、含无界循环的离散概率程序,转换为随机位模型中已证明正确的可执行采样器。我们利用的关键思想是,所有离散概率分布都可归约为无偏抛硬币方案。该编译器流水线首先把 cpGCL 程序翻译为 choice-fix 树,这是一种适合归约有偏概率选择的中间表示;随后将 choice-fix 树翻译为共归纳交互树,以便在随机位模型中执行。组合翻译的正确性确立了采样等分布定理:编译得到的采样器相对于 cpGCL 源程序的条件最弱前期望语义是正确的。Zar 在 Coq 证明助手中实现并得到完整验证。我们将经过验证的采样器抽取到 OCaml 和 Python,并通过若干说明性示例对其进行了实验验证。
英文摘要:
We present Zar: a formally verified compiler pipeline from discrete probabilistic programs with unbounded loops in the conditional probabilistic guarded command language (cpGCL) to proved-correct executable samplers in the random bit model. We exploit the key idea that all discrete probability distributions can be reduced to unbiased coin-flipping schemes. The compiler pipeline first translates a cpGCL program into choice-fix trees, an intermediate representation suitable for reduction of biased probabilistic choices. Choice-fix trees are then translated to coinductive interaction trees for execution within the random bit model. The correctness of the composed translations establishes the sampling equidistribution theorem: compiled samplers are correct wrt. the conditional weakest pre-expectation semantics of cpGCL source programs. Zar is implemented and fully verified in the Coq proof assistant. We extract verified samplers to OCaml and Python and empirically validate them on a number of illustrative examples.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。