Encoding rewriting strategies in λ-calculi with patterns

نویسنده

  • Germain Faure
چکیده

We propose a patch to the pure pattern calculus: we claim that this is strictly more powerful to define the application of the match fail as the pure λ-term defining the boolean false instead of the identity function as it is done in the original version of the pure pattern calculus [JK09]. We show that using non algebraic patterns we are able to encode in a natural way any rewriting strategies as well as the branching construct | used in functional programming languages. We close the open question (raised in [Cir00, CK01]) whether rewriting strategies can be directly encoded in λ-calculi with patterns. Key-words: Rewriting strategies, lambda-calculus with patterns, rewriting calculus, pure pattern calculus, higher-order encodings. in ria -0 04 13 17 8, v er si on 2 3 Se p 20 09 Encodage des stratégies de réécritures dans les λ-calculs avec motifs Résumé : Nous proposons une alternative au calcul pur de motifs: nous affirmons qu’il est strictement plus puissant de définir l’application du filtre d’échec comme le terme du λ-calcul pur définissant la constante false plutôt que de le définir comme la fonction identité comme cela a été fait dans la version originale du calcul pur de motifs [JK09]. Nous montrons qu’en utilisant des motifs non algébriques nous pouvons obtenir un encodage naturel des stratégies de réécriture ainsi que du constructeur de branchement | des langages fonctionnels. Nous clôturons la question ouverte (formulée dans [Cir00, CK01]) si les stratégies de réécriture sont directement encodables dans les λ-calculs avec motifs. Mots-clés : Stratégies de réécriture, lambda-calcul de motifs, calcul de réécriture, calcul pur de motifs, encodage d’ordre supérieur. in ria -0 04 13 17 8, v er si on 2 3 Se p 20 09 Encoding rewriting strategies in λ-calculi with patterns 3 1 Preliminaries We first recall some classical encoding of pairs, boolean etc. in the pure λcalculus (see for example [Bar84]) 〈t, u〉 = λx. x t u π1t = t (λxy. x) π2t = t (λxy. y) true = λxy. x false = λxy. y if t then u else v = t u v let x = t in u = (λx. u) t fix = (λx. λf. f(x x f)) (λx. λf. f(x x f)) If C[] is a context then we will write fun = fix(C[fun]) for the definition of a recursive function called fun and defined by fix (λs.C[s]). 2 Yet a more general framework We consider the general framework given in Section 2 of [JK09] and use the same notations. We first begin by a remark. The application of a match μ to a term can be defined in a more general way as follows: If μ is a substitution, then the application of the match to a term is obtained by applying the substitution to variables of the term as explained in [JK09]. If μ is fail, we define fail t = u where u is an arbitrary term [the calculus is parametrized by this term u]. Theorem 2.1 (Confluence) The pure pattern calculus, as defined in Section 3 of [JK09] but with the above application of a match, is confluent when u is a pure λ-term in normal form.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Confluence of Pattern-Based Calculi

Different pattern calculi integrate the functional mechanisms from the λ-calculus and the matching capabilities from rewriting. Several approaches are used to obtain the confluence but in practice the proof methods share the same structure and each variation on the way patternabstractions are applied needs another proof of confluence. We propose here a generic confluence proof where the way pat...

متن کامل

Confluence via strong normalisation in an algebraic lambda-calculus with rewriting

The linear-algebraic λ -calculus and the algebraic λ -calculus are untyped λ -calculi extended with arbitrary linear combinations of terms. The former presents the axioms of linear algebra in the form of a rewrite system, while the latter uses equalities. When given by rewrites, algebraic λ -calculi are not confluent unless further restrictions are added. We provide a type system for the linear...

متن کامل

Normalisation for Dynamic Pattern Calculi

The Pure Pattern Calculus (PPC) [10, 11] extends the λ-calculus, as well as the family of algebraic pattern calculi [20, 6, 12], with first-class patterns i.e. patterns can be passed as arguments, evaluated and returned as results. The notion of matching failure of PPC in [11] not only provides a mechanism to define functions by pattern matching on cases but also supplies PPC with parallelor-li...

متن کامل

Encoding Distributed Process Calculi into LMNtal

Towards a unifying model of concurrency, we have designed and implemented LMNtal (pronounced “elemental”), a model and language based on hierarchical graph rewriting that uses logical variables to represent connectivity and membranes to represent hierarchy. Diverse computational models including the π-calculus and the λ-calculus have been encoded into LMNtal and tested on our LMNtal system. Thi...

متن کامل

Distributive ρ-calculus

The rewriting calculus has been introduced as a general formalism that uniformlyintegrates rewriting and λ-calculus. In this calculus all the basic ingredients ofrewriting such as rewrite rules, rule applications and results are rst-class objects.The rewriting calculus has been originally designed and used for expressing thesemantics of rule based as well as object oriented ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009