325 research outputs found

    Reachability Analysis of Innermost Rewriting

    Get PDF
    We consider the problem of inferring a grammar describing the output of a functional program given a grammar describing its input. Solutions to this problem are helpful for detecting bugs or proving safety properties of functional programs and, several rewriting tools exist for solving this problem. However, known grammar inference techniques are not able to take evaluation strategies of the program into account. This yields very imprecise results when the evaluation strategy matters. In this work, we adapt the Tree Automata Completion algorithm to approximate accurately the set of terms reachable by rewriting under the innermost strategy. We prove that the proposed technique is sound and precise w.r.t. innermost rewriting. The proposed algorithm has been implemented in the Timbuk reachability tool. Experiments show that it noticeably improves the accuracy of static analysis for functional programs using the call-by-value evaluation strategy

    Reachability Analysis of Innermost Rewriting

    Get PDF
    Approximating the set of terms reachable by rewriting finds more and more applications ranging from termination proofs of term rewriting systems, cryp- tographic protocol verification to static analysis of programs. However, since approximation techniques do not take rewriting strategies into account, they build very coarse approximations when rewriting is constrained by a specific strategy. In this work, we propose to adapt the Tree Automata Completion algorithm to accurately approximate the set of terms reachable by rewriting under the inner- most strategy. We prove that the proposed technique is sound and precise w.r.t. innermost rewriting. The proposed algorithm has been implemented in the Timbuk reachability tool. Experiments shows that it noticeably improves the accuracy of static analysis for functional programs using the call-by-value evaluation strategy. In particular, for some functional programs needing lazy evaluation to terminate, the computed approximations are precise enough to prove the absence of innermost normal forms, i.e. prove non termination of the program with call-by-value

    Reversible Computation in Term Rewriting

    Full text link
    Essentially, in a reversible programming language, for each forward computation from state SS to state S′S', there exists a constructive method to go backwards from state S′S' to state SS. Besides its theoretical interest, reversible computation is a fundamental concept which is relevant in many different areas like cellular automata, bidirectional program transformation, or quantum computing, to name a few. In this work, we focus on term rewriting, a computation model that underlies most rule-based programming languages. In general, term rewriting is not reversible, even for injective functions; namely, given a rewrite step t1→t2t_1 \rightarrow t_2, we do not always have a decidable method to get t1t_1 from t2t_2. Here, we introduce a conservative extension of term rewriting that becomes reversible. Furthermore, we also define two transformations, injectivization and inversion, to make a rewrite system reversible using standard term rewriting. We illustrate the usefulness of our transformations in the context of bidirectional program transformation.Comment: To appear in the Journal of Logical and Algebraic Methods in Programmin

    Programming errors in traversal programs over structured data

    Get PDF
    Traversal strategies \'a la Stratego (also \'a la Strafunski and 'Scrap Your Boilerplate') provide an exceptionally versatile and uniform means of querying and transforming deeply nested and heterogeneously structured data including terms in functional programming and rewriting, objects in OO programming, and XML documents in XML programming. However, the resulting traversal programs are prone to programming errors. We are specifically concerned with errors that go beyond conservative type errors; examples we examine include divergent traversals, prematurely terminated traversals, and traversals with dead code. Based on an inventory of possible programming errors we explore options of static typing and static analysis so that some categories of errors can be avoided. This exploration generates suggestions for improvements to strategy libraries as well as their underlying programming languages. Haskell is used for illustrations and specifications with sufficient explanations to make the presentation comprehensible to the non-specialist. The overall ideas are language-agnostic and they are summarized accordingly

    Termination of Narrowing: Automated Proofs and Modularity Properties

    Full text link
    En 1936 Alan Turing demostro que el halting problem, esto es, el problema de decidir si un programa termina o no, es un problema indecidible para la inmensa mayoria de los lenguajes de programacion. A pesar de ello, la terminacion es un problema tan relevante que en las ultimas decadas un gran numero de tecnicas han sido desarrolladas para demostrar la terminacion de forma automatica de la maxima cantidad posible de programas. Los sistemas de reescritura de terminos proporcionan un marco teorico abstracto perfecto para el estudio de la terminacion de programas. En este marco, la evaluaci on de un t ermino consiste en la aplicacion no determinista de un conjunto de reglas de reescritura. El estrechamiento (narrowing) de terminos es una generalizacion de la reescritura que proporciona un mecanismo de razonamiento automatico. Por ejemplo, dado un conjunto de reglas que denan la suma y la multiplicacion, la reescritura permite calcular expresiones aritmeticas, mientras que el estrechamiento permite resolver ecuaciones con variables. Esta tesis constituye el primer estudio en profundidad de las propiedades de terminacion del estrechamiento. Las contribuciones son las siguientes. En primer lugar, se identican clases de sistemas en las que el estrechamiento tiene un comportamiento bueno, en el sentido de que siempre termina. Muchos metodos de razonamiento automatico, como el analisis de la semantica de lenguajes de programaci on mediante operadores de punto jo, se benefician de esta caracterizacion. En segundo lugar, se introduce un metodo automatico, basado en el marco teorico de pares de dependencia, para demostrar la terminacion del estrechamiento en un sistema particular. Nuestro metodo es, por primera vez, aplicable a cualquier clase de sistemas. En tercer lugar, se propone un nuevo metodo para estudiar la terminacion del estrechamiento desde un termino particular, permitiendo el analisis de la terminacion de lenguajes de programacion. El nuevo metodo generaliza losIborra López, J. (2010). Termination of Narrowing: Automated Proofs and Modularity Properties [Tesis doctoral no publicada]. Universitat Politècnica de València. https://doi.org/10.4995/Thesis/10251/19251Palanci

    Narrowing Trees for Syntactically Deterministic Conditional Term Rewriting Systems

    Get PDF
    A narrowing tree for a constructor term rewriting system and a pair of terms is a finite representation for the space of all possible innermost-narrowing derivations that start with the pair and end with non-narrowable terms. Narrowing trees have grammar representations that can be considered regular tree grammars. Innermost narrowing is a counterpart of constructor-based rewriting, and thus, narrowing trees can be used in analyzing constructor-based rewriting to normal forms. In this paper, using grammar representations, we extend narrowing trees to syntactically deterministic conditional term rewriting systems that are constructor systems. We show that narrowing trees are useful to prove two properties of a normal conditional term rewriting system: one is infeasibility of conditional critical pairs and the other is quasi-reducibility

    Reachability analysis of first-order definable pushdown systems

    Get PDF
    We study pushdown systems where control states, stack alphabet, and transition relation, instead of being finite, are first-order definable in a fixed countably-infinite structure. We show that the reachability analysis can be addressed with the well-known saturation technique for the wide class of oligomorphic structures. Moreover, for the more restrictive homogeneous structures, we are able to give concrete complexity upper bounds. We show ample applicability of our technique by presenting several concrete examples of homogeneous structures, subsuming, with optimal complexity, known results from the literature. We show that infinitely many such examples of homogeneous structures can be obtained with the classical wreath product construction.Comment: to appear in CSL'1
    • …
    corecore