Skip to main content

Automatic Generation of Generalization Lemmas for Proving Properties of Tail-Recursive Definitions

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2758))

Abstract

Automatically proving properties of tail-recursive function definitions by induction is known to be challenging. The difficulty arises due to a property of a tail-recursive function definition typically expressed by instantiating the accumulator argument to be a constant only on one side of the property. The application of the induction hypothesis gets blocked in a proof attempt. Following an approach developed by Kapur and Subramaniam, a transformation heuristic is proposed which hypothesizes the other side of property to also have an occurrence of the same constant. Constraints on the transformation are identified which enable a generalization of the constant on both sides with the hope that the generalized conjecture is easier to prove. Conditions are generated from which intermediate lemmas necessary to make a proof attempt to succeed can be speculated. By considering structural properties of recursive definitions, it is possible to identify properties of the functions used in recursive definitions for the conjecture to be valid. The heuristic is demonstrated on well-known tail-recursive definitions on numbers as well as other recursive data structures, including finite lists, finite sequences, finite trees, where a definition is expressed using one recursive call or multiple recursive calls. In case, a given conjecture is not valid because of a possible bug in an implementation (a tail-recursive definition) or a specification (a recursive definition), the heuristic can be often used to generate a counter-example. Conditions under which the heuristic is applicable can be checked easily. The proposed heuristic is likely to be helpful for automatically generating loop invariants as well as in proofs of correctness of properties of programs with respect to their specifications.

This research was partially supported by an NSF ITR award CCR-0113611.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aubin, R.: Mechanizing structural induction II: Strategies. Theoretical Computer Science 9, 347–361 (1979)

    Article  MATH  MathSciNet  Google Scholar 

  2. Bundy, A.: The Automation of Proof by Mathematical Induction. In: Robinson, A., Voronkov, A. (eds.) Handbook of Automated Reasoning, vol. 1, pp. 845–911 (2001)

    Google Scholar 

  3. Boyer, R.S., Moore, J.: A Computational Logic. Academic Press, London (1979)

    MATH  Google Scholar 

  4. Castaing, J.: How to facilitate the proof of theorems by using the inductionmatching and by generalization. In: Proceedings of the Ninth International Joint Conference on Artificial Intelligence, pp. 1208–1213 (1985)

    Google Scholar 

  5. Giesl, J.: Context-Moving Transformations for Function Verification. In: Bossi, A. (ed.) LOPSTR 1999. LNCS, vol. 1817, pp. 293–312. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  6. Ireland, A., Bundy, A.: Automatic Verification of Functions with Accumulating Parameters. Journal of Functional Programming 9(2), 225–245 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  7. Kapur, D., Zhang, H.: An Overview of Rewrite Rule Laboratory (RRL). Journal of Computer and Mathematics with Applications 29, 91–114 (1995)

    Article  MathSciNet  Google Scholar 

  8. Kapur, D., Subramaniam, M.: Lemma Discovery in Automating Induction. In: McRobbie, M.A., Slaney, J.K. (eds.) CADE 1996. LNCS, vol. 1104, pp. 538–552. Springer, Heidelberg (1996)

    Google Scholar 

  9. Klinger, W.D.: Proper Tail Recursion and Space Efficiency. In: Proc. ACM Programming Language Design and Implementation (1998)

    Google Scholar 

  10. Vadera, S.: Generalization for Induction Mechanizing. Technical Report UMCS-93- 6-8 (1993)

    Google Scholar 

  11. Walther, C.: Mathematical Induction. In: Gabbay, D.M., Hogger, C.J., Robinson, J.A. (eds.) Handbook of Logic in Artificial Intelligence and Logic Programming, vol. 2. Oxford University Press, Oxford (1994)

    Google Scholar 

  12. Zhang, H., Kapur, D., Krishnamoorthy, M.S.: A Mechanizable Induction Principle for Equational Specifications. In: Lusk, E.‘., Overbeek, R. (eds.) CADE 1988. LNCS, vol. 310, pp. 162–181. Springer, Heidelberg (1988)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kapur, D., Sakhanenko, N.A. (2003). Automatic Generation of Generalization Lemmas for Proving Properties of Tail-Recursive Definitions. In: Basin, D., Wolff, B. (eds) Theorem Proving in Higher Order Logics. TPHOLs 2003. Lecture Notes in Computer Science, vol 2758. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10930755_9

Download citation

  • DOI: https://doi.org/10.1007/10930755_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-40664-8

  • Online ISBN: 978-3-540-45130-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics