224 research outputs found
Parametric Compositional Data Types
In previous work we have illustrated the benefits that compositional data
types (CDTs) offer for implementing languages and in general for dealing with
abstract syntax trees (ASTs). Based on Swierstra's data types \'a la carte,
CDTs are implemented as a Haskell library that enables the definition of
recursive data types and functions on them in a modular and extendable fashion.
Although CDTs provide a powerful tool for analysing and manipulating ASTs, they
lack a convenient representation of variable binders. In this paper we remedy
this deficiency by combining the framework of CDTs with Chlipala's parametric
higher-order abstract syntax (PHOAS). We show how a generalisation from
functors to difunctors enables us to capture PHOAS while still maintaining the
features of the original implementation of CDTs, in particular its modularity.
Unlike previous approaches, we avoid so-called exotic terms without resorting
to abstract types: this is crucial when we want to perform transformations on
CDTs that inspect the recursively computed CDTs, e.g. constant folding.Comment: In Proceedings MSFP 2012, arXiv:1202.240
Strict Ideal Completions of the Lambda Calculus
The infinitary lambda calculi pioneered by Kennaway et al. extend the basic
lambda calculus by metric completion to infinite terms and reductions.
Depending on the chosen metric, the resulting infinitary calculi exhibit
different notions of strictness. To obtain infinitary normalisation and
infinitary confluence properties for these calculi, Kennaway et al. extend
-reduction with infinitely many `-rules', which contract
meaningless terms directly to . Three of the resulting B\"ohm reduction
calculi have unique infinitary normal forms corresponding to B\"ohm-like trees.
In this paper we develop a corresponding theory of infinitary lambda calculi
based on ideal completion instead of metric completion. We show that each of
our calculi conservatively extends the corresponding metric-based calculus.
Three of our calculi are infinitarily normalising and confluent; their unique
infinitary normal forms are exactly the B\"ohm-like trees of the corresponding
metric-based calculi. Our calculi dispense with the infinitely many
-rules of the metric-based calculi. The fully non-strict calculus (called
) consists of only -reduction, while the other two calculi (called
and ) require two additional rules that precisely state their
strictness properties: (for ) and (for and )
Cutting out continuations
In the field of program transformation, one often transforms programs into continuation-passing style to make their flow of control explicit, and then immediately removes the resulting continuations using defunctionalisation to make the programs first-order. In this article, we show how these two transformations can be fused together into a single transformation step that cuts out the need to first introduce and then eliminate continuations. Our approach is calculational, uses standard equational reasoning techniques, and is widely applicable
Compiling a 50-year journey
Fifty years ago, John McCarthy and James Painter (1967) published the first paper on compiler verification, in which they showed how to formally prove the correctness of a compiler that translates arithmetic expressions into code for a register-based machine. In this article, we revisit this example in a modern context, and show how such a compiler can now be calculated directly from a specification of its correctness using simple equational reasoning techniques
- …