Proofs about a Folklore Let - Polymorphic TypeInference

نویسندگان

  • OUKSEH LEE
  • KWANGKEUN YI
چکیده

The Hindley/Milner let-polymorphic type inference system has two diierent algorithms: one is the de facto standard Algorithm W that is bottom-up (or context-insensitive), and the other is a \folklore" algorithm that is top-down (or context-sensitive). Because the latter algorithm has not been formally presented with its soundness and completeness proofs, and its relation with the W algorithm has not been rigorously investigated, its use in place of (or in combination with) W is not well founded. In this article, we formally deene the context-sensitive, top-down type inference algorithm (named \M"), prove its soundness and completeness, and show a distinguishing property that M always stops earlier than W if the input program is ill typed. Our proofs can be seen as theoretical justiications for various type-checking strategies being used in practice. 1. INTRODUCTION Algorithm W , which is the standard presentation of the Hindley/Milner let-poly-morphic type inference system, fails late if the input program has a type error. Because the algorithm fails only at an application expression where its two subex-pressions (function and argument) have connicting types, an erroneous expression is often successfully type-checked long before its consequence collides at an application expression. This \bottom-up" Algorithm W thus reports the whole application expression as the problem area, implying some of its subexpressions are ill typed. Such a large type-error message does not help the programmer to nd the cause of the type problem. A diierent type inference algorithm, which has been used in an early ML compiler Leroy 1993], can cure this problem. This folklore algorithm carries a type

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Proving Lazy Folklore with Mixed Lazy/strict Semantics

Abstract. Explicit enforcement of strictness is used by functional programmers for many different purposes. Few functional programmers, however, are aware that explicitly enforcing strictness has serious consequences for (formal) reasoning about their programs. Some vague “folklore” knowledge has emerged concerning the correspondence between lazy and strict evaluation but this is based on exper...

متن کامل

An Anthropological Study of Folklore in Gilan Province with a focus on Lullabies

Folklore is the body of expressive culture, including tales, music, dance, legends, oral history, proverbs and Lullabies. Study about lullabies as part of Folklore is relatively new science, however collection of its material is a very difficult job because this treasure mostly collected and obtained from the memory of illiterate and uneducated people. It needs a great effort and stability for ...

متن کامل

Undecidability of Type-Checking in Domain-Free Typed Lambda-Calculi with Existence

This paper shows undecidability of type-checking and typeinference problems in domain-free typed lambda-calculi with existential types: a negation and conjunction fragment, and an implicational fragment. These are proved by reducing type-checking and type-inference problems of the domain-free polymorphic typed lambda-calculus to those of the lambda-calculi with existential types by continuation...

متن کامل

Let-Polymorphism and Eager Type Schemes

This paper presents a new algorithm for polymorphic type inferencing involving the let contruct of ML. It avoids the gen operation of the algorithm W of Damas and Milner. This new algorithm is a closer counterpart to the proof-theoretic formulation of the ML typing discipline than other approaches. Sketches of the proofs of correctness, including completeness for the let case, are also given. T...

متن کامل

Hugo Luiz MARIANO and Francisco MIRAGLIA PROFINITE STRUCTURES ARE RETRACTS OF ULTRAPRODUCTS OF FINITE STRUCTURES

The results presented here first appeared in Chapter 2 of [Mrn1] and were announced with proofs in [MM1]. Our motivation came from [KMS], that introduces the class of direct limits of finite abstract order spaces, a theory due to M. Marshall ([Mar1]). The theory of special groups, introduced in [DM2], is a first-order axiomatization of the algebraic theory of quadratic forms, and there is a nat...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1998