skip to main content
research-article
Free Access

Conditioning in Probabilistic Programming

Published:03 January 2018Publication History
Skip Abstract Section

Abstract

This article investigates the semantic intricacies of conditioning, a main feature in probabilistic programming. Our study is based on an extension of the imperative probabilistic guarded command language pGCL with conditioning. We provide a weakest precondition (wp) semantics and an operational semantics. To deal with possibly diverging program behavior, we consider liberal preconditions. We show that diverging program behavior plays a key role when defining conditioning. We establish that weakest preconditions coincide with conditional expected rewards in Markov chains—the operational semantics—and that the wp-semantics conservatively extends the existing semantics of pGCL (without conditioning). An extension of these results with nondeterminism turns out to be problematic: although an operational semantics using Markov decision processes is rather straightforward, we show that providing an inductive wp-semantics in this setting is impossible. Finally, we present two program transformations that eliminate conditioning from any program. The first transformation hoists conditioning while updating the probabilistic choices in the program, while the second transformation replaces conditioning—in the same vein as rejection sampling—by a program with loops. In addition, we present a last program transformation that replaces an independent identically distributed loop with conditioning.

References

  1. Nathanael Leedom Ackerman, Cameron E. Freer, and Daniel M. Roy. 2011. Noncomputable conditional distributions. In Proc. of LICS. IEEE Computer Society, 107--116. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Miguel E. Andrés and Peter van Rossum. 2008. Conditional probabilities over probabilistic and nondeterministic systems. In TACAS (LNCS), Vol. 4963. Springer, 157--172.Google ScholarGoogle Scholar
  3. Philippe Audebaud and Christine Paulin-Mohring. 2009. Proofs of randomized algorithms in Coq. Sci. Comput. Program. 74, 8 (2009), 568--589. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Ralph-Johan Back and Joakim von Wright. 1998. Refinement Calculus - A Systematic Introduction. Springer. Google ScholarGoogle ScholarCross RefCross Ref
  5. Christel Baier and Joost-Pieter Katoen. 2008. Principles of Model Checking. MIT Press.Google ScholarGoogle Scholar
  6. Christel Baier, Joachim Klein, Sascha Klüppelholz, and Steffen Märcker. 2014. Computing conditional probabilities in Markovian models efficiently. In TACAS (LNCS), Vol. 8413. Springer, 515--530.Google ScholarGoogle Scholar
  7. Gilles Barthe, Thomas Espitau, Luis María Ferrer Fioriti, and Justin Hsu. 2016. Synthesizing probabilistic invariants via doob’s decomposition. In CAV (LNCS), Vol. 9779. Springer, 43--61.Google ScholarGoogle ScholarCross RefCross Ref
  8. Hans Bekić. 1984. Definable operation in general algebras, and the theory of automata and flowcharts. In Programming Languages and Their Definition. Springer, 30--55.Google ScholarGoogle Scholar
  9. Johannes Borgström, Andrew D. Gordon, Michael Greenberg, James Margetson, and Jurgen Van Gael. 2011. Measure transformer semantics for Bayesian machine learning. In ESOP (LNCS), Vol. 6602. Springer, 77--96.Google ScholarGoogle Scholar
  10. Göran Broström and Leif Nilsson. 2000. Acceptance--rejection sampling from the conditional distribution of independent discrete random variables, given their sum. Statistics J. Theoret. Appl. Stat. 34, 3 (2000), 247--257.Google ScholarGoogle Scholar
  11. Michael Carbin, Sasa Misailovic, and Martin C. Rinard. 2013. Verifying quantitative reliability for programs that execute on unreliable hardware. In OOPSLA. ACM Press, 33--52. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Aleksandar Chakarov and Sriram Sankaranarayanan. 2013. Probabilistic program analysis with martingales. In CAV (LNCS), Vol. 8044. Springer, 511--526. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Aleksandar Chakarov and Sriram Sankaranarayanan. 2014. Expectation invariants for probabilistic program loops as fixed points. In SAS (LNCS), Vol. 8723. Springer, 85--100. Google ScholarGoogle ScholarCross RefCross Ref
  14. Krishnendu Chatterjee, Hongfei Fu, Petr Novotný, and Rouzbeh Hasheminezhad. 2016. Algorithmic analysis of qualitative and quantitative termination problems for affine probabilistic programs. In POPL. ACM Press, 327--342.Google ScholarGoogle Scholar
  15. Guillaume Claret, Sriram K. Rajamani, Aditya V. Nori, Andrew D. Gordon, and Johannes Borgström. 2013. Bayesian inference using data flow analysis. In ESEC/SIGSOFT FSE. ACM Press, 92--102.Google ScholarGoogle Scholar
  16. David Cock. 2014. pGCL for Isabelle. Archive of Formal Proofs (2014).Google ScholarGoogle Scholar
  17. Patrick Cousot and Michael Monerau. 2012. Probabilistic abstract interpretation. In ESOP (LNCS), Vol. 7211. Springer, 169--193. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Jerry den Hartog and Erik P. de Vink. 2002. Verifying probabilistic programs using a Hoare like logic. Int. J. Found. Comput. Sci. 13, 3 (2002), 315--340. Google ScholarGoogle ScholarCross RefCross Ref
  19. Edsger W. Dijkstra. 1976. A Discipline of Programming. Prentice Hall.Google ScholarGoogle Scholar
  20. Anton Dries, Angelika Kimmig, Wannes Meert, Joris Renkens, Guy Van den Broeck, Jonas Vlasselaer, and Luc De Raedt. 2015. ProbLog2: Probabilistic logic programming. In ECML/PKDD (3) (LNCS), Vol. 9286. Springer, 312--315.Google ScholarGoogle Scholar
  21. Barbara Espinoza and Geoffrey Smith. 2013. Min-entropy as a resource. Inf. Comput. 226 (2013), 57--75. Google ScholarGoogle ScholarCross RefCross Ref
  22. Noah D. Goodman and Andreas Stuhlmüller. 2014. The Design and Implementation of Probabilistic Programming Languages. (electronic). http://dippl.org.Google ScholarGoogle Scholar
  23. Andrew D. Gordon, Thore Graepel, Nicolas Rolland, Claudio V. Russo, Johannes Borgström, and John Guiver. 2014. Tabular: A schema-driven probabilistic programming language. In POPL. ACM Press, 321--334.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Andrew D. Gordon, Thomas A. Henzinger, Aditya V. Nori, and Sriram K. Rajamani. 2014. Probabilistic programming. In FOSE. ACM Press, 167--181. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Friedrich Gretz, Joost-Pieter Katoen, and Annabelle McIver. 2014. Operational versus weakest pre-expectation semantics for the probabilistic guarded command language. Perform. Eval. 73 (2014), 110--132. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden. 1999. Stochastic processes as concurrent constraint programs. In POPL. ACM Press, 189--202. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Eric C. R. Hehner. 2011. A probability perspective. Formal Aspects Comput. 23, 4 (2011), 391--419. Google ScholarGoogle ScholarCross RefCross Ref
  28. Chung-Kil Hur, Aditya V. Nori, Sriram K. Rajamani, and Selva Samuel. 2014. Slicing probabilistic programs. In PLDI. ACM Press, 133--144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Joe Hurd, Annabelle McIver, and Carroll Morgan. 2005. Probabilistic guarded commands mechanized in HOL. Theor. Comput. Sci. 346, 1 (2005), 96--112. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Nils Jansen, Christian Dehnert, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Lukas Westhofen. 2016. Bounded model checking for probabilistic programs. In ATVA (LNCS). Springer, 68--85. Google ScholarGoogle ScholarCross RefCross Ref
  31. Nils Jansen, Benjamin Lucien Kaminski, Joost-Pieter Katoen, Federico Olmedo, Friedrich Gretz, and Annabelle McIver. 2015. Conditioning in probabilistic programming. Electronic Notes in Theoretical Computer Science (ENTCS) 319 (2015), 199--216. DOI:https://doi.org/10.1016/j.entcs.2015.12.013 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Benjamin Lucien Kaminski and Joost-Pieter Katoen. 2015. On the hardness of almost-sure termination. In Mathematical Foundations of Computer Science (MFCS), Part I (LNCS), Vol. 9234. Springer, 307--318. Google ScholarGoogle ScholarCross RefCross Ref
  33. Benjamin Lucien Kaminski and Joost-Pieter Katoen. 2017. A weakest pre-expectation semantics for mixed-sign expectations. In Proc. of LICS. IEEE Computer Society, 1--12. Google ScholarGoogle ScholarCross RefCross Ref
  34. Joost-Pieter Katoen, Friedrich Gretz, Nils Jansen, Benjamin Lucien Kaminski, and Federico Olmedo. 2015. Understanding probabilistic programs. In Correct System Design (LNCS), Vol. 9360. Springer, 15--32. Google ScholarGoogle ScholarCross RefCross Ref
  35. Joost-Pieter Katoen, Annabelle McIver, Larissa Meinicke, and Carroll C. Morgan. 2010. Linear-invariant generation for probabilistic programs. In SAS (LNCS), Vol. 6337. Springer, 390--406. Google ScholarGoogle ScholarCross RefCross Ref
  36. Mark Kattenbelt, Marta Z. Kwiatkowska, Gethin Norman, and David Parker. 2010. A game-based abstraction-refinement framework for Markov decision processes. Formal Methods Syst. Design 36, 3 (2010), 246--280. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Dexter Kozen. 1981. Semantics of probabilistic programs. J. Comput. Syst. Sci. 22, 3 (1981), 328--350. Google ScholarGoogle ScholarCross RefCross Ref
  38. Dexter Kozen. 1985. A probabilistic PDL. J. Comput. Syst. Sci. 30, 2 (1985), 162--178. Google ScholarGoogle ScholarCross RefCross Ref
  39. Johan J. Lukkien. 1994. Operational semantics and generalized weakest preconditions. Sci. Comput. Program. 22, 1--2 (1994), 137--155.Google ScholarGoogle Scholar
  40. Annabelle McIver and Carroll Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer.Google ScholarGoogle Scholar
  41. Carroll Morgan, Annabelle McIver, and Karen Seidel. 1996. Probabilistic predicate transformers. ACM Trans. Program. Lang. Syst. 18, 3 (1996), 325--353. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Aditya V. Nori, Chung-Kil Hur, Sriram K. Rajamani, and Selva Samuel. 2014. R2: An efficient MCMC sampler for probabilistic programs. In AAAI. AAAI Press, 2476--2482.Google ScholarGoogle Scholar
  43. Federico Olmedo, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Christoph Matheja. 2016. Reasoning about recursive probabilistic programs. In Proc. of LICS. ACM Press, 672--682. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Brooks Paige and Frank Wood. 2014. A compilation target for probabilistic programming languages. In ICML (Proc. of JMLR), Vol. 32. 1935--1943.Google ScholarGoogle Scholar
  45. Avi Pfeffer. 2016. Practical Probabilistic Programming. Manning Publications Co.Google ScholarGoogle Scholar
  46. Martin Puterman. 1994. Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley and Sons. Google ScholarGoogle ScholarCross RefCross Ref
  47. Christian Robert and George Casella. 2013. Monte Carlo Statistical Methods. Springer Science 8 Business Media.Google ScholarGoogle Scholar
  48. Adrian Sampson, Pavel Panchekha, Todd Mytkowicz, Kathryn S. McKinley, Dan Grossman, and Luis Ceze. 2014. Expressing and verifying probabilistic assertions. In PLDI. ACM Press, 14. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Victor Shoup. 2009. A Computational Introduction to Number Theory and Algebra. Cambridge University Press.Google ScholarGoogle Scholar
  50. Sam Staton, Hongseok Yang, Frank Wood, Chris Heunen, and Ohad Kammar. 2016. Semantics for probabilistic programming: Higher-order functions, continuous distributions, and soft constraints. In Proc. of LICS. ACM Press, 525--534. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Henk Tijms. 2007. Understanding Probability: Chance Rules in Everyday Life. Cambridge University Press. Google ScholarGoogle ScholarCross RefCross Ref
  52. Daniele Varacca and Glynn Winskel. 2006. Distributing probability over non-determinism. Math. Structures Comput. Sci. 16, 1 (2006), 87--113. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Wolfgang Wechler. 1992. Universal Algebra for Computer Scientists. EATCS Monographs on Theoretical Computer Science, Vol. 25. Springer. Google ScholarGoogle ScholarCross RefCross Ref
  54. Herbert Wiklicky. 2016. On dynamical probabilities, or: How to learn to shoot straight. In Proc. of COORDINATION (LNCS), Vol. 9686. Springer, 262--277. Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Conditioning in Probabilistic Programming

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!