Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
162 tokens/sec
GPT-4o
7 tokens/sec
Gemini 2.5 Pro Pro
45 tokens/sec
o3 Pro
4 tokens/sec
GPT-4.1 Pro
38 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Almost-Sure Termination by Guarded Refinement (2404.08494v2)

Published 12 Apr 2024 in cs.LO and cs.PL

Abstract: Almost-sure termination is an important correctness property for probabilistic programs, and a number of program logics have been developed for establishing it. However, these logics have mostly been developed for first-order programs written in languages with specific syntactic patterns for looping. In this paper, we consider almost-sure termination for higher-order probabilistic programs with general references. This combination of features allows for recursion and looping to be encoded through a variety of patterns. Therefore, rather than developing proof rules for reasoning about particular recursion patterns, we instead propose an approach based on proving refinement between a higher-order program and a simpler probabilistic model, in such a way that the refinement preserves termination behavior. By proving a refinement, almost-sure termination behavior of the program can then be established by analyzing the simpler model. We present this approach in the form of Caliper, a higher-order separation logic for proving termination-preserving refinements. Caliper uses probabilistic couplings to carry out relational reasoning between a program and a model. To handle the range of recursion patterns found in higher-order programs, Caliper uses guarded recursion, in particular the principle of L\"ob induction. A technical novelty is that Caliper does not require the use of transfinite step indexing or other technical restrictions found in prior work on guarded recursion for termination-preservation refinement. We demonstrate the flexibility of this approach by proving almost-sure termination of several examples, including first-order loop constructs, a random list generator, treaps, and a sampler for Galton-Watson trees that uses higher-order store. All the results have been mechanized in the Coq proof assistant.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (68)
  1. Lexicographic ranking supermartingales: an efficient approach to termination of probabilistic programs. Proc. ACM Program. Lang. 2, POPL (2018), 34:1–34:32. https://doi.org/10.1145/3158122
  2. Relational Reasoning for Markov Chains in a Probabilistic Guarded Lambda Calculus. In Programming Languages and Systems - 27th European Symposium on Programming, ESOP 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14-20, 2018, Proceedings (Lecture Notes in Computer Science, Vol. 10801), Amal Ahmed (Ed.). Springer, 214–241. https://doi.org/10.1007/978-3-319-89884-1_8
  3. Alejandro Aguirre and Lars Birkedal. 2023. Step-Indexed Logical Relations for Countable Nondeterminism and Probabilistic Choice. Proc. ACM Program. Lang. 7, POPL (2023), 33–60. https://doi.org/10.1145/3571195
  4. A very modal model of a modern, major, general type system. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2007, Nice, France, January 17-19, 2007. 109–122. https://doi.org/10.1145/1190216.1190235
  5. Parameterized Verification by Probabilistic Abstraction. In Foundations of Software Science and Computational Structures, 6th International Conference, FOSSACS 2003 Held as Part of the Joint European Conference on Theory and Practice of Software, ETAPS 2003, Warsaw, Poland, April 7-11, 2003, Proceedings (Lecture Notes in Computer Science, Vol. 2620), Andrew D. Gordon (Ed.). Springer, 87–102. https://doi.org/10.1007/3-540-36576-1_6
  6. K.B. Athreya and P.E. Ney. 2012. Branching Processes. Springer Berlin Heidelberg.
  7. Robert Atkey. 2011. Amortised Resource Analysis with Separation Logic. Logical Methods in Computer Science Volume 7, Issue 2 (June 2011). https://doi.org/10.2168/LMCS-7(2:17)2011
  8. On continuation-passing transformations and expected cost analysis. Proc. ACM Program. Lang. 5, ICFP (2021), 1–30. https://doi.org/10.1145/3473592
  9. Formal certification of code-based cryptographic proofs. In Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL ’09. ACM Press, Savannah, GA, USA, 90. https://doi.org/10.1145/1480881.1480894
  10. Lars Birkedal and Aleš Bizjak. 2023. Lecture Notes on Iris: Higher-Order Concurrent Separation Logic. http://iris-project.org/tutorial-pdfs/iris-lecture-notes.pdf
  11. First steps in synthetic guarded domain theory: step-indexing in the topos of trees. Log. Methods Comput. Sci. 8, 4 (2012). https://doi.org/10.2168/LMCS-8(4:1)2012
  12. Ales Bizjak and Lars Birkedal. 2015. Step-Indexed Logical Relations for Probability. In Foundations of Software Science and Computation Structures - 18th International Conference, FoSSaCS 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings. 279–294. https://doi.org/10.1007/978-3-662-46678-0_18
  13. Coquelicot: A User-Friendly Library of Real Analysis for Coq. Math. Comput. Sci. 9, 1 (2015), 41–62.
  14. 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
  15. Analyzing probabilistic pushdown automata. Formal Methods Syst. Des. 43, 2 (2013), 124–163. https://doi.org/10.1007/S10703-012-0166-0
  16. 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. 511–526. https://doi.org/10.1007/978-3-642-39799-8_34
  17. Arthur Charguéraud and François Pottier. 2019. Verifying the Correctness and Amortized Complexity of a Union-Find Implementation in Separation Logic with Time Credits. Journal of Automated Reasoning 62, 3 (March 2019), 331–365. https://doi.org/10.1007/s10817-017-9431-7
  18. D.L. Cohn. 2013. Measure Theory: Second Edition. Springer New York.
  19. Coq Development Team. 2023. The Coq Proof Assistant. https://doi.org/10.5281/zenodo.8161141
  20. Luc Devroye. 2012. Simulating Size-constrained Galton-Watson Trees. SIAM J. Comput. 41, 1 (2012), 1–11. https://doi.org/10.1137/090766632
  21. Logical Step-Indexed Logical Relations. Log. Methods Comput. Sci. 7, 2 (2011). https://doi.org/10.2168/LMCS-7(2:16)2011
  22. Verified Analysis of Random Binary Tree Structures. J. Autom. Reason. 64, 5 (2020), 879–910. https://doi.org/10.1007/S10817-020-09545-0
  23. Jeff Erickson. 2017. Treaps and Skip Lists. https://jeffe.cs.illinois.edu/teaching/algorithms/notes/03-treaps.pdf
  24. Proving Termination of Probabilistic Programs Using Patterns. In Computer Aided Verification - 24th International Conference, CAV 2012, Berkeley, CA, USA, July 7-13, 2012 Proceedings (Lecture Notes in Computer Science, Vol. 7358), P. Madhusudan and Sanjit A. Seshia (Eds.). Springer, 123–138. https://doi.org/10.1007/978-3-642-31424-7_14
  25. Kousha Etessami and Mihalis Yannakakis. 2009. Recursive Markov chains, stochastic grammars, and monotone systems of nonlinear equations. J. ACM 56, 1 (2009), 1:1–1:66. https://doi.org/10.1145/1462153.1462154
  26. Lower Bounds for Possibly Divergent Probabilistic Programs. Proc. ACM Program. Lang. 7, OOPSLA1 (2023), 696–726. https://doi.org/10.1145/3586051
  27. 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
  28. Compositional Non-Interference for Fine-Grained Concurrent Programs. In 42nd IEEE Symposium on Security and Privacy, SP 2021, San Francisco, CA, USA, 24-27 May 2021. IEEE, 1416–1433. https://doi.org/10.1109/SP40001.2021.00003
  29. ReLoC Reloaded: A Mechanized Relational Logic for Fine-Grained Concurrency and Logical Atomicity. Log. Methods Comput. Sci. 17, 3 (2021). https://doi.org/10.46298/lmcs-17(3:9)2021
  30. 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. 468–490. https://doi.org/10.1007/978-3-030-11245-5_22
  31. Asynchronous Probabilistic Couplings in Higher-Order Separation Logic. Proc. ACM Program. Lang. 8, POPL (2024), 753–784. https://doi.org/10.1145/3632868
  32. Mechanized logical relations for termination-insensitive noninterference. Proc. ACM Program. Lang. 5, POPL (2021), 1–29. https://doi.org/10.1145/3434291
  33. Termination of Probabilistic Concurrent Program. ACM Trans. Program. Lang. Syst. 5, 3 (1983), 356–380. https://doi.org/10.1145/2166.357214
  34. Joe Hurd. 2002. A Formal Approach to Probabilistic Termination. In Theorem Proving in Higher Order Logics, 15th International Conference, TPHOLs 2002, Hampton, VA, USA, August 20-23, 2002, Proceedings (Lecture Notes in Computer Science, Vol. 2410), Victor Carreño, César A. Muñoz, and Sofiène Tahar (Eds.). Springer, 230–245. https://doi.org/10.1007/3-540-45685-6_16
  35. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. J. Funct. Program. 28 (2018), e20. https://doi.org/10.1017/S0956796818000151
  36. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015. 637–650. https://doi.org/10.1145/2676726.2676980
  37. On the hardness of analyzing probabilistic programs. Acta Informatica 56, 3 (2019), 255–285. https://doi.org/10.1007/S00236-018-0321-1
  38. Weakest Precondition Reasoning for Expected Run-Times of Probabilistic Programs. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings. 364–389. https://doi.org/10.1007/978-3-662-49498-1_15
  39. On the Termination Problem for Probabilistic Higher-Order Recursive Programs. In 34th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2019, Vancouver, BC, Canada, June 24-27, 2019. 1–14. https://doi.org/10.1109/LICS.2019.8785679
  40. On the Termination Problem for Probabilistic Higher-Order Recursive Programs. Log. Methods Comput. Sci. 16, 4 (2020). https://lmcs.episciences.org/6817
  41. PRISM 4.0: Verification of Probabilistic Real-Time Systems. In Computer Aided Verification - 23rd International Conference, CAV 2011, Snowbird, UT, USA, July 14-20, 2011. Proceedings. 585–591. https://doi.org/10.1007/978-3-642-22110-1_47
  42. Intersection types and (positive) almost-sure termination. Proc. ACM Program. Lang. 5, POPL (2021), 1–32. https://doi.org/10.1145/3434313
  43. Ugo Dal Lago and Charles Grellois. 2017. Probabilistic Termination by Monadic Affine Sized Typing. In Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings (Lecture Notes in Computer Science, Vol. 10201), Hongseok Yang (Ed.). Springer, 393–419. https://doi.org/10.1007/978-3-662-54434-1_15
  44. P. J. Landin. 1964. The Mechanical Evaluation of Expressions. Comput. J. 6, 4 (1964), 308–320. https://doi.org/10.1093/COMJNL/6.4.308
  45. T. Lindvall. 2002. Lectures on the Coupling Method. Dover Publications, Incorporated.
  46. 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
  47. 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
  48. Time Credits and Time Receipts in Iris. In Programming Languages and Systems (Lecture Notes in Computer Science), Luís Caires (Ed.). Springer International Publishing, Cham, 3–29. https://doi.org/10.1007/978-3-030-17184-1_1
  49. Carroll Morgan and Annabelle McIver. 1999. pGCL: formal reasoning for random algorithms. South African Computer Journal 22 (1999), 14–27.
  50. Hiroshi Nakano. 2000. A Modality for Recursion. In 15th Annual IEEE Symposium on Logic in Computer Science, Santa Barbara, California, USA, June 26-29, 2000. 255–266. https://doi.org/10.1109/LICS.2000.855774
  51. Bounded expectations: resource analysis for probabilistic programs. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2018, Philadelphia, PA, USA, June 18-22, 2018, Jeffrey S. Foster and Dan Grossman (Eds.). ACM, 496–512. https://doi.org/10.1145/3192366.3192394
  52. Thunks and Debits in Separation Logic with Time Credits. Proceedings of the ACM on Programming Languages 8, POPL (Jan. 2024), 50:1482–50:1508. https://doi.org/10.1145/3632892
  53. John C. Reynolds. 2002. Separation Logic: A Logic for Shared Mutable Data Structures. In 17th IEEE Symposium on Logic in Computer Science (LICS 2002), 22-25 July 2002, Copenhagen, Denmark, Proceedings. IEEE Computer Society, 55–74. https://doi.org/10.1109/LICS.2002.1029817
  54. Raimund Seidel and Cecilia R. Aragon. 1996. Randomized Search Trees. Algorithmica 16, 4/5 (1996), 464–497. https://doi.org/10.1007/BF01940876
  55. Transfinite Iris: resolving an existential dilemma of step-indexed separation logic. In PLDI ’21: 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, Virtual Event, Canada, June 20-25, 2021. 80–95. https://doi.org/10.1145/3453483.3454031
  56. Transfinite step-indexing for termination. Proc. ACM Program. Lang. 5, POPL (2021), 1–29. https://doi.org/10.1145/3434294
  57. F. Spitzer. 2013. Principles of Random Walk. Springer New York.
  58. Transfinite Step-Indexing: Decoupling Concrete and Logical Steps. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings (Lecture Notes in Computer Science, Vol. 9632), Peter Thiemann (Ed.). Springer, 727–751. https://doi.org/10.1007/978-3-662-49498-1_28
  59. Alfred Tarski. 1955. A lattice-theoretical fixpoint theorem and its applications. Pacific J. Math. 5, 2 (June 1955), 285–309. https://doi.org/10.2140/pjm.1955.5.285
  60. Joseph Tassarotti and Robert Harper. 2019. A separation logic for concurrent randomized programs. Proc. ACM Program. Lang. 3, POPL (2019), 64:1–64:30. https://doi.org/10.1145/3290377
  61. A Higher-Order Logic for Concurrent Termination-Preserving Refinement. In Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings (Lecture Notes in Computer Science, Vol. 10201), Hongseok Yang (Ed.). Springer, 909–936. https://doi.org/10.1007/978-3-662-54434-1_34
  62. Hermann Thorisson. 2000. Coupling, stationarity, and regeneration. Springer-Verlag, New York. xiv+517 pages.
  63. Trillium: Higher-Order Concurrent and Distributed Separation Logic for Intensional Refinement. Proc. ACM Program. Lang. 8, POPL (2024), 241–272. https://doi.org/10.1145/3632851
  64. A Logical Approach to Type Soundness. (2024). https://iris-project.org/pdfs/2024-submitted-logical-type-soundness.pdf Unpublished manuscript.
  65. Unifying refinement and hoare-style reasoning in a logic for higher-order concurrency. In ACM SIGPLAN International Conference on Functional Programming, ICFP’13, Boston, MA, USA - September 25 - 27, 2013. 377–390. https://doi.org/10.1145/2500365.2500600
  66. C. Villani. 2008. Optimal Transport: Old and New. Springer Berlin Heidelberg.
  67. Contextual equivalence for a probabilistic language with continuous random variables and recursion. Proc. ACM Program. Lang. 2, ICFP (2018), 87:1–87:30. https://doi.org/10.1145/3236782
  68. Raising expectations: automating expected cost analysis with types. Proc. ACM Program. Lang. 4, ICFP (2020), 110:1–110:31. https://doi.org/10.1145/3408992
Citations (2)

Summary

We haven't generated a summary for this paper yet.

X Twitter Logo Streamline Icon: https://streamlinehq.com