Abstract
In a functional program the value of an expression may be required several times. If a usage analysis can determine how many times it will be required, certain optimisations are possible, such as converting lazy parameter passing to call-by-name or call-by-value, compile-time garbage collection and in-place update. This paper presents a method for deducing usage information in the λ-calculus, based on a type logic employing reduction types. A system is presented wherein function type constructors are annotated with expressions over the natural numbers to indicate the usage behaviour of λ-terms. This system is shown to be correct by interpreting the type language over a semi-model of the λ-calculus and demonstrating soundness and completeness. Furthermore, we show how the Curry-Howard interpretation naturally relates such types to relevant logic.
Preview
Unable to display preview. Download preview PDF.
References
A. R. Anderson and N. D. Belnap, Jr. Entailment: The Logic of Relevance and Necessity. Princeton University Press, 1975.
A. Avron. The semantics and proof theory of linear logic. Theoretical Computer Science, 57:161–184, 1988.
C. A. Baker-Finch. Relevant logic and strictness analysis. In Workshop on Static Analysis, LaBRI, Bordeaux, pages 221–228. Bigre 81–82, 1992.
H.P. Barendregt. The Lambda-Calculus: its Syntax and Semantics, volume 103 of Studies in Logic and the Foundations of Mathematics. North-Holland, second edition, 1984.
H.P. Barendregt, M. Coppo, and M. Dezani-Ciancaglini. A Filter Lambda Model and the Completeness of Type Assignment. Journal of Symbolic Logic, 48(4):931–940, December 1983.
H.P. Barendregt, J.R. Kennaway, J.W. Klop, and M.R. Sleep. Needed Reduction and Spine Strategies for the lambda-calculus. Technical report, Centre for Mathematics and Computer Science, May 1986.
P.N. Benton. Strictness Logic and Polymorphic Invariance. In Logical Foundations of Computer Science, pages 33–44, 20–24 July 1992.
G.L. Burn, C.L. Hankin, and S. Abramsky. Strictness analysis for higher-order functions. Science of Computer Programming, 7:249–278, 1986.
A. Church. The weak theory of implication. In Menne, Wilhelmy, and Angsil, editors, Kontrolliertes Denken, Untersuchungen zum Logikkalkül und der Logik der Einzelwissenschaften, pages 22–37. Kommissions-verlag Karl Alber, 1951.
M. Coppo. An Extended Polymorphic Type System for Applicative Languages. In Mathematical Foundations of Computer Science, number 88 in Lecture Notes in Computer Science. Springer-Verlag, September 1980.
M. Coppo. Type Inference, Abstract Interpretation and Strictness Analysis. Draft manuscript, 1992.
P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In ACM Symposium on Principles of Programming Languages, pages 238–252. ACM, 1977.
H.B. Curry and R. Feys. Combinatory Logic, Volume 1. Studies in Logic and the Foundations of Mathematics. North-Holland, 1958.
J. M. Dunn. Relevance logic and entailment. In D. Gabbay and F. Guenthner, editors, Handbook of Philosophical Logic, Vol. III. D. Reidel, 1986.
B. Goldberg. Detecting Sharing of Partial Applications in Functional Programs. In Functional Programming Languages and Computer Architecture, volume 274 of Lecture Notes in Computer Science. Springer-Verlag, 1987.
G. Helman. Completeness of the normal typed fragment of the λ-system U. Journal of Philosophical Logic, 6:33–46, 1977.
G. Helman. Restricted Lambda Abstraction and the Interpretation of Some Non-Classical Logics. PhD thesis, University of Pittsburgh, 1977.
J.R. Hindley. The Completeness Theorem for Typing λ-terms. Theoretical Computer Science, 22:1–17, 1983.
W. A. Howard. The formulae-as-types notion of construction. In J. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays on Combinatorial Logic, Lambda Calculus and Formalism, pages 479–490. Academic Press, 1980.
P. Hudak and R. Young. Higher-order strictness analysis in untyped lambda calculus. In ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 97–109. ACM, 1986.
Bart Jacobs. Semantics of weakening and contraction. Technical report, Department of Pure Mathematics, University of Cambridge, 1992.
T.P. Jensen. Strictness Analysis in Logical Form, 1991.
T.P. Jensen and T.A. Mogensen. A Backwards Analysis for Compile-time Garbage Collection. In N.D. Jones, editor, European Symposium on Programming, volume 432 of Lecture Notes in Computer Science. Springer-Verlag, 1990.
J.W. Klop. Combinatory Reduction Systems. PhD thesis, State University of Utrecht, 1980.
T-M. Kuo and P. Mishra. Strictness Analysis: A New Perspective based on Type Inference. In FPCA '89, pages 260–272, London, United Kingdom, September 1989.
A. Mycroft. The theory and practice of transforming call-by-need into call-by-value. In International Symposium on Programming, volume 83 of Lecture Notes in Computer Science, pages 269–281. Springer-Verlag, 1980.
A. Mycroft and N. Jones. A relational framework for abstract interpretation. In Workshop on Programs as Data Objects, volume 217 of Lecture Notes in Computer Science, pages 156–171. Springer-Verlag, 1985.
G.D. Plotkin. A Semantics for Type Checking. In Theoretical Aspects of Computer Science, volume 526 of Lecture Notes in Computer Science, pages 1–17. Springer-Verlag, 1991.
P. Sestoft. Analysis and Efficient Implementation of Functional Programs. PhD thesis, DIKU, University of Copenhagen, 1991.
J.H. Siekmann. Unification Theory. Journal of Symbolic Computation, 7:207–274, 1989.
P. Wadler. Is there a use for Linear Logic? In Partial Evaluation and Program Manipulation. ACM Press, 1991.
D.A. Wright. Strictness Analysis Via (Type) Inference. Technical Report TR89-3, University of Tasmania, September 1989.
D.A. Wright. A New Technique for Strictness Analysis. In Theory and Practice of Software Development, number 494 in Lecture Notes in Computer Science. Springer-Verlag, April 1991.
D.A. Wright. Reduction Types and Intensionality in the Lambda-Calculus. PhD thesis, University of Tasmania, 1992.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1993 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wright, D.A., Baker-Finch, C.A. (1993). Usage analysis with natural reduction types. In: Cousot, P., Falaschi, M., Filé, G., Rauzy, A. (eds) Static Analysis. WSA 1993. Lecture Notes in Computer Science, vol 724. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-57264-3_46
Download citation
DOI: https://doi.org/10.1007/3-540-57264-3_46
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-57264-0
Online ISBN: 978-3-540-48027-3
eBook Packages: Springer Book Archive