Staged Compilation with Two-Level Type Theory

09/20/2022
by   András Kovács, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/14/2020

Isabelle/Spartan – A Dependent Type Theory Framework for Isabelle

This paper introduces Isabelle/Spartan, an implementation of intensional...
research
01/10/2019

Cocon: Computation in Contextual Type Theory

We describe a Martin-Löf style dependent type theory, called Cocon, that...
research
05/07/2019

A Type Theory for Defining Logics and Proofs

We describe a Martin-Löf-style dependent type theory, called Cocon, that...
research
09/15/2023

Dependent Type Refinements for Futures

Type refinements combine the compositionality of typechecking with the e...
research
02/17/2018

Design and Implementation of the Andromeda Proof Assistant

Andromeda is an LCF-style proof assistant where the user builds derivabl...
research
11/29/2021

Formalization of dependent type theory: The example of CaTT

We present the type theory CaTT, originally introduced by Finster and Mi...
research
11/28/2018

Adventures in Formalisation: Financial Contracts, Modules, and Two-Level Type Theory

We present three projects concerned with applications of proof assistant...

Please sign up or login with your details

Forgot password? Click here to reset