A Dependently Typed Multi-Stage Calculus

08/06/2019
by   Akira Kawata, et al.
0

We study a dependently typed extension of a multi-stage programming language a la MetaOCaml, which supports quasi-quotation and cross-stage persistence for manipulation of code fragments as first-class values and eval for the execution of programs dynamically generated by the code manipulation. Dependent types are expected to bring to multi-stage programming enforcement of strong invariants---beyond simple type safety---on the behavior of dynamically generated code. An extension is, however, not trivial because a type system would have to take stages---roughly speaking, the number of surrounding quotations---of types into account. To rigorously study properties of such an extension, we develop lambda^MD, which is an extension of Hanada and Igarashi's typed calculus lambda^% with dependent types, and prove its properties including preservation, confluence, strong normalization for full reduction, and progress for staged reduction. Motivated by code generators such that the type of generated code depends on a value from outside of quotations, we argue the significance of cross-stage persistence in dependently typed multi-stage programming and certain type equivalence that is not directly derived from reduction rules.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset