88 research outputs found
Bigloo User's Manual
Projet ICSLA\Ba Scheme compiler developped at Inria-RocquencourteQeQ in the Icsla team. This is the continuation of Nitsan Séniak's work on the compilation of functional languages \citeSeniak91, Christian Queinnec's modules for \Scheme\ \citeQueinnec91d and Jean-Marie Geffroy's pattern-matching compiler \citeQueinnec92c
Canonical Abstract Syntax Trees
This paper presents Gom, a language for describing abstract syntax trees and
generating a Java implementation for those trees. Gom includes features
allowing the user to specify and modify the interface of the data structure.
These features provide in particular the capability to maintain the internal
representation of data in canonical form with respect to a rewrite system. This
explicitly guarantees that the client program only manipulates normal forms for
this rewrite system, a feature which is only implicitly used in many
implementations
MatchPy: A Pattern Matching Library
Pattern matching is a powerful tool for symbolic computations, based on the
well-defined theory of term rewriting systems. Application domains include
algebraic expressions, abstract syntax trees, and XML and JSON data.
Unfortunately, no lightweight implementation of pattern matching as general and
flexible as Mathematica exists for Python Mathics,MacroPy,patterns,PyPatt.
Therefore, we created the open source module MatchPy which offers similar
pattern matching functionality in Python using a novel algorithm which finds
matches for large pattern sets more efficiently by exploiting similarities
between patterns.Comment: arXiv admin note: substantial text overlap with arXiv:1710.0007
Equations for Hereditary Substitution in Leivant's Predicative System F: A Case Study
This paper presents a case study of formalizing a normalization proof for
Leivant's Predicative System F using the Equations package. Leivant's
Predicative System F is a stratified version of System F, where type
quantification is annotated with kinds representing universe levels. A weaker
variant of this system was studied by Stump & Eades, employing the hereditary
substitution method to show normalization. We improve on this result by showing
normalization for Leivant's original system using hereditary substitutions and
a novel multiset ordering on types. Our development is done in the Coq proof
assistant using the Equations package, which provides an interface to define
dependently-typed programs with well-founded recursion and full dependent
pattern- matching. Equations allows us to define explicitly the hereditary
substitution function, clarifying its algorithmic behavior in presence of term
and type substitutions. From this definition, consistency can easily be
derived. The algorithmic nature of our development is crucial to reflect
languages with type quantification, enlarging the class of languages on which
reflection methods can be used in the proof assistant.Comment: In Proceedings LFMTP 2015, arXiv:1507.07597. www:
http://equations-fpred.gforge.inria.fr
Strategic Rewriting
AbstractThis is a position paper preparing the round table organized during the 4th International Workshop on Reduction Strategies in Rewriting and Programming. I sketch what I believe to be important challenges of strategic rewriting
Practical implementation of a dependently typed functional programming language
Types express a program's meaning, and checking types ensures that a program has the intended meaning. In a dependently typed programming language types are predicated on values, leading to the possibility of expressing invariants of a program's behaviour in its type. Dependent types allow us to give more detailed meanings to programs, and hence be more confident of their correctness. This thesis considers the practical implementation of a dependently typed programming language, using the Epigram notation defined by McBride and McKinna. Epigram is a high level notation for dependently typed functional programming elaborating to a core type theory based on Lu๙s UTT, using Dybjer's inductive families and elimination rules to implement pattern matching. This gives us a rich framework for reasoning about programs. However, a naive implementation introduces several run-time overheads since the type system blurs the distinction between types and values; these overheads include the duplication of values, and the storage of redundant information and explicit proofs. A practical implementation of any programming language should be as efficient as possible; in this thesis we see how the apparent efficiency problems of dependently typed programming can be overcome and that in many cases the richer type information allows us to apply optimisations which are not directly available in traditional languages. I introduce three storage optimisations on inductive families; forcing, detagging and collapsing. I further introduce a compilation scheme from the core type theory to G-machine code, including a pattern matching compiler for elimination rules and a compilation scheme for efficient run-time implementation of Peano's natural numbers. We also see some low level optimisations for removal of identity functions, unused arguments and impossible case branches. As a result, we see that a dependent type theory is an effective base on which to build a feasible programming language
Elaborating Inductive Definitions
We present an elaboration of inductive definitions down to a universe of
datatypes. The universe of datatypes is an internal presentation of strictly
positive families within type theory. By elaborating an inductive definition --
a syntactic artifact -- to its code -- its semantics -- we obtain an
internalized account of inductives inside the type theory itself: we claim that
reasoning about inductive definitions could be carried in the type theory, not
in the meta-theory as it is usually the case. Besides, we give a formal
specification of that elaboration process. It is therefore amenable to formal
reasoning too. We prove the soundness of our translation and hint at its
correctness with respect to Coq's Inductive definitions.
The practical benefits of this approach are numerous. For the type theorist,
this is a small step toward bootstrapping, ie. implementing the inductive
fragment in the type theory itself. For the programmer, this means better
support for generic programming: we shall present a lightweight deriving
mechanism, entirely definable by the programmer and therefore not requiring any
extension to the type theory.Comment: 32 pages, technical repor
Formal Validation of Pattern Matching code
When addressing the formal validation of generated software, two main
alternatives consist either to prove the correctness of compilers or
to directly validate the generated code. Here, we focus on directly
proving the correctness of compiled code issued from powerful
pattern matching constructions typical of ML like languages or
rewrite based languages such as ELAN, MAUDE or Tom.
In this context, our first contribution is to define a general
framework for anchoring algebraic pattern-matching capabilities
in existing languages like C, Java or ML. Then, using a just enough
powerful intermediate language, we formalize the behavior of compiled
code and define the correctness of compiled code with respect to
pattern-matching behavior. This allows us to prove the equivalence of
compiled code correctness with a generic first-order proposition whose
proof could be achieved via a proof assistant or an automated theorem
prover. We then extend these results to the multi-match situation
characteristic of the ML like languages.
The whole approach has been implemented on top of the Tom compiler
and used to validate the syntactic matching code of the Tom compiler
itself
Algebraic Pattern Matching in Join Calculus
We propose an extension of the join calculus with pattern matching on
algebraic data types. Our initial motivation is twofold: to provide an
intuitive semantics of the interaction between concurrency and pattern
matching; to define a practical compilation scheme from extended join
definitions into ordinary ones plus ML pattern matching. To assess the
correctness of our compilation scheme, we develop a theory of the applied join
calculus, a calculus with value passing and value matching. We implement this
calculus as an extension of the current JoCaml system
- …