Stop When You Are Almost-Full

Adventures in Constructive Termination
  • Dimitrios Vytiniotis
  • Thierry Coquand
  • David Wahlstedt
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7406)


Disjunctive well-foundedness, size-change termination, and well-quasi-orders are examples of techniques that have been successfully applied to program termination. Although these works originate in different communities, they rely on closely related principles and both employ similar arguments from Ramsey theory. At the same time there is a notable absence of these techniques in programming systems based on constructive type theory. In this paper we’d like to highlight the aforementioned connection and make the core ideas widely accessible to theoreticians and programmers, by offering a development in type theory which culminates in some novel tools for induction. Inevitably, we have to present some Ramsey-like arguments: Though similar proofs are typically classical, we offer an entirely constructive development based on the work of Bezem and Veldman, and Richman and Stolzenberg.


Type Theory Transitive Closure Recursive Call Proof Obligation Induction Principle 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abel, A.: Termination and productivity checking with continuous types. In: Proceedings of the 6th International Conference on Typed Lambda Calculi and Applications, TLCA 2003, Valencia, Spain, pp. 1–15. Springer, Heidelberg (2003),, ISBN: 3-540-40332-9
  2. 2.
    Ben-Amram, A.M.: General Size-Change Termination and Lexicographic Descent. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 3–17. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  3. 3.
    Berghofer, S.: A Constructive Proof of Higman’s Lemma in Isabelle. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 66–82. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  4. 4.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer (2004)Google Scholar
  5. 5.
    Blanqui, F., Koprowski, A.: Color: a COQ library on well-founded rewrite relations and its application to the automated verification of termination certificates. MSCS 21(4), 827–859 (2011)MathSciNetzbMATHGoogle Scholar
  6. 6.
    Bolingbroke, M., Jones, S.P., Vytiniotis, D.: Termination combinators forever. In: Proceedings of the 4th ACM Symposium of Haskell 2011, pp. 23–34. ACM (2011)Google Scholar
  7. 7.
    Bove, A., Capretta, V.: Modelling general recursion in type theory. MSCS 15, 671–708 (2005)MathSciNetzbMATHGoogle Scholar
  8. 8.
    Charguéraud, A.: The Optimal Fixed Point Combinator. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 195–210. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  9. 9.
    Cook, B., Podelski, A., Rybalchenko, A.: Termination proofs for systems code. In: Proceedings of PLDI 2006, pp. 415–426. ACM (2006)Google Scholar
  10. 10.
    Coquand, T.: An analysis of Ramsey’s Theorem. Inf. Comput. 110, 297–304 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Coquand, T., Siles, V.: A Decision Procedure for Regular Expression Equivalence in Type Theory. In: Jouannaud, J.-P., Shao, Z. (eds.) CPP 2011. LNCS, vol. 7086, pp. 119–134. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  12. 12.
    Dershowitz, N., Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: A general framework for automatic termination analysis of logic programs. Appl. Algebra Eng. Commun. Comput. 12(1/2), 117–156 (2001)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Fridlender, D.: Higman’s Lemma in Type Theory. In: Giménez, E. (ed.) TYPES 1996. LNCS, vol. 1512, pp. 112–133. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  14. 14.
    Geser, A.: Relative termination. PhD thesis, Universität Passau (1990)Google Scholar
  15. 15.
    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)CrossRefGoogle Scholar
  16. 16.
    Jones, N.D., Bohr, N.: Call-by-value termination in the untyped lambda-calculus. Logical Methods in Computer Science 4(1) (2008)Google Scholar
  17. 17.
    Krauss, A., Sternagel, C., Thiemann, R., Fuhs, C., Giesl, J.: Termination of Isabelle Functions via Termination of Rewriting. In: van Eekelen, M., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011. LNCS, vol. 6898, pp. 152–167. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  18. 18.
    Krauss, A.: Certified Size-Change Termination. In: Pfenning, F. (ed.) CADE 2007. LNCS (LNAI), vol. 4603, pp. 460–475. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  19. 19.
    Krauss, A.: Partial and nested recursive function definitions in higher-order logic. Journal of Automated Reasoning 44, 303–336 (2010)MathSciNetzbMATHCrossRefGoogle Scholar
  20. 20.
    Kruskal, J.B.: Well-quasi-ordering, the Tree Theorem, and Vazsonyi’s conjecture. Trans. Amer. Math. Soc. 95, 210–225 (1960)MathSciNetzbMATHGoogle Scholar
  21. 21.
    Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The size-change principle for program termination. In: Proceedings of POPL 2001, pp. 81–92. ACM (2001)Google Scholar
  22. 22.
    Leuschel, M.: Homeomorphic Embedding for Online Termination of Symbolic Methods. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 379–403. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  23. 23.
    Megacz, A.: A coinductive monad for Prop-bounded recursion. In: Stump, A., Xi, H. (eds.) Proceedings of PLPV 2007, pp. 11–20. ACM (2007)Google Scholar
  24. 24.
    Bezem, M.A., Nakata, K., Uustalu, T.: On streams that are finitely red. To appear in Logical Methods in Computer Science (2011)Google Scholar
  25. 25.
    Nash-Williams, C.S.J.A.: On well-quasi-ordering finite trees. In: Mathematical Proceedings of the Cambridge Philosophical Society, vol. 59, pp. 833–835. Cambridge Univ. Press (1963)Google Scholar
  26. 26.
    Podelski, A., Rybalchenko, A.: Transition invariants. In: Proceedings of LICS 2004, pp. 32–41. IEEE Computer Society, Washington, DC (2004)Google Scholar
  27. 27.
    Richman, F., Stolzenberg, G.: Well-quasi-ordered sets. Advanced Mathematics, 145–193 (1993)Google Scholar
  28. 28.
    Sagiv, Y.: A termination test for logic programs. In: ISLP, pp. 518–532 (1991)Google Scholar
  29. 29.
    Seisenberger, M.: An Inductive Version of Nash-Williams’ Minimal-Bad-Sequence Argument for Higman’s Lemma. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, pp. 233–242. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  30. 30.
    Sereni, D.: Termination analysis and call graph construction for higher-order functional programs. In: Proceedings of ICFP 2007, pp. 71–84. ACM (2007)Google Scholar
  31. 31.
    Sørensen, M.H., Glück, R.: An algorithm of generalization in positive supercompilation. In: Proceedings of ILPS 1995, The International Logic Programming Symposium, pp. 465–479. MIT Press (1995)Google Scholar
  32. 32.
    Sozeau, M.: Subset Coercions in COQ. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 237–252. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  33. 33.
    Sozeau, M.: A New Look at Generalized Rewriting in Type Theory. Journal of Formalized Reasoning 2(1), 41–62 (2009)MathSciNetzbMATHGoogle Scholar
  34. 34.
    Terese: Term Rewriting Systems. Cambridge Tracts in Theoretical Computer Science, vol. 55. Cambridge University Press (2003)Google Scholar
  35. 35.
    Veldman, W., Bezem, M.: Ramsey’s theorem and the pigeonhole principle in intuitionistic mathematics. Journal of the London Mathematical Society s2-47(2), 193–211 (1993)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Dimitrios Vytiniotis
    • 1
  • Thierry Coquand
    • 2
  • David Wahlstedt
    • 2
  1. 1.Microsoft ResearchCambridgeUK
  2. 2.University of GothenburgSweden

Personalised recommendations