Conditioning in Probabilistic Programming

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.

[1]  Gilles Barthe,et al.  Probabilistic Relational Reasoning for Differential Privacy , 2012, TOPL.

[2]  Geoffrey Smith,et al.  Min-entropy as a resource , 2013, Inf. Comput..

[3]  Luc De Raedt,et al.  ProbLog2: Probabilistic Logic Programming , 2015, ECML/PKDD.

[4]  Joost-Pieter Katoen,et al.  On the Hardness of Almost-Sure Termination , 2015, MFCS.

[5]  Joost-Pieter Katoen,et al.  A weakest pre-expectation semantics for mixed-sign expectations , 2017, 2017 32nd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[6]  Christel Baier,et al.  Computing Conditional Probabilities in Markovian Models Efficiently , 2014, TACAS.

[7]  Frank D. Wood,et al.  A Compilation Target for Probabilistic Programming Languages , 2014, ICML.

[8]  Marta Z. Kwiatkowska,et al.  A game-based abstraction-refinement framework for Markov decision processes , 2010, Formal Methods Syst. Des..

[9]  David Cock pGCL for Isabelle , 2014, Arch. Formal Proofs.

[10]  Victor Shoup,et al.  A computational introduction to number theory and algebra , 2005 .

[11]  Wolfgang Wechler,et al.  Universal Algebra for Computer Scientists , 1992, EATCS Monographs on Theoretical Computer Science.

[12]  Chung-Kil Hur,et al.  R2: An Efficient MCMC Sampler for Probabilistic Programs , 2014, AAAI.

[13]  Andrew D. Gordon,et al.  Measure Transformer Semantics for Bayesian Machine Learning , 2011, ESOP.

[14]  C. Jones,et al.  A probabilistic powerdomain of evaluations , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[15]  Johan J. Lukkien Operational Semantics and Generalized Weakest Preconditions , 1994, Sci. Comput. Program..

[16]  Glynn Winskel,et al.  Distributing probability over non-determinism , 2006, Mathematical Structures in Computer Science.

[17]  Christel Baier,et al.  Principles of model checking , 2008 .

[18]  Gilles Barthe,et al.  Synthesizing Probabilistic Invariants via Doob's Decomposition , 2016, CAV.

[19]  Radha Jagadeesan,et al.  Stochastic processes as concurrent constraint programs , 1999, POPL '99.

[20]  H. Tijms Understanding Probability: Chance Rules in Everyday Life , 2004 .

[21]  Nils Jansen,et al.  Bounded Model Checking for Probabilistic Programs , 2016, ATVA.

[22]  Christian P. Robert,et al.  Monte Carlo Statistical Methods (Springer Texts in Statistics) , 2005 .

[23]  Patrick Cousot,et al.  Probabilistic Abstract Interpretation , 2012, ESOP.

[24]  Radha Jagadeesan,et al.  Probabilistic Concurrent Constraint Programming , 1997, CONCUR.

[25]  Avi Pfeffer,et al.  Practical Probabilistic Programming , 2016, ILP.

[26]  Claudio V. Russo,et al.  Tabular: a schema-driven probabilistic programming language , 2014, POPL.

[27]  Thomas A. Henzinger,et al.  Probabilistic programming , 2014, FOSE.

[28]  Martin C. Rinard,et al.  Verifying quantitative reliability for programs that execute on unreliable hardware , 2013, OOPSLA.

[29]  Noah D. Goodman,et al.  Lightweight Implementations of Probabilistic Programming Languages Via Transformational Compilation , 2011, AISTATS.

[30]  Martin L. Puterman,et al.  Markov Decision Processes: Discrete Stochastic Dynamic Programming , 1994 .

[31]  G. Broström,et al.  Acceptance–Rejection Sampling from the Conditional Distribution of Independent Discrete Random Variables, given their Sum , 2000 .

[32]  Annabelle McIver,et al.  Conditioning in Probabilistic Programming , 2015, MFPS.

[33]  Hans Bekic,et al.  Definable Operation in General Algebras, and the Theory of Automata and Flowcharts , 1984, Programming Languages and Their Definition.

[34]  Joost-Pieter Katoen,et al.  Reasoning about Recursive Probabilistic Programs* , 2016, 2016 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[35]  Annabelle McIver,et al.  Abstraction and refinement in probabilistic systems , 2005, PERV.

[36]  Annabelle McIver,et al.  Operational versus weakest pre-expectation semantics for the probabilistic guarded command language , 2014, Perform. Evaluation.

[37]  Dexter Kozen,et al.  A probabilistic PDL , 1983, J. Comput. Syst. Sci..

[38]  Annabelle McIver,et al.  Abstraction, Refinement and Proof for Probabilistic Systems , 2004, Monographs in Computer Science.

[39]  Nils Jansen,et al.  Understanding Probabilistic Programs , 2015, Correct System Design.

[40]  Christian P. Robert,et al.  Monte Carlo Statistical Methods , 2005, Springer Texts in Statistics.

[41]  Ralph-Johan Back,et al.  Refinement Calculus: A Systematic Introduction , 1998 .

[42]  Dan Grossman,et al.  Expressing and verifying probabilistic assertions , 2014, PLDI.

[43]  Annabelle McIver,et al.  Linear-Invariant Generation for Probabilistic Programs: - Automated Support for Proof-Based Methods , 2010, SAS.

[44]  Dana S. Scott Stochastic λ-calculi: An extended abstract , 2014, J. Appl. Log..

[45]  Christine Paulin-Mohring,et al.  Proofs of randomized algorithms in Coq , 2006, Sci. Comput. Program..

[46]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[47]  Annabelle McIver,et al.  Probabilistic guarded commands mechanized in HOL , 2005, Theor. Comput. Sci..

[48]  Eric C. R. Hehner,et al.  A probability perspective , 2011, Formal Aspects of Computing.

[49]  Herbert Wiklicky,et al.  On Dynamical Probabilities, or: How to Learn to Shoot Straight , 2016, COORDINATION.

[50]  Ohad Kammar,et al.  Semantics for probabilistic programming: higher-order functions, continuous distributions, and soft constraints , 2016, 2016 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[51]  Peter van Rossum,et al.  Conditional Probabilities over Probabilistic and Nondeterministic Systems , 2008, TACAS.

[52]  Sriram Sankaranarayanan,et al.  Expectation Invariants for Probabilistic Program Loops as Fixed Points , 2014, SAS.

[53]  Krishnendu Chatterjee,et al.  Algorithmic analysis of qualitative and quantitative termination problems for affine probabilistic programs , 2015, POPL.

[54]  Erik P. de Vink,et al.  Verifying Probabilistic Programs Using a Hoare Like Logic , 2002, Int. J. Found. Comput. Sci..

[55]  Daniel M. Roy,et al.  Noncomputable Conditional Distributions , 2011, 2011 IEEE 26th Annual Symposium on Logic in Computer Science.

[56]  Annabelle McIver,et al.  Probabilistic predicate transformers , 1996, TOPL.

[57]  Sriram Sankaranarayanan,et al.  Probabilistic Program Analysis with Martingales , 2013, CAV.

[58]  Chung-Kil Hur,et al.  Slicing probabilistic programs , 2014, PLDI.

[59]  Andrew D. Gordon,et al.  Bayesian inference using data flow analysis , 2013, ESEC/FSE 2013.

[60]  Dexter Kozen,et al.  Semantics of probabilistic programs , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).