Abstract
We describe a novel technique for the automatic synthesis of tail-recursive programs. The technique is to specify the required program using the standard equations and then synthesise the tail-recursive program using the proofs as programs technique. This requires the specification to be proved realisable in a constructive logic. Restrictions on the form of the proof ensure that the synthesised program is tail-recursive.
The automatic search for a synthesis proof is controlled by proof plans, which are descriptions of the high-level structure of proofs of this kind. We have extended the known proof plans for inductive proofs by adding a new form of generalisation and by making greater use of middle-out reasoning. In middle-out reasoning we postpone decisions in the early part of the proof by the use of meta-variables which are instantiated, by unification, during later parts of the proof. Higher order unification is required, since these meta-variables can represent higher order objects.
The program synthesised is automatically verified to ensure that it satisfies its specification. This type of verification is contrasted with template-based transformation approaches which require proofs that the general transformations described by the templates preserve equivalence.
The technique described is more general than template-based approaches, since it is not tied to program patterns which must be specified in advance. Detailed information about proof structure enables it to use a wider repertoire of rewritings in a more goal-directed way than comparable transformational techniques.
The research reported in this paper was supported by SERC grant GR/E/71799, and an SERC Senior Fellowship to the second author. We are grateful for feedback on this paper from Andrew Ireland and Toby Walsh, and for conversations with Dale Miller and other members of the Mathematical Reasoning Group at Edinburgh.
Preview
Unable to display preview. Download preview PDF.
References
R.S. Boyer and J.S. Moore. A Computational Logic. Academic Press, 1979. ACM monograph series.
A. Bundy, F. van Harmelen, J. Hesketh, and A. Smaill. Experiments with proof plans for induction. Journal of Automated Reasoning, 7:303–324, 1991. Earlier version available from Edinburgh as DAI Research Paper No 413.
A. Bundy, F. van Harmelen, J. Hesketh, A. Smaill, and A. Stevens. A rational reconstruction and extension of recursion analysis. In N.S. Sridharan, editor, Proceedings of the Eleventh International Joint Conference on Artificial Intelligence, pages 359–365, Morgan Kaufmann, 1989. Also available from Edinburgh as DAI Research Paper 419.
A. Bundy, F. van Harmelen, C. Horn, and A. Smaill. The Oyster-Clam system. In M.E. Stickel, editor, 10th International Conference on Automated Deduction, pages 647–648, Springer-Verlag, 1990. Lecture Notes in Artificial Intelligence No. 449. Also available from Edinburgh as DAI Research Paper 507.
A. Bundy, F. van Harmelen, A. Smaill, and A. Ireland. Extensions to the rippling-out tactic for guiding inductive proofs. In M.E. Stickel, editor, 10th International Conference on Automated Deduction, pages 132–146, Springer-Verlag, 1990. Lecture Notes in Artificial Intelligence No. 449. Also available from Edinburgh as DAI Research Paper 459.
J. Darlington. An experimental program transformation and synthesis system. Artificial Intelligence, 16(3):1–46, August 1981.
G. Huet. A unification algorithm for lambda calculus. Theoretical Computer Science, 1:27–57, 1975.
G. Huet and B. Lang. Proving and applying program transformation expressed with second order patterns. Acta Informatica, 11:31–55, 1978.
D.J. Pym. Proofs, search and computation in general logic. PhD thesis, University of Edinburgh, 1990. Available as LFCS report ECS-LFCS-90-125.
S.S. Wainer. Programs from proofs. 1989. Seminar given at the Department of Artificial Intelligence, Edinburgh.
ÅWikström. Functional Programming Using Standard ML. Prentice Hall, 1987.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1992 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Hesketh, J., Bundy, A., Smaill, A. (1992). Using middle-out reasoning to control the synthesis of tail-recursive programs. In: Kapur, D. (eds) Automated Deduction—CADE-11. CADE 1992. Lecture Notes in Computer Science, vol 607. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55602-8_174
Download citation
DOI: https://doi.org/10.1007/3-540-55602-8_174
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-55602-2
Online ISBN: 978-3-540-47252-0
eBook Packages: Springer Book Archive