Sound and Complete Proof Rules for Probabilistic Termination (2404.19724v2)
Abstract: Deciding termination is a fundamental problem in the analysis of probabilistic imperative programs. We consider the qualitative and quantitative probabilistic termination problems for an imperative programming model with discrete probabilistic choice and demonic bounded nondeterminism. The qualitative question asks if the program terminates almost-surely, no matter how nondeterminism is resolved. The quantitative question asks for a bound on the probability of termination. Despite a long and rich literature on the topic, no sound and relatively complete proof systems were known for these problems. In this paper, we provide such sound and relatively complete proof rules for proving qualitative and quantitative termination in the assertion language of arithmetic. Our rules use supermartingales as estimates of the likelihood of a program's evolution and variants as measures of distances to termination. Our key insight is our completeness result, which shows how to construct a suitable supermartingales from an almost-surely terminating program. We also show that proofs of termination in many existing proof systems can be transformed to proofs in our system, pointing to its applicability in practice. As an application of our proof rule, we show an explicit proof of almost-sure termination for the two-dimensional random walker.
- Krzysztof R. Apt. 1981. Ten Years of Hoare’s Logic: A Survey - Part 1. ACM Trans. Program. Lang. Syst. 3, 4 (1981), 431–483. https://doi.org/10.1145/357146.357150
- Krzysztof R. Apt and Dexter Kozen. 1986. Limits for Automatic Verification of Finite-State Concurrent Systems. Inf. Process. Lett. 22, 6 (1986), 307–309. https://doi.org/10.1016/0020-0190(86)90071-2
- Krzysztof R. Apt and Gordon D. Plotkin. 1986. Countable nondeterminism and random assignment. J. ACM 33, 4 (1986), 724–767. https://doi.org/10.1145/6490.6494
- On probabilistic term rewriting. Sci. Comput. Program. 185 (2020). https://doi.org/10.1016/j.scico.2019.102338
- Christel Baier and Joost-Pieter Katoen. 2008. Principles of model checking. MIT Press.
- Relatively complete verification of probabilistic programs: an expressive language for expectation-based reasoning. Proc. ACM Program. Lang. 5, POPL (2021), 1–30. https://doi.org/10.1145/3434320
- Andrea Bianco and Luca de Alfaro. 1995. Model Checking of Probabalistic and Nondeterministic Systems. In Foundations of Software Technology and Theoretical Computer Science, 15th Conference, Bangalore, India, December 18-20, 1995, Proceedings (Lecture Notes in Computer Science, Vol. 1026), P. S. Thiagarajan (Ed.). Springer, 499–513. https://doi.org/10.1007/3-540-60692-0_70
- Olivier Bournez and Florent Garnier. 2005. Proving Positive Almost-Sure Termination. In Term Rewriting and Applications, 16th International Conference, RTA 2005, Nara, Japan, April 19-21, 2005, Proceedings (Lecture Notes in Computer Science, Vol. 3467), Jürgen Giesl (Ed.). Springer, 323–337. https://doi.org/10.1007/978-3-540-32033-3_24
- Aleksandar Chakarov and Sriram Sankaranarayanan. 2013. Probabilistic Program Analysis with Martingales. In Computer Aided Verification - 25th International Conference, CAV 2013, Saint Petersburg, Russia, July 13-19, 2013. Proceedings (Lecture Notes in Computer Science, Vol. 8044), Natasha Sharygina and Helmut Veith (Eds.). Springer, 511–526. https://doi.org/10.1007/978-3-642-39799-8_34
- Sound and Complete Certificates for Quantitative Termination Analysis of Probabilistic Programs. In Computer Aided Verification - 34th International Conference, CAV 2022, Haifa, Israel, August 7-10, 2022, Proceedings, Part I (Lecture Notes in Computer Science, Vol. 13371), Sharon Shoham and Yakir Vizel (Eds.). Springer, 55–78. https://doi.org/10.1007/978-3-031-13185-1_4
- Stochastic invariants for probabilistic termination. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 145–160. https://doi.org/10.1145/3009837.3009873
- Stephen A. Cook. 1978. Soundness and Completeness of an Axiom System for Program Verification. SIAM J. Comput. 7, 1 (1978), 70–90. https://doi.org/10.1137/0207005
- Costas Courcoubetis and Mihalis Yannakakis. 1995. The Complexity of Probabilistic Verification. J. ACM 42, 4 (1995), 857–907. https://doi.org/10.1145/210332.210339
- Luca de Alfaro and Thomas A. Henzinger. 2000. Concurrent Omega-Regular Games. In 15th Annual IEEE Symposium on Logic in Computer Science, Santa Barbara, California, USA, June 26-29, 2000. IEEE Computer Society, 141–154. https://doi.org/10.1109/LICS.2000.855763
- Concurrent reachability games. Theor. Comput. Sci. 386, 3 (2007), 188–217. https://doi.org/10.1016/J.TCS.2007.07.008
- Jerry den Hartog and Erik P. de Vink. 2002. Verifying Probabilistic Programs Using a Hoare Like Logic. Int. J. Found. Comput. Sci. 13, 3 (2002), 315–340. https://doi.org/10.1142/S012905410200114X
- Edsger W. Dijkstra. 1976. A Discipline of Programming. Prentice-Hall. https://www.worldcat.org/oclc/01958445
- J. L. Doob. 1953. Stochastic processes. John Wiley & Sons, New York. viii+654 pages. MR 15,445b. Zbl 0053.26802..
- Lower Bounds for Possibly Divergent Probabilistic Programs. Proc. ACM Program. Lang. 7, OOPSLA1 (2023), 696–726. https://doi.org/10.1145/3586051
- Luis María Ferrer Fioriti and Holger Hermanns. 2015. 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, Sriram K. Rajamani and David Walker (Eds.). ACM, 489–501. https://doi.org/10.1145/2676726.2677001
- On Buffon Machines and Numbers. In Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, San Francisco, California, USA, January 23-25, 2011, Dana Randall (Ed.). SIAM, 172–183. https://doi.org/10.1137/1.9781611973082.15
- Robert W. Floyd. 1993. Assigning Meanings to Programs. Springer Netherlands, Dordrecht, 65–81. https://doi.org/10.1007/978-94-011-1793-7_4
- F.G. Foster. 1951. Markov chains with an enumerable number of states and a class of cascade processes. Math. Proc. Cambridge Philos. Soc. 47 (1951), 77–85.
- F.G. Foster. 1953. On the stochastic matrices associated with certain queuing processes. Ann. Math. Statistics 24 (1953), 355–360.
- Hongfei Fu and Krishnendu Chatterjee. 2019. Termination of Nondeterministic Probabilistic Programs. In Verification, Model Checking, and Abstract Interpretation - 20th International Conference, VMCAI 2019, Cascais, Portugal, January 13-15, 2019, Proceedings (Lecture Notes in Computer Science, Vol. 11388), Constantin Enea and Ruzica Piskac (Eds.). Springer, 468–490. https://doi.org/10.1007/978-3-030-11245-5_22
- David Harel. 1980. Proving the Correctness of Regular Deterministic Programs: A Unifying Survey Using Dynamic Logic. Theor. Comput. Sci. 12 (1980), 61–81. https://doi.org/10.1016/0304-3975(80)90005-5
- Dynamic Logic. MIT Press.
- Termination of Probabilistic Concurrent Program. ACM Trans. Program. Lang. Syst. 5, 3 (1983), 356–380. https://doi.org/10.1145/2166.357214
- Peter Hitchcock and David Michael Ritchie Park. 1972. Induction Rules and Termination Proofs. In Automata, Languages and Programming, Colloquium, Paris, France, July 3-7, 1972, Maurice Nivat (Ed.). North-Holland, Amsterdam, 225–251.
- New Approaches for Almost-Sure Termination of Probabilistic Programs. In Programming Languages and Systems - 16th Asian Symposium, APLAS 2018, Wellington, New Zealand, December 2-6, 2018, Proceedings (Lecture Notes in Computer Science, Vol. 11275), Sukyoung Ryu (Ed.). Springer, 181–201. https://doi.org/10.1007/978-3-030-02768-1_11
- On the hardness of analyzing probabilistic programs. Acta Informatica 56, 3 (2019), 255–285. https://doi.org/10.1007/s00236-018-0321-1
- Dexter Kozen. 2006. Theory of Computation. Springer. https://doi.org/10.1007/1-84628-477-5
- Rupak Majumdar and V. R. Sathiyanarayana. 2023. Positive Almost-Sure Termination - Complexity and Proof Rules. CoRR abs/2310.16145 (2023). https://doi.org/10.48550/ARXIV.2310.16145 arXiv:2310.16145
- Rupak Majumdar and V. R. Sathiyanarayana. 2024. Positive Almost-Sure Termination: Complexity and Proof Rules. Proc. ACM Program. Lang. 8, POPL (2024), 1089–1117. https://doi.org/10.1145/3632879
- Zohar Manna and Amir Pnueli. 1974. Axiomatic Approach to Total Correctness of Programs. Acta Informatica 3 (1974), 243–263. https://doi.org/10.1007/BF00288637
- Annabelle McIver and Carroll Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer. https://doi.org/10.1007/B138392
- A new proof rule for almost-sure termination. Proc. ACM Program. Lang. 2, POPL (2018), 33:1–33:28. https://doi.org/10.1145/3158121
- Non-homogeneous random walks: Lyapunov function methods for near critical stochastic systems. Cambridge University Press.
- Necessary and Sufficient Conditions for Recurrence and Transience of Markov Chains, in Terms of Inequalities. Journal of Applied Probability 15, 4 (1978), 848–851. http://www.jstor.org/stable/3213440
- George Pólya. 1921. Über eine aufgabe betreffend die irrfahrt im strassennetz. Math. Ann. 84 (1921), 149–160.
- Serguei Popov. 2021. Two-Dimensional Random Walk: From Path Counting to Random Interlacements. Cambridge University Press. https://doi.org/10.1017/9781108680134
- Julia Robinson. 1949. Definability and Decision Problems in Arithmetic. J. Symb. Log. 14, 2 (1949), 98–114. https://doi.org/10.2307/2266510
- Hartley Rogers Jr. 1987. Theory of recursive functions and effective computability (Reprint from 1967). MIT Press. https://mitpress.mit.edu/9780262680523/theory-of-recursive-functions-and-effective-computability/
- Ranking and Repulsing Supermartingales for Reachability in Randomized Programs. ACM Trans. Program. Lang. Syst. 43, 2 (2021), 5:1–5:46. https://doi.org/10.1145/3450967
- Alan M. Turing. 1937. On computable numbers, with an application to the Entscheidungsproblem. Proc. London Math. Soc. s2-42, 1 (1937), 230–265. https://doi.org/10.1112/PLMS/S2-42.1.230
- Moshe Y. Vardi. 1985. Automatic Verification of Probabilistic Concurrent Finite-State Programs. In 26th Annual Symposium on Foundations of Computer Science, Portland, Oregon, USA, 21-23 October 1985. IEEE Computer Society, 327–338. https://doi.org/10.1109/SFCS.1985.12