paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Formally Verified Samplers from Probabilistic Programs with Loops and Conditioning

从带循环与条件化的概率程序到形式验证的采样器
PLDI 7(PLDI)2023匹配度 5/10 · 论文研究带循环和条件化的离散概率程序到正确采样器的 Coq 形式化验证编译器,属于概率编程/贝叶斯程序语义与形式化验证方向,与用户关注的贝叶斯程序分析有交集;但未涉及 LLM/Agent、静态分析在 ML 系统中的应用或浮点程序分析,因此匹配度中等。引用 5 inbox
Alexander Bagnall, Gordon Stewart, Anindya Banerjee
crossref: 2026-09-10

AI 速览

一句话:提出经 Coq 形式验证的 Zar 编译器,将带循环与条件化的离散概率程序编译为正确采样器。

论文解决如何从含无界循环与条件化的离散概率程序生成分布正确的可执行采样器的问题。作者提出 Zar:一条在 Coq 中完整形式验证的编译流水线。其核心思想是将离散概率分布归约为无偏抛硬币方案。流水线先把条件概率守卫命令语言 cpGCL 程序翻译为 choice-fix 树,以便归约有偏概率选择;再翻译为共归纳交互树,在随机位模型下执行。组合翻译的正确性给出采样等分布定理:编译出的采样器相对于 cpGCL 源程序的条件最弱前置期望语义是正确的。Zar 已实现并验证,可提取为 OCaml 与 Python 采样器,并在若干示例上做了经验验证。

问题
如何从带无界循环和条件化的离散概率程序生成分布正确的可执行采样器,并保证其相对源程序语义的正确性。
方法
提出 Zar 编译流水线:将 cpGCL 程序转成 choice-fix 树归约有偏概率选择,再转成共归纳交互树在随机位模型中执行;在 Coq 中形式验证并证明采样等分布定理。
评估
在 Coq 中实现并完整验证 Zar,提取 OCaml/Python 采样器,并在若干说明性示例上经验验证。
原文摘要(Abstract)

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 cpGCL programs 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.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1954,
  title = {Formally Verified Samplers from Probabilistic Programs with Loops and Conditioning},
  author = {Alexander Bagnall and Gordon Stewart and Anindya Banerjee},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {PLDI},
  year = {2023},
  doi = {10.1145/3591220}
}