13 research outputs found
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
Tracking Data-Flow with Open Closure Types
Type systems hide data that is captured by function closures in function
types. In most cases this is a beneficial design that favors simplicity and
compositionality. However, some applications require explicit information about
the data that is captured in closures. This paper introduces open closure
types, that is, function types that are decorated with type contexts. They are
used to track data-flow from the environment into the function closure. A
simply-typed lambda calculus is used to study the properties of the type theory
of open closure types. A distinctive feature of this type theory is that an
open closure type of a function can vary in different type contexts. To present
an application of the type theory, it is shown that a type derivation
establishes a simple non-interference property in the sense of information-flow
theory. A publicly available prototype implementation of the system can be used
to experiment with type derivations for example programs.Comment: Logic for Programming Artificial Intelligence and Reasoning (2013
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
Dual-Context Calculi for Modal Logic
We present natural deduction systems and associated modal lambda calculi for
the necessity fragments of the normal modal logics K, T, K4, GL and S4. These
systems are in the dual-context style: they feature two distinct zones of
assumptions, one of which can be thought as modal, and the other as
intuitionistic. We show that these calculi have their roots in in sequent
calculi. We then investigate their metatheory, equip them with a confluent and
strongly normalizing notion of reduction, and show that they coincide with the
usual Hilbert systems up to provability. Finally, we investigate a categorical
semantics which interprets the modality as a product-preserving functor
Reasoning About Multi-stage Programs
Multi-stage programming (MSP) is a style of writing program
generators---programs which generate programs---supported by special
annotations that direct construction, combination, and execution of
object programs. Various researchers have shown MSP to be effective
in writing efficient programs without sacrificing genericity.
However, correctness proofs of such programs have so far received
limited attention, and approaches and challenges for that task have
been largely unexplored. In this thesis, I establish formal
equational properties of the multi-stage lambda calculus and related
proof techniques, as well as results that delineate the intricacies
of multi-stage languages that one must be aware of.
In particular, I settle three basic questions that naturally arise
when verifying multi-stage functional programs. Firstly, can adding
staging MSP to a language compromise the interchangeability of terms
that held in the original language? Unfortunately it can, and more
care is needed to reason about terms with free variables. Secondly,
staging annotations, as the term ``annotations'' suggests, are often
thought to be orthogonal to the behavior of a program, but when is
this formally guaranteed to be the case? I give termination
conditions that characterize when this guarantee holds. Finally, do
multi-stage languages satisfy extensional facts, for example that
functions agreeing on all arguments are equivalent? I develop a
sound and complete notion of applicative bisimulation, which can
establish not only extensionality but, in principle, any other valid
program equivalence as well. These results improve our general
understanding of staging and enable us to prove the correctness of
complicated multi-stage programs