skip to main content

PMAF: an algebraic framework for static analysis of probabilistic programs

Published:11 June 2018Publication History
Skip Abstract Section

Abstract

Automatically establishing that a probabilistic program satisfies some property ϕ is a challenging problem. While a sampling-based approach—which involves running the program repeatedly—can suggest that ϕ holds, to establish that the program satisfies ϕ, analysis techniques must be used. Despite recent successes, probabilistic static analyses are still more difficult to design and implement than their deterministic counterparts. This paper presents a framework, called PMAF, for designing, implementing, and proving the correctness of static analyses of probabilistic programs with challenging features such as recursion, unstructured control-flow, divergence, nondeterminism, and continuous distributions. PMAF introduces pre-Markov algebras to factor out common parts of different analyses. To perform interprocedural analysis and to create procedure summaries, PMAF extends ideas from non-probabilistic interprocedural dataflow analysis to the probabilistic setting. One novelty is that PMAF is based on a semantics formulated in terms of a control-flow hyper-graph for each procedure, rather than a standard control-flow graph. To evaluate its effectiveness, PMAF has been used to reformulate and implement existing intraprocedural analyses for Bayesian-inference and the Markov decision problem, by creating corresponding interprocedural analyses. Additionally, PMAF has been used to implement a new interprocedural linear expectation-invariant analysis. Experiments with benchmark programs for the three analyses demonstrate that the approach is practical.

Skip Supplemental Material Section

Supplemental Material

p513-wang.webm

References

  1. S. Abramsky and A. Jung. 1994. Domain Theory. In Handbook of Logic in Computer Science. Oxford University Press Oxford, UK. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. I. Bahar, E. A. Frohm, C. M. Gaona, G. D. Hachtel, E. Macii, A. Pardo, and F. Somenzi. 1997. Algebraic Decision Diagrams and their Applications. Formal Methods in System Design 10 (April 1997). Issue 2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. T. Ball, A. Podelski, and S. K. Rajamani. 2001. Boolean and Cartesian Abstraction for Model Checking C Programs. In Tools and Algs. for the Construct. and Anal. of Syst. (TACAS'01). Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. G. Barthe, T. Espitau, L. M. Ferrer Fioriti, and J. Hsu. 2016. Synthesizing Probabilistic Invariants via Doob's Decomposition. In Computer Aided Verif. (CAV'16).Google ScholarGoogle Scholar
  5. G. Barthe, T. Espitau, M. Gaboardi, B. Gregoire, J. Hsu, and P.-Y. Strub. 2016. A Program Logic for Probabilistic Programs. Available at justinh.su/files/papers/ellora.pdf.Google ScholarGoogle Scholar
  6. G. Barthe, B. Gregoire, and S. Zanella Beguelin. 2009. Formal Certification of Code-based Cryptographic Proofs. In Princ. of Prog. Lang. (POPL'09). Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. Billingsley. 2012. Probability and Measure. John Wiley & Sons, Inc.Google ScholarGoogle Scholar
  8. J. Borgstrom, U. D. Lago, A. D. Gordon, and M. Szymczak. 2016. A Lambda-Calculus Foundation for Universal Probabilistic Programming. In Int. Conf. on Functional Programming (ICFP'16). Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. F. Bourdoncle. 1993. Efficient Chaotic Iteration Strategies With Widenings. In Formal Methods in Prog. and Their Applications.Google ScholarGoogle Scholar
  10. T. Brazdil, S. Kiefer, and A. Kucera. 2014. Efficient Analysis of Probabilistic Programs with an Unbounded Counter. J. ACM 61 (November 2014). Issue 6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Brazdil, S. Kiefer, A. Kucera, and I. H. Varekova. 2015. Runtime Analysis of Probabilistic Programs with Unbounded Recursion. J. Comput. Syst. Sci. 81 (February 2015). Issue 1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Carpenter, A. Gelman, M. D. Hoffman, D. Lee, B. Goodrich, M. Betancourt, M. Brubaker, J. Guo, P. Li, and A. Riddell. 2017. Stan: A Probabilistic Programming Language. J. Statistical Softw. 76 (2017). Issue 1.Google ScholarGoogle Scholar
  13. A. Chakarov and S. Sankaranarayanan. 2013. Probabilistic Program Analysis with Martingales. In Computer Aided Verif. (CAV'13). Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Chakarov and S. Sankaranarayanan. 2014. Expectation Invariants for Probabilistic Program Loops as Fixed Points. In Static Analysis Symp. (SAS'14).Google ScholarGoogle Scholar
  15. K. Chatterjee, H. Fu, and A. K. Goharshady. 2016. Termination Analysis of Probabilistic Programs Through Positivstellensatz's. In Computer Aided Verif. (CAV'16).Google ScholarGoogle Scholar
  16. K. Chatterjee, H. Fu, P. Novotny, and R. Hasheminezhad. 2016. Algorithmic Analysis of Qualitative and Quantitative Termination Problems for Affine Probabilistic Programs. In Princ. of Prog. Lang. (POPL'16). Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. K. Chatterjee, P. Novotny, and D. ?ikelic. 2017. Stochastic Invariants for Probabilistic Termination. In Princ. of Prog. Lang. (POPL'17). Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. Claret, S. K. Rajamani, A. V. Nori, A. D. Gordon, and J. Borgstrom. 2013. Bayesian Inference using Data Flow Analysis. In Found. of Softw. Eng. (FSE'13). Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Conchon, J.-C. Filliatre, and J. Signoles. 2007. Designing a Generic Graph Library Using ML Functors. In Trends in Functional Programming.Google ScholarGoogle Scholar
  20. P. Cousot. 1981. Semantic Foundations of Program Analysis. In Program Flow Analysis: Theory and Applications. Prentice-Hall.Google ScholarGoogle Scholar
  21. P. Cousot and R. Cousot. 1977. Abstract Interpretation: A Unified Latice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In Princ. of Prog. Lang. (POPL'77). Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. P. Cousot and R. Cousot. 1978. Static Determination of Dynamic Properties of Recursive Procedures. In Formal Descriptions of Programming Concepts, (IFIP WG 2.2, St. Andrews, Canada, August 1977). North-Holland.Google ScholarGoogle Scholar
  23. P. Cousot and R. Cousot. 1979. Systematic Design of Program Analysis Frameworks. In Princ. of Prog. Lang. (POPL'79). Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. P. Cousot and N. Halbwachs. 1978. Automatic Discovery of Linear Constraints Among Variables of a Program. In Princ. of Prog. Lang. (POPL'78). Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. P. Cousot and M. Monerau. 2012. Probabilistic Abstract Interpretation. In European Symp. on Programming (ESOP'12). Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. E. Darulova and V. Kuncak. 2014. Sound Compilation of Reals. In Princ. of Prog. Lang. (POPL'14). Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. I. den Hartog and E. P. de Vink. 1999. Mixing Up Nondeterminism and Probability: a preliminary report. Electr. Notes Theor. Comp. Sci. 22 (1999).Google ScholarGoogle Scholar
  28. E. W. Dijkstra. 1997. A Discipline of Programming. Prentice Hall PTR Upper Saddle River. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. K. Etessami, D.Wojtczak, and M. Yannakakis. 2008. Recursive Stochastic Games with Positive Rewards. In Int. Colloq. on Automata, Langs., and Programming (ICALP'08). Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. K. Etessami and M. Yannakakis. 2005. Recursive Markov Chains, Stochastic Grammars, and Monotone Systems of Nonlinear Equations. In Symp. on Theor. Aspects of Comp. Sci. (STACS'05). Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. K. Etessami and M. Yannakakis. 2015. Recursive Markov Decision Processes and Recursive Stochastic Games. J. ACM 62 (May 2015). Issue 2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. A. Farzan and Z. Kincaid. 2015. Compositional Recurrence Analysis. In Formal Methods in Compiter-Aided Design (FMCAD'15). Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. L. M. Ferrer Fioriti and H. Hermanns. 2015. Probabilistic Termination: Soundness, Completeness, and Compositionality. In Princ. of Prog. Lang. (POPL'15). Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. R. W. Floyd. 1967. Assigning Meanings to Programs. In Proc. AMS Symposium in Appl. Math.Google ScholarGoogle ScholarCross RefCross Ref
  35. G. Gallo, G. Longo, S. Pallottino, and S. Nguyen. 1993. Directed Hypergraphs and Applications. Disc. Appl. Math. 42 (April 1993). Issue 2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. T. Gehr, S. Misailovic, and M. Vechev. 2016. PSI: Exact Symbolic Inference for Probabilistic Programs. In Computer Aided Verif. (CAV'16).Google ScholarGoogle Scholar
  37. Z. Ghahramani. 2015. Probabilistic machine learning and artificial intelligence. Nature (2015).Google ScholarGoogle Scholar
  38. N. D. Goodman, V. K. Mansinghka, D. M. Roy, and J. B. Tenenbaum. 2008. Church: a language for generative models. In Uncertainty in Artif. Intelligence. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. A. D. Gordon, T. A. Henzinger, A. V. Nori, and S. K. Rajamani. 2014. Probabilistic Programming. In Future of Softw. Eng. (FOSE'14). Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. S. Graf and H. Saidi. 1997. Construction of Abstract State Graphs with PVS. In Computer Aided Verif. (CAV'97). Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. C. A. Gunter, P. D. Mosses, and D. S. Scott. 1989. Semantic Domains and Denotational Semantics. Technical Report. University of Pennsylvania Department of Computer and Information Science.Google ScholarGoogle Scholar
  42. N. Halbwachs. 1979. Determination automatique de relations lineaires verifiees par les variables d'un programme. Ph.D. Dissertation. Univ. of Grenoble.Google ScholarGoogle Scholar
  43. C. A. R. Hoare. 1969. An Axiomatic Basis for Computer Programming. Commun. ACM 12 (October 1969). Issue 10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. S. Horwitz, T. Reps, and M. Sagiv. 1995. Demand Interprocedural Dataflow Analysis. In Found. of Softw. Eng. (FSE'95). Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. B. Jeannet and A. Mine. 2009. Apron: A Library of Numerical Abstract Domains for Static Analysis. In Computer Aided Verif. (CAV'09). Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. C. Jones. 1989. Probabilistic Non-determinism. Ph.D. Dissertation. University of Edinburgh Edinburgh. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. C. Jones and G. Plotkin. 1989. A Probabilistic Powerdomain of Evaluations. In Logic in Computer Science (LICS'89). Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. B. L. Kaminski, J.-P. Katoen, C. Matheja, and F. Olmedo. 2016. Weakest Precondition Reasoning for Expected Run--Times of Probabilistic Programs. In European Symp. on Programming (ESOP'16). Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. J.-P. Katoen, A. K. McIver, L. A. Meinicke, and C. C. Morgan. 2010. Linear-Invariant Generation for Probabilistic Programs: Automated Support for Proof-Based Methods. In Static Analysis Symp. (SAS'10). Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. M. Kattenbelt, M. Kwiatkowska, G. Norman, and D. Parker. 2009. Abstraction Refinement for Probabilistic Software. In Verif., Model Checking, and Abs. Interp. (VMCAI'09). Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. G. A. Kildall. 1973. A Unified Approach to Global Program Optimization. In Princ. of Prog. Lang. (POPL'73). Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. J. Knoop and B. Steffen. 1992. The Interprocedural Coincidence Theorem. In Comp. Construct. (CC'92). Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. D. E. Knuth. 1977. A Generalization of Dijkstra's Algorithm. Inf. Proc. Let. 6 (February 1977). Issue 1.Google ScholarGoogle ScholarCross RefCross Ref
  54. S. Kok, M. Sumner, M. Richardson, P. Singla, H. Poon, D. Lowd, J. Wang, and P. Domingos. 2007. The Alchemy System for Statistical Relational AI. Technical Report. University of Washington.Google ScholarGoogle Scholar
  55. D. Kozen. 1981. Semantics of Probabilistic Programs. J. Comput. Syst. Sci. 22 (June 1981). Issue 3.Google ScholarGoogle Scholar
  56. D. Kozen. 1985. A Probabilistic PDL. J. Comput. Syst. Sci. 30 (April 1985). Issue 2.Google ScholarGoogle Scholar
  57. A. Lal, T. Reps, and G. Balakrishnan. 2005. Extended Weighted Pushdown Systems. In Computer Aided Verif. (CAV'05). Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Z. Li and J. Eisner. 2009. First- and Second-Order Expectation Semirings with Applications to Minimum-Risk Training on Translation Forests. In Conference on Empirical Methods in Natural Language Processing (EMNLP'09). Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. A. K. McIver and C. C. Morgan. 2001. Partial correctness for probabilistic demonic programs. Theor. Comp. Sci. 266 (September 2001). Issue 1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. A. K. McIver and C. C. Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer Science+Business Media, Inc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. B. Milch, B. Marthi, S. Russell, D. Sontag, D. L. Ong, and A. Kolobov. 2005. BLOG: Probabilistic Models with Unknown Objects. In Int. Joint Conf. on Artif. Intelligence (IJCAI'05). Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. A. Mine. 2006. Symbolic Methods to Enhance the Precision of Numerical Abstract Domains. In Verif., Model Checking, and Abs. Interp. (VMCAI'06). Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. T. Minka, J. M. Winn, J. P. Guiver, S. Webster, Y. Zaykov, B. Yangel, A. Spengler, and J. Bronskill. 2014. Infer.NET 2.6. Microsoft Research Cambridge. research.microsoft.com/infernet.Google ScholarGoogle Scholar
  64. M. Mislove. 2000. Nondeterminism and Probabilistic Choice: Obeying the Laws. In Concurrency Theory. Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. M. Mislove, J. Ouaknine, and J. Worrell. 2004. Axioms for Probability and Nondeterminism. Electr. Notes Theor. Comp. Sci. 96 (June 2004).Google ScholarGoogle Scholar
  66. U. Moncke and R. Wilhelm. 1991. Grammar Flow Analysis. In Attribute Grammars, Applications and Systems, (Int. Summer School SAGA). Google ScholarGoogle ScholarDigital LibraryDigital Library
  67. D. Monniaux. 2000. Abstract Interpretation of Probabilistic Semantics. In Static Analysis Symp. (SAS'00). Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. D. Monniaux. 2001. Backwards Abstract Interpretation of Probabilistic Programs. In European Symp. on Programming (ESOP'01). Google ScholarGoogle ScholarDigital LibraryDigital Library
  69. D. Monniaux. 2003. Abstract Interpretation of Programs as Markov Decision Processes. In Static Analysis Symp. (SAS'03). Google ScholarGoogle ScholarDigital LibraryDigital Library
  70. M. Mottl. 2017. Lacaml - Linear Algebra for OCaml. Available at github.com/mmottl/lacaml.Google ScholarGoogle Scholar
  71. M. Muller-Olm and H. Seidl. 2004. Precise Interprocedural Analysis through Linear Algebra. In Princ. of Prog. Lang. (POPL'04). Google ScholarGoogle ScholarDigital LibraryDigital Library
  72. F. Olmedo, B. L. Kaminski, J.-P. Katoen, and C. Matheja. 2016. Reasoning about Recursive Probabilistic Programs. In Logic in Computer Science (LICS'16). Google ScholarGoogle ScholarDigital LibraryDigital Library
  73. P. Panangaden. 1999. The Category of Markov Kernels. Electr. Notes Theor. Comp. Sci. 22 (1999).Google ScholarGoogle Scholar
  74. A. Pfeffer. 2005. The Design and Implementation of IBAL: A General-Purpose Probabilistic Language. Technical Report. Harvard Computer Science Group.Google ScholarGoogle Scholar
  75. M. L. Puterman. 1994. Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons, Inc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  76. G. Ramalingam. 1996. Bounded Incremental Computation. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  77. T. Reps, S. Horwitz, and M. Sagiv. 1995. Precise Interprocedural Dataflow Analysis via Graph Reachability. In Princ. of Prog. Lang. (POPL'95). Google ScholarGoogle ScholarDigital LibraryDigital Library
  78. M. Sagiv, T. Reps, and S. Horwitz. 1996. Precise Interprocedural Dataflow Analysis with Applications to Constant Propagation. Theor. Comp. Sci. 167 (1996). Issue 1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  79. S. Sankaranarayanan, A. Chakarov, and S. Gulwani. 2013. Static Analysis for Probabilistic Programs: Inferring Whole Program Properties from Finitely Many Paths. In Prog. Lang. Design and Impl. (PLDI'13). Google ScholarGoogle ScholarDigital LibraryDigital Library
  80. M. Sharir and A. Pnueli. 1981. Two Approaches to Interprocedural Data Flow Analysis. In Program Flow Analysis: Theory and Applications. Prentice-Hall.Google ScholarGoogle Scholar
  81. R. E. Tarjan. 1981. A Unified Approach to Path Problems. J. ACM 28 (July 1981). Issue 3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  82. R. Tix, K. Keimel, and G. Plotkin. 2009. Semantic Domains for Combining Probability and Non-Determinism. Electr. Notes Theor. Comp. Sci. 222 (February 2009). Google ScholarGoogle ScholarDigital LibraryDigital Library
  83. D. Wang, J. Hoffmann, and T. Reps. 2018. A Denotational Semantics for Nondeterminism in Probabilistic Programs. Available at www.cs.cmu.edu/~diw3/papers/WangHR18.pdf.Google ScholarGoogle Scholar
  84. D. Wojtczak and K. Etessami. 2017. PReMo s Probabilistic Recursive Models analyzer. Available at groups.inf.ed.ac.uk/premo/.Google ScholarGoogle Scholar

Index Terms

  1. PMAF: an algebraic framework for static analysis of probabilistic programs

        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!