69,801 research outputs found
A Rational Deconstruction of Landin's SECD Machine with the J Operator
Landin's SECD machine was the first abstract machine for applicative
expressions, i.e., functional programs. Landin's J operator was the first
control operator for functional languages, and was specified by an extension of
the SECD machine. We present a family of evaluation functions corresponding to
this extension of the SECD machine, using a series of elementary
transformations (transformation into continu-ation-passing style (CPS) and
defunctionalization, chiefly) and their left inverses (transformation into
direct style and refunctionalization). To this end, we modernize the SECD
machine into a bisimilar one that operates in lockstep with the original one
but that (1) does not use a data stack and (2) uses the caller-save rather than
the callee-save convention for environments. We also identify that the dump
component of the SECD machine is managed in a callee-save way. The caller-save
counterpart of the modernized SECD machine precisely corresponds to Thielecke's
double-barrelled continuations and to Felleisen's encoding of J in terms of
call/cc. We then variously characterize the J operator in terms of CPS and in
terms of delimited-control operators in the CPS hierarchy. As a byproduct, we
also present several reduction semantics for applicative expressions with the J
operator, based on Curien's original calculus of explicit substitutions. These
reduction semantics mechanically correspond to the modernized versions of the
SECD machine and to the best of our knowledge, they provide the first syntactic
theories of applicative expressions with the J operator
Sequent Calculus and Equational Programming
Proof assistants and programming languages based on type theories usually
come in two flavours: one is based on the standard natural deduction
presentation of type theory and involves eliminators, while the other provides
a syntax in equational style. We show here that the equational approach
corresponds to the use of a focused presentation of a type theory expressed as
a sequent calculus. A typed functional language is presented, based on a
sequent calculus, that we relate to the syntax and internal language of Agda.
In particular, we discuss the use of patterns and case splittings, as well as
rules implementing inductive reasoning and dependent products and sums.Comment: In Proceedings LFMTP 2015, arXiv:1507.0759
Logical relations for coherence of effect subtyping
A coercion semantics of a programming language with subtyping is typically
defined on typing derivations rather than on typing judgments. To avoid
semantic ambiguity, such a semantics is expected to be coherent, i.e.,
independent of the typing derivation for a given typing judgment. In this
article we present heterogeneous, biorthogonal, step-indexed logical relations
for establishing the coherence of coercion semantics of programming languages
with subtyping. To illustrate the effectiveness of the proof method, we develop
a proof of coherence of a type-directed, selective CPS translation from a typed
call-by-value lambda calculus with delimited continuations and control-effect
subtyping. The article is accompanied by a Coq formalization that relies on a
novel shallow embedding of a logic for reasoning about step-indexing
Answer-Type Modification without Tears: Prompt-Passing Style Translation for Typed Delimited-Control Operators
The salient feature of delimited-control operators is their ability to modify
answer types during computation. The feature, answer-type modification (ATM for
short), allows one to express various interesting programs such as typed printf
compactly and nicely, while it makes it difficult to embed these operators in
standard functional languages.
In this paper, we present a typed translation of delimited-control operators
shift and reset with ATM into a familiar language with multi-prompt shift and
reset without ATM, which lets us use ATM in standard languages without
modifying the type system. Our translation generalizes Kiselyov's direct-style
implementation of typed printf, which uses two prompts to emulate the
modification of answer types, and passes them during computation. We prove that
our translation preserves typing. As the naive prompt-passing style translation
generates and passes many prompts even for pure terms, we show an optimized
translation that generate prompts only when needed, which is also
type-preserving. Finally, we give an implementation in the tagless-final style
which respects typing by construction.Comment: In Proceedings WoC 2015, arXiv:1606.0583
- …