Affiliation:
1. Eötvös Loránd University, Hungary
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 that staging is given by the evaluation of 2LTT
syntax in a semantic domain. The staging algorithm together with its correctness
constitutes a proof of strong conservativity of 2LLT over the object theory. To our
knowledge, this is the first description of staged compilation which supports
full dependent types and unrestricted staging for types.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference52 articles.
1. Untyped Algorithmic Equality for Martin-Löf’s Logical Framework with Surjective Pairs;Abel Andreas;Fundam. Informaticae,2007
2. A Modular Type-checking algorithm for Type Theory with Singleton Types and Proof Irrelevance
3. Decidability of conversion for type theory in type theory
4. Agda developers. 2022. Agda documentation. https://agda.readthedocs.io/en/v2.6.2.1/ Agda developers. 2022. Agda documentation. https://agda.readthedocs.io/en/v2.6.2.1/
5. Type theory in type theory using quotient inductive types
Cited by
8 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Staged Compilation with Module Functors;Proceedings of the ACM on Programming Languages;2024-08-15
2. Closure-Free Functional Programming in a Two-Level Type Theory;Proceedings of the ACM on Programming Languages;2024-08-15
3. Scoped and Typed Staging by Evaluation;Proceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation;2024-01-11
4. Internalizing Indistinguishability with Dependent Types;Proceedings of the ACM on Programming Languages;2024-01-05
5. Generic bidirectional typing for dependent type theories;Lecture Notes in Computer Science;2024