Skip to main content

Automated Generalisation of Function Definitions

  • Conference paper
Functional and Logic Programming (FLOPS 1999)

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

Included in the following conference series:

Abstract

We address the problem of finding the common generalisation of a set of Haskell function definitions so that each function can be defined by partial application of the generalisation. By analogy with unification, which derives the most general common specialisation of two terms, we aim to infer the least general common generalisation. This problem has a unique solution in a first-order setting, but not in a higher-order language. We define a smallest minimal common generalisation which is unique and consider how it might be used for automated program improvement. The same function can have many definitions; we risk over-generalisation if equality is not recognised. A normalising rewrite system is used before generalisation, so many equivalent definitions become identical. The generalisation system we describe has been implemented in Haskell.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Baader, F.: Unification, weak unification, upper bound, lower bound and generalization problems. LNCS, vol. 488, pp. 86–97 (1991)

    Google Scholar 

  2. Barendregt, H.P.: The Lambda Calculus: its syntax and semantics. Elsevier Science Publishers BV, Amsterdam (1984)

    MATH  Google Scholar 

  3. Dershowitz, N.: Termination of rewriting. J. Sym. Comp. 3(1-2), 69–116 (1987)

    Article  MATH  MathSciNet  Google Scholar 

  4. Dershowitz, N., Jouannaud, J.P.: Rewrite Systems, ch. 6. Handbook of Theoretical Computer Science, vol. B, pp. 243–320. Elsevier, Amsterdam (1990)

    Google Scholar 

  5. Peterson, J., et al.: Haskell 1.4: A Non-Strict, Purely Functional Language (1997)

    Google Scholar 

  6. Furtado, A.I.: Analogy by generalization – and the quest for the grail. ACM SIGPLAN Notices 27(1), 105–113 (1992)

    Article  MATH  Google Scholar 

  7. Hagiya, M.: Synthesis of rewrite programs by higher-order unification and semantic unification. New Generation Computing 8(4), 403–420 (1991)

    Article  MATH  Google Scholar 

  8. Huet, G.P.: A unification algorithm for typed λ −-calculus. Theor. Comp. Sci. 1, 27–57 (1975)

    Article  MathSciNet  Google Scholar 

  9. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall International, Englewood Cliffs (1993)

    MATH  Google Scholar 

  10. Knight, K.: Unification: A multidisciplinary survey. ACM Computing Surveys 21(1), 93–124 (1989)

    Article  MATH  MathSciNet  Google Scholar 

  11. Page, C.D., Frisch, A.M.: Generalization and Learnability: A Study of Constrained Atoms, ch. 2: Inductive Logic Programming, London Academic Press, London (1992)

    Google Scholar 

  12. Plotkin, G.D.: A note on inductive generalization. In: Meltzer, B., Mitchie, D. (eds.) Machine Intelligence, vol. 5, pp. 153–163. Edinburgh University Press (1969)

    Google Scholar 

  13. Reynolds, J.C.: Transformational systems and the algebraic structure of atomic formulas. In: Meltzer, B., Mitchie, D. (eds.) Machine Intelligence, vol. 5, pp. 135–151. Edinburgh University Press (1970)

    Google Scholar 

  14. Runciman, C., Toyn, I.: Retrieving reusable software components by polymorphic type. Journal of Functional Programming 1(2), 191–211 (1991)

    MATH  MathSciNet  Google Scholar 

  15. Stickel, M.E.: A unification algorithm for associative-commutative functions. JACM 28(3), 423–434 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  16. Summers, P.D.: A methodology for lisp program construction from examples. JACM 24(1), 161–175 (1977)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bakewell, A., Runciman, C. (1999). Automated Generalisation of Function Definitions. In: Middeldorp, A., Sato, T. (eds) Functional and Logic Programming. FLOPS 1999. Lecture Notes in Computer Science, vol 1722. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10705424_15

Download citation

  • DOI: https://doi.org/10.1007/10705424_15

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-66677-6

  • Online ISBN: 978-3-540-47950-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics