Abstract
We show that linear-time self-interpretation of the pure untyped lambda calculus is possible, in the sense that interpretation has a constant overhead compared to direct execution under various execution models. The present paper shows this result for reduction to weak head normal form under call-by-name, call-by-value and call-by-need.
We use a self-interpreter based on previous work on self-interpretation and partial evaluation of the pure untyped lambda calculus.
We use operational semantics to define each reduction strategy. For each of these we show a simulation lemma that states that each inference step in the evaluation of a term by the operational semantics is simulated by a sequence of steps in evaluation of the self-interpreter applied to the term (using the same operational semantics).
By assigning costs to the inference rules in the operational semantics, we can compare the cost of normal evaluation and self-interpretation. Three different cost-measures are used: number of beta-reductions, cost of a substitution-based implementation (similar to graph reduction) and cost of an environment-based implementation.
For call-by-need we use a non-deterministic semantics, which simplifies the proof considerably.
Similar content being viewed by others
References
Barendregt, H.P. The Lambda Calculus, its Syntax and Semantics, 2 edition, North-Holland, Amsterdam, New York, Oxford, 1984. Studies in Logic and the Foundations of Mathematics, vol. 103.
Durand, I. and Middeldorp, A. Decidable call by need computations in term rewriting. In CADE '97. Springer-Verlag, 1997, pp. 4–18. Lecture Notes in Artificial Intelligence 1249.
Frandsen, G. and Sturtivant, C. In Proceedings of the Fifth ACM Conference on Functional Programming and Computer Architecture, John Hughes (Ed.). Springer-Verlag, Cambridge, Massachusetts, 1991, pp. 289–312. Lecture Notes in Computer Science 523.
Hennessy, M. The Semantics of Programming Languages. John Wiley and Sons, Chichester, New York, Brisbane, Toronto, Signapore, 1990.
Jones, N.D. Constant time factors do matter. In STOC '93. Symposium on Theory of Computing, S. Homer (Ed.). ACM Press, 1993, pp. 602–611.
Lawall, J.L. and Mairson, H.G. Optimality and inefficiency: What isn't a cost model of the lambda calculus. In Proceedings of ICFP '95, R.K. Dybvig (Ed.). ACM, ACM Press, 1996, pp. 92–101.
Mogensen, T.Æ . Efficient self-interpretation in lambda calculus. Journal of Functional Programming 2(3) (1992) 345–364.
Mogensen, T.Æ . Self-applicable partial evaluation for pure lambda calculus. In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation, C. Consel (Ed.). ACM, Yale University, 1992, pp. 116–121.
Mogensen, T.Æ . Self-applicable online partial evaluation of the pure lambda calculus. In Proceedings of PEPM '95, W.L. Scherlis (Ed.). ACM, ACM Press, 1995, pp. 39–44.
Pfenning, F. and Elliot, C. Higher-order abstract syntax. In Proceedings of the ACM-SIGPLAN Conference on Programming Language Design and Implementation, ACM, ACM Press, 1988, pp. 199–208.
Plotkin, G.D. A structural approach to operational semantics. Technical Report FN-19, DAIMI, Aarhus University, Denmark, Sept. 1981.
Rose, E. Characterizing computation models with a constant factor time hierarchy. In DIMACS Workshop On Computational Complexity and Programming Languages, B. Kapron (Ed.). New Jersey, USA, July 1996. DIMACS, RUTCOR, Rutgers University.
Rose, E. Linear time hierarchies for a functional language machine model. Science of Computer Programming 32(1–3) (1998) 109–143.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Mogensen, T.Æ. Linear-Time Self-Interpretation of the Pure Lambda Calculus. Higher-Order and Symbolic Computation 13, 217–237 (2000). https://doi.org/10.1023/A:1010058213619
Issue Date:
DOI: https://doi.org/10.1023/A:1010058213619