19 research outputs found
A Lambda Term Representation Inspired by Linear Ordered Logic
We introduce a new nameless representation of lambda terms inspired by
ordered logic. At a lambda abstraction, number and relative position of all
occurrences of the bound variable are stored, and application carries the
additional information where to cut the variable context into function and
argument part. This way, complete information about free variable occurrence is
available at each subterm without requiring a traversal, and environments can
be kept exact such that they only assign values to variables that actually
occur in the associated term. Our approach avoids space leaks in interpreters
that build function closures.
In this article, we prove correctness of the new representation and present
an experimental evaluation of its performance in a proof checker for the
Edinburgh Logical Framework.
Keywords: representation of binders, explicit substitutions, ordered
contexts, space leaks, Logical Framework.Comment: In Proceedings LFMTP 2011, arXiv:1110.668
Stratégies Efficaces et Modèles d'Implantation pour les Langages Fonctionnels.
In functional languages, efficiency heavily relies on the choice of an evaluation strategy and an implementation model.! We first develop a λ-calculus with explicit substitution! s which avoids the usual problems of substitution and α-conversion, where we can define the usual strategies, as well as some strategies with more sharing of computations. We then develop an efficient implementation model for this calculus. To this end, we propose an innovative representation of free variables, first in the very general setting of higher-order rewriting, then with more details in our particular case. We thus obtain a λ-calculus with explicit substitutions without names nor indices, in which terms are annotated with information about how substitutions should be propagated, which is a suitable implementation model for our strategies. Abstract machines are then defined, implemented, and experimentally compared to the best known evaluators. Finally, we study the relationship between traditional abstract machines and interaction nets, two common but very different implementation models. More precisely, we show how some strategies can be implemented in interaction nets in a very natural way, thus bridging the gap between two models used to implement efficient strategies.Dans les langages fonctionnels, l'efficacité dépend crucialement du choix de la stratégie d'évaluation et d'un modèle d'implantation adapté. Nous développons d'abord un λ-calcul avec substitutions explicites qui évite les problèmes habituels liés à la substitution et à l'α-conversion, dans lequel on peut définir les stratégies usuelles, mais aussi des stratégies avec un meilleur partage de calcul. Ensuite, nous développons un modèle d'implantation efficace pour ce calcul. Pour cela, nous proposons une représentation innnovante des variables libres, d'abord dans le cadre très général de la récriture d'ordre supérieur, puis avec plus de détails dans notre cas particulier. Nous obtenons ainsi un λ-calcul avec substitutions explicites sans noms ni indices, dans lequel les te! rmes sont annotés avec de l'information qui indique comment les substitutions doivent être propagées, et qui constitue un modèle d'implantation efficace pour nos stratégies. Des machines abstraites sont alors définies, implantées et comparées expérimentalement aux meilleurs évaluateurs connus. Finalement, nous étudions les relations entre machines abstraites traditionnelles et réseaux d'interaction, deux modèles d'implantation courants mais très différents. Plus précisément, nous montrons comment certaines stratégies peuvent être implantées dans les réseaux d'interaction d'une façon très naturelle, rapprochant ainsi deux modèles utilisés pour l'implantation de stratégies efficaces
Token-Passing Nets: Call-by-Need for Free
Recently, encodings in interaction nets of the call-by-name and call-by-value strategies of the λ-calculus have been proposed. The purpose of these encodings was to bridge the gap between interaction nets and traditional abstract machines, which are both used to provide lower-level specifications of strategies of the λ-calculus, but in radically different ways. The strength of these encodings is their simplicity, which comes from the simple idea of introducing an explicit syntactic object to represent the flow of evaluation. In particular, no artifact to represent boxes is needed. However, these encodings purposefully follow as closely as possible the implemented strategies, call-by-name and call-by-value, hence do not benefit from the ability of interaction nets to easily represent sharing. The aim of this note is to show that sharing can indeed be achieved without adding any structure. We thus present the call-by-need strategy following the same philosophy, which is indeed not any more complicated than call-by-name. This continues the task of bridging the gap between interaction nets and abstract machines, thus pushing forward a more uniform framework for implementations of the λ-calculus
A Natural Semantics for Completely Lazy Evaluation
Abstract. Lazy evaluation (or call-by-need) is widely used and well understood, partly thanks to a clear operational semantics given by Launchbury. However, modern non-strict functional languages do not use plain call-by-need evaluation: they also use optimisations like fully lazy λ-lifting or partial evaluation. To ease reasoning, it would be nice to have all these features in a uniform setting. In this paper, we generalise Launchbury’s semantics in order to capture “complete laziness”, as coined by Holst and Gomard in 1991, which is slightly more than fully lazy sharing, and closer to on-the-fly needed partial evaluation. This gives a clear, formal and implementation-independent operational semantics to completely lazy evaluation, in a natural (or big-step) style similar to Launchbury’s. Surprisingly, this requires to share not only terms, but also contexts, a property which was thought to characterise optimal reduction.
Rule-Based Operational Semantics for an Imperative Language
Abstract. Operational semantics for programming languages usually come in two flavours: big-step and small-step. Both are defined using deduction rules with a congruence rule allowing reduction in certain contexts. For a description based on rewrite rules, known approaches consist in deriving an abstract machine, which is very close to implementation. In this paper, we describe the operational semantics of an imperative language in a rule-based style, arguably as abstract as the other kinds of semantics. Moreover, we combine the approach with the store-based semantics, which puts the focus on memory states rather than values, which is more appropriate for imperative languages.
Macros for Interaction Nets: A Conservative Extension of Interaction Nets
AbstractWe propose a conservative extension of interaction nets which offers enriched pattern-matching facilities. The extension is conservative in the sense that it can be implemented inside standard interaction nets, and thus can be seen as a system of macros. Consequently, we are guaranteed to keep all the good properties of interaction nets, in particular strong confluence. We see this extension as a crucial step towards using interaction nets as a programming language, which remains a relatively unexplored area. One significant feature of the extension presented here is that, in contrast to other extensions presented previously, we essentially follow the syntax and spirit of interaction nets, and moreover the extension lives at the same level
Interaction Nets vs. the ρ-calculus: Introducing Bigraphical Nets
The ρ-calculus generalises both term rewriting and the λ-calculus in a uniform framework. Interaction nets are a form of graph rewriting which proved most successful in understanding the dynamics of the λ-calculus, the prime example being the implementation of optimal β-reduction. It is thus natural to study interaction net encodings of the ρ-calculus as a first step towards the definition of efficient reduction strategies. We give two interaction net encodings which bring a new understanding to the operational semantics of the ρ-calculus; however, these encodings have some drawbacks and to overcome them we introduce bigraphical nets—a new paradigm of computation inspired by Lafont’s interactions nets and Milner’s bigraphs
Efficient Reductions with Director Strings
We present a name free λ-calculus with explicit substitutions based on a generalized notion of director strings: we annotate a term with information about how each substitution should be propagated through the term. We first present a calculus where we can simulate arbitrary β-reduction steps, and then simplify the rules to model the evaluation of functional programs (reduction to weak head normal form). We also show that we can derive the closed reduction strategy (a weak strategy which, in contrast with standard weak strategies allows certain reductions to take place inside λ-abstractions thus offering more sharing). Our experimental results confirm that, for large combinator based terms, our weak evaluation strategies out-perform standard evaluators. Moreover, we derive two abstract machines for strong reduction which inherit the efficiency of the weak evaluators
Lambda-Calculus with Director Strings
No description supplie
Interaction Nets vs. the rho-calculus: Introducing Bigraphical Nets
No description supplie