Usage analysis with natural reduction types

  • David A. Wright
  • Clement A. Baker-Finch
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 724)


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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. R. Anderson and N. D. Belnap, Jr. Entailment: The Logic of Relevance and Necessity. Princeton University Press, 1975.Google Scholar
  2. [2]
    A. Avron. The semantics and proof theory of linear logic. Theoretical Computer Science, 57:161–184, 1988.Google Scholar
  3. [3]
    C. A. Baker-Finch. Relevant logic and strictness analysis. In Workshop on Static Analysis, LaBRI, Bordeaux, pages 221–228. Bigre 81–82, 1992.Google Scholar
  4. [4]
    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.Google Scholar
  5. [5]
    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.Google Scholar
  6. [6]
    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.Google Scholar
  7. [7]
    P.N. Benton. Strictness Logic and Polymorphic Invariance. In Logical Foundations of Computer Science, pages 33–44, 20–24 July 1992.Google Scholar
  8. [8]
    G.L. Burn, C.L. Hankin, and S. Abramsky. Strictness analysis for higher-order functions. Science of Computer Programming, 7:249–278, 1986.Google Scholar
  9. [9]
    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.Google Scholar
  10. [10]
    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.Google Scholar
  11. [11]
    M. Coppo. Type Inference, Abstract Interpretation and Strictness Analysis. Draft manuscript, 1992.Google Scholar
  12. [12]
    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.Google Scholar
  13. [13]
    H.B. Curry and R. Feys. Combinatory Logic, Volume 1. Studies in Logic and the Foundations of Mathematics. North-Holland, 1958.Google Scholar
  14. [14]
    J. M. Dunn. Relevance logic and entailment. In D. Gabbay and F. Guenthner, editors, Handbook of Philosophical Logic, Vol. III. D. Reidel, 1986.Google Scholar
  15. [15]
    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.Google Scholar
  16. [16]
    G. Helman. Completeness of the normal typed fragment of the λ-system U. Journal of Philosophical Logic, 6:33–46, 1977.Google Scholar
  17. [17]
    G. Helman. Restricted Lambda Abstraction and the Interpretation of Some Non-Classical Logics. PhD thesis, University of Pittsburgh, 1977.Google Scholar
  18. [18]
    J.R. Hindley. The Completeness Theorem for Typing λ-terms. Theoretical Computer Science, 22:1–17, 1983.Google Scholar
  19. [19]
    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.Google Scholar
  20. [20]
    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.Google Scholar
  21. [21]
    Bart Jacobs. Semantics of weakening and contraction. Technical report, Department of Pure Mathematics, University of Cambridge, 1992.Google Scholar
  22. [22]
    T.P. Jensen. Strictness Analysis in Logical Form, 1991.Google Scholar
  23. [23]
    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.Google Scholar
  24. [24]
    J.W. Klop. Combinatory Reduction Systems. PhD thesis, State University of Utrecht, 1980.Google Scholar
  25. [25]
    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.Google Scholar
  26. [26]
    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.Google Scholar
  27. [27]
    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.Google Scholar
  28. [28]
    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.Google Scholar
  29. [29]
    P. Sestoft. Analysis and Efficient Implementation of Functional Programs. PhD thesis, DIKU, University of Copenhagen, 1991.Google Scholar
  30. [30]
    J.H. Siekmann. Unification Theory. Journal of Symbolic Computation, 7:207–274, 1989.Google Scholar
  31. [31]
    P. Wadler. Is there a use for Linear Logic? In Partial Evaluation and Program Manipulation. ACM Press, 1991.Google Scholar
  32. [32]
    D.A. Wright. Strictness Analysis Via (Type) Inference. Technical Report TR89-3, University of Tasmania, September 1989.Google Scholar
  33. [33]
    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.Google Scholar
  34. [34]
    D.A. Wright. Reduction Types and Intensionality in the Lambda-Calculus. PhD thesis, University of Tasmania, 1992.Google Scholar

Copyright information

© Springer-Verlag 1993

Authors and Affiliations

  • David A. Wright
    • 1
  • Clement A. Baker-Finch
    • 2
  1. 1.Department of Computer ScienceUniversity of TasmaniaHobartAustralia
  2. 2.Information Sciences and Eng.University of CanberraCanberraAustralia

Personalised recommendations