4,896 research outputs found
Rewriting and narrowing for constructor systems with call-time choice semantics
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
Singular and Plural Functions for Functional Logic Programming
Functional logic programming (FLP) languages use non-terminating and
non-confluent constructor systems (CS's) as programs in order to define
non-strict non-determi-nistic functions. Two semantic alternatives have been
usually considered for parameter passing with this kind of functions: call-time
choice and run-time choice. While the former is the standard choice of modern
FLP languages, the latter lacks some properties---mainly
compositionality---that have prevented its use in practical FLP systems.
Traditionally it has been considered that call-time choice induces a singular
denotational semantics, while run-time choice induces a plural semantics. We
have discovered that this latter identification is wrong when pattern matching
is involved, and thus we propose two novel compositional plural semantics for
CS's that are different from run-time choice.
We study the basic properties of our plural semantics---compositionality,
polarity, monotonicity for substitutions, and a restricted form of the bubbling
property for constructor systems---and the relation between them and to
previous proposals, concluding that these semantics form a hierarchy in the
sense of set inclusion of the set of computed values. We have also identified a
class of programs characterized by a syntactic criterion for which the proposed
plural semantics behave the same, and a program transformation that can be used
to simulate one of them by term rewriting. At the practical level, we study how
to use the expressive capabilities of these semantics for improving the
declarative flavour of programs. We also propose a language which combines
call-time choice and our plural semantics, that we have implemented in Maude.
The resulting interpreter is employed to test several significant examples
showing the capabilities of the combined semantics.
To appear in Theory and Practice of Logic Programming (TPLP)Comment: 53 pages, 5 figure
- …