Foundations and Trends® in Programming Languages > Vol 6 > Issue 3–4

Refinement Types: A Tutorial

By Ranjit Jhala, University of California, San Diego, USA, jhala@cs.ucsd.edu | Niki Vazou, IMDEA Software Institute, Madrid, Spain, niki.vazou@imdea.org

 
Suggested Citation
Ranjit Jhala and Niki Vazou (2021), "Refinement Types: A Tutorial", Foundations and Trends® in Programming Languages: Vol. 6: No. 3–4, pp 159-317. http://dx.doi.org/10.1561/2500000032

Publication Date: 05 Oct 2021
© 2021 Ranjit Jhala and Niki Vazou
 
Subjects
Program Logic,  Program Verification,  Type Theory and Type Systems,  Mechanical Proof Checking
 

Free Preview:

Download extract

Share

Download article
In this article:
1. Introduction
2. Refinement Logic
3. The Simply Typed 𝜆-calculus
4. Branches and Recursion
5. Refinement Inference
6. Type Polymorphism
7. Data Types
8. Refinement Polymorphism
9. Termination
10. Programs as Proofs
11. Related Work
12. Conclusion
References

Abstract

Refinement types enrich a language’s type system with logical predicates that circumscribe the set of values described by the type. These refinement predicates provide software developers a tunable knob with which to inform the type system about what invariants and correctness properties should be checked on their code, and give the type checker a way to enforce those properties at compile time. In this article, we distill the ideas developed in the substantial literature on refinement types into a unified tutorial that explains the key ingredients of modern refinement type systems. In particular, we show how to implement a refinement type checker via a progression of languages that incrementally add features to the language or type system.

DOI:10.1561/2500000032
ISBN: 978-1-68083-884-8
180 pp. $99.00
Buy book (pb)
 
ISBN: 978-1-68083-885-5
180 pp. $280.00
Buy E-book (.pdf)
Table of contents:
1. Introduction
2. Refinement Logic
3. The Simply Typed -calculus
4. Branches and Recursion
5. Refinement Inference
6. Type Polymorphism
7. Data Types
8. Refinement Polymorphism
9. Termination
10. Programs as Proofs
11. Related Work
12. Conclusion
References

Refinement Types: A Tutorial

Refinement types can be the vector that brings formal verification into mainstream software development. This happy outcome hinges upon the design and implementation of refinement type systems that can be retrofitted to existing languages, or co-designed with new ones.

In this book, the authors catalyze the development of such systems by distilling the ideas developed in the sprawling literature on the topic into a coherent and unified tutorial that explains the key ingredients of modern refinement type systems, by showing how to implement a refinement type checker.

Inspired by the nanopass framework for teaching compilation the authors show how to implement refinement types via a progression of languages that incrementally add features to the language or type system.

The readily accessible book provides the reader with an insightful introduction into Refinement Types using an innovative tutorial style that enables fast learning. Furthermore, the accompanying software implementation allows readers to work on practical real-world examples.

 
PGL-032