A Provably Correct Sampler for Probabilistic Programs

Authors Chung-Kil Hur, Aditya V. Nori, Sriram K. Rajamani, Selva Samuel

Thumbnail PDF


  • Filesize: 1.04 MB
  • 14 pages

Document Identifiers

Author Details

Chung-Kil Hur
Aditya V. Nori
Sriram K. Rajamani
Selva Samuel

Cite AsGet BibTex

Chung-Kil Hur, Aditya V. Nori, Sriram K. Rajamani, and Selva Samuel. A Provably Correct Sampler for Probabilistic Programs. In 35th IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2015). Leibniz International Proceedings in Informatics (LIPIcs), Volume 45, pp. 475-488, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2015)


We consider the problem of inferring the implicit distribution specified by a probabilistic program. A popular inference technique for probabilistic programs called Markov Chain Monte Carlo or MCMC sampling involves running the program repeatedly and generating sample values by perturbing values produced in "previous runs". This simulates a Markov chain whose stationary distribution is the distribution specified by the probabilistic program. However, it is non-trivial to implement MCMC sampling for probabilistic programs since each variable could be updated at multiple program points. In such cases, it is unclear which values from the "previous run" should be used to generate samples for the "current run". We present an algorithm to solve this problem for the general case and formally prove that the algorithm is correct. Our algorithm handles variables that are updated multiple times along the same path, updated along different paths in a conditional statement, or repeatedly updated inside loops, We have implemented our algorithm in a tool called InferX. We empirically demonstrate that InferX produces the correct result for various benchmarks, whereas existing tools such as R2 and Stan produce incorrect results on several of these benchmarks.
  • Probabilistic Programming
  • Program Correctness
  • Probabilistic Inference
  • Markov Chain Monte Carlo Sampling


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads