Intensional Datatype Refinement
Eddie Jones, Steven Ramsay

TL;DR
This paper introduces a refinement type system that automatically verifies pattern-match safety in functional programs, combining algebraic datatypes with structural subtyping and intersection, enabling efficient analysis.
Contribution
It presents a novel, fully automatic, sound, and complete type inference system for pattern-match safety, with linear-time complexity and a prototype implementation for Haskell.
Findings
Prototype analyzes Haskell packages in milliseconds
Type inference is linear-time and fully automatic
System extends ML-style types with structural subtyping and intersection
Abstract
The pattern-match safety problem is to verify that a given functional program will never crash due to non-exhaustive patterns in its function definitions. We present a refinement type system that can be used to solve this problem. The system extends ML-style type systems with algebraic datatypes by a limited form of structural subtyping and environment-level intersection. We describe a fully automatic, sound and complete type inference procedure for this system which, under reasonable assumptions, is worst-case linear-time in the program size. Compositionality is essential to obtaining this complexity guarantee. A prototype implementation for Haskell is able to analyse a selection of packages from the Hackage database in a few hundred milliseconds.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Formal Methods in Verification · Software Engineering Research
