Scala's type system unifies aspects of ML modules, object-oriented, and functional programming. The Dependent Object Types (DOT) family of calculi has been proposed as a new theoretic foundation for Scala and similar expressive languages. Unfortunately, it is not clear how DOT relates to well-studied type systems from the literature, and type soundness has only been established for very restricted subsets. In fact, it has been shown that important Scala features such as type refinement or a subtyping relation with lattice structure break at least one key metatheoretic property such as environment narrowing or subtyping transitivity, which are usually required for a type soundness proof. The first main contribution of this paper is to demonstrate how, perhaps surprisingly, even though these properties are lost in their full generality, a rich DOT calculus that includes both type refinement and a subtyping lattice with intersection types can still be proved sound. The key insight is that narrowing and subtyping transitivity only need to hold for runtime objects, but not for code that is never executed. Alas, the dominant method of proving type soundness, Wright and Felleisen's syntactic approach, is based on term rewriting, which does not a priori make a distinction between runtime and type assignment time. The second main contribution of this paper is to demonstrate how type soundness proofs for advanced, polymorphic, type systems can be carried out with an operational semantics based on high-level, definitional interpreters, implemented in Coq. We present the first mechanized soundness proof in this style for System F<: and several extensions, including mutable references. Our proofs use only straightforward induction, which is another surprising result, as the combination of big-step semantics, mutable references, and polymorphism is commonly believed to require co-inductive proof techniques. The third main contribution of this paper is to show how DOTlike calculi emerge from straightforward generalizations of the operational aspects of F<:, exposing a rich design space of calculi with path-dependent types inbetween System F and DOT, which we collectively call System D. Armed with the insights gained from the definitional interpreter semantics, we also show how equivalent small-step semantics and soundness proofs in the style of Wright and Felleisen can be derived for these systems.
Soundness results with mechanized proofs for versions of System D <: and DOT similar to the ones presented here (but still based on big-step semantics) were only recently established REF .
From F to DOT: Type Soundness Proofs with Definitional Interpreters
ArXiv
ArXiv
Computer Science