Complexity of Bradley-Manna-Sipma Lexicographic Ranking Functions

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


In this paper we turn the spotlight on a class of lexicographic ranking functions introduced by Bradley, Manna and Sipma in a seminal CAV 2005 paper, and establish for the first time the complexity of some problems involving the inference of such functions for linear-constraint loops (without precondition). We show that finding such a function, if one exists, can be done in polynomial time in a way which is sound and complete when the variables range over the rationals (or reals). We show that when variables range over the integers, the problem is harder—deciding the existence of a ranking function is coNP-complete. Next, we study the problem of minimizing the number of components in the ranking function (a.k.a. the dimension). This number is interesting in contexts like computing iteration bounds and loop parallelization. Surprisingly, and unlike the situation for some other classes of lexicographic ranking functions, we find that even deciding whether a two-component ranking function exists is harder than the unrestricted problem: NP-complete over the rationals and \(\varSigma ^P_2\)-complete over the integers.


Polynomial Time Ranking Function Minimal Dimension Abstract Transition Iteration Bound 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    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) CrossRefGoogle Scholar
  2. 2.
    Ben-Amram, A., Genaim, S.: Complexity of Bradley-Manna-Sipma lexicographic ranking functions. In: CoRR, abs/1504.05018 (2015)Google Scholar
  3. 3.
    Ben-Amram, A.M.: Monotonicity constraints for termination in the integer domain. Logical Methods in Comput. Sci. 7(3) (2011)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)MathSciNetCrossRefGoogle 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) 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) CrossRefGoogle Scholar
  7. 7.
    Bradley, A.R., Manna, Z., Sipma, H.B.: Termination Analysis of Integer Linear Loops. In: Abadi, M., de Alfaro, L. (eds.) CONCUR 2005. LNCS, vol. 3653, pp. 488–502. Springer, Heidelberg (2005) CrossRefGoogle Scholar
  8. 8.
    Bradley, A.R., Manna, Z., Sipma, H.B.: Termination of polynomial programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 113–129. Springer, Heidelberg (2005) CrossRefGoogle Scholar
  9. 9.
    Brockschmidt, M., Cook, B., Fuhs, C.: Better termination proving through cooperation. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 413–429. Springer, Heidelberg (2013) CrossRefGoogle Scholar
  10. 10.
    Colón, M., Sipma, H.: Synthesis of linear ranking functions. In: Margaria, T., Yi, W. (eds.) TACAS 2001. LNCS, vol. 2031, pp. 67–81. Springer, Heidelberg (2001)Google Scholar
  11. 11.
    Colón, M., Sipma, H.: Practical methods for proving program termination. In: Brinksma, D., Larsen, K.G. (eds.) CAV 2002. LNCS, vol. 2404, pp. 442–454. Springer, Heidelberg (2002)Google Scholar
  12. 12.
    Cook, B., Kroening, D., Rümmer, P., Wintersteiger, C.M.: Ranking function synthesis for bit-vector relations. Formal Methods in System Design 43(1), 93–120 (2013)CrossRefzbMATHGoogle Scholar
  13. 13.
    Cook, B., See, A., Zuleger, F.: Ramsey vs. lexicographic termination proving. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013 (ETAPS 2013). LNCS, vol. 7795, pp. 47–61. Springer, Heidelberg (2013) CrossRefGoogle 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.
    Feautrier, P.: Some efficient solutions to the affine scheduling problem. II. Multidimensional time. Int. J. Parallel Prog. 21(6), 389–420 (1992)MathSciNetCrossRefGoogle Scholar
  16. 16.
    Floyd, R.W.: Assigning meanings to programs. Proc. Symp. Appl. Math. XIX, 19–32 (1967)MathSciNetCrossRefGoogle Scholar
  17. 17.
    Harris, W.R., Lal, A., Nori, A.V., Rajamani, S.K.: Alternation for termination. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 304–319. Springer, Heidelberg (2010) CrossRefGoogle Scholar
  18. 18.
    Leike, J., Heizmann, M.: Ranking templates for linear loops. In: Ábrahám, E., Havelund, K. (eds.) TACAS 2014 (ETAPS). LNCS, vol. 8413, pp. 172–186. Springer, Heidelberg (2014) CrossRefGoogle Scholar
  19. 19.
    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
  20. 20.
    László, L.: Coverings and colorings of hypergraphs. In: Proceedings of the 4th Southeastern Conference on Combinatorics, Graph Theory, and Computing, pp. 3–12 (1973)Google Scholar
  21. 21.
    Mesnard, F., Serebrenik, A.: Recurrence with affine level mappings is P-time decidable for CLP(R). TPLP 8(1), 111–119 (2008)MathSciNetzbMATHGoogle Scholar
  22. 22.
    Phelps, K.T., Rödl, V.: On the algorithmic complexity of coloring simple hypergraphs and steiner triple systems. Combinatorica 4(1), 79–88 (1984)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    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) CrossRefGoogle Scholar
  24. 24.
    Rybalchenko, A.: Temporal verification with transition invariants. Ph.D. thesis, Universität des Saarlandes (2004)Google Scholar
  25. 25.
    Schrijver, A.: Theory of Linear and Integer Programming. John Wiley and Sons, New York (1986)zbMATHGoogle Scholar
  26. 26.
    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, New York (1991)Google Scholar
  27. 27.
    Stockmeyer, L.J.: The polynomial-time hierarchy. Theor. Comput. Sci. 3(1), 1–22 (1976)MathSciNetCrossRefGoogle Scholar
  28. 28.
    Turing, A.M.: Checking a large routine. In: Report of a Conference on High Speed Automatic Calculating Machines, pp. 67–69, 1948. reprinted. In: The early British computer conferences, Charles Babbage Institute Reprint Series For The History Of Computing, vol. 14. MIT Press (1989)Google Scholar
  29. 29.
    Urban, C., Miné, A.: An abstract domain to infer ordinal-valued ranking functions. In: Shao, Z. (ed.) ESOP 2014 (ETAPS). LNCS, vol. 8410, pp. 412–431. Springer, Heidelberg (2014) CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

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

Personalised recommendations