Compositional Analysis for Almost-Sure Termination of Probabilistic Programs

In this work, we consider the almost-sure termination problem for probabilistic programs that asks whether a given probabilistic program terminates with probability 1. Scalable approaches for program analysis often rely on compositional analysis as their theoretical basis. In non-probabilistic programs, the classical variant rule (V-rule) of Floyd-Hoare logic is the foundation for compositional analysis. Extension of this rule to almost-sure termination of probabilistic programs is quite tricky, and a probabilistic variant was proposed in [15]. While the proposed probabilistic variant cautiously addresses the key issue of integrability, we show that the proposed compositional rule is still not sound for almost-sure termination of probabilistic programs. Besides establishing unsoundness of the previous rule, our contributions are as follows: First, we present a sound compositional rule for almost-sure termination of probabilistic programs. Our approach is based on a novel notion of descent supermartingales. Second, for algorithmic approaches, we consider descent supermartingales that are linear and show that they can be synthesized in polynomial time. Finally, we present experimental results on several natural examples that model various types of nested while loops in probabilistic programs and demonstrate that our approach is able to efficiently prove their almost-sure termination property.

[1]  Hinrich Schütze,et al.  Book Reviews: Foundations of Statistical Natural Language Processing , 1999, CL.

[2]  Alexander Schrijver,et al.  Combinatorial optimization. Polyhedra and efficiency. , 2003 .

[3]  Vikash K. Mansinghka,et al.  A stochastic programming perspective on nonparametric Bayes , 2008 .

[4]  Krishnendu Chatterjee,et al.  New Approaches for Almost-Sure Termination of Probabilistic Programs , 2018, APLAS.

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

[6]  Robert W. Floyd,et al.  Assigning Meanings to Programs , 1993 .

[7]  Joost-Pieter Katoen,et al.  Weakest Precondition Reasoning for Expected Run-Times of Probabilistic Programs , 2016, ESOP.

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

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

[10]  Kousha Etessami,et al.  Recursive Markov chains, stochastic grammars, and monotone systems of nonlinear equations , 2005, JACM.

[11]  Krishnendu Chatterjee,et al.  Stochastic invariants for probabilistic termination , 2016, POPL.

[12]  Wim H. Hesselink Proof rules for recursive procedures , 2005, Formal Aspects of Computing.

[13]  Krishnendu Chatterjee,et al.  Computational Approaches for Stochastic Shortest Path on Succinct MDPs , 2018, IJCAI.

[14]  Annabelle McIver,et al.  Developing and Reasoning About Probabilistic Programs in pGCL , 2004, PSSE.

[15]  Sebastian Thrun,et al.  Probabilistic Algorithms in Robotics , 2000, AI Mag..

[16]  Di Wang,et al.  PMAF: an algebraic framework for static analysis of probabilistic programs , 2018, PLDI.

[17]  Alexandra Silva,et al.  Probabilistic NetKAT , 2016, ESOP.

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

[19]  Krishnendu Chatterjee,et al.  Termination of Nondeterministic Recursive Probabilistic Programs , 2017, ArXiv.

[20]  David Williams,et al.  Probability with Martingales , 1991, Cambridge mathematical textbooks.

[21]  Sebastian Thrun,et al.  Probabilistic robotics , 2002, CACM.

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

[23]  Javier Esparza,et al.  Proving Termination of Probabilistic Programs Using Patterns , 2012, CAV.

[24]  Claire Jones,et al.  Probabilistic non-determinism , 1990 .

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

[26]  Krishnendu Chatterjee,et al.  Cost analysis of nondeterministic probabilistic programs , 2019, PLDI.

[27]  Holger Hermanns,et al.  Probabilistic Termination , 2015, POPL.

[28]  Henny B. Sipma,et al.  Linear Invariant Generation Using Non-linear Constraint Solving , 2003, CAV.

[29]  W. Hoeffding Probability Inequalities for sums of Bounded Random Variables , 1963 .

[30]  Krishnendu Chatterjee,et al.  Termination Analysis of Probabilistic Programs Through Positivstellensatz's , 2016, CAV.

[31]  David M. Kahn Undecidable Problems for Probabilistic Network Programming , 2017, MFCS.

[32]  Annabelle McIver,et al.  A new proof rule for almost-sure termination , 2017, Proc. ACM Program. Lang..

[33]  Krishnendu Chatterjee,et al.  Lexicographic ranking supermartingales: an efficient approach to termination of probabilistic programs , 2017, Proc. ACM Program. Lang..

[34]  Joost-Pieter Katoen,et al.  On the hardness of analyzing probabilistic programs , 2018, Acta Informatica.

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

[36]  Krishnendu Chatterjee,et al.  Algorithmic Analysis of Qualitative and Quantitative Termination Problems for Affine Probabilistic Programs , 2018, ACM Trans. Program. Lang. Syst..

[37]  Henny B. Sipma,et al.  Constraint-Based Linear-Relations Analysis , 2004, SAS.

[38]  David Tolpin,et al.  Design and Implementation of Probabilistic Programming Language Anglican , 2016, IFL 2016.

[39]  Van Chan Ngo,et al.  Bounded expectations: resource analysis for probabilistic programs , 2017, PLDI.

[40]  Claudio V. Russo,et al.  A model-learner pattern for bayesian reasoning , 2013, POPL.

[41]  Zohar Manna,et al.  A closer look at termination , 1975, Acta Informatica.

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

[43]  Krishnendu Chatterjee,et al.  Modular verification for almost-sure termination of probabilistic programs , 2019, Proc. ACM Program. Lang..

[44]  Alexandra Silva,et al.  Cantor meets Scott: semantic foundations for probabilistic networks , 2016, POPL.

[45]  Olivier Bournez,et al.  Proving Positive Almost-Sure Termination , 2005, RTA.