Skip to main content

An Abstract Domain to Infer Ordinal-Valued Ranking Functions

  • Conference paper

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 8410)


The traditional method for proving program termination consists in inferring a ranking function. In many cases (i.e. programs with unbounded non-determinism), a single ranking function over natural numbers is not sufficient. Hence, we propose a new abstract domain to automatically infer ranking functions over ordinals.

We extend an existing domain for piecewise-defined natural-valued ranking functions to polynomials in ω, where the polynomial coefficients are natural-valued functions of the program variables. The abstract domain is parametric in the choice of the maximum degree of the polynomial, and the types of functions used as polynomial coefficients.

We have implemented a prototype static analyzer for a while-language by instantiating our domain using affine functions as polynomial coefficients. We successfully analyzed small but intricate examples that are out of the reach of existing methods.

To our knowledge this is the first abstract domain able to reason about ordinals. Handling ordinals leads to a powerful approach for proving termination of imperative programs, which in particular subsumes existing techniques based on lexicographic ranking functions.

The research leading to these results has received funding from the ARTEMIS Joint Undertaking under grant agreement no. 269335 (ARTEMIS project MBAT) (see Article II.9. of the JU Grant Agreement).


  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)

    CrossRef  Google Scholar 

  2. Ben-Amram, A.M., Lee, C.S.: Ranking Functions for Size-Change Termination II. Logical Methods in Computer Science 5(2) (2009)

    Google Scholar 

  3. 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)

    CrossRef  Google Scholar 

  4. Cook, B., Podelski, A., Rybalchenko, A.: Proving Program Termination. Communications of the ACM 54(5), 88–98 (2011)

    CrossRef  Google Scholar 

  5. Cook, B., See, A., Zuleger, F.: Ramsey vs. Lexicographic Termination Proving. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013. LNCS, vol. 7795, pp. 47–61. Springer, Heidelberg (2013)

    Google Scholar 

  6. Cousot, P.: Constructive Design of a Hierarchy of Semantics of a Transition System by Abstract Interpretation. Electronic Notes in Theoretical Computer Science 6, 77–102 (1997)

    CrossRef  MathSciNet  Google Scholar 

  7. Cousot, P., Cousot, R.: Static Determination of Dynamic Properties of Programs. In: Symposium on Programming, pp. 106–130 (1976)

    Google Scholar 

  8. Cousot, P., Cousot, R.: Abstract Interpretation: a Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: POPL, pp. 238–252 (1977)

    Google Scholar 

  9. Cousot, P., Cousot, R.: Higher Order Abstract Interpretation (and Application to Comportment Analysis Generalizing Strictness, Termination, Projection, and PER Analysis. In: ICCL, pp. 95–112 (1994)

    Google Scholar 

  10. Cousot, P., Cousot, R.: An Abstract Interpretation Framework for Termination. In: POPL, pp. 245–258 (2012)

    Google Scholar 

  11. Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints Among Variables of a Program. In: POPL, pp. 84–96 (1978)

    Google Scholar 

  12. Floyd, R.W.: Assigning Meanings to Programs. In: Proceedings of Symposium on Applied Mathematics, vol. 19, pp. 19–32 (1967)

    Google Scholar 

  13. Heizmann, M., Jones, N.D., Podelski, A.: Size-Change Termination and Transition Invariants. In: Cousot, R., Martel, M. (eds.) SAS 2010. LNCS, vol. 6337, pp. 22–50. Springer, Heidelberg (2010)

    CrossRef  Google Scholar 

  14. Jeannet, B., Miné, A.: Apron: A Library of Numerical Abstract Domains for Static Analysis. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 661–667. Springer, Heidelberg (2009)

    CrossRef  Google Scholar 

  15. Kunen, K.: Set Theory: An Introduction to Independence Proofs. Studies in Logic and the Foundations of Mathematics (1980)

    Google Scholar 

  16. Lee, C.S.: Ranking Functions for Size-Change Termination. ACM Transactions on Programming Languages and Systems 31(3) (2009)

    Google Scholar 

  17. Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The Size-Change Principle for Program Termination. In: POPL, pp. 81–92 (2001)

    Google Scholar 

  18. Manna, Z., Pnueli, A.: The Temporal Verification of Reactive Systems: Progress (1996)

    Google Scholar 

  19. Miné, A.: The Octagon Abstract Domain. Higher-Order and Symbolic Computation 19(1), 31–100 (2006)

    CrossRef  MATH  Google Scholar 

  20. Podelski, A., Rybalchenko, A.: Transition Invariants. In: LICS, pp. 32–41 (2004)

    Google Scholar 

  21. Urban, C.: FuncTion,

  22. Urban, C.: The Abstract Domain of Segmented Ranking Functions. In: Logozzo, F., Fähndrich, M. (eds.) SAS 2013. LNCS, vol. 7935, pp. 43–62. Springer, Heidelberg (2013)

    Google Scholar 

  23. Velroyen, H., Rümmer, P.: Non-Termination Checking for Imperative Programs. In: Beckert, B., Hähnle, R. (eds.) TAP 2008. LNCS, vol. 4966, pp. 154–170. Springer, Heidelberg (2008)

    CrossRef  Google Scholar 

Download references

Author information

Authors and Affiliations


Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Urban, C., Miné, A. (2014). An Abstract Domain to Infer Ordinal-Valued Ranking Functions. In: Shao, Z. (eds) Programming Languages and Systems. ESOP 2014. Lecture Notes in Computer Science, vol 8410. Springer, Berlin, Heidelberg.

Download citation

  • DOI:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-54832-1

  • Online ISBN: 978-3-642-54833-8

  • eBook Packages: Computer ScienceComputer Science (R0)