Lune

OOPSLA2026顶会

First-Class Refinement Types for Scala

Matt Bovel, Viktor Kunčak, Martin Odersky

摘要

Refinement types—types qualified with logical predicates—have proven effective for lightweight verification in languages like Liquid Haskell, F*, and Dafny. However, in these systems refinements are either written in a separate specification language or treated as second-class annotations, disconnected from the host language's type system. This disconnect creates usability barriers: programmers must maintain two mental models, and refinements cannot interact with features like type inference, subtyping, or overloading. We present the design of first-class refinement types for Scala 3, where refinements are ordinary types that participate in subtyping, inference, and pattern matching alongside existing language features. We prove type soundness of a core, pure calculus mechanized in Rocq, combining dependent function types, bounded polymorphism, positive equi-recursive types, union and intersection types, and refinement types, using a fuel-bounded definitional interpreter and semantic typing. A distinctive design choice is our partial-correctness semantics: predicates are arbitrary terms that may diverge, and type soundness requires no termination assumptions. Finally, we implement our design as a prototype extension of the Scala 3 compiler with a lightweight e-graph-based solver for predicate entailment.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

可以从这些问题问起

Lune 可以查阅

全文 · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Flux: Liquid Types for Rust 引用了 RefinedC: automating the foundational verification of C code with refined ownership types
  • RefinedC: automating the foundational verification of C code with refined ownership types 引用了 HACL: A Verified Modern Cryptographic Library
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

它引用的 Paper14

  1. HACL*: A Verified Modern Cryptographic LibraryJean Karim Zinzindohoué, Karthikeyan Bhargavan, Jonathan Protzenko, Benjamin BeurdoucheCCS 2017 · 258 次引用
  2. egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt 等POPL 2021 · 170 次引用
  3. Verus: Verifying Rust Programs using Linear Ghost TypesAndrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun 等OOPSLA 2023 · 86 次引用
  4. RefinedC: automating the foundational verification of C code with refined ownership typesMichael Sammler, Rodolphe Lepigre, Robbert Krebbers, Kayvan Memarian 等PLDI 2021 · 83 次引用
  5. Flux: Liquid Types for RustNico Lehmann, Adam T. Geller, Niki Vazou, Ranjit JhalaPLDI 2023 · 29 次引用

相关 Paper

  1. Undecidability of d<: and its decidable fragmentsJason Z. S. Hu, Ondrej LhotákPOPL 2020 · 9 次引用
  2. PLEX: Normalization for Refinement TypesAlessio Ferrarini, Niki Vazou, Wouter SwierstraOOPSLA 2026
  3. Data flow refinement type inferenceZvonimir Pavlinovic, Yusen Su, Thomas WiesPOPL 2021 · 15 次引用
  4. Quotient Haskell: Lightweight Quotient Types for AllBrandon Hewer, Graham HuttonPOPL 2024 · 3 次引用
  5. Resolution as intersection subtyping via Modus PonensKoar Marntirosian, Tom Schrijvers, Bruno C. d. S. Oliveira, Georgios KarachaliasOOPSLA 2020 · 5 次引用
黄昏的海面,两侧是细线勾勒的悬崖