Occurrence Typing Modulo Theories
Andrew M. Kent, David Kempe, Sam Tobin-Hochstadt

TL;DR
This paper introduces an advanced type system that combines occurrence typing with dependent refinement types, enabling richer type relationships and solver-backed reasoning in Typed Racket, improving safety guarantees with minimal annotations.
Contribution
It extends occurrence typing with dependent refinement types, formalizes the system, and demonstrates practical safety improvements in Typed Racket programs.
Findings
50% of vector accesses proven safe without new annotations
Near 80% safety proof with minimal annotations
System integrates theories over linear arithmetic and bitvectors
Abstract
We present a new type system combining occurrence typing, previously used to type check programs in dynamically-typed languages such as Racket, JavaScript, and Ruby, with dependent refinement types. We demonstrate that the addition of refinement types allows the integration of arbitrary solver-backed reasoning about logical propositions from external theories. By building on occurrence typing, we can add our enriched type system as an extension of Typed Racket---adding dependency and refinement reuses the existing formalism while increasing its expressiveness. Dependent refinement types allow Typed Racket programmers to express rich type relationships, ranging from data structure invariants such as red-black tree balance to preconditions such as vector bounds. Refinements allow programmers to embed the propositions that occurrence typing in Typed Racket already reasons about into…
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.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
