Results 1  10
of
20
A Calculus for Overload Functions with Subtyping

, 1992
"... We present a simple extension of typed calculus where functions can be overloaded by putting different "branches of code" together. When the function is applied, the branch to execute is chosen according to a particular selection rule which depends on the type of the argument. The cru ..."
Abstract

Cited by 139 (28 self)
 Add to MetaCart
We present a simple extension of typed calculus where functions can be overloaded by putting different "branches of code" together. When the function is applied, the branch to execute is chosen according to a particular selection rule which depends on the type of the argument. The crucial feature of the present approach is that the branch selection depends on the "runtime type" of the argument, which may differ from its compiletime type, because of the existence of a subtyping relation among types. Hence overloading cannot be eliminated by a static analysis of code, but is an essential feature to be dealt with during computation. We obtain in this way a typedependent calculus, which differs from the various calculi where types do not play any role during computation. We prove Confluence and a generalized SubjectReduction theorem for this calculus. We prove Strong Normalization for a "stratified" subcalculus. The definition of this calculus is guided by the understand...
Inheritance As Implicit Coercion
 Information and Computation
, 1991
"... . We present a method for providing semantic interpretations for languages with a type system featuring inheritance polymorphism. Our approach is illustrated on an extension of the language Fun of Cardelli and Wegner, which we interpret via a translation into an extended polymorphic lambda calculus. ..."
Abstract

Cited by 120 (3 self)
 Add to MetaCart
. We present a method for providing semantic interpretations for languages with a type system featuring inheritance polymorphism. Our approach is illustrated on an extension of the language Fun of Cardelli and Wegner, which we interpret via a translation into an extended polymorphic lambda calculus. Our goal is to interpret inheritances in Fun via coercion functions which are definable in the target of the translation. Existing techniques in the theory of semantic domains can be then used to interpret the extended polymorphic lambda calculus, thus providing many models for the original language. This technique makes it possible to model a rich type discipline which includes parametric polymorphism and recursive types as well as inheritance. A central difficulty in providing interpretations for explicit type disciplines featuring inheritance in the sense discussed in this paper arises from the fact that programs can typecheck in more than one way. Since interpretations follow the type...
Coherence for Qualified Types
, 1993
"... The meaning of programs in a language with implicit overloading can be described by translating them into a second language that makes the use of overloading explicit. A single program may have many distinct translations and it is important to show that any two translations are semantically equivale ..."
Abstract

Cited by 91 (9 self)
 Add to MetaCart
The meaning of programs in a language with implicit overloading can be described by translating them into a second language that makes the use of overloading explicit. A single program may have many distinct translations and it is important to show that any two translations are semantically equivalent to ensure that the meaning of the original program is welldefined. This property is commonly known as coherence. This paper deals with an implicitly typed language that includes support for parametric polymorphism and overloading based on a system of qualified types. Typical applications include Haskell type classes, extensible records and subtyping. In the general case, it is possible to find examples for which the coherence property does not hold. Extending the development of a type inference algorithm for this language to include the calculation of translations, we give a simple syntactic condition on the principal type scheme of a term that is sufficient to guarantee coherence for a large class of programs. One of the most interesting aspects of this work is the use of terms in the target language to provide a semantic interpretation for the ordering relation between types that is used to establish the existence of principal types. On a practical level, our results explain the importance of unambiguous type schemes in Haskell.
Coinductive Axiomatization of Recursive Type Equality and Subtyping
, 1998
"... e present new sound and complete axiomatizations of type equality and subtype inequality for a firstorder type language with regular recursive types. The rules are motivated by coinductive characterizations of type containment and type equality via simulation and bisimulation, respectively. The mai ..."
Abstract

Cited by 66 (2 self)
 Add to MetaCart
e present new sound and complete axiomatizations of type equality and subtype inequality for a firstorder type language with regular recursive types. The rules are motivated by coinductive characterizations of type containment and type equality via simulation and bisimulation, respectively. The main novelty of the axiomatization is the fixpoint rule (or coinduction principle), which has the form A; P ` P A ` P (Fix) where P is either a type equality = 0 or type containment 0 and the proof of the premise must be contractive in a formal sense. In particular, a proof of A; P ` P using the assumption axiom is not contractive. The fixpoint rule embodies a finitary coinduction principle and thus allows us to capture a coinductive relation in the fundamentally inductive framework of inference systems. The new axiomatizations are more concise than previous axiomatizations, particularly so for type containment since no separate axiomatization of type equality is required, as in A...
A semantic basis for Quest
 JOURNAL OF FUNCTIONAL PROGRAMMING
, 1991
"... Quest is a programming language based on impredicative type quantifiers and subtyping within a threelevel structure of kinds, types and type operators, and values. The semantics of Quest is rather challenging. In particular, difficulties arise when we try to model simultaneously features such as c ..."
Abstract

Cited by 64 (13 self)
 Add to MetaCart
Quest is a programming language based on impredicative type quantifiers and subtyping within a threelevel structure of kinds, types and type operators, and values. The semantics of Quest is rather challenging. In particular, difficulties arise when we try to model simultaneously features such as contravariant function spaces, record types, subtyping, recursive types, and fixpoints. In this paper we describe in detail the type inference rules for Quest, and we give them meaning using a partial equivalence relation model of types. Subtyping is interpreted as in previous work by Bruce and Longo, but the interpretation of some aspects, namely subsumption, power kinds, and record subtyping, is novel. The latter is based on a new encoding of record types. We concentrate on modeling quantifiers and subtyping; recursion is the subject of current work.
Extensible records in a pure calculus of subtyping
 In Theoretical Aspects of ObjectOriented Programming
, 1994
"... Extensible records were introduced by Mitchell Wand while studying type inference in a polymorphic λcalculus with record types. This paper describes a calculus with extensible records, F <:ρ, that can be translated into a simpler calculus, F <: , lacking any record primitives. Given independe ..."
Abstract

Cited by 38 (9 self)
 Add to MetaCart
Extensible records were introduced by Mitchell Wand while studying type inference in a polymorphic λcalculus with record types. This paper describes a calculus with extensible records, F <:ρ, that can be translated into a simpler calculus, F <: , lacking any record primitives. Given independent axiomatizations of F <:ρ and F <: (the former being an extension of the latter) we show that the translation preserves typing, subtyping, and equality. F <:ρ can then be used as an expressive calculus of extensible records, either directly or to give meaning to yet other languages. We show that F <:ρ can express many of the standard benchmark examples that appear in the literature. Like other record calculi that have been proposed, F <:ρ has a rather complex set of rules but, unlike those other calculi, its rules are justified by a translation to a very simple calculus. We argue that thinking in terms of translations may help in simplifying and organizing the various record calculi that have been proposed, as well as in generating new ones.
Formally optimal boxing
 In POPL '94 [37
"... An important implementation decision in polymorphically typed functional programming languages is whether to represent data in boxed or unboxed form and when to transform them from one representation to the other. Using a language with explicit representation types and boxing/unboxing operations w ..."
Abstract

Cited by 38 (0 self)
 Add to MetaCart
An important implementation decision in polymorphically typed functional programming languages is whether to represent data in boxed or unboxed form and when to transform them from one representation to the other. Using a language with explicit representation types and boxing/unboxing operations we axiomatize equationally the set of all explicitly boxed versions, called completions, of a given source program. In a twostage process we give some of the equations a rewriting interpretation that captures eliminating boxing/unboxing operations without relying on a specific implementation or even semantics of the underlying language. The resulting reduction systems operate on congruence classes of completions defined by the remaining equations E, which can be understood as moving boxing/unboxing operations along data flow paths in the source program. We call a completion eopt formally optimal if every other completion for the same program (and at the same representation type) reduces to eopt under this twostage reduction. We show that every source program has formally optimal completions, which are unique modulo E. This is accomplished by first “polarizing ” the equations in E and orienting them to obtain two canonical (confluent and strongly normalizing) rewriting systems. The completions produced by Leroy’s and Poulsen’s algorithms are generally not formally optimal in our sense. The rewriting systems have been implemented and applied to some simple Standard ML programs. Our results show that the amount of boxing and unboxing operations is also in practice substantially reduced in comparison to Leroy’s completions. This analysis is intended to be integrated into Tofte’s regionbased implementation of Standard ML currently underway at DIKU.
Divergence of F≤ Type Checking
"... System F≤ is an extension of secondorder typed lambda calculus, where a subtype hierarchy among types is defined, and bounded secondorder lambda abstraction is allowed. This language is a basis for much of the current research on integration of typed functional languages with subtypes and inherita ..."
Abstract

Cited by 14 (4 self)
 Add to MetaCart
System F≤ is an extension of secondorder typed lambda calculus, where a subtype hierarchy among types is defined, and bounded secondorder lambda abstraction is allowed. This language is a basis for much of the current research on integration of typed functional languages with subtypes and inheritance. An algorithm to perform type checking for F≤ expressions has been known since the language Fun was defined. The algorithm has been proved complete, by the author and P.L. Curien, which means that it is a semidecision procedure for the typechecking problem. In this paper we show that this algorithm is not a decision procedure, by exhibiting a term which makes it diverge. This result was the basis of Pierce's proof of undecidability of typing for F≤. We study the behavior of the algorithm to show that our diverging judgement is in some sense contained in any judgement which makes the algorithm diverge. On the basis of this result, and of other results in the paper, we claim that the c...
Completely Bounded Quantification is Decidable
 In ACM SIGPLAN Workshop on ML and its Applications
, 1992
"... This paper proves the decidability of subtyping for F when the bounds on polymorphic types do not contain Top (i.e., in all types of the form 8ff!:ø 1 :ø 2 , ø 1 does not contain Top). This general restriction is subsequently relaxed to allow unbounded quantification. 1 Introduction F [CW85,CG] is ..."
Abstract

Cited by 14 (3 self)
 Add to MetaCart
This paper proves the decidability of subtyping for F when the bounds on polymorphic types do not contain Top (i.e., in all types of the form 8ff!:ø 1 :ø 2 , ø 1 does not contain Top). This general restriction is subsequently relaxed to allow unbounded quantification. 1 Introduction F [CW85,CG] is a typed calculus with subtyping and bounded secondorder polymorphism. The importance of F in programming language design is that it provides a simple context for studying the typing problems that arise when subtyping and bounded quantification are added to polymorphic languages such as ML. Curien and Ghelli [CG] recently developed a subtyping algorithm for F and proved its partial correctness. Subsequently, Ghelli [Ghe90] presented a termination proof for this algorithm. A mistake was discovered in this termination proof, following which Pierce [Pie92] presented a proof showing that the subtyping problem for general F types is undecidable. This paper shows how one can make the subtyping p...
Foundations for the Implementation of HigherOrder Subtyping
, 1997
"... We show how to implement a calculus with higherorder subtyping and subkinding by replacing uses of implicit subsumption with explicit coercions. To ensure this can be done, a polymorphic function is adjusted to take, as an additional argument, a proof that its type constructor argument has the desi ..."
Abstract

Cited by 13 (6 self)
 Add to MetaCart
We show how to implement a calculus with higherorder subtyping and subkinding by replacing uses of implicit subsumption with explicit coercions. To ensure this can be done, a polymorphic function is adjusted to take, as an additional argument, a proof that its type constructor argument has the desired kind. Such a proof is extracted from the derivation of a kinding judgement and may in turn require proof coercions, which are extracted from subkinding judgements. This technique is formalized as a typedirected translation from a calculus of higherorder subtyping to a subtypingfree calculus. This translation generalizes an existing result for secondorder subtyping calculi (such as F ). We also discuss two interpretations of subtyping, one that views it as type inclusion and another that views it as the existence of a wellbehaved coercion, and we show, by a typetheoretic construction, that our translation is the minimum consequence of shifting from the inclusion interpretation to th...