Advertisement

Computing Expected Runtimes for Constant Probability Programs

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11716)

Abstract

We introduce the class of constant probability (CP) programs and show that classical results from probability theory directly yield a simple decision procedure for (positive) almost sure termination of programs in this class. Moreover, asymptotically tight bounds on their expected runtime can always be computed easily. Based on this, we present an algorithm to infer the exact expected runtime of any CP program.

Keywords

Probabilistic programs Expected runtimes (Positive) almost sure termination Complexity Decidability 

Notes

Acknowledgments

We would like to thank Nicos Georgiou and Vladislav Vysotskiy for drawing our attention to Wald’s Lemma and to the work of Frank Spitzer on random walks, and Benjamin Lucien Kaminski and Christoph Matheja for many helpful discussions. Furthermore, we thank Tom Küspert who helped with the implementation of our technique in our tool KoAT.

References

  1. 1.
    Agrawal, S., Chatterjee, K., Novotný, P.: Lexicographic ranking supermartingales: an efficient approach to termination of probabilistic programs. Proc. ACM Program. Lang. (POPL) 2, 34:1–34:32 (2018).  https://doi.org/10.1145/3158122CrossRefGoogle Scholar
  2. 2.
    Ash, R.B., Doleans-Dade, C.A.: Probability and Measure Theory. Elsevier/Academic Press (2000)Google Scholar
  3. 3.
    Bazzi, L., Mitter, S.: The solution of linear probabilistic recurrence relations. Algorithmica 36(1), 41–57 (2003).  https://doi.org/10.1007/s00453-002-1003-4MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Bournez, O., Garnier, F.: Proving positive almost-sure termination. In: Giesl, J. (ed.) RTA 2005. LNCS, vol. 3467, pp. 323–337. Springer, Heidelberg (2005).  https://doi.org/10.1007/978-3-540-32033-3_24CrossRefGoogle Scholar
  5. 5.
    Braverman, M.: Termination of integer linear programs. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 372–385. Springer, Heidelberg (2006).  https://doi.org/10.1007/11817963_34CrossRefGoogle Scholar
  6. 6.
    Brázdil, T., Brozek, V., Etessami, K.: One-counter stochastic games. In: Lodaya, K., Mahajan, M. (eds.) FSTTCS 2010, LIPIcs, vol. 8, pp. 108–119 (2010).  https://doi.org/10.4230/LIPIcs.FSTTCS.2010.108
  7. 7.
    Brázdil, T., Kučera, A., Novotný, P., Wojtczak, D.: Minimizing expected termination time in one-counter Markov decision processes. In: Czumaj, A., Mehlhorn, K., Pitts, A., Wattenhofer, R. (eds.) ICALP 2012. LNCS, vol. 7392, pp. 141–152. Springer, Heidelberg (2012).  https://doi.org/10.1007/978-3-642-31585-5_16CrossRefGoogle Scholar
  8. 8.
    Brázdil, T., Esparza, J., Kiefer, S., Kucera, A.: Analyzing probabilistic pushdown automata. Formal Methods Syst. Des. 43(2), 124–163 (2013).  https://doi.org/10.1007/s10703-012-0166-0CrossRefzbMATHGoogle Scholar
  9. 9.
    Brockschmidt, M., Emmes, F., Falke, S., Fuhs, C., Giesl, J.: Analyzing runtime and size complexity of integer programs. ACM Trans. Program. Lang. Syst. 38(4), 13:1–13:50 (2016).  https://doi.org/10.1145/2866575CrossRefGoogle Scholar
  10. 10.
    Chakarov, A., Sankaranarayanan, S.: Probabilistic program analysis with martingales. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 511–526. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-39799-8_34CrossRefGoogle Scholar
  11. 11.
    Chatterjee, K., Fu, H., Murhekar, A.: Automated recurrence analysis for almost-linear expected-runtime bounds. In: Majumdar, R., Kunčak, V. (eds.) CAV 2017. LNCS, vol. 10426, pp. 118–139. Springer, Cham (2017).  https://doi.org/10.1007/978-3-319-63387-9_6CrossRefGoogle Scholar
  12. 12.
    Chatterjee, K., Novotný, P., Zikelic, D.: Stochastic invariants for probabilistic termination. In: Castagna, G., Gordon, A.D. (eds.) POPL 2017, pp. 145–160 (2017).  https://doi.org/10.1145/3093333.3009873CrossRefGoogle Scholar
  13. 13.
    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/3174800CrossRefzbMATHGoogle Scholar
  14. 14.
    Elaydi, S.: An Introduction to Difference Equations. Springer, New York (2005).  https://doi.org/10.1007/0-387-27602-5CrossRefzbMATHGoogle Scholar
  15. 15.
    Esparza, J., Kucera, A., Mayr, R.: Quantitative analysis of probabilistic pushdown automata: expectations and variances. In: Panangaden, P. (ed.) LICS 2005, pp. 117–126 (2005).  https://doi.org/10.1109/LICS.2005.39
  16. 16.
    Feller, W.: An Introduction to Probability Theory and Its Applications, Probability and Mathematical Statistics, vol. 1. Wiley, Hoboken (1950)zbMATHGoogle Scholar
  17. 17.
    Fioriti, L.M.F., Hermanns, H.: Probabilistic termination: soundness, completeness, and compositionality. In: Rajamani, S.K., Walker, D. (eds.) POPL 2015, pp. 489–501 (2015).  https://doi.org/10.1145/2676726.2677001
  18. 18.
    Frohn, F., Giesl, J.: Termination of triangular integer loops is decidable. In: Dillig, I., Tasiran, S. (eds.) CAV 2019. LNCS, vol. 11562, pp. 426–444. Springer, Cham (2019).  https://doi.org/10.1007/978-3-030-25543-5_24 CrossRefGoogle Scholar
  19. 19.
    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_22CrossRefGoogle Scholar
  20. 20.
    Giesl, J., Giesl, P., Hark, M.: Computing expected runtimes for constant probability programs. CoRR abs/1905.09544 (2019). https://arxiv.org/abs/1905.09544
  21. 21.
    Grimmett, G., Stirzaker, D.: Probability and Random Processes. Oxford University Press, Oxford (2001)zbMATHGoogle Scholar
  22. 22.
    Johansson, F., et al.: MpMath: a Python library for arbitrary-precision floating-point arithmetic. http://mpmath.org/
  23. 23.
    Kaminski, B.L., Katoen, J.: On the hardness of almost-sure termination. In: Italiano, G.F., Pighizzini, G., Sannella, D. (eds.) MFCS 2015. LNCS, vol. 9234, pp. 307–318. Springer, Heidelberg (2015).  https://doi.org/10.1007/978-3-662-48057-1_24CrossRefGoogle Scholar
  24. 24.
    Kaminski, B.L., Katoen, J.-P., Matheja, C., Olmedo, F.: Weakest precondition reasoning for expected run–times of probabilistic programs. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 364–389. Springer, Heidelberg (2016).  https://doi.org/10.1007/978-3-662-49498-1_15CrossRefGoogle Scholar
  25. 25.
    Karp, R.M.: Probabilistic recurrence relations. J. ACM 41(6), 1136–1150 (1994).  https://doi.org/10.1145/195613.195632MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Kozen, D.: Semantics of probabilistic programs. In: Kosaraju, S.R. (ed.) FOCS 1979, pp. 101–114 (1979).  https://doi.org/10.1109/SFCS.1979.38
  27. 27.
    McIver, A., Morgan, C.: Abstraction, Refinement and Proof for Probabilistic Systems. Springer, New York (2005).  https://doi.org/10.1007/b138392CrossRefzbMATHGoogle Scholar
  28. 28.
    McIver, A., Morgan, C., Kaminski, B.L., Katoen, J.: A new proof rule for almost-sure termination. Proc. ACM Program. Lang. (POPL) 2, 33:1–33:28 (2018).  https://doi.org/10.1145/3158121CrossRefGoogle Scholar
  29. 29.
    Meurer, A., et al.: SymPy: symbolic computing in Python. Peer J Comput. Sci. 3, e103 (2017).  https://doi.org/10.7717/peerj-cs.103CrossRefGoogle Scholar
  30. 30.
    Ngo, V.C., Carbonneaux, Q., Hoffmann, J.: Bounded expectations: resource analysis for probabilistic programs. In: Foster, J.S., Grossman, D. (eds.) PLDI 2018, pp. 496–512 (2018).  https://doi.org/10.1145/3192366.3192394. Extended Version available at https://arxiv.org/abs/1711.08847
  31. 31.
    Ouaknine, J., Pinto, J.S., Worrell, J.: On termination of integer linear loops. In: Indyk, P. (ed.) SODA 2015, pp. 957–969 (2015).  https://doi.org/10.1137/1.9781611973730.65
  32. 32.
    Puterman, M.L.: Markov Decision Processes: Discrete Stochastic Dynamic Programming. Wiley, New York (1994)CrossRefGoogle Scholar
  33. 33.
    Spitzer, F.: Principles of Random Walk. Springer, New York (1964).  https://doi.org/10.1007/978-1-4757-4229-9CrossRefzbMATHGoogle Scholar
  34. 34.
    Tassarotti, J., Harper, R.: Verified tail bounds for randomized programs. In: Avigad, J., Mahboubi, A. (eds.) ITP 2018. LNCS, vol. 10895, pp. 560–578. Springer, Cham (2018).  https://doi.org/10.1007/978-3-319-94821-8_33CrossRefGoogle Scholar
  35. 35.
    Tiwari, A.: Termination of linear programs. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 70–82. Springer, Heidelberg (2004).  https://doi.org/10.1007/978-3-540-27813-9_6CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.LuFG Informatik 2RWTH Aachen UniversityAachenGermany
  2. 2.Department of MathematicsUniversity of SussexBrightonUK

Personalised recommendations