Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time

  • Dirk Dussart
  • Fritz Henglein
  • Christian Mossin
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 983)


The combination of parameter polymorphism, subtyping extended to qualified and polymorphic types, and polymorphic recursion is useful in standard type inference and gives expressive type-based program analyses, but raises difficult algorithmic problems.

In a program analysis context we show how Mycroft's iterative method of computing principal types for a type system with polymorphic recursion can be generalized and adapted to work in a setting with subtyping. This does not only yield a proof of existence of principal types (most general properties), but also an algorithm for computing them. The punch-line of the development is that a very simple modification of the basic algorithm reduces its computational complexity from exponential time to polynomial time relative to the size of the given, explicitly typed program.

This solves the open problem of finding an inference algorithm for polymorphic binding-time analysis [7].


Type System Type Scheme Inference Algorithm Type Inference Principal Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. Aiken, E. L. Wimmers, and T. Lakshman. Soft typing with conditional types. In Proc. 21st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Portland, Oregon. ACM, ACM Press, Jan. 1994.Google Scholar
  2. 2.
    J. Cai and R. Paige. Program derivation by fixed point computation. Science of Computer Programming, 11:197–261, 1989.Google Scholar
  3. 3.
    C. Consel, P. Jouvelot, and P. Ørbæk. Seperate polyvariant binding time reconstruction. Technical Report CRI Report A/261, Ecole des Mines, Oct. 1994.Google Scholar
  4. 4.
    L. Damas. Type Assignment in Programming Languages. PhD thesis, University of Edinburgh, 1984. Technical Report CST-33–85 (1985).Google Scholar
  5. 5.
    L. Damas and R. Milner. Principal type schemes for functional programs. In Proc. 9th Annual ACM Symp. on Principles of Programming Languages, pages 207–212, Jan. 1982.Google Scholar
  6. 6.
    F. Henglein. Type inference and semi-unification. In Proc. ACM Conf. on LISP and Functional Programming (LFP), Snowbird, Utah, pages 184–197. ACM Press, July 1988.Google Scholar
  7. 7.
    F. Henglein and C. Mossin. Polymorphic binding-time analysis. In D. Sanella, editor, 5th European Symposium on Programming, LNCS 788, pages 287–301. Springer-Verlag, 1994.Google Scholar
  8. 8.
    M. Jones. A theory of qualified types. In Proc. 4th European Symposium on Programming (ESOP), Rennes, France, volume 582 of Lecture Notes in Computer Science, pages 287–306. Springer-Verlag, Feb. 1992.Google Scholar
  9. 9.
    S. Kaes. Type inference in the presence of overloading, subtyping, and recursive types. In Proc. ACM Conf. on LISP and Functional Programming (LFP), San Francisco, California, pages 193–204. ACM Press, June 1992.Google Scholar
  10. 10.
    A. Kfoury, J. Tiuryn, and P. Urzyczyn. The undecidability of the semi-unification problem. Technical Report BUCS-89-010, Boston University, Oct. 1989. also in Proc. of Symp. on Theory of Computing, Baltimore, Maryland, May 1990.Google Scholar
  11. 11.
    R. Milner. A theory of type polymorphism in programming. J. Computer and System Sciences, 17:348–375, 1978.Google Scholar
  12. 12.
    A. Mycroft. Polymorphic type schemes and recursive definitions. In Proc. 6th Int. Conf. on Programming, LNCS 167, 1984.Google Scholar
  13. 13.
    H. Nielson and F. Nielson. Automatic binding time analysis for a typed lambda calculus. Science of Computer Programming, 10:139–176, 1988.Google Scholar
  14. 14.
    M. Rittri. Dimension inference under polymorphic recursion. In Proc. Conf. on Functional Programming Languages and Computer Architecture (FPCA), San Diego, California. ACM Press, June 1995.Google Scholar
  15. 15.
    G. S. Smith. Polymorphic type inference with overloading and subtyping. In Proc. Theory and Practice of Software Development (TAPSOFT), Orsay, France, volume 668 of Lecture Notes in Computer Science, pages 671–685. Springer-Verlag, April 1993.Google Scholar
  16. 16.
    M. Tofte. Personal communication, June 1995.Google Scholar
  17. 17.
    M. Tofte and J.-P. Talpin. Implementation of the typed call-by-value λ-calculus using a stack of regions. In Proc. 21st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Portland, Oregon (this proceedings). ACM, ACM Press, Jan. 1994.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Dirk Dussart
    • 1
  • Fritz Henglein
    • 2
  • Christian Mossin
    • 2
  1. 1.K.U.LeuvenBelgium
  2. 2.DIKUDenmark

Personalised recommendations