Commutative Semantics for Probabilistic Programming

We show that a measure-based denotational semantics for probabilistic programming is commutative. The idea underlying probabilistic programming languages Anglican, Church, Hakaru, etc. is that programs express statistical models as a combination of prior distributions and likelihood of observations. The product of prior and likelihood is an unnormalized posterior distribution, and the inference problem is to find the normalizing constant. One common semantic perspective is thus that a probabilistic program is understood as an unnormalized posterior measure, in the sense of measure theory, and the normalizing constant is the measure of the entire semantic domain. A programming language is said to be commutative if only data flow is meaningful; control flow is irrelevant, and expressions can be re-ordered. It has been unclear whether probabilistic programs are commutative because it is well-known that Fubini-Tonelli theorems for reordering integration fail in general. We show that probabilistic programs are in fact commutative, by characterizing the measures/kernels that arise from programs as 's-finite', i.e. sums of finite measures/kernels. The result is of theoretical interest, but also of practical interest, because program transformations based on commutativity help with symbolic inference and can improve the efficiency of simulation.

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

[2]  Ugo Dal Lago,et al.  A lambda-calculus foundation for universal probabilistic programming , 2015, ICFP.

[3]  D. Pollard A User's Guide to Measure Theoretic Probability by David Pollard , 2001 .

[4]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

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

[6]  N. Ramsey All You Need is the Monad . . . What Monad Was That Again ? , 2015 .

[7]  Joanna Mitro General theory of markov processes , 1991 .

[8]  L. Rogers GENERAL THEORY OF MARKOV PROCESSES , 1989 .

[9]  Roman Fric,et al.  A Categorical Approach to Probability Theory , 2010, Stud Logica.

[10]  Zoubin Ghahramani,et al.  Practical probabilistic programming with monads , 2015, Haskell.

[11]  Frank D. Wood,et al.  A New Approach to Probabilistic Programming Inference , 2014, AISTATS.

[12]  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).

[13]  Yura N. Perov,et al.  Venture: a higher-order probabilistic programming platform with programmable inference , 2014, ArXiv.

[14]  Bas Spitters,et al.  Synthetic topology in Homotopy Type Theory for probabilistic programming , 2019, ArXiv.

[15]  Sam Staton,et al.  Universal properties of impure programming languages , 2013, POPL.

[16]  Jacques Carette,et al.  Probabilistic Inference by Program Transformation in Hakaru (System Description) , 2016, FLOPS.

[17]  Bart Jacobs,et al.  Under Consideration for Publication in J. Functional Programming Categorical Semantics for Arrows , 2022 .

[18]  Rasmus Ejlers Møgelberg,et al.  Linear usage of state , 2014, Log. Methods Comput. Sci..

[19]  John Power,et al.  Generic models for computational effects , 2006, Theor. Comput. Sci..

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

[21]  Ryan Culpepper,et al.  Contextual Equivalence for Probabilistic Programs with Continuous Random Variables and Scoring , 2017, ESOP.

[22]  Norman Ramsey,et al.  Stochastic lambda calculus and monads of probability distributions , 2002, POPL '02.

[23]  Robert Atkey,et al.  What is a Categorical Model of Arrows? , 2011, MSFP@ICALP.

[24]  E. Doberkat Stochastic Relations : Foundations for Markov Transition Systems , 2007 .

[25]  Olav Kallenberg,et al.  Stationary and invariant densities and disintegration kernels , 2014 .

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

[27]  J. Lambek Deductive systems and categories II. Standard constructions and closed categories , 1969 .

[28]  Bart Jacobs,et al.  A Predicate/State Transformer Semantics for Bayesian Learning , 2016, MFPS.

[29]  Joshua B. Tenenbaum,et al.  Church: a language for generative models , 2008, UAI.

[30]  Joachim Lambek Deductive systems and categories , 2005, Mathematical systems theory.

[31]  Tom Leinster Higher Operads, Higher Categories , 2003 .

[32]  David Van Horn,et al.  Running Probabilistic Programs Backwards , 2015, ESOP.

[33]  Bas Spitters,et al.  An Application of Computable Distributions to the Semantics of Probabilistic Programs , 2018, ArXiv.

[34]  Ohad Kammar,et al.  A convenient category for higher-order probability theory , 2017, 2017 32nd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[35]  Hayo Thielecke,et al.  Modelling environments in call-by-value programming languages , 2003, Inf. Comput..

[36]  Sam Staton,et al.  Freyd categories are Enriched Lawvere Theories , 2014, WACT.

[37]  Esfandiar Haghverdi,et al.  A categorical approach to linear logic, geometry of proofs and full completeness. , 2000 .

[38]  Alan Jeffrey,et al.  Premonoidal categories and flow graphs , 1997, HOOTS.

[39]  Prakash Panangaden,et al.  Quantitative Algebraic Reasoning , 2016, 2016 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[40]  Jacques Carette,et al.  Simplifying Probabilistic Programs Using Computer Algebra , 2016, PADL.

[41]  Mathew D. Penrose,et al.  Lectures on the Poisson Process , 2017 .

[42]  Norman Ramsey,et al.  Exact Bayesian inference by symbolic disintegration , 2017, POPL.

[43]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[44]  David Pollard,et al.  A User's Guide to Measure Theoretic Probability by David Pollard , 2001 .