PSI: Exact Symbolic Inference for Probabilistic Programs

  • Timon GehrEmail author
  • Sasa Misailovic
  • Martin Vechev
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9779)


Probabilistic inference is a key mechanism for reasoning about probabilistic programs. Since exact inference is theoretically expensive, most probabilistic inference systems today have adopted approximate inference techniques, which trade precision for better performance (but often without guarantees). As a result, while desirable for its ultimate precision, the practical effectiveness of exact inference for probabilistic programs is mostly unknown.

This paper presents PSI (, a novel symbolic analysis system for exact inference in probabilistic programs with both continuous and discrete random variables. PSI computes succinct symbolic representations of the joint posterior distribution represented by a given probabilistic program. PSI can compute answers to various posterior distribution, expectation and assertion queries using its own back-end for symbolic reasoning.

Our evaluation shows that PSI is more effective than existing exact inference approaches: (i) it successfully computed a precise result for more programs, and (ii) simplified expressions that existing computer algebra systems (e.g., Mathematica, Maple) fail to andle.


Posterior Distribution Inference Engine Source Language Probabilistic Inference Probabilistic Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
  2. 2.
  3. 3.
  4. 4.
    Audebaud, P., Paulin-Mohring, C.: Proofs of randomized algorithms in Coq. Sci. Comput. Program. 74(8), 568–589 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Barthe, G., Köpf, B., Olmedo, F., Zanella Béguelin, S.: Probabilistic relational reasoning for differential privacy. In: ACM POPL (2012)Google Scholar
  6. 6.
    Bhat, S., Agarwal, A., Vuduc, R., Gray, A.: A type theory for probability density functions. In: ACM POPL (2012)Google Scholar
  7. 7.
    Bhat, S., Borgström, J., Gordon, A.D., Russo, C.: Deriving probability density functions from probabilistic functional programs. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013 (ETAPS 2013). LNCS, vol. 7795, pp. 508–522. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  8. 8.
    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
  9. 9.
    Bornholt, J., Mytkowicz, T., McKinley, K.S.: Uncertain<T>: a first-order type for uncertain data. In: ASPLOS (2014)Google Scholar
  10. 10.
    Carette, J., Shan, C.-C.: Simplifying probabilistic programs using computer algebra. In: Gavanelli, M., et al. (eds.) PADL 2016. LNCS, vol. 9585, pp. 135–152. Springer, Heidelberg (2016). doi: 10.1007/978-3-319-28228-2_9 CrossRefGoogle Scholar
  11. 11.
    Chang, K.C., Fung, R.: Symbolic probabilistic inference with both discrete and continuous variables. IEEE Trans. Syst. Man Cybern. 25(6), 910–916 (1995)CrossRefGoogle Scholar
  12. 12.
    Claret, G., Rajamani, S.K., Nori, A.V., Gordon, A.D., Borgström, J.: Bayesian inference using data flow analysis. In: ESEC/FSE (2013)Google Scholar
  13. 13.
    Cooper, G.F.: The computational complexity of probabilistic inference using Bayesian belief networks. Artif. Intell. 42(2), 393–405 (1990)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Cousot, P., Monerau, M.: Probabilistic abstract interpretation. In: Seidl, H. (ed.) Programming Languages and Systems. LNCS, vol. 7211, pp. 169–193. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  15. 15.
    Dagum, P., Luby, M.: Approximating probabilistic inference in Bayesian belief networks is NP-hard. Artif. Intell. 60(1), 141–153 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Di Pierro, A., Wiklicky, H.: Probabilistic abstract interpretation and statistical testing (extended abstract). In: Hermanns, H., Segala, R. (eds.) PROBMIV 2002, PAPM-PROBMIV 2002 and PAPM 2002. LNCS, vol. 2399, p. 211. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  17. 17.
    Eberl, M., Hölzl, J., Nipkow, T.: A verified compiler for probability density functions. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 80–104. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  18. 18.
    Filieri, A., Păsăreanu, C.S., Visser, W.: Reliability analysis in symbolic pathfinder. In: ICSE (2013)Google Scholar
  19. 19.
    Gelman, A., Lee, D., Guo, J.: Stan a probabilistic programming language for Bayesian inference and optimization. J. Educ. Behav. Stat. 40, 530–543 (2015)CrossRefGoogle Scholar
  20. 20.
    Gilks, W.R., Thomas, A., Spiegelhalter, D.J.: A language and program for complex Bayesian modelling. Statistician 43, 169–177 (1994)CrossRefGoogle Scholar
  21. 21.
    Goodman, N., Mansinghka, V., Roy, D., Bonawitz, K., Tenenbaum, J.: Church: a language for generative models. In: UAI (2008)Google Scholar
  22. 22.
    Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: Proceedings of Future of Software Engineering (2014)Google Scholar
  23. 23.
    Gretz, F., Jansen, N., Kaminski, B.L., Katoen, J.P., McIver, A., Olmedo, F.: Conditioning in probabilistic programming. arXiv preprint (2015). arXiv:1504.00198
  24. 24.
    Hasan, O.: Formalized Probability Theory and Applications Using Theorem Proving. IGI Global, Hershey (2015)CrossRefGoogle Scholar
  25. 25.
    Hershey, S., Bernstein, J., Bradley, B., Schweitzer, A., Stein, N., Weber, T., Vigoda, B.: Accelerating inference: towards a full language, compiler and hardware stack. arXiv preprint (2012). arXiv:1212.2991
  26. 26.
    Hinton, A., Kwiatkowska, M., Norman, G., Parker, D.: PRISM: a tool for automatic verification of probabilistic systems. In: Hermanns, H., Palsberg, J. (eds.) TACAS 2006. LNCS, vol. 3920, pp. 441–444. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  27. 27.
    Hur, C.K., Nori, A.V., Rajamani, S.K., Samuel, S.: Slicing probabilistic programs. In: ACM PLDI (2014)Google Scholar
  28. 28.
    Hurd, J.: Formal verification of probabilistic algorithms. Ph.D. thesis, University of Cambridge (2001)Google Scholar
  29. 29.
    Katoen, J.-P., McIver, A.K., Meinicke, L.A., Morgan, C.C.: Linear-invariant generation for probabilistic programs. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 390–406. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  30. 30.
    Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981)MathSciNetCrossRefzbMATHGoogle Scholar
  31. 31.
    Kozlov, A.V., Koller, D.: Nonuniform dynamic discretization in hybrid networks. In: UAI (1997)Google Scholar
  32. 32.
    Mansinghka, V., Selsam, D., Perov, Y.: Venture: a higher-order probabilistic programming platform with programmable inference. arXiv preprint (2014). arXiv:1404.0099
  33. 33.
    Mardziel, P., Magill, S., Hicks, M., Srivatsa, M.: Dynamic enforcement of knowledge-based security policies using probabilistic abstract interpretation. J. Comput. Secur. 21(4), 463–532 (2013)CrossRefGoogle Scholar
  34. 34.
    Minka, T., Winn, J., Guiver, J., Webster, S., Zaykov, Y., Yangel, B., Spengler, A., Bronskill, J.: Infer.NET 2.5 (2013).
  35. 35.
    Monniaux, D.: Abstract interpretation of probabilistic semantics. In: SAS (2000)Google Scholar
  36. 36.
    Moral, S., Rumí, R., Salmerón, A.: Mixtures of truncated exponentials in hybrid Bayesian networks. In: Benferhat, S., Besnard, P. (eds.) ECSQARU 2001. LNCS (LNAI), vol. 2143, pp. 156–167. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  37. 37.
    Morgan, C., McIver, A., Seidel, K.: Probabilistic predicate transformers. ACM Trans. Program. Lang. Syst. (TOPLAS) 18(3), 325–353 (1996)CrossRefGoogle Scholar
  38. 38.
    Narayanan, P., Carette, J., Romano, W., Shan, C.C., Zinkov, R.: Probabilistic inference by program transformation in Hakaru (system description),
  39. 39.
    Nori, A.V., Hur, C.K., Rajamani, S.K., Samuel, S.: R2: an efficient MCMC sampler for probabilistic programs. In: AAAI (2014)Google Scholar
  40. 40.
    Pfeffer, A.: IBAL: a probabilistic rational programming language. In: Proceedings of 17th International Joint Conference on Artificial Intelligence, vol. 1, pp. 733–740. Morgan Kaufmann Publishers Inc. (2001)Google Scholar
  41. 41.
    Sampson, A., Panchekha, P., Mytkowicz, T., McKinley, K.S., Grossman, D., Ceze, L.: Expressing and verifying probabilistic assertions. In: ACM PLDI (2014)Google Scholar
  42. 42.
    Sankaranarayanan, S., Chakarov, A., Gulwani, S.: Static analysis for probabilistic programs: inferring whole program properties from finitely many paths. In: ACM PLDI (2013)Google Scholar
  43. 43.
    Sanner, S., Abbasnejad, E.: Symbolic variable elimination for discrete and continuous graphical models. In: AAAI (2012)Google Scholar
  44. 44.
    Shachter, R.D., D’Ambrosio, B., Del Favero, B.: Symbolic probabilistic inference in belief networks. In: AAAI (1990)Google Scholar
  45. 45.
    Shenoy, P.P., West, J.C.: Inference in hybrid Bayesian networks using mixtures of polynomials. Int. J. Approx. Reason. 52(5), 641–657 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  46. 46.
    Wood, F., van de Meent, J.W., Mansinghka, V.: A new approach to probabilistic programming inference. In: AISTATS (2014)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.ETH ZurichZurichSwitzerland
  2. 2.University of Illinois at Urbana-ChampaignChampaign and UrbanaUSA

Personalised recommendations