Staged Compilation with Two-Level Type Theory
Andr\'as Kov\'acs

TL;DR
This paper demonstrates how two-level type theory (2LTT) can be effectively used for staged compilation with dependent types, providing a correct staging algorithm and establishing strong conservativity over the object theory.
Contribution
It introduces a novel staged compilation approach using 2LTT, including a staging-by-evaluation algorithm and proof of its correctness, supporting full dependent types.
Findings
Staging-by-evaluation technique for 2LTT.
Proof of correctness and conservativity of the staging algorithm.
Supports full dependent types and unrestricted staging.
Abstract
The aim of staged compilation is to enable metaprogramming in a way such that we have guarantees about the well-formedness of code output, and we can also mix together object-level and meta-level code in a concise and convenient manner. In this work, we observe that two-level type theory (2LTT), a system originally devised for the purpose of developing synthetic homotopy theory, also serves as a system for staged compilation with dependent types. 2LTT has numerous good properties for this use case: it has a concise specification, well-behaved model theory, and it supports a wide range of language features both at the object and the meta level. First, we give an overview of 2LTT's features and applications in staging. Then, we present a staging algorithm and prove its correctness. Our algorithm is "staging-by-evaluation", analogously to the technique of normalization-by-evaluation, in…
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.
