Usage Analysis with Natural Reduction Types

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.

[1]  Chris Hankin,et al.  Strictness Analysis for Higher-Order Functions , 1986, Sci. Comput. Program..

[2]  J. Roger Hindley,et al.  The Completeness Theorem for Typing lambda-Terms , 1983, Theor. Comput. Sci..

[3]  Neil D. Jones,et al.  A relational framework for abstract interpretation , 1985, Programs as Data Objects.

[4]  Mariangiola Dezani-Ciancaglini,et al.  A filter lambda model and the completeness of type assignment , 1983, Journal of Symbolic Logic.

[5]  Avron Arnon The semantics and proof theory of linear logic , 1988 .

[6]  Hendrik Pieter Barendregt,et al.  Needed Reduction and Spine Strategies for the Lambda Calculus , 1987, Inf. Comput..

[7]  Mario Coppo,et al.  An Extended Polymorphic Type System for Applicative Languages , 1980, MFCS.

[8]  Clement A. Baker-Finch,et al.  Relevant Logic and Strictness Analysis , 1992, WSA.

[9]  Nuel D. Belnap,et al.  Entailment : the logic of relevance and necessity , 1975 .

[10]  Alberto Ferrari,et al.  Type Inference, Abstract Interpretation and Strictness Analysis , 1993, Theor. Comput. Sci..

[11]  Bart Jacobs,et al.  Semantics of Weakening and Contraction , 1994, Ann. Pure Appl. Log..

[12]  Gordon D. Plotkin,et al.  A Semantics for Type Checking , 1991, TACS.

[13]  Benjamin Goldberg,et al.  Detecting sharing of partial applications in functional programs , 1987, FPCA.

[14]  Haskell B. Curry,et al.  Combinatory Logic, Volume I , 1959 .

[15]  Thomas P. Jensen,et al.  Strictness Analysis in Logical Form , 1991, FPCA.

[16]  David A. Wright,et al.  A New Technique for Strictness Analysis , 1991, TAPSOFT, Vol.2.

[17]  Philip Wadler Is there a use for linear logic , 1991 .

[18]  Glen Helman Completeness of the normal typed fragment of the λ-system U , 1977, J. Philos. Log..

[19]  Torben Æ. Mogensen,et al.  A Backwards Analysis for Compile-time Garbage Collection , 1990, ESOP.

[20]  David Amson Wright,et al.  Reduction types and intensionality in the lambda-calculus , 1992 .

[21]  J. Michael Dunn,et al.  Relevance Logic and Entailment , 1986 .

[22]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[23]  Tsung-Min Kuo,et al.  Strictness analysis: a new perspective based on type inference , 1989, FPCA.

[24]  Jörg H. Siekmann Unification Theory , 1989, J. Symb. Comput..

[25]  Jan Willem Klop,et al.  Combinatory reduction systems , 1980 .

[26]  Paul Hudak,et al.  Higher-order strictness analysis in untyped lambda calculus , 1986, POPL '86.

[27]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[28]  Alan Mycroft,et al.  The Theory and Practice of Transforming Call-by-need into Call-by-value , 1980, Symposium on Programming.

[29]  Nick Benton Strictness Logic and Polymorphic Invariance , 1992, LFCS.