skip to main content
10.1007/978-3-031-13185-1_5guideproceedingsArticle/Chapter ViewAbstractPublication PagesConference Proceedingsacm-pubtype
Article

Does a Program Yield the Right Distribution?: Verifying Probabilistic Programs via Generating Functions

Published: 07 August 2022 Publication History

Abstract

We study discrete probabilistic programs with potentially unbounded looping behaviors over an infinite state space. We present, to the best of our knowledge, the first decidability result for the problem of determining whether such a program generates exactly a specified distribution over its outputs (provided the program terminates almost-surely). The class of distributions that can be specified in our formalism consists of standard distributions (geometric, uniform, etc.) and finite convolutions thereof. Our method relies on representing these (possibly infinite-support) distributions as probability generating functions which admit effective arithmetic operations. We have automated our techniques in a tool called PRODIGY, which supports automatic invariance checking, compositional reasoning of nested loops, and efficient queries to the output distribution, as demonstrated by experiments.

References

[1]
Arvo, J., Kirk, D.B.: Particle transport and image synthesis. In: SIGGRAPH, pp. 63–66. ACM (1990)
[2]
Aspnes J and Herlihy M Fast randomized consensus using shared memory J. Algorithms 1990 11 3 441-461
[3]
Barthe, G., Grégoire, B., Béguelin, S.Z.: Formal certification of code-based cryptographic proofs. In: POPL, pp. 90–101. ACM (2009)
[4]
Barthe, G., Jacomme, C., Kremer, S.: Universal equivalence and majority of probabilistic programs over finite fields. In: LICS, pp. 155–166. ACM (2020)
[5]
Barthe, G., Katoen, J., Silva, A. (eds.): Foundations of Probabilistic Programming. Cambridge University Press, Cambridge (2020)
[6]
Barthe, G., Köpf, B., Olmedo, F., Béguelin, S.Z.: Probabilistic relational reasoning for differential privacy. ACM Trans. Program. Lang. Syst. 35(3), 9:1–9:49 (2013)
[7]
Bartocci E, Kovács L, and Stankovič M Pun VKI, Stolz V, and Simao A Analysis of Bayesian networks via prob-solvable loops Theoretical Aspects of Computing – ICTAC 2020 2020 Cham Springer 221-241
[8]
Bartocci E, Kovács L, and Stankovič M Mora - automatic generation of moment-based invariants Tools and Algorithms for the Construction and Analysis of Systems 2020 Cham Springer 492-498
[9]
Batz K, Chen M, Kaminski BL, Katoen J-P, Matheja C, and Schröer P Silva A and Leino KRM Latticed k-induction with an application to probabilistic programs Computer Aided Verification 2021 Cham Springer 524-549
[10]
Bauer C, Frink A, and Kreckel R Introduction to the GiNaC framework for symbolic computation within the C++ programming language J. Symb. Comput. 2002 33 1 1-12
[11]
Bhat, S., Agarwal, A., Vuduc, R.W., Gray, A.G.: A type theory for probability density functions. In: POPL, pp. 545–556. ACM (2012)
[12]
Bhat, S., Borgström, J., Gordon, A.D., Russo, C.V.: Deriving probability density functions from probabilistic functional programs. Log. Methods Comput. Sci. 13(2) (2017)
[13]
Carbin M, Misailovic S, and Rinard MC Verifying quantitative reliability for programs that execute on unreliable hardware Commun. ACM 2016 59 8 83-91
[14]
Carette J and Shan C-C Gavanelli M and Reppy J Simplifying probabilistic programs using computer algebra Practical Aspects of Declarative Languages 2016 Cham Springer 135-152
[15]
Chakarov A and Sankaranarayanan S Sharygina N and Veith H Probabilistic program analysis with martingales Computer Aided Verification 2013 Heidelberg Springer 511-526
[16]
Chatterjee K, Fu H, and Goharshady AK Chaudhuri S and Farzan A Termination analysis of probabilistic programs through Positivstellensatz’s Computer Aided Verification 2016 Cham Springer 3-22
[17]
Chatterjee, K., Fu, H., Novotný, P.: Termination analysis of probabilistic programs with martingales, pp. 221–258. In: Barthe et al. [5] (2020)
[18]
Chen, M., Katoen, J., Klinkenberg, L., Winkler, T.: Does a program yield the right distribution? Verifying probabilistic programs via generating functions. CoRR abs/2205.01449 (2022)
[19]
Dijkstra EW Guarded commands, nondeterminacy and formal derivation of programs Commun. ACM 1975 18 8 453-457
[20]
Evans, O., Stuhlmüller, A., Salvatier, J., Filan, D.: Modeling agents with probabilistic programs. http://agentmodels.org (2017). Accessed 17 Jan 2022
[21]
Flajolet, P., Pelletier, M., Soria, M.: On Buffon machines and numbers. In: SODA, pp. 172–183. SIAM (2011)
[22]
Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)
[23]
Forejt V, Jancar P, Kiefer S, and Worrell J Language equivalence of probabilistic pushdown automata Inf. Comput. 2014 237 1-11
[24]
Gehr T, Misailovic S, and Vechev M Chaudhuri S and Farzan A PSI: exact symbolic inference for probabilistic programs Computer Aided Verification 2016 Cham Springer 62-83
[25]
Gehr, T., Steffen, S., Vechev, M.T.: λPSI: exact inference for higher-order probabilistic programs. In: PLDI, pp. 883–897. ACM (2020)
[26]
Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: FOSE, pp. 167–181. ACM (2014)
[27]
Hammersley, J.: Monte Carlo Methods. Springer Science & Business Media (2013)
[28]
Hark, M., Kaminski, B.L., Giesl, J., Katoen, J.: Aiming low is harder: induction for lower bounds in probabilistic program verification. Proc. ACM Program. Lang. 4(POPL), 37:1–37:28 (2020)
[29]
Heninger, N.: RSA, DH and DSA in the wild. In: Bos, J., Stam, M. (eds.) Computational Cryptography: Algorithmic Aspects of Cryptology, pp. 140–181. Cambridge University Press, Cambridge (2021)
[30]
Hicks, M.: What is probabilistic programming? In: The Programming Languages Enthusiast (2014). http://www.pl-enthusiast.net/2014/09/08. Accessed 09 Dec 2021
[31]
Holtzen, S., den Broeck, G.V., Millstein, T.D.: Scaling exact inference for discrete probabilistic programs. Proc. ACM Program. Lang. 4(OOPSLA), 140:1–140:31 (2020)
[32]
Huang Z, Dutta S, and Misailovic S Hou Z and Ganesh V AQUA: automated quantized inference for probabilistic programs Automated Technology for Verification and Analysis 2021 Cham Springer 229-246
[33]
Jacobs, B., Zanasi, F.: The logical essentials of Bayesian reasoning, pp. 295–331. In: Barthe et al. [5] (2020)
[34]
Jansen N, Dehnert C, Kaminski BL, Katoen J-P, and Westhofen L Artho C, Legay A, and Peled D Bounded model checking for probabilistic programs Automated Technology for Verification and Analysis 2016 Cham Springer 68-85
[35]
Johnson, N., Kotz, S., Kemp, A.: Univariate Discrete Distributions. Wiley, Hoboken (1993)
[36]
Jones, C.: Probabilistic non-determinism. Ph.D. thesis, University of Edinburgh, UK (1990)
[37]
Kajiya, J.T.: The rendering equation. In: SIGGRAPH, pp. 143–150. ACM (1986)
[38]
Kaminski, B.L.: Advanced weakest precondition calculi for probabilistic programs. Ph.D. thesis, RWTH Aachen University, Germany (2019)
[39]
Kaminski BL, Katoen J-P, and Matheja C On the hardness of analyzing probabilistic programs Acta Informatica 2018 56 3 255-285
[40]
Kaminski, B.L., Katoen, J., Matheja, C., Olmedo, F.: Weakest precondition reasoning for expected runtimes of randomized algorithms. J. ACM 65(5), 30:1–30:68 (2018)
[41]
Kiefer S, Murawski AS, Ouaknine J, Wachter B, and Worrell J Gopalakrishnan G and Qadeer S Language equivalence for probabilistic automata Computer Aided Verification 2011 Heidelberg Springer 526-540
[42]
Klinkenberg L, Batz K, Kaminski BL, Katoen J-P, Moerman J, and Winkler T Fernández M Generating functions for probabilistic programs Logic-Based Program Synthesis and Transformation 2021 Cham Springer 231-248
[43]
Kozen D Semantics of probabilistic programs J. Comput. Syst. Sci. 1981 22 3 328-350
[44]
Kozen D A probabilistic PDL J. Comput. Syst. Sci. 1985 30 2 162-178
[45]
Legay A, Murawski AS, Ouaknine J, and Worrell J Ramakrishnan CR and Rehof J on automated verification of probabilistic programs Tools and Algorithms for the Construction and Analysis of Systems 2008 Heidelberg Springer 173-187
[46]
McIver, A., Morgan, C.: Abstraction, Refinement and Proof For Probabilistic Systems. Monographs in Computer Science. Springer, New York (2005).
[47]
McIver, A., Morgan, C., Kaminski, B.L., Katoen, J.: A new proof rule for almost-sure termination. PACMPL 2(POPL), 33:1–33:28 (2018)
[48]
van de Meent, J., Paige, B., Yang, H., Wood, F.: An introduction to probabilistic programming. CoRR abs/1809.10756 (2018)
[49]
Meurer A et al. SymPy: symbolic computing in Python PeerJ Comput. Sci. 2017 3
[50]
Moosbrugger M, Bartocci E, Katoen J-P, and Kovács L Huisman M, Păsăreanu C, and Zhan N The probabilistic termination tool amber Formal Methods 2021 Cham Springer 667-675
[51]
Murawski AS and Ouaknine J Abadi M and de Alfaro L On probabilistic program equivalence and refinement CONCUR 2005 – Concurrency Theory 2005 Heidelberg Springer 156-170
[52]
Narayanan P, Carette J, Romano W, Shan C, and Zinkov R Kiselyov O and King A Probabilistic inference by program transformation in Hakaru (system description) Functional and Logic Programming 2016 Cham Springer 62-79
[53]
Schneider M Self-stabilization ACM Comput. Surv. 1993 25 1 45-67
[54]
Shamsi, S.M., Farina, G.P., Gaboardi, M., Napp, N.: Probabilistic programming languages for modeling autonomous systems. In: MFI, pp. 32–39. IEEE (2020)
[55]
Tijms, H.C.: A First Course in Stochastic Models. Wiley, Hoboken (2003)
[56]
Tzeng W A polynomial-time algorithm for the equivalence of probabilistic automata SIAM J. Comput. 1992 21 2 216-227
[57]
Vollinga J GiNaC-symbolic Computation with C++ Nucl. Instrum. Methods Phys. Res. 2006 559 1 282-284
[58]
Wang, D., Hoffmann, J., Reps, T.W.: Central moment analysis for cost accumulators in probabilistic programs. In: PLDI, pp. 559–573. ACM (2021)
[59]
Wang, J., Sun, Y., Fu, H., Chatterjee, K., Goharshady, A.K.: Quantitative analysis of assertion violations in probabilistic programs. In: PLDI, pp. 1171–1186. ACM (2021)
[60]
Wilf, H.S.: Generating Functionology. CRC Press, Boca Raton (2005)
[61]
Ying, M.: Floyd-Hoare logic for quantum programs. ACM Trans. Program. Lang. Syst. 33(6), 19:1–19:49 (2011)

Cited By

View all

Index Terms

  1. Does a Program Yield the Right Distribution?: Verifying Probabilistic Programs via Generating Functions
            Index terms have been assigned to the content through auto-classification.

            Recommendations

            Comments

            Information & Contributors

            Information

            Published In

            cover image Guide Proceedings
            Computer Aided Verification: 34th International Conference, CAV 2022, Haifa, Israel, August 7–10, 2022, Proceedings, Part I
            Aug 2022
            562 pages
            ISBN:978-3-031-13184-4
            DOI:10.1007/978-3-031-13185-1
            • Editors:
            • Sharon Shoham,
            • Yakir Vizel
            Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

            Publisher

            Springer-Verlag

            Berlin, Heidelberg

            Publication History

            Published: 07 August 2022

            Author Tags

            1. Probabilistic programs
            2. Quantitative verification
            3. Program equivalence
            4. Denotational semantics
            5. Generating functions

            Qualifiers

            • Article

            Contributors

            Other Metrics

            Bibliometrics & Citations

            Bibliometrics

            Article Metrics

            • Downloads (Last 12 months)0
            • Downloads (Last 6 weeks)0
            Reflects downloads up to 15 Jan 2025

            Other Metrics

            Citations

            Cited By

            View all

            View Options

            View options

            Media

            Figures

            Other

            Tables

            Share

            Share

            Share this Publication link

            Share on social media