Abstract
Higher-order lazy functional languages have had a reputation for inefficiency, and recent work has both addressed and corrected these defects. An unfortunate side-effect of the improved efficiency is the increasing complexity of the resultant implementations. In this paper we present the correctness proof of a new abstract machine. The abstract machine deals with the issues of currying, nonstrictness and sharing. Like most modern abstract machines, it employs spineless reduction to tackle partial function applications, and graph rewriting to deal with both non-strictness and sharing. The abstract machine has been defined as a state monad and is directly implementable in an imperative language.
The machine is proved correct with respect to the direct denotational semantics of the functional language. The proof is carried out in two stages, with the introduction of an intermediate operational semantics. The correctness of the intermediate semantics is stated in terms of soundness and adequacy. Because of the higher-order nature of the language, inclusive predicates over reflexive domains are used in the adequacy proof. A large part of the proof has been constructed with the aid of a theorem prover.
Preview
Unable to display preview. Download preview PDF.
References
Z.M. Ariola, M. Felleisen, J. Maraist, M. Odersky, and P. Wadler. The call-by-need lambda calculus. In 22'nd Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, San Francisco, California, 1995. ACM Press.
G.L. Burn. Lazy Functional Languages: Abstract Interpretation and Compilation. Research Monographs in Parallel and Distributed Computing. Pitman in association with MIT Press, 1991.
M.J.C. Gordon. Models of pure LISP (a worked example in semantics). Experimental Programming Reports 31, Department of Machine Intelligence, University of Edinburgh, 1973.
S.P. Jones and P. Wadler. Imperative functional programming. In 20'th Symposium on Principles of Programming Languages, Charlotte, North Carolina, 1993. ACM Press.
J. Launchbury. A natural semantics for lazy evaluation. In Twentieth ACM Symposium on Principles of Programming Languages, Charleston, South Carolina, pages 144–154. ACM, 1993.
D.R. Lester. Combinator Graph Reduction: A Congruence and its Applications. Dphil thesis, Oxford University, 1988. Also published as Technical Monograph PRG-73.
D.R. Lester and S. Mintchev. Towards machine-checked compiler correctness for higher-order pure functional languages. In L. Pacholski and J. Tiuryn, editors, Proceedings of the 1994 Annual Conference of the European Association for Computer Science Logic, pages 369–381. Springer-Verlag LNCS 933, 1995.
S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In 22'nd Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, San Francisco, California, 1995. ACM Press.
R.E. Milne. The Formal Semantics of Computer Languages and Their Implementation. PhD thesis, University of Cambridge, 1974.
S. Mintchev. A denotational approach to compiling core Haskell. In Peter Fritzson, editor, Proceedings of the poster session of the International Conference on Compiler Construction CC'94, Linköping University research report LiTH-IDA-R-94-11, pages 123–133, 1994.
S. Mintchev. Mechanized reasoning about functional programs. In K. Hammond, D.N. Turner, and P. Sansom, editors, Functional Programming, Glasgow 1994, pages 151–167. Springer-Verlag Workshops in Computing, 1995.
E. Moggi. Computational lambda-calculus and monads. In Proceedings of the Fourth Annual Symposium on Logic in Computer Science (LICS), Pacific Grove, California, 1989.
K. Mulmuley. Full Abstraction and Semantic Equivalence. MIT Press, Cambridge, Massachusetts, 1987. ACM Doctoral Dissertation Award 1986.
F. Nielson and H.R. Nielson. Two-level Functional Languages. Number 34 in Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.
L.C. Paulson. Isabelle: A Generic Theorem Prover. Springer-Verlag LNCS 828, 1994.
S.L. Peyton Jones. Implementing lazy functional languages on stock hardware: the spineless tagless G-Machine. Journal of Functional Programming, 2(2):127–202, April 1992.
A.M. Pitts. Computational adequacy via ‘mixed’ inductive definitions. In Mathematical Foundations of Programming Semantics, Proc. 9th Int. Conf., New Orleans, LA, USA, April 1993, volume 802 of Lecture Notes in Computer Science, pages 72–82. Springer-Verlag, Berlin, 1994.
P. Sestoft. Deriving a lazy abstract machine. Technical Report ID-TR 1994-146, Department of Computer Science, Technical University of Denmark, 1994.
J.E. Stoy. The congruence of two programming language definitions. Theoretical Computer Science, 13(2):151–174, February 1981.
P. Wadler. Comprehending monads. Mathematical Structures in Computer Science, 1992. Special issue of selected papers from 6'th Conference on Lisp and Functional Programming.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Mintchev, S., Lester, D. (1996). The correctness of a higher-order lazy functional language implementation: An exercise in mechanical theorem proving. In: Dowek, G., Heering, J., Meinke, K., Möller, B. (eds) Higher-Order Algebra, Logic, and Term Rewriting. HOA 1995. Lecture Notes in Computer Science, vol 1074. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61254-8_24
Download citation
DOI: https://doi.org/10.1007/3-540-61254-8_24
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61254-4
Online ISBN: 978-3-540-68389-6
eBook Packages: Springer Book Archive