Abstract
Affine size-change analysis has been used for termination analysis of eager functional programming languages. The same style of analysis is also capable of compactly recording and calculating other properties of programs, including their runtime, maximum stack depth, and (relative) path time costs. In this paper we show how precise (not just big- \(\mathcal{O}\)) polynomial bounds on such costs may be calculated on programs, by a characterization as a problem in quantifier elimination. The technique is decidable, and complete for a class of size-change terminating programs with limited-degree polynomial costs. An extension to the technique allows the calculation of some classes of exponential-cost programs. We demonstrate the new technique by recording the calculation in numbers-of-function (or procedure) calls for a simple functional definition language, but it can also be applied to imperative languages. The technique is automated within the reduce computer algebra system.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Aehlig, K., Schwichtenberg, H.: A Syntactical Analysis of Non-Size-Increasing Polynomial Time Computation. ACM Trans. Comput. Logic 3(3), 383–401 (2002)
Anderson, H., Khoo, S.C.: Affine-based Size-change Termination. In: Ohori, A. (ed.) APLAS 2003. LNCS, vol. 2895, pp. 122–140. Springer, Heidelberg (2003)
Ball, T., Larus, J.R.: Branch Prediction For Free. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 300–313 (1993)
Bellantoni, S., Cook, S.: A New Recursion-Theoretic Characterization of the Polytime Functions (Extended Abstract). In: STOC 1992: Proceedings of the twenty-fourth annual ACM symposium on Theory of computing, pp. 283–293. ACM Press, New York (1992)
Caseiro, V.H.: Equations for Defining Poly-Time Functions. PhD thesis, University of Oslo (1997)
Caviness, B.F., Johnson, J.R. (eds.): Quantifier Elimination and Cylindrical Algebraic Decomposition. Springer, Heidelberg (1998)
Collins, G.E.: Quantifier Elimination for Real Closed Fields by Cylindrical Algebraic Decomposition. In: Brakhage, H. (ed.) Automata Theory and Formal Languages, Berlin, vol. 33, pp. 134–183 (1975)
Dolzmann, A., Sturm, T.: REDLOG: Computer algebra meets computer logic. SIGSAM Bulletin (ACM Special Interest Group on Symbolic and Algebraic Manipulation) 31(2), 2–9 (1997)
Hong, H., et al., http://www.cs.usna.edu/~qepcad/B/QEPCAD.html
Gómez, G., Liu, Y.A.: Automatic Time-Bound Analysis for a Higher-Order Language. In: PEPM 2002: Proceedings of the 2002 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation, pp. 75–86. ACM Press, New York (2002)
Grobauer, B.: Cost Recurrences for DML Programs. In: International Conference on Functional Programming, pp. 253–264 (2001)
Hofmann, M.: Linear Types and Non-Size-Increasing Polynomial Time Computation. In: Logic in Computer Science, pp. 464–473 (1999)
Hong, H.: RISC-CLP(Real): Constraint Logic Programming over Real Numbers. In: Benhamou, F., Colmerauer, A. (eds.) Constraint Logic Programming: Selected Research. MIT Press, Cambridge (1993)
Jones, N.: Private communication (June 2003)
Kapur, D.: Automatically Generating Loop Invariants Using Quantifier Elimination. In: Proceedings of the 10th International Conference on Applications of Computer Algebra. ACA and Lamar University (July 2004)
Kaser, O., Ramakrishnan, C.R., Pawagi, S.: On the Conversion of Indirect to Direct Recursion. LOPLAS 2(1-4), 151–164 (1993)
Khoo, S.C., Anderson, H.: Bounded Size-Change Termination. Technical Report TRB6/05, National University of Singapore (June 2005)
Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The Size-Change Principle for Program Termination. In: Conference Record of the 28th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, January 2001, vol. 28, pp. 81–92. ACM Press, New York (2001)
Rosendahl, M.: Automatic Complexity Analysis. In: FPCA 1989: Proceedings of the fourth international conference on Functional programming languages and computer architecture, pp. 144–156. ACM Press, New York (1989)
Van Roy, P., Haridi, S.: Concepts, Techniques, and Models of Computer Programming. MIT Press, Cambridge (2004)
Sands, D.: Complexity Analysis for a Lazy Higher-Order Language. In: Jones, N.D. (ed.) ESOP 1990. LNCS, vol. 432, pp. 361–376. Springer, Heidelberg (1990)
Sankaranarayanan, S., Sipma, H., Manna, Z.: Non-linear loop invariant generation using Gröbner bases. In: Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2004, Venice, Italy, January 14-16, pp. 318–329 (2004)
Tarski, A.: A decision method for elementary algebra and geometry. Prepared for publication by J.C.C. Mac Kinsey, Berkeley (1951)
Yu, T., Kaser, O.: A Note on “On the Conversion of Indirect to Direct Recursion”. ACM Trans. Program. Lang. Syst. 19(6), 1085–1087 (1997)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Anderson, H., Khoo, SC., Andrei, S., Luca, B. (2005). Calculating Polynomial Runtime Properties. In: Yi, K. (eds) Programming Languages and Systems. APLAS 2005. Lecture Notes in Computer Science, vol 3780. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11575467_16
Download citation
DOI: https://doi.org/10.1007/11575467_16
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-29735-2
Online ISBN: 978-3-540-32247-4
eBook Packages: Computer ScienceComputer Science (R0)