Abstract
We present a novel modular approach to infer upper bounds on the expected runtimes of probabilistic integer programs automatically. To this end, it computes bounds on the runtimes of program parts and on the sizes of their variables in an alternating way. To evaluate its power, we implemented our approach in a new version of our open-source tool KoAT.
Footnotes
funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - 235950644 (Project GI 274/6-2) & DFG Research Training Group 2236 UnRAVeL
Contributor Information
Jan Friso Groote, Email: j.f.groote@tue.nl.
Kim Guldstrand Larsen, Email: kgl@cs.aau.dk.
Fabian Meyer, Email: fabian.niklas.meyer@rwth-aachen.de.
Marcel Hark, Email: marcel.hark@cs.rwth-aachen.de.
Jürgen Giesl, Email: giesl@cs.rwth-aachen.de.
References
- 1.Agrawal, S., Chatterjee, K., Novotný, P.: Lexicographic ranking supermartingales: An efficient approach to termination of probabilistic programs. Proc. ACM Program. Lang. 2(POPL) (2017), 10.1145/3158122 [DOI]
- 2.Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. J. Autom. Reasoning 46(2), 161–203 (2011), 10.1007/s10817-010-9174-1 [DOI]
- 3.Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: Cost analysis of object-oriented bytecode programs. Theor. Comput. Sci. 413(1), 142–159 (2012), 10.1016/j.tcs.2011.07.009 [DOI]
- 4.Albert, E., Genaim, S., Masud, A.N.: On the inference of resource usage upper and lower bounds. ACM Trans. Comput. Log. 14(3) (2013), 10.1145/2499937.2499943 [DOI]
- 5.Albert, E., Bofill, M., Borralleras, C., Martin-Martin, E., Rubio, A.: Resource analysis driven by (conditional) termination proofs. Theory Pract. Log. Program. 19(5-6), 722–739 (2019), 10.1017/S1471068419000152 [DOI]
- 6.Alias, C., Darte, A., Feautrier, P., Gonnord, L.: Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In: Proc. SAS ’10. LNCS, vol. 6337, pp. 117–133 (2010), 10.1007/978-3-642-15769-1_8 [DOI]
- 7.Ash, R.B., Doléans-Dade, C.A.: Probability and Measure Theory. Harcourt Academic Press, 2nd edn. (2000)
- 8.Avanzini, M., Moser, G.: A combination framework for complexity. In: Proc. RTA 13. LIPIcs, vol. 21, pp. 55–70 (2013), 10.4230/LIPIcs.RTA.2013.55 [DOI]
- 9.Avanzini, M., Moser, G., Schaper, M.: TcT: Tyrolean Complexity Tool. In: Proc. TACAS ’16. LNCS, vol. 9636, pp. 407–423 (2016), 10.1007/978-3-662-49674-9_24 [DOI]
- 10.Avanzini, M., Moser, G., Schaper, M.: A modular cost analysis for probabilistic programs. Proc. ACM Program. Lang. 4(OOPSLA) (2020), 10.1145/3428240 [DOI]
- 11.Avanzini, M., Dal Lago, U., Yamada, A.: On probabilistic term rewriting. Sci. Comput. Program. 185 (2020), 10.1016/j.scico.2019.102338 [DOI]
- 12.Ben-Amram, A.M., Genaim, S.: Ranking functions for linear-constraint loops. J. ACM 61(4) (2014), 10.1145/2629488 [DOI]
- 13.Ben-Amram, A.M., Genaim, S.: On multiphase-linear ranking functions. In: Proc. CAV ’17. LNCS, vol. 10427, pp. 601–620 (2017), 10.1007/978-3-319-63390-9_32 [DOI]
- 14.Ben-Amram, A.M., Doménech, J.J., Genaim, S.: Multiphase-linear ranking functions and their relation to recurrent sets. In: Proc. SAS ’19. LNCS, vol. 11822, pp. 459–480 (2019), 10.1007/978-3-030-32304-2_22 [DOI]
- 15.Bournez, O., Garnier, F.: Proving positive almost-sure termination. In: Proc. RTA ’05. LNCS, vol. 3467, pp. 323–337 (2005), 10.1007/978-3-540-32033-3_24 [DOI]
- 16.Bournez, O., Garnier, F.: Proving positive almost sure termination under strategies. In: Proc. RTA ’06. LNCS, vol. 4098, pp. 357–371 (2006), 10.1007/11805618_27 [DOI]
- 17.Bradley, A.R., Manna, Z., Sipma, H.B.: Linear ranking with reachability. In: Proc. CAV ’05. LNCS, vol. 3576, pp. 491–504 (2005), 10.1007/11513988_48 [DOI]
- 18.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) (2016), 10.1145/2866575 [DOI]
- 19.Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. J. ACM 24(1), 44–67 (1977), 10.1145/321992.321996 [DOI]
- 20.Carbonneaux, Q., Hoffmann, J., Shao, Z.: Compositional certified resource bounds. In: Proc. PLDI ’15. pp. 467–478 (2015), 10.1145/2737924.2737955 [DOI]
- 21.Carbonneaux, Q., Hoffmann, J., Reps, T.W., Shao, Z.: Automated resource analysis with Coq proof objects. In: CAV ’17. LNCS, vol. 10427, pp. 64–85 (2017), 10.1007/978-3-319-63390-9_4 [DOI]
- 22.Chakarov, A., Sankaranarayanan, S.: Probabilistic program analysis with martingales. In: Proc. CAV ’13. LNCS, vol. 8044, pp. 511–526 (2013), 10.1007/978-3-642-39799-8_34 [DOI]
- 23.Chatterjee, K., Novotný, P., Zikelic, D.: Stochastic invariants for probabilistic termination. In: Proc. POPL ’17. pp. 145–160 (2017), 10.1145/3093333.3009873 [DOI]
- 24.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) (2018), 10.1145/3174800 [DOI]
- 25.Chatterjee, K., Fu, H., Novotný, P.: Termination analysis of probabilistic programs with martingales. In: Barthe, G., Katoen, J., Silva, A. (eds.) Foundations of Probabilistic Programming, pp. 221—258. Cambridge University Press (2020), 10.1017/9781108770750.008 [DOI]
- 26.Ferrer Fioriti, L.M., Hermanns, H.: Probabilistic termination: Soundness, completeness, and compositionality. In: Proc. POPL ’15. pp. 489–501 (2015), 10.1145/2676726.2677001 [DOI]
- 27.Flores-Montoya, A., Hähnle, R.: Resource analysis of complex programs with cost equations. In: Proc. APLAS ’14. LNCS, vol. 8858, pp. 275–295 (2014), 10.1007/978-3-319-12736-1_15 [DOI]
- 28.Flores-Montoya, A.: Upper and lower amortized cost bounds of programs expressed as cost relations. In: Proc. FM ’16. LNCS, vol. 9995, pp. 254–273 (2016), 10.1007/978-3-319-48989-6_16 [DOI]
- 29.Fu, H., Chatterjee, K.: Termination of nondeterministic probabilistic programs. In: Proc. VMCAI ’19. LNCS, vol. 11388, pp. 468–490 (2019), 10.1007/978-3-030-11245-5_22 [DOI]
- 30.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 58(1), 3–31 (2017), 10.1007/s10817-016-9388-y [DOI]
- 31.Giesl, J., Rubio, A., Sternagel, C., Waldmann, J., Yamada, A.: The termination and complexity competition. In: Proc. TACAS ’19. LNCS, vol. 11429, pp. 156–166 (2019), 10.1007/978-3-030-17502-3_10 [DOI]
- 32.Giesl, J., Giesl, P., Hark, M.: Computing expected runtimes for constant probability programs. In: Proc. CADE ’19. LNAI, vol. 11716, pp. 269–286 (2019), 10.1007/978-3-030-29436-6_16 [DOI]
- 33.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) (2020), 10.1145/3371105 [DOI]
- 34.Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst. 34(3) (2012), 10.1145/2362389.2362393 [DOI]
- 35.Hoffmann, J., Shao, Z.: Type-based amortized resource analysis with integers and arrays. J. Funct. Program. 25 (2015), 10.1017/S0956796815000192 [DOI]
- 36.Hoffmann, J., Das, A., Weng, S.C.: Towards automatic resource bound analysis for OCaml. In: Proc. POPL ’17. pp. 359–373 (2017), 10.1145/3009837.3009842 [DOI]
- 37.Huang, M., Fu, H., Chatterjee, K.: New approaches for almost-sure termination of probabilistic programs. In: Proc. APLAS ’18. LNCS, vol. 11275, pp. 181–201 (2018), 10.1007/978-3-030-02768-1_11 [DOI]
- 38.Huang, M., Fu, H., Chatterjee, K., Goharshady, A.K.: Modular verification for almost-sure termination of probabilistic programs. Proc. ACM Program. Lang. 3(OOPSLA) (2019), 10.1145/3360555 [DOI]
- 39.Jeannet, B., Miné, A.: Apron: A library of numerical abstract domains for static analysis. In: Proc. CAV ’09. pp. 661–667 (2009), 10.1007/978-3-642-02658-4_52 [DOI]
- 40.Kallenberg, O.: Foundations of Modern Probability. Springer, New York (2002), 10.1007/978-1-4757-4015-8 [DOI]
- 41.Kaminski, B.L., Katoen, J., Matheja, C., Olmedo, F.: Weakest precondition reasoning for expected runtimes of randomized algorithms. J. ACM 65 (2018), 10.1145/3208102 [DOI]
- 42.Kaminski, B.L., Katoen, J., Matheja, C.: Expected runtime analyis by program verification. In: Barthe, G., Katoen, J., Silva, A. (eds.) Foundations of Probabilistic Programming, pp. 185—220. Cambridge University Press (2020), 10.1017/9781108770750.007 [DOI]
- 43.KoAT: Web interface, binary, Docker image, and examples available at the web site https://aprove-developers.github.io/ExpectedUpperBounds/. The source code is available at https://github.com/aprove-developers/KoAT2-Releases/tree/probabilistic.
- 44.Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981), 10.1016/0022-0000(81)90036-2 [DOI]
- 45.McIver, A., Morgan, C.: Abstraction, Refinement and Proof for Probabilistic Systems. Springer (2005), 10.1007/b138392 [DOI]
- 46.McIver, A., Morgan, C., Kaminski, B.L., Katoen, J.: A new proof rule for almost-sure termination. Proc. ACM Program. Lang. 2(POPL) (2018), 10.1145/3158121 [DOI]
- 47.Meyer, F., Hark, M., Giesl, J.: Inferring expected runtimes of probabilistic integer programs using expected sizes. CoRR abs/2010.06367 (2020), https://arxiv.org/abs/2010.06367
- 48.Moosbrugger, M., Bartocci, E., Katoen, J., Kovács, L.: Automated termination analysis of polynomial probabilistic programs. In: Proc. ESOP ’21. LNCS (2021), to appear.
- 49.de Moura, L., Bjørner, N.: Z3: An efficient SMT solver. In: Proc. TACAS ’08. LNCS, vol. 4963, pp. 337–340 (2008), 10.1007/978-3-540-78800-3_24 [DOI]
- 50.Ngo, V.C., Carbonneaux, Q., Hoffmann, J.: Bounded expectations: Resource analysis for probabilistic programs. In: Proc. PLDI ’18. pp. 496–512 (2018), 10.1145/3192366.3192394, tool artifact and benchmarks available from https://channgo2203.github.io/zips/tool_benchmark.zip [DOI]
- 51.Noschinski, L., Emmes, F., Giesl, J.: Analyzing innermost runtime complexity of term rewriting by dependency pairs. J. Autom. Reasoning 51(1), 27–56 (2013), 10.1007/s10817-013-9277-6 [DOI]
- 52.Olmedo, F., Kaminski, B.L., Katoen, J., Matheja, C.: Reasoning about recursive probabilistic programs. In: Proc. LICS ’16. pp. 672–681 (2016), 10.1145/2933575.2935317 [DOI]
- 53.Podelski, A., Rybalchenko, A.: A complete method for the synthesis of linear ranking functions. In: Proc. VMCAI ’04. LNCS, vol. 2937, pp. 239–251 (2004), 10.1007/978-3-540-24622-0_20 [DOI]
- 54.Puterman, M.L.: Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons (2005)
- 55.RaML (Resource Aware ML), https://www.raml.co/interface/
- 56.Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Constraint-based linear-relations analysis. In: Proc. SAS ’04. LNCS, vol. 3148, pp. 53–68 (2004), 10.1007/978-3-540-27864-1_7 [DOI]
- 57.Sinn, M., Zuleger, F., Veith, H.: Complexity and resource bound analysis of imperative programs using difference constraints. J. Autom. Reasoning 59(1), 3–45 (2017), 10.1007/s10817-016-9402-4 [DOI] [PMC free article] [PubMed]
- 58.Srikanth, A., Sahin, B., Harris, W.R.: Complexity verification using guided theorem enumeration. In: Proc. POPL ’17. pp. 639–652 (2017), 10.1145/3009837.3009864 [DOI]
- 59.TPDB (Termination Problems Data Base), http://termination-portal.org/wiki/TPDB
- 60.Vardi, M.Y.: Automatic verification of probabilistic concurrent finite-state programs. In: Proc. FOCS ’85. pp. 327–338 (1985), 10.1109/SFCS.1985.12 [DOI]
- 61.Wang, D., Kahn, D.M., Hoffmann, J.: Raising expectations: automating expected cost analysis with types. Proc. ACM Program. Lang. 4(ICFP) (2020), 10.1145/3408992 [DOI]
- 62.Wang, P., Fu, H., Goharshady, A.K., Chatterjee, K., Qin, X., Shi, W.: Cost analysis of nondeterministic probabilistic programs. In: Proc. PLDI ’19. pp. 204–220 (2019), 10.1145/3314221.3314581 [DOI]
