Intrinsically typed compilation with nameless labels
Arjen Rouvoet, Robbert Krebbers, Eelco Visser
Abstract
To avoid compilation errors it is desirable to verify that a compiler is type correct —i.e., given well-typed source code, it always outputs well-typed target code. This can be done intrinsically by implementing it as a function in a dependently typed programming language, such as Agda. This function manipulates data types of well-typed source and target programs, and is therefore type correct by construction. A key challenge in implementing an intrinsically typed compiler is the representation of labels in bytecode. Because label names are global, bytecode typing appears to be inherently a non-compositional, whole-program property. The individual operations of the compiler do not preserve this property, which requires the programmer to reason about labels, which spoils the compiler definition with proof terms. In this paper, we address this problem using a new nameless and co-contextual representation of typed global label binding, which is compositional. Our key idea is to use linearity to ensure that all labels are defined exactly once. To write concise compilers that manipulate programs in our representation, we develop a linear, dependently typed, shallowly embedded language in Agda, based on separation logic. We show that this language enables the concise specification and implementation of intrinsically typed operations on bytecode, culminating in an intrinsically typed compiler for a language with structured control-flow.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 14b35b53-2a11-450e-87ee-455102c678ecCited by top-tier papers1
Ask how each one uses itRelated papers
- Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek CalculusSteven Schaefer, Nathan Varner, Pedro Henrique Azevedo de Amorim, Max S. NewPLDI 2025
- Total Type Error Localization and Recovery with HolesEric Zhao, Raef Maroof, Anand Dukkipati, Andrew Blinn et al.POPL 2024 · 15 citations
- Formal metatheory of second-order abstract syntaxMarcelo Fiore, Dmitrij SzamozvancevPOPL 2022 · 20 citations
- Learning Structure-Aware Representations of Dependent TypesKonstantinos Kogkalidis, Orestis Melkonian, Jean-Philippe BernardyNeurIPS 2024 · 6 citations
- Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specificationsArjen Rouvoet, Hendrik van Antwerpen, Casper Bach Poulsen, Robbert Krebbers et al.OOPSLA 2020 · 9 citations
