Skip to main content
QUICK REVIEW

[Paper Review] A Theory of Higher-Order Subtyping with Type Intervals (Extended Version)

Sandro Stucki, Paolo G. Giarrusso|arXiv (Cornell University)|Jul 5, 2021
Logic, programming, and type systemsComputer Science43 references3 citations
TL;DR

This paper introduces 𝐹𝜔··, a formal theory of higher-order subtyping with type intervals that unifies bounded polymorphism, type operators, and translucent type definitions in Scala’s higher-kinded types. By extending 𝐹𝜔<: with interval kinds, the framework enables a unified, type-safe treatment of complex type-level abstractions, with machine-checked proofs of type safety, kind safety, and weak normalization via hereditary substitution in Agda.

ABSTRACT

The calculus of Dependent Object Types (DOT) has enabled a more principled and robust implementation of Scala, but its support for type-level computation has proven insufficient. As a remedy, we propose $F^\omega_{..}$, a rigorous theoretical foundation for Scala's higher-kinded types. $F^\omega_{..}$ extends $F^\omega_{<:}$ with interval kinds, which afford a unified treatment of important type- and kind-level abstraction mechanisms found in Scala, such as bounded quantification, bounded operator abstractions, translucent type definitions and first-class subtyping constraints. The result is a flexible and general theory of higher-order subtyping. We prove type and kind safety of $F^\omega_{..}$, as well as weak normalization of types and undecidability of subtyping. All our proofs are mechanized in Agda using a fully syntactic approach based on hereditary substitution.

Motivation & Objective

  • To address the lack of a rigorous theoretical foundation for Scala’s higher-kinded types, which are essential in the standard library but unsupported by the DOT calculus.
  • To unify diverse type-level abstractions—bounded quantification, bounded type operators, and translucent type definitions—under a single formalism.
  • To provide a machine-checked, syntactic foundation for subtyping in higher-kinded type systems using hereditary substitution.
  • To enable first-class subtyping constraints and support for dependent kinds through interval kinds.
  • To resolve longstanding implementation challenges in Scala 3 by formalizing the semantics of higher-kinded types with type intervals.

Proposed method

  • Extends the 𝐹𝜔<: calculus with interval kinds, where type variables are constrained by lower and upper bounds, forming intervals 𝐴..𝐵.
  • Introduces first-class type inequations via bindings of the form 𝑋: 𝐴..𝐵, which reflect subtyping constraints directly in the type system.
  • Employs a fully syntactic approach based on hereditary substitution to formalize type and kind reduction, ensuring precise control over substitution and type safety.
  • Uses Agda to mechanize all proofs, including type safety, kind safety, weak normalization of types, and undecidability of subtyping.
  • Supports advanced features like bounded polymorphism, first-class subtyping constraints, and recursive type definitions through interval-based abstractions.
  • Encodes complex type systems (e.g., intersection types, recursive types) by postulating abstract type operators and their subtyping rules as interval constraints.

Experimental results

Research questions

  • RQ1How can bounded polymorphism, bounded type operators, and translucent type definitions be uniformly formalized within a single higher-order subtyping framework?
  • RQ2Can interval kinds provide a principled foundation for Scala’s higher-kinded types that the DOT calculus cannot?
  • RQ3How can first-class subtyping constraints be integrated into a higher-kinded type system without sacrificing type safety?
  • RQ4What is the impact of interval kinds on the metatheory of type systems, particularly regarding normalization and decidability?
  • RQ5Can the resulting system support advanced type-level abstractions like intersection and recursive types through interval-based encoding?

Key findings

  • The calculus 𝐹𝜔·· provides a unified, formal foundation for Scala’s higher-kinded types, subsuming bounded quantification, bounded type operators, and translucent type definitions through interval kinds.
  • The system is formally proven to be type safe and kind safe, with all proofs mechanized in Agda using hereditary substitution.
  • Weak normalization of types is established, ensuring that all type reduction sequences terminate.
  • Subtyping in 𝐹𝜔·· is undecidable, which is shown via a reduction from the undecidability of subtyping in related systems.
  • The framework supports encoding of advanced type constructs—such as intersection types and recursive types—by postulating abstract type operators and their associated subtyping rules as interval constraints.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.