Skip to main content

Automated Termination Analysis of Polynomial Probabilistic Programs

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 12648)

Abstract

The termination behavior of probabilistic programs depends on the outcomes of random assignments. Almost sure termination (AST) is concerned with the question whether a program terminates with probability one on all possible inputs. Positive almost sure termination (PAST) focuses on termination in a finite expected number of steps. This paper presents a fully automated approach to the termination analysis of probabilistic while-programs whose guards and expressions are polynomial expressions. As proving (positive) AST is undecidable in general, existing proof rules typically provide sufficient conditions. These conditions mostly involve constraints on supermartingales. We consider four proof rules from the literature and extend these with generalizations of existing proof rules for (P)AST. We automate the resulting set of proof rules by effectively computing asymptotic bounds on polynomials over the program variables. These bounds are used to decide the sufficient conditions – including the constraints on supermartingales – of a proof rule. Our software tool Amber can thus check AST, PAST, as well as their negations for a large class of polynomial probabilistic programs, while carrying out the termination reasoning fully with polynomial witnesses. Experimental results show the merits of our generalized proof rules and demonstrate that Amber can handle probabilistic programs that are out of reach for other state-of-the-art tools.

Keywords

  • Probabilistic Programming
  • Almost sure Termination
  • Martingales
  • Asymptotic Bounds
  • Linear Recurrences

This research was supported by the WWTF ICT19-018 grant ProbInG, the ERC Starting Grant SYMCAR 639270, the ERC AdG Grant FRAPPANT 787914, and the Austrian FWF project W1255-N23.

References

  1. Agrawal, S., Chatterjee, K., Novotný, P.: Lexicographic ranking supermartingales: an efficient approach to termination of probabilistic programs. Proc. of POPL (2017). https://doi.org/10.1145/3158122

  2. Arora, N.S., Russell, S.J., Sudderth, E.B.: NET–VISA: Network Processing Vertically Integrated Seismic Analysis. Seismol. Soc. Am., Bull. (2013). https://doi.org/10.1785/0120120107

  3. Avanzini, M., Lago, U.D., Yamada, A.: On probabilistic term rewriting. Sci. Comput. Program. (2020). https://doi.org/10.1016/j.scico.2019.102338

  4. Bartocci, E., Kovács, L., Stankovic, M.: Automatic generation of moment-based invariants for prob-solvable loops. In: Proc. of ATVA (2019). https://doi.org/10.1007/978-3-030-31784-3_15

  5. Bartocci, E., Kovács, L., Stankovic, M.: Analysis of bayesian networks via prob-solvable loops. In: Proc. of ICTAC (2020). https://doi.org/10.1007/978-3-030-64276-1_12

  6. Bartocci, E., Kovács, L., Stankovic, M.: Mora - automatic generation of moment-based invariants. In: Proc. of TACAS (2020). https://doi.org/10.1007/978-3-030-45190-5

  7. Bistline, J.E., Blum, D.M., Rinaldi, C., Shields-Estrada, G., Hecker, S.S., Paté-Cornell, M.E.: A Bayesian Model to Assess the Size of North Korea’s Uranium Enrichment Program. Sci. Global Secur. (2015). https://doi.org/10.1080/08929882.2015.1039431

  8. Bournez, O., Garnier, F.: Proving positive almost-sure termination. In: Proc. of RTA (2005). https://doi.org/10.1007/978-3-540-32033-3_24

  9. Bradley, A.R., Manna, Z., Sipma, H.B.: Termination of Polynomial Programs. In: Proc. of VMCAI (2005). https://doi.org/10.1007/b105073

  10. Chakarov, A., Sankaranarayanan, S.: Probabilistic Program Analysis with Martingales. In: Proc. of CAV (2013). https://doi.org/10.1007/978-3-642-39799-8_34

  11. Chatterjee, K., Fu, H., Goharshady, A.K.: Termination Analysis of Probabilistic Programs Through Positivstellensatz’s. In: Proc. of CAV (2016). https://doi.org/10.1007/978-3-319-41528-4_1

  12. Chatterjee, K., Fu, H., Novotný, P., Hasheminezhad, R.: Algorithmic Analysis of Qualitative and Quantitative Termination Problems for Affine Probabilistic Programs. ACM Trans. Program. Lang. Syst. (2018). https://doi.org/10.1145/3174800

  13. Chatterjee, K., Novotný, P., Zikelic, D.: Stochastic Invariants for Probabilistic Termination. In: Proc. of POPL (2017). https://doi.org/10.1145/3009837.3009873

  14. Chen, J., He, F.: Proving almost-sure termination by omega-regular decomposition. In: Proc. of PLDI (2020). https://doi.org/10.1145/3385412.3386002

  15. Cook, B., Podelski, A., Rybalchenko, A.: Terminator: Beyond Safety. In: Proc. of CAV (2006). https://doi.org/10.1007/11817963_37

  16. Cook, B., Podelski, A., Rybalchenko, A.: Proving program termination. Commun. ACM (2011). https://doi.org/10.1145/1941487.1941509

  17. Dal Lago, U., Grellois, C.: Probabilistic termination by monadic affine sized typing. ACM Trans. Program. Lang. Syst. (2019). https://doi.org/10.1145/3293605

  18. Esparza, J., Gaiser, A., Kiefer, S.: Proving Termination of Probabilistic Programs Using Patterns. In: Proc. of CAV (2012). https://doi.org/10.1007/978-3-642-31424-7_14

  19. Ferrer Fioriti, L.L.M., Hermanns, H.: Probabilistic Termination: Soundness, Completeness, and Compositionality. In: Proc. of POPL (2015). https://doi.org/10.1145/2676726.2677001

  20. Fremont, D.J., Dreossi, T., Ghosh, S., Yue, X., Sangiovanni-Vincentelli, A.L., Seshia, S.A.: Scenic: a language for scenario specification and scene generation. In: Proc. of PLDI (2019). https://doi.org/10.1145/3314221.3314633

  21. Giesl, J., Aschermann, C., Brockschmidt, M., Emmes, F., Frohn, F., Fuhs, C., Hensel, J., Otto, C., Plücker, M., Schneider-Kamp, P., Ströder, T., Swiderski, S., Thiemann, R.: Analyzing program termination and complexity automatically with aprove. J. Autom. Reasoning (2017). https://doi.org/10.1007/s10817-016-9388-y

  22. Giesl, J., Giesl, P., Hark, M.: Computing expected runtimes for constant probability programs. In: Proc. of CADE (2019). https://doi.org/10.1007/978-3-030-29436-6_16

  23. Gruntz, D.: On computing limits in a symbolic manipulation system. Ph.D. thesis, ETH Zürich (1996). https://doi.org/10.3929/ETHZ-A-001631582

  24. Hark, M., Frohn, F., Giesl, J.: Polynomial loops: Beyond termination. In: Proc. of LPAR (2020). https://doi.org/10.29007/nxv1

  25. Hark, M., Kaminski, B.L., Giesl, J., Katoen, J.: Aiming low is harder: induction for lower bounds in probabilistic program verification. In: Proc. of POPL (2020). https://doi.org/10.1145/3371105

  26. Heizmann, M., Chen, Y., Dietsch, D., Greitschus, M., Hoenicke, J., Li, Y., Nutz, A., Musa, B., Schilling, C., Schindler, T., Podelski, A.: Ultimate automizer and the search for perfect interpolants - (competition contribution). In: Proc. of TACAS (2018). https://doi.org/10.1007/978-3-319-89963-3_30

  27. Hoare, C.A.R.: An Axiomatic Basis for Computer Programming. Commun. ACM (1969). https://doi.org/10.1145/363235.363259

  28. Huang, M., Fu, H., Chatterjee, K.: New Approaches for Almost-Sure Termination of Probabilistic Programs. In: Proc. of APLAS (2018). https://doi.org/10.1007/978-3-030-02768-1_11

  29. Huang, M., Fu, H., Chatterjee, K., Goharshady, A.K.: Modular verification for almost-sure termination of probabilistic programs. Proc. ACM Program. Lang. (2019). https://doi.org/10.1145/3360555

  30. Kaminski, B.L., Katoen, J.P.: On the hardness of almost-sure termination. In: Proc. of MFCS (2015). https://doi.org/10.1007/978-3-662-48057-1_24

  31. Kaminski, B.L., Katoen, J., Matheja, C., Olmedo, F.: Weakest precondition reasoning for expected runtimes of randomized algorithms. J. ACM (2018). https://doi.org/10.1145/3208102

  32. Kauers, M., Paule, P.: The Concrete Tetrahedron: Symbolic Sums, Recurrence Equations, Generating Functions, Asymptotic Estimates. Springer (2011)

    Google Scholar 

  33. Kemeny, J.G., Snell, J.L., Knapp, A.W.: Denumerable Markov Chains: with a chapter of Markov Random Fields by David Griffeath. Springer, 2 edn. (1976)

    Google Scholar 

  34. Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. (1981). https://doi.org/10.1016/0022-0000(81)90036-2

  35. Kozen, D.: A probabilistic PDL. J. Comput. Syst. Sci. (1985). https://doi.org/10.1016/0022-0000(85)90012-1

  36. Lengál, O., Lin, A.W., Majumdar, R., Rümmer, P.: Fair termination for parameterized probabilistic concurrent systems. In: Proc. of TACAS (2017). https://doi.org/10.1007/978-3-662-54577-5_29

  37. McIver, A., Morgan, C.: Abstraction, Refinement and Proof for Probabilistic Systems. Springer (2005)

    Google Scholar 

  38. McIver, A., Morgan, C., Kaminski, B.L., Katoen, J.P.: A New Proof Rule for Almost-sure Termination. Proc. ACM Program. Lang. (2018). https://doi.org/10.1145/3158121

  39. Monniaux, D.: An abstract analysis of the probabilistic termination of programs. In: Proc. of SAS (2001). https://doi.org/10.1007/3-540-47764-0

  40. Moosbrugger, M., Bartocci, E., Katoen, J.P., Kovács, L.: Automated termination analysis of polynomial probabilistic programs (2020)

    Google Scholar 

  41. de Moura, L.M., Bjørner, N.: Z3: an efficient SMT solver. In: Proc. of TACAS (2008). https://doi.org/10.1007/978-3-540-78800-3

  42. Ngo, V.C., Carbonneaux, Q., Hoffmann, J.: Bounded expectations: resource analysis for probabilistic programs. In: Proc. of PLDI (2018). https://doi.org/10.1145/3192366.3192394

  43. Takisaka, T., Oyabu, Y., Urabe, N., Hasuo, I.: Ranking and repulsing supermartingales for reachability in probabilistic programs. In: Proc. of ATVA (2018). https://doi.org/10.1007/978-3-030-01090-4_28

  44. Yamada, A., Kusakari, K., Sakabe, T.: Nagoya termination tool. In: Proc. of RTA-TLCA (2014). https://doi.org/10.1007/978-3-319-08918-8_32

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Marcel Moosbrugger .

Editor information

Editors and Affiliations

Rights and permissions

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.

Reprints and Permissions

Copyright information

© 2021 The Author(s)

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Moosbrugger, M., Bartocci, E., Katoen, JP., Kovács, L. (2021). Automated Termination Analysis of Polynomial Probabilistic Programs. In: Yoshida, N. (eds) Programming Languages and Systems. ESOP 2021. Lecture Notes in Computer Science(), vol 12648. Springer, Cham. https://doi.org/10.1007/978-3-030-72019-3_18

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-72019-3_18

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-72018-6

  • Online ISBN: 978-3-030-72019-3

  • eBook Packages: Computer ScienceComputer Science (R0)