29 research outputs found
Polymorphic Context for Contextual Modality
Through the Curry-Howard isomorphism between logics and calculi, necessity
modality in logic is interpreted as types representing program code.
Particularly, \lamcirc, which was proposed in influential work by Davies, and
its successors have been widely used as a logical foundation for syntactic
meta-programming. However, it is less known how to extend calculi based on
modal type theory to handle more practical operations including manipulation of
variable binding structures.
This paper constructs such a modal type theory in two steps. First, we
reconstruct contextual modal type theory by Nanevski, et al.\ as a Fitch-style
system, which introduces hypothetical judgment with hierarchical context. The
resulting type theory, \multilayer contextual modal type theory \fcmtt, is
generalized to accommodate not only S4 but also K, T, and K4 modalities, and
proven to enjoy many desired properties. Second, we extend \fcmtt with
polymorphic context, which is an internalization of contextual weakening, to
obtain a novel modal type theory \envpoly. Despite the fact that it came from
observation in logic, polymorphic context allows both binding manipulation and
hygienic code generation. We claim this by showing a sound translation from
\lamcirc to \envpoly
The intuitionistic temporal logic of dynamical systems
A dynamical system is a pair , where is a topological space and
is continuous. Kremer observed that the language of
propositional linear temporal logic can be interpreted over the class of
dynamical systems, giving rise to a natural intuitionistic temporal logic. We
introduce a variant of Kremer's logic, which we denote , and show
that it is decidable. We also show that minimality and Poincar\'e recurrence
are both expressible in the language of , thus providing a
decidable logic expressive enough to reason about non-trivial asymptotic
behavior in dynamical systems
Abstract parsing for two-staged languages with concatenation
This article, based on Doh, Kim, and Schmidt’s “abstract parsing ” technique, presents an abstract interpretation for statically checking the syntax of generated code in two-staged programs. Abstract parsing is a static analysis technique for checking the syntax of generated strings. We adopt this technique for two-staged programming languages and formulate it in the abstract interpretation framework. We parameterize our analysis with the abstract domain so that one can choose the abstract domain as long as it satisfies the condition we provide. We also present an instance of the abstract domain, namely an abstract parse stack and its widening with k-cutting
A Logical Foundation for Environment Classifiers
Taha and Nielsen have developed a multi-stage calculus {\lambda}{\alpha} with
a sound type system using the notion of environment classifiers. They are
special identifiers, with which code fragments and variable declarations are
annotated, and their scoping mechanism is used to ensure statically that
certain code fragments are closed and safely runnable. In this paper, we
investigate the Curry-Howard isomorphism for environment classifiers by
developing a typed {\lambda}-calculus {\lambda}|>. It corresponds to
multi-modal logic that allows quantification by transition variables---a
counterpart of classifiers---which range over (possibly empty) sequences of
labeled transitions between possible worlds. This interpretation will reduce
the "run" construct---which has a special typing rule in
{\lambda}{\alpha}---and embedding of closed code into other code fragments of
different stages---which would be only realized by the cross-stage persistence
operator in {\lambda}{\alpha}---to merely a special case of classifier
application. {\lambda}|> enjoys not only basic properties including subject
reduction, confluence, and strong normalization but also an important property
as a multi-stage calculus: time-ordered normalization of full reduction. Then,
we develop a big-step evaluation semantics for an ML-like language based on
{\lambda}|> with its type system and prove that the evaluation of a well-typed
{\lambda}|> program is properly staged. We also identify a fragment of the
language, where erasure evaluation is possible. Finally, we show that the proof
system augmented with a classical axiom is sound and complete with respect to a
Kripke semantics of the logic
A dependently typed multi-stage calculus
Programming Languages and Systems: 17th Asian Symposium, APLAS 2019, Nusa Dua, Bali, Indonesia, December 1–4, 2019. Part of the Lecture Notes in Computer Science book series (LNCS, volume 11893). Also part of the Programming and Software Engineering book sub series (LNPSE, volume 11893).We study a dependently typed extension of a multi-stage programming language à la MetaOCaml, which supports quasi-quotation and cross-stage persistence for manipulation of code fragments as first-class values and an evaluation construct for execution of programs dynamically generated by this code manipulation. Dependent types are expected to bring to multi-stage programming enforcement of strong invariant—beyond simple type safety—on the behavior of dynamically generated code. An extension is, however, not trivial because such a type system would have to take stages of types—roughly speaking, the number of surrounding quotations—into account. To rigorously study properties of such an extension, we develop λMD, which is an extension of Hanada and Igarashi’s typed calculus λ▹% with dependent types, and prove its properties including preservation, confluence, strong normalization for full reduction, and progress for staged reduction. Motivated by code generators that generate code whose type depends on a value from outside of the quotations, we argue the significance of cross-stage persistence in dependently typed multi-stage programming and certain type equivalences that are not directly derived from reduction rules
Modelling homogeneous generative meta-programming
Homogeneous generative meta-programming (HGMP) enables the generation of program fragments at compile-time or run-time. We present a foundational calculus which can model both compile-time and run-time evaluated HGMP, allowing us to model, for the first time, languages such as Template Haskell. The calculus is designed such that it can be gradually enhanced with the features needed to model many of the advanced features of real languages. We demonstrate this by showing how a simple, staged type system as found in Template Haskell can be added to the calculus