Skip to main content

On Lexicographic Proof Rules for Probabilistic Termination

  • Conference paper
  • First Online:
Formal Methods (FM 2021)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 13047))

Included in the following conference series:

Abstract

We consider the almost-sure (a.s.) termination problem for probabilistic programs, which are a stochastic extension of classical imperative programs. Lexicographic ranking functions provide a sound and practical approach for termination of non-probabilistic programs, and their extension to probabilistic programs is achieved via lexicographic ranking supermartingales (LexRSMs). However, LexRSMs introduced in the previous work have a limitation that impedes their automation: all of their components have to be non-negative in all reachable states. This might result in LexRSM not existing even for simple terminating programs. Our contributions are twofold: First, we introduce a generalization of LexRSMs which allows for some components to be negative. This standard feature of non-probabilistic termination proofs was hitherto not known to be sound in the probabilistic setting, as the soundness proof requires a careful analysis of the underlying stochastic process. Second, we present polynomial-time algorithms using our generalized LexRSMs for proving a.s. termination in broad classes of linear-arithmetic programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 89.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 119.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Agrawal, S., Chatterjee, K., Novotný, P.: Lexicographic ranking supermartingales: an efficient approach to termination of probabilistic programs. PACMPL 2(POPL), 34:1–34:32 (2018)

    Google Scholar 

  2. Alias, C., Darte, A., Feautrier, P., Gonnord, L.: Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 117–133. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-15769-1_8

    Chapter  Google Scholar 

  3. Ash, R., Doléans-Dade, C.: Probability and Measure Theory. Harcourt/Academic Press, Boston (2000)

    Google Scholar 

  4. Avanzini, M., Dal Lago, U., Ghyselen, A.: Type-based complexity analysis of probabilistic functional programs. In: 2019 34th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), pp. 1–13 (2019). https://doi.org/10.1109/LICS.2019.8785725

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

    Article  MATH  Google Scholar 

  6. Avanzini, M., Moser, G., Schaper, M.: A modular cost analysis for probabilistic programs. In: Proceedings of the ACM on Programming Languages, vol. 4 ((Proceedings of OOPSLA 2020)), pp. 1–30 (2020)

    Google Scholar 

  7. Baier, C., Katoen, J.P.: Principles of Model Checking. The MIT Press, Cambridge (2008)

    MATH  Google Scholar 

  8. Barthe, G., Espitau, T., Ferrer Fioriti, L.M., Hsu, J.: Synthesizing probabilistic invariants via Doob’s decomposition. In: Chaudhuri, S., Farzan, A. (eds.) CAV 2016. LNCS, vol. 9779, pp. 43–61. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-41528-4_3

    Chapter  Google Scholar 

  9. Barthe, G., Gaboardi, M., Grégoire, B., Hsu, J., Strub, P.Y.: Proving differential privacy via probabilistic couplings. In: Proceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science, pp. 749–758, LICS 2016. ACM, New York, NY, USA (2016). https://doi.org/10.1145/2933575.2934554

  10. Barthe, G., Gaboardi, M., Hsu, J., Pierce, B.: Programming language techniques for differential privacy. ACM SIGLOG News 3(1), 34–53 (2016)

    Google Scholar 

  11. Ben-Amram, A.M., Genaim, S.: On the linear ranking problem for integer linear-constraint loops. In: Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 51–62, POPL 2013. ACM, New York, NY, USA (2013). https://doi.org/10.1145/2429069.2429078

  12. Ben-Amram, A.M., Genaim, S.: Complexity of Bradley-Manna-Sipma lexicographic ranking functions. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9207, pp. 304–321. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21668-3_18

    Chapter  Google Scholar 

  13. Billingsley, P.: Probability and Measure, 3rd edn. Wiley, New York (1995)

    Google Scholar 

  14. Bournez, O., Garnier, F.: Proving positive almost-sure termination. In: RTA, pp. 323–337 (2005)

    Google Scholar 

  15. Bradley, A.R., Manna, Z., Sipma, H.B.: Linear ranking with reachability. In: Computer Aided Verification, 17th International Conference, CAV 2005, Edinburgh, Scotland, UK, 6–10 July 2005, Proceedings, pp. 491–504 (2005). https://doi.org/10.1007/11513988_48

  16. Brockschmidt, M., Cook, B., Fuhs, C.: Better termination proving through cooperation. In: Computer Aided Verification - 25th International Conference, CAV 2013, Saint Petersburg, Russia, July 13–19, 2013, Proceedings, pp. 413–429 (2013). https://doi.org/10.1007/978-3-642-39799-8_28

  17. Brockschmidt, M., Cook, B., Ishtiaq, S., Khlaaf, H., Piterman, N.: T2: temporal property verification. In: Chechik, M., Raskin, J.-F. (eds.) TACAS 2016. LNCS, vol. 9636, pp. 387–393. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49674-9_22

    Chapter  Google Scholar 

  18. Chakarov, A., Sankaranarayanan, S.: Probabilistic program analysis with martingales. In: CAV 2013, pp. 511–526 (2013)

    Google Scholar 

  19. Chakarov, A., Voronin, Y.-L., Sankaranarayanan, S.: Deductive proofs of almost sure persistence and recurrence properties. In: Chechik, M., Raskin, J.-F. (eds.) TACAS 2016. LNCS, vol. 9636, pp. 260–279. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49674-9_15

    Chapter  MATH  Google Scholar 

  20. Chatterjee, K., Fu, H., Goharshady, A.K.: Termination analysis of probabilistic programs through Positivstellensatz’s. In: CAV, pp. 3–22 (2016)

    Google Scholar 

  21. 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. 40(2), 7:1–7:45 (2018). https://doi.org/10.1145/3174800

  22. Chatterjee, K., Goharshady, E.K., Novotný, P., Zárevúcky, J., Žikelić, D.: On lexicographic proof rules for probabilistic termination (2021). https://arxiv.org/abs/2108.02188

  23. Chatterjee, K., Novotný, P., Žikelić, D.: Stochastic invariants for probabilistic termination. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, pp. 145–160, POPL 2017. ACM, New York, NY, USA (2017). https://doi.org/10.1145/3009837.3009873

  24. Chen, J., He, F.: Proving almost-sure termination by omega-regular decomposition. In: Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, London, UK, June 15–20, 2020, pp. 869–882 (2020). https://doi.org/10.1145/3385412.3386002

  25. Claret, G., Rajamani, S.K., Nori, A.V., Gordon, A.D., Borgström, J.: Bayesian inference using data flow analysis. In: Joint Meeting on Foundations of Software Engineering, pp. 92–102. ACM (2013)

    Google Scholar 

  26. Colón, M., Sipma, H.: Synthesis of linear ranking functions. In: Tools and Algorithms for the Construction and Analysis of Systems, 7th International Conference, TACAS 2001 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2001 Genova, Italy, April 2–6, 2001, Proceedings, pp. 67–81 (2001). https://doi.org/10.1007/3-540-45319-9_6

  27. Cook, B., Podelski, A., Rybalchenko, A.: Termination proofs for systems code. SIGPLAN Not. 41(6), 415–426 (2006)

    Article  Google Scholar 

  28. Cook, B., Podelski, A., Rybalchenko, A.: Proving program termination. Commun. ACM 54(5), 88–98 (2011)

    Article  Google Scholar 

  29. Cook, B., See, A., Zuleger, F.: Ramsey vs. lexicographic termination proving. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013. LNCS, vol. 7795, pp. 47–61. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-36742-7_4

    Chapter  Google Scholar 

  30. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Conference Record of the Fourth ACM Symposium on Principles of Programming Languages, Los Angeles, California, USA, January 1977, pp. 238–252 (1977). https://doi.org/10.1145/512950.512973

  31. Dal Lago, U., Faggian, C., Rocca, S.R.D.: Intersection types and (positive) almost-sure termination. Proc. ACM Program. Lang. 5(POPL), 1–32 (2021). https://doi.org/10.1145/3434313

  32. Dubhashi, D., Panconesi, A.: Concentration of Measure for the Analysis of Randomized Algorithms, 1st edn. Cambridge University Press, New York (2009)

    Book  Google Scholar 

  33. Esparza, J., Gaiser, A., Kiefer, S.: Proving termination of probabilistic programs using patterns. In: CAV 2012, pp. 123–138 (2012)

    Google Scholar 

  34. Feldman, Y.A.: A decidable propositional dynamic logic with explicit probabilities. Inf. Control 63(1), 11–38 (1984)

    Google Scholar 

  35. Feldman, Y.A., Harel, D.: A probabilistic dynamic logic. In: Proceedings of the Fourteenth Annual ACM Symposium on Theory of Computing, pp. 181–195. ACM (1982)

    Google Scholar 

  36. Fioriti, L.M.F., Hermanns, H.: Probabilistic termination: soundness, completeness, and compositionality. In: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15–17, 2015, pp. 489–501 (2015). https://doi.org/10.1145/2676726.2677001

  37. Floyd, R.W.: Assigning meanings to programs. Math. Aspects Comput. Sci. 19, 19–33 (1967)

    Article  MathSciNet  Google Scholar 

  38. Foster, F.G.: On the stochastic matrices associated with certain queuing processes. Ann. Math. Stat. 24(3), 355–360 (1953)

    Article  MathSciNet  Google Scholar 

  39. Foster, N., Kozen, D., Mamouras, K., Reitblatt, M., Silva, A.: Probabilistic NetKAT. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 282–309. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49498-1_12

    Chapter  Google Scholar 

  40. Fu, H., Chatterjee, K.: Termination of nondeterministic probabilistic programs. In: Enea, C., Piskac, R. (eds.) VMCAI 2019. LNCS, vol. 11388, pp. 468–490. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-11245-5_22

    Chapter  Google Scholar 

  41. Ghahramani, Z.: Probabilistic machine learning and artificial intelligence. Nature 521(7553), 452–459 (2015)

    Article  Google Scholar 

  42. Giesl, J., Giesl, P., Hark, M.: Computing expected runtimes for constant probability programs. In: Fontaine, P. (ed.) Automated Deduction - CADE 27, pp. 269–286. Springer, Cham (2019)

    Chapter  Google Scholar 

  43. Gonnord, L., Monniaux, D., Radanne, G.: Synthesis of ranking functions using extremal counterexamples. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 608–618, PLDI 2015. ACM, New York, NY, USA (2015). https://doi.org/10.1145/2737924.2737976

  44. Gordon, A.D., Aizatulin, M., Borgstrom, J., Claret, G., Graepel, T., Nori, A.V., Rajamani, S.K., Russo, C.: A model-learner pattern for Bayesian reasoning. ACM SIGPLAN Not. 48(1), 403–416 (2013)

    Article  Google Scholar 

  45. Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: Proceedings of the on Future of Software Engineering, pp. 167–181. ACM (2014)

    Google Scholar 

  46. Gretz, F., Katoen, J.P., McIver, A.: Operational versus weakest pre-expectation semantics for the probabilistic guarded command language. Perform. Eval. 73, 110–132 (2014)

    Article  Google Scholar 

  47. 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). https://doi.org/10.1145/3371105

  48. Huang, M., Fu, H., Chatterjee, K.: New approaches for almost-sure termination of probabilistic programs. In: Ryu, S. (ed.) Programming Languages and Systems, pp. 181–201. Springer, Cham (2018)

    Chapter  Google Scholar 

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

  50. Kaelbling, L.P., Littman, M.L., Moore, A.W.: Reinforcement learning: a survey. JAIR 4, 237–285 (1996)

    Article  Google Scholar 

  51. Kaminski, B.L., Katoen, J.P., Matheja, C.: On the hardness of analyzing probabilistic programs. Acta Informatica 56(3), 1–31 (2018)

    Google Scholar 

  52. 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). https://doi.org/10.1145/3208102

  53. Kobayashi, N., Lago, U.D., Grellois, C.: On the termination problem for probabilistic higher-order recursive programs. Log. Methods Comput. Sci. 16(4), 2:1–2:57 (2020). https://lmcs.episciences.org/6817

  54. Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981). https://doi.org/10.1016/0022-0000(81)90036-2

    Article  MathSciNet  MATH  Google Scholar 

  55. Kozen, D.: A probabilistic PDL. In: Proceedings of the Fifteenth Annual ACM Symposium on Theory of Computing, pp. 291–297, STOC 1983. ACM, New York, NY, USA (1983). https://doi.org/10.1145/800061.808758

  56. Kwiatkowska, M., Norman, G., Parker, D.: PRISM 4.0: verification of probabilistic real-time systems. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 585–591. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22110-1_47

    Chapter  Google Scholar 

  57. Lago, U.D., Grellois, C.: Probabilistic termination by monadic affine sized typing. ACM Trans. Program. Lang. Syst. 41(2), 10:1–10:65 (2019). https://doi.org/10.1145/3293605

  58. McIver, A., Morgan, C.: Developing and reasoning about probabilistic programs in pGCL. In: PSSE, pp. 123–155 (2004)

    Google Scholar 

  59. McIver, A., Morgan, C.: Abstraction, Refinement and Proof for Probabilistic Systems. Monographs in Computer Science. Springer, New York (2005). https://doi.org/10.1007/b138392

  60. McIver, A., Morgan, C.: A new rule for almost-certain termination of probabilistic and demonic programs. CoRR abs/1612.01091 (2016). http://arxiv.org/abs/1612.01091

  61. 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). https://doi.org/10.1145/3158121

  62. Monniaux, D.: An abstract analysis of the probabilistic termination of programs. In: Cousot, P. (ed.) SAS 2001. LNCS, vol. 2126, pp. 111–126. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-47764-0_7

    Chapter  MATH  Google Scholar 

  63. Moosbrugger, M., Bartocci, E., Katoen, J.-P., Kovács, L.: Automated termination analysis of polynomial probabilistic programs. In: ESOP 2021. LNCS, vol. 12648, pp. 491–518. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-72019-3_18

    Chapter  Google Scholar 

  64. Morgan, C., McIver, A.: pGCL: formal reasoning for random algorithms (1999)

    Google Scholar 

  65. Morgan, C., McIver, A., Seidel, K.: Probabilistic predicate transformers. ACM Trans. Program. Lang. Syst. (TOPLAS) 18(3), 325–353 (1996)

    Article  Google Scholar 

  66. Motwani, R., Raghavan, P.: Randomized Algorithms. Cambridge University Press, New York (1995)

    Book  Google Scholar 

  67. Neuhäußer, M.R., Katoen, J.-P.: Bisimulation and logical preservation for continuous-time Markov decision processes. In: Caires, L., Vasconcelos, V.T. (eds.) CONCUR 2007. LNCS, vol. 4703, pp. 412–427. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74407-8_28

    Chapter  Google Scholar 

  68. Neuhäußer, M.R., Stoelinga, M., Katoen, J.-P.: Delayed nondeterminism in continuous-time Markov Decision Processes. In: de Alfaro, L. (ed.) FoSSaCS 2009. LNCS, vol. 5504, pp. 364–379. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00596-1_26

    Chapter  Google Scholar 

  69. Ngo, V.C., Carbonneaux, Q., Hoffmann, J.: Bounded expectations: resource analysis for probabilistic programs. In: PLDI 2018, pp. 496–512 (2018)

    Google Scholar 

  70. Olmedo, F., Kaminski, B.L., Katoen, J.P., Matheja, C.: Reasoning about recursive probabilistic programs. In: Proceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science, pp. 672–681, LICS 2016. ACM, New York, NY, USA (2016). https://doi.org/10.1145/2933575.2935317

  71. Podelski, A., Rybalchenko, A.: A complete method for the synthesis of linear ranking functions. In: 5th International Conference on Verification, Model Checking, and Abstract Interpretation, VMCAI 2004, Venice, January 11–13, 2004, Proceedings, pp. 239–251 (2004). https://doi.org/10.1007/978-3-540-24622-0_20

  72. Podelski, A., Rybalchenko, A.: Transition invariants. In: Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, pp. 32–41, LICS 2004. IEEE Computer Society, Washington, DC, USA (2004). https://doi.org/10.1109/LICS.2004.50

  73. Roy, D., Mansinghka, V., Goodman, N., Tenenbaum, J.: A stochastic programming perspective on nonparametric Bayes. In: Nonparametric Bayesian Workshop, International Conference on Machine Learning, vol. 22, p. 26 (2008)

    Google Scholar 

  74. Ścibior, A., Ghahramani, Z., Gordon, A.D.: Practical probabilistic programming with monads. ACM SIGPLAN Not. 50(12), 165–176 (2015)

    Article  Google Scholar 

  75. Smolka, S., Kumar, P., Foster, N., Kozen, D., Silva, A.: Cantor meets Scott: semantic foundations for probabilistic networks. In: POPL 2017, pp. 557–571 (2017)

    Google Scholar 

  76. Sohn, K., Gelder, A.V.: Termination detection in logic programs using argument sizes. In: Proceedings of the Tenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, May 29–31, 1991, Denver, Colorado, USA, pp. 216–226 (1991). https://doi.org/10.1145/113413.113433

  77. Thrun, S.: Probabilistic robotics. Commun. ACM 45(3), 52–57 (2002)

    Article  Google Scholar 

  78. Wang, D., Hoffmann, J., Reps, T.W.: PMAF: an algebraic framework for static analysis of probabilistic programs. In: PLDI 2018, pp. 513–528 (2018)

    Google Scholar 

  79. Wang, P., Fu, H., Goharshady, A.K., Chatterjee, K., Qin, X., Shi, W.: Cost analysis of nondeterministic probabilistic programs. In: PLDI 2019, pp. 204–220 (2019)

    Google Scholar 

  80. Williams, D.: Probability with Martingales. Cambridge Mathematical Textbooks, Cambridge University Press, Cambridge (1991)

    Book  Google Scholar 

Download references

Acknowledgements

This research was partially supported by the ERC CoG 863818 (ForM-SMArt), the Czech Science Foundation grant No. GJ19-15134Y, and the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie Grant Agreement No. 665385.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Đorđe Žikelić .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Chatterjee, K., Goharshady, E.K., Novotný, P., Zárevúcky, J., Žikelić, Đ. (2021). On Lexicographic Proof Rules for Probabilistic Termination. In: Huisman, M., Păsăreanu, C., Zhan, N. (eds) Formal Methods. FM 2021. Lecture Notes in Computer Science(), vol 13047. Springer, Cham. https://doi.org/10.1007/978-3-030-90870-6_33

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-90870-6_33

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-90869-0

  • Online ISBN: 978-3-030-90870-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics