A logical algorithm for ML type inference

  • Authors:
  • David McAllester

  • Affiliations:
  • Toyota Technological Institute at Chicago

  • Venue:
  • RTA'03 Proceedings of the 14th international conference on Rewriting techniques and applications
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper gives a bottom-up logic programming formulation of the Hindley-Milner polymorphic type inference algorithm. We show that for programs of bounded order and arity the given algorithm runs in O(nα(n) + dn) time where n is the length of the program, d is the "scheme depth" of the program, and α is the inverse of Ackermann's function. It is argued that for practical programs d will not exceed 5 even for programs with hundreds of module layers. This formulation of the Hindley-Milner algorithm is intended as a case study in "logical algorithms", i.e., algorithms presented and analyzed as bottom-up inference rules.