7 research outputs found

    On-demand Evaluation by Program Transformation1 1Work partially supported by CICYT TIC2001-2705-C03-01 and MCYT grants HA2001-0059 and HU2001-0019.

    Get PDF
    AbstractStrategy annotations are used in eager programming languages (e.g., OBJ2, OBJ3, CafeOBJ, and Maude) for improving efficiency and/or reducing the risk of nontermination. Syntactically, they are given either as lists of natural numbers or as lists of integers associated to function symbols whose (absolute) values refer to the arguments of the corresponding symbol. A positive index forces the evaluation of an argument whereas a negative index means “evaluation on-demand”. Recently, we have introduced a formal description of the operational meaning of such on-demand strategy annotations which improves previous formalizations that were lacking satisfactory computational properties. In this paper, we introduce an automatic, semantics-preserving program transformation which produces a program (without negative annotations) which can be then correctly executed by typical OBJ interpreters. Moreover, to demonstrate the practicality of our ideas, the program transformation has been implemented (in Haskell) and we compare the evaluation of transformed programs with the original ones on a set of representative benchmarks

    Rewriting and narrowing for constructor systems with call-time choice semantics

    Get PDF
    Non-confluent and non-terminating constructor-based term rewrite systems are useful for the purpose of specification and programming. In particular, existing functional logic languages use such kind of rewrite systems to define possibly non-strict non-deterministic functions. The semantics adopted for non-determinism is call-time choice, whose combination with non-strictness is a non trivial issue, addressed years ago from a semantic point of view with the Constructor-based Rewriting Logic (CRWL), a well-known semantic framework commonly accepted as suitable semantic basis of modern functional logic languages. A drawback of CRWL is that it does not come with a proper notion of one-step reduction, which would be very useful to understand and reason about how computations proceed. In this paper we develop thoroughly the theory for the first order version of letrewriting, a simple reduction notion close to that of classical term rewriting, but extended with a let-binding construction to adequately express the combination of call-time choice with non-strict semantics. Let-rewriting can be seen as a particular textual presentation of term graph rewriting. We investigate the properties of let-rewriting, most remarkably their equivalence with respect to a conservative extension of the CRWL-semantics coping with let-bindings, and we show by some case studies that having two interchangeable formal views (reduction/semantics) of the same language is a powerful reasoning tool. After that, we provide a notion of let-narrowing which is adequate for call-time choice as proved by soundness and completeness results of let-narrowing with respect to letre writing. Moreover, we relate those let-rewriting and let-narrowing relations (and hence CRWL) with ordinary term rewriting and narrowing, providing in particular soundness and completeness of let-rewriting with respect to term rewriting for a class of programs which are deterministic in a semantic sense

    Demandness in Rewriting and Narrowing

    Get PDF
    The traditional investigation of rewriting and narrowing strategies aims at establishing fundamental properties, such as soundness, completeness and/or optimality, of a strategy. In this work, we analyze and compare rewriting and narrowing strategies from the point of view of the information taken into account by a strategy to compute a step. The notion of demandness provides a suitable framework for presenting and comparing well-known strategies. We find the existence of an almost linear sequence of strategies that take into account more and more information. We show on examples that, as we progress on this sequence, a strategy becomes more focused and avoids some useless steps computed by strategies preceding it in this sequence. Our work, which is still in progress, clarifies the behavior of similar or related strategies and it promises to simplify the transfer of some results from one strategy to another. It also suggests that the notion of demandness is both atomic and fundamental to the study of strategies

    Refining Weakly Outermost-Needed Rewriting and Narrowing

    No full text
    Outermost-needed rewriting/narrowing is a sound and complete optimal demand-driven strategy for the class of inductively sequential constructor systems. Its parallel extension (known as weakly) deals with non-inductively sequential constructor systems. In this paper, we present natural rewriting, a suitable extension of (weakly) outermost-needed rewriting which is based on a refinement of the demandness notion associated to the latter, and we extend it to narrowing. Intuitively, natural rewriting (narrowing) always reduces (narrows) the most often demanded position in a term. We formalize the strategy for left-linear constructor systems though, for the class of inductively sequential constructor systems, natural rewriting (narrowing) behaves even better than outermost-needed rewriting (narrowing) in the avoidance of failing computations. With regard to inductively sequential constructor systems, we introduce a larger class of systems called inductively sequential preserving where natural rewriting and narrowing preserve optimality for sequential parts of the program. We also provide a prototype interpreter of natural rewriting and narrowing

    Research Report UDMI/18/2002/RR, pages 35–43 Demandness in Rewriting and Narrowing

    No full text
    Abstract. The traditional investigation of rewriting and narrowing strategies aims at establishing fundamental properties, such as soundness, completeness and/or optimality, of a strategy. In this work, we analyze and compare rewriting and narrowing strategies from the point of view of the information taken into account by a strategy to compute a step. The notion of demandness provides a suitable framework for presenting and comparing well-known strategies. We find the existence of an almost linear sequence of strategies that take into account more and more information. We show on examples that, as we progress on this sequence, a strategy becomes more focused and avoids some useless steps computed by strategies preceding it in this sequence. Our work, which is still in progress, clarifies the behavior of similar or related strategies and it promises to simplify the transfer of some results from one strategy to another. It also suggests that the notion of demandness is both atomic and fundamental to the study of strategies.
    corecore