A Two-Level Linear Dependent Type Theory
Qiancheng Fu, Hongwei Xi
TL;DR
The paper presents TLL, a two-level linear dependent type theory that separates logic from programs to track resources precisely while allowing proofs to be erased. It develops a rigorous erasure procedure and a heap semantics to ensure extracted programs run with memory safety, and provides meta-theoretic results (confluence, normalization, subject reduction) formalized in Coq with an OCaml compiler producing C code. By reflecting program-level terms into the logical level, it achieves code sharing between fragments and supports sort-polymorphism and linear inductive types. This work offers a unified framework for writing resource-safe programs and verifying their correctness, with practical tooling and clear avenues for future extensions.
Abstract
We present a type theory combining both linearity and dependency by stratifying typing rules into a level for logics and a level for programs. The distinction between logics and programs decouples their semantics, allowing the type system to assume tight resource bounds. A natural notion of irrelevancy is established where all proofs and types occurring inside programs are fully erasable without compromising their operational behavior. Through a heap-based operational semantics, we show that extracted programs always make computational progress and run memory clean. Additionally, programs can be freely reflected into the logical level for conducting deep proofs in the style of standard dependent type theories. This enables one to write resource safe programs and verify their correctness using a unified language.
