An Application of Computable Distributions to the Semantics of Probabilistic Programming Languages

  • Daniel HuangEmail author
  • Greg Morrisett
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9632)


Most probabilistic programming languages for Bayesian inference give either operational semantics in terms of sampling, or denotational semantics in terms of measure-theoretic distributions. It is important that we can relate the two, given that practitioners often reason both analytically (e.g., density) as well as algorithmically (i.e., in terms of sampling) about distributions. In this paper, we give denotational semantics to a functional language extended with continuous distributions and show that by restricting attention to computable distributions, we can realize a corresponding sampling semantics.


Probabilistic programs Computable distributions Semantics 



This work was supported by Oracle Labs. We would like to thank Nate Ackerman, Stephen Chong, Jean-Baptiste Tristan, Dexter Kozen, Dan Roy, and our anonymous reviewers for helpful discussions and feedback.


  1. 1.
    Ackerman, N.L., Freer, C.E., Roy, D.M.: Noncomputable conditional distributions. In: Proceedings of the IEEE 26th Annual Symposium on Logic in Computer Science, LICS 2011, pp. 107–116. IEEE Computer Society, Washington, DC (2011)Google Scholar
  2. 2.
    Bailey, D., Borwein, P., Plouffe, S.: On the Rapid Computation of Various Polylogarithmic Constants. Math. Comput. 66(218), 903–913 (1997)MathSciNetzbMATHCrossRefGoogle Scholar
  3. 3.
    Borgström, J., Gordon, A.D., Greenberg, M., Margetson, J., Van Gael, J.: Measure transformer semantics for bayesian machine learning. In: Barthe, G. (ed.) ESOP 2011. LNCS, vol. 6602, pp. 77–96. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  4. 4.
    Freer, C.E., Roy, D.M.: Posterior distributions are computable from predictive distributions. In: Teh, Y.W., Titterington, D.M. (eds.) Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS-10), vol. 9, pp. 233–240 (2010)Google Scholar
  5. 5.
    Freer, C.E., Roy, D.M.: Computable de finetti measures. Ann. Pure. Appl. Logic 163(5), 530–546 (2012)MathSciNetzbMATHCrossRefGoogle Scholar
  6. 6.
    Gács, P.: Uniform test of algorithmic randomness over a general space. Theor. Comput. Sci. 341(1), 91–137 (2005)MathSciNetzbMATHCrossRefGoogle Scholar
  7. 7.
    Galatolo, S., Hoyrup, M., Rojas, C.: Effective symbolic dynamics, random points, statistical behavior, complexity and entropy. Inf. Comput. 208(1), 23–41 (2010)MathSciNetzbMATHCrossRefGoogle Scholar
  8. 8.
    Giry, M.: A categorical approach to probability theory. In: Banaschewski, B. (ed.) Categorical Aspects of Topology and Analysis, pp. 68–85. Springer, Heidelberg (1982)CrossRefGoogle Scholar
  9. 9.
    Goodman, N.D., Mansinghka, V.K., Roy, D., Bonawitz, K., Tenenbaum, J.B.: Church: A language for generative models. In: Proceedings of the 24th Conference on Uncertainty in Artificial Intelligence, UAI , pp. 220–229 (2008)Google Scholar
  10. 10.
    Hershey, S., Bernstein, J., Bradley, B., Schweitzer, A., Stein, N., Weber, T., Vigoda, B.: Accelerating Inference: towards a full Language, Compiler and Hardware stack. CoRR abs/1212.2991 (2012)
  11. 11.
    Hoffman, M.D., Gelman, A.: The No-U-Turn sampler: adaptively setting path lengths in hamiltonian monte carlo. J. Mach. Learn. Res. 15, 1351–1381 (2013)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Hoyrup, M., Rojas, C.: Computability of probability measures and Martin-Löf randomness over metric spaces. Inf. Comput. 207(7), 830–847 (2009)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Jones, C., Plotkin, G.: A probabilistic powerdomain of evaluations. In: Proceedings of the Fourth Annual Symposium on Logic in Computer Science, pp. 186–195. IEEE Press, Piscataway (1989)Google Scholar
  14. 14.
    Koller, D., McAllester, D., Pfeffer, A.: Effective bayesian inference for stochastic programs. In: Proceedings of the 14th National Conference on Artificial Intelligence (AAAI), pp. 740–747 (1997)Google Scholar
  15. 15.
    Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981)MathSciNetzbMATHCrossRefGoogle Scholar
  16. 16.
    Lunn, D., Spiegelhalter, D., Thomas, A., Best, N.: The BUGS project: Evolution, critique and future directions. Statistic in Medicine (2009)Google Scholar
  17. 17.
    McCallum, A., Schultz, K., Singh, S.: Factorie: Probabilistic programming via imperatively defined factor graphs. Adv. Neural Inf. Process. Syst. 22, 1249–1257 (2009)Google Scholar
  18. 18.
    Minka, T., Guiver, J., Winn, J., Kannan, A.: Infer.NET 2.3, Microsoft Research Cambridge (2009)Google Scholar
  19. 19.
    Neal, R.M.: Markov chain sampling methods for Dirichlet process mixture models. J. Comput. Graph. Stat. 9(2), 249–265 (2000)MathSciNetGoogle Scholar
  20. 20.
    Nori, A.V., Hur, C.-K., Rajamani, S.K., Samuel, S.: R2: An efficient MCMC sampler for probabilistic programs. In: AAAI Conference on Artificial Intelligence (2014)Google Scholar
  21. 21.
    Park, S., Pfenning, F., Thrun, S.: A probabilistic language based upon sampling functions. In: Proceedings of the 32Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, pp. 171–182. ACM, New York (2005)Google Scholar
  22. 22.
    Jones, S.P., Reid, A., Henderson, F., Hoare, T., Marlow, S.: A semantics for imprecise exceptions. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 1999, pp. 25–36. ACM, New York (1999)Google Scholar
  23. 23.
    Pfeffer, A.: Creating and manipulating probabilistic programs with figaro. In: 2nd International Workshop on Statistical Relational AI (2012)Google Scholar
  24. 24.
    Pfeffer, A.: IBAL: a probabilistic rational programming language. In: Proceedings of the 17th International Joint Conference on Artificial Intelligence - vol. 1, IJCAI 2001, pp. 733–740. Morgan Kaufmann Publishers Inc., San Francisco (2001)Google Scholar
  25. 25.
    Ramsey, N., Pfeffer, A.: Stochastic lambda calculus and monads of probability distributions. In: Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2002, pp. 154–165. ACM, New York (2002)Google Scholar
  26. 26.
    Rao, M.M., Swift, R.J.: Probability Theory with Applications. Springer-Verlag New York Inc, Secaucus (2006)zbMATHGoogle Scholar
  27. 27.
    Saheb-Djahromi, N.: CPO’s of measures for nondeterminism. Theor. Comput. Sci. 12(1), 19–37 (1980)MathSciNetzbMATHCrossRefGoogle Scholar
  28. 28.
    Schröder, M.: Admissible representations for probability measures. Math. Logic Q. 53(4–5), 431–445 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  29. 29.
    Toronto, N., McCarthy, J., Van Horn, D.: Running probabilistic programs backwards. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 53–79. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  30. 30.
    Tristan, J.-B., Huang, D., Tassarotti, J., Pocock, A.C., Green, S., Steele, G.L.: Augur: data-parallel probabilistic modeling. In: Advances in Neural Information Processing Systems, pp. 2600–2608 (2014)Google Scholar
  31. 31.
    Weihrauch, K.: Computability on the probability measures on the Borel sets of the unit interval. Theor. Comput. Sci. 219(1), 421–437 (1999)MathSciNetzbMATHCrossRefGoogle Scholar
  32. 32.
    Weihrauch, K.: Computable Analysis: An Introduction. Springer-Verlag New York Inc, Secaucus (2000)zbMATHCrossRefGoogle Scholar
  33. 33.
    Wingate, D., Stuhlmller, A., Goodman, N.D.: Lightweight implementations of probabilistic programming languages via transformational compilation. In: Artificial Intelligence and Statistics, AISTATS 2011 (2011)Google Scholar
  34. 34.
    Winskel, G.: The Formal Semantics of Programming Languages: An Introduction. MIT Press, Cambridge (1993)zbMATHGoogle Scholar
  35. 35.
    Wood, F., van de Meent, J.W., Mansinghka, V.: A new approach to probabilistic programming inference. In: Proceedings of the 17th International Conference on Artificial Intelligence and Statistics, pp. 2–46 (2014)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  1. 1.Harvard SEASCambridgeUSA
  2. 2.Cornell UniversityIthacaUSA

Personalised recommendations