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.
Keywords
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.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Baader, F.: Unification, weak unification, upper bound, lower bound and generalization problems. LNCS, vol. 488, pp. 86–97 (1991)
Barendregt, H.P.: The Lambda Calculus: its syntax and semantics. Elsevier Science Publishers BV, Amsterdam (1984)
Dershowitz, N.: Termination of rewriting. J. Sym. Comp. 3(1-2), 69–116 (1987)
Dershowitz, N., Jouannaud, J.P.: Rewrite Systems, ch. 6. Handbook of Theoretical Computer Science, vol. B, pp. 243–320. Elsevier, Amsterdam (1990)
Peterson, J., et al.: Haskell 1.4: A Non-Strict, Purely Functional Language (1997)
Furtado, A.I.: Analogy by generalization – and the quest for the grail. ACM SIGPLAN Notices 27(1), 105–113 (1992)
Hagiya, M.: Synthesis of rewrite programs by higher-order unification and semantic unification. New Generation Computing 8(4), 403–420 (1991)
Huet, G.P.: A unification algorithm for typed λ −-calculus. Theor. Comp. Sci. 1, 27–57 (1975)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall International, Englewood Cliffs (1993)
Knight, K.: Unification: A multidisciplinary survey. ACM Computing Surveys 21(1), 93–124 (1989)
Page, C.D., Frisch, A.M.: Generalization and Learnability: A Study of Constrained Atoms, ch. 2: Inductive Logic Programming, London Academic Press, London (1992)
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)
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)
Runciman, C., Toyn, I.: Retrieving reusable software components by polymorphic type. Journal of Functional Programming 1(2), 191–211 (1991)
Stickel, M.E.: A unification algorithm for associative-commutative functions. JACM 28(3), 423–434 (1981)
Summers, P.D.: A methodology for lisp program construction from examples. JACM 24(1), 161–175 (1977)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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