Advertisement

On Multiphase-Linear Ranking Functions

  • Amir M. Ben-Amram
  • Samir GenaimEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10427)

Abstract

Multiphase ranking functions (\( M\varPhi \)RFs) were proposed as a means to prove the termination of a loop in which the computation progresses through a number of “phases”, and the progress of each phase is described by a different linear ranking function. Our work provides new insights regarding such functions for loops described by a conjunction of linear constraints (single-path loops). We provide a complete polynomial-time solution to the problem of existence and of synthesis of \( M\varPhi \)RF of bounded depth (number of phases), when variables range over rational or real numbers; a complete solution for the (harder) case that variables are integer, with a matching lower-bound proof, showing that the problem is coNP-complete; and a new theorem which bounds the number of iterations for loops with \( M\varPhi \)RFs. Surprisingly, the bound is linear, even when the variables involved change in non-linear way. We also consider a type of lexicographic ranking functions more expressive than types of lexicographic functions for which complete solutions have been given so far. We prove that for the above type of loops, lexicographic functions can be reduced to \( M\varPhi \)RFs, and thus the questions of complexity of detection, synthesis, and iteration bounds are also answered for this class.

References

  1. 1.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. J. Autom. Reason. 46(2), 161–203 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Alias, C., Darte, A., Feautrier, P., Gonnord, L.: Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 117–133. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-15769-1_8 CrossRefGoogle Scholar
  3. 3.
    Bagnara, R., Mesnard, F.: Eventual linear ranking functions. In: Proceedings of the 15th International Symposium on Principles and Practice of Declarative Programming, PPDP 2013, pp. 229–238. ACM Press (2013)Google Scholar
  4. 4.
    Ben-Amram, A.M., Genaim, S.: Ranking functions for linear-constraint loops. J. ACM 61(4), 26:1–26:55 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Bradley, A.R., Manna, Z., Sipma, H.B.: Linear ranking with reachability. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 491–504. Springer, Heidelberg (2005). doi: 10.1007/11513988_48 CrossRefGoogle Scholar
  6. 6.
    Bradley, A.R., Manna, Z., Sipma, H.B.: The polyranking principle. In: Caires, L., Italiano, G.F., Monteiro, L., Palamidessi, C., Yung, M. (eds.) ICALP 2005. LNCS, vol. 3580, pp. 1349–1361. Springer, Heidelberg (2005). doi: 10.1007/11523468_109 CrossRefGoogle Scholar
  7. 7.
    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 (2016)CrossRefGoogle Scholar
  8. 8.
    Chen, H.Y., Flur, S., Mukhopadhyay, S.: Termination proofs for linear simple loops. STTT 17(1), 47–57 (2015)CrossRefGoogle Scholar
  9. 9.
    Colóon, M.A., Sipma, H.B.: Synthesis of linear ranking functions. In: Margaria, T., Yi, W. (eds.) TACAS 2001. LNCS, vol. 2031, pp. 67–81. Springer, Heidelberg (2001). doi: 10.1007/3-540-45319-9_6 CrossRefGoogle Scholar
  10. 10.
    Cook, B., Gotsman, A., Podelski, A., Rybalchenko, A., Vardi, M.Y.: Proving that programs eventually do something good. In: Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2007, Nice, France, 17–19 January 2007, pp. 265–276 (2007)Google Scholar
  11. 11.
    Cook, B., Gulwani, S., Lev-Ami, T., Rybalchenko, A., Sagiv, M.: Proving conditional termination. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123, pp. 328–340. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-70545-1_32 CrossRefGoogle Scholar
  12. 12.
    Cook, B., Kroening, D., Rümmer, P., Wintersteiger, C.M.: Ranking function synthesis for bit-vector relations. Formal Methods Syst. Des. 43(1), 93–120 (2013)CrossRefzbMATHGoogle Scholar
  13. 13.
    Cook, B., Podelski, A., Rybalchenko, A.: Termination proofs for systems code. In: Schwartzbach, M.I., Ball, T., (eds.) Programming Language Design and Implementation, PLDI 2006, pp. 415–426. ACM (2006)Google Scholar
  14. 14.
    Feautrier, P.: Some efficient solutions to the affine scheduling problem I. One-dimensional time. Int. J. Parallel Prog. 21(5), 313–347 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Ganty, P., Genaim, S.: Proving termination starting from the end. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 397–412. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-39799-8_27 CrossRefGoogle Scholar
  16. 16.
    Harrison, M.: Lectures on Sequential Machines. Academic Press, Cambridge (1969)zbMATHGoogle Scholar
  17. 17.
    Larraz, D., Oliveras, A., Rodríguez-Carbonell, E., Rubio, A.: Proving termination of imperative programs using Max-SMT. In: Formal Methods in Computer-Aided Design, FMCAD 2013, pp. 218–225. IEEE (2013)Google Scholar
  18. 18.
    Leike, J., Heizmann, M.: Ranking templates for linear loops. Log. Methods Comput. Sci. 11(1), 1–27 (2015)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Leroux, J., Sutre, G.: Flat counter automata almost everywhere!. In: Peled, D.A., Tsay, Y.-K. (eds.) ATVA 2005. LNCS, vol. 3707, pp. 489–503. Springer, Heidelberg (2005). doi: 10.1007/11562948_36 CrossRefGoogle Scholar
  20. 20.
    Li, Y., Zhu, G., Feng, Y.: The L-depth eventual linear ranking functions for single-path linear constraint loops. In: 10th International Symposium on Theoretical Aspects of Software Engineering (TASE 2016), pp. 30–37. IEEE (2016)Google Scholar
  21. 21.
    Ouaknine, J., Worrell, J.: On linear recurrence sequences and loop termination. ACM SIGLOG News 2(2), 4–13 (2015)Google Scholar
  22. 22.
    Podelski, A., Rybalchenko, A.: A complete method for the synthesis of linear ranking functions. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 239–251. Springer, Heidelberg (2004). doi: 10.1007/978-3-540-24622-0_20 CrossRefGoogle Scholar
  23. 23.
    Schrijver, A.: Theory of Linear and Integer Programming. Wiley, New York (1986)zbMATHGoogle Scholar
  24. 24.
    Sohn, K., Van Gelder, A.: Termination detection in logic programs using argument sizes. In: Rosenkrantz, D.J. (ed.) Symposium on Principles of Database Systems, pp. 216–226. ACM Press (1991)Google Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.School of Computer ScienceThe Tel-Aviv Academic CollegeTel AvivIsrael
  2. 2.DSICComplutense University of Madrid (UCM)MadridSpain

Personalised recommendations