No Arabic abstract
The possibility of translating logic programs into functional ones has long been a subject of investigation. Common to the many approaches is that the original logic program, in order to be translated, needs to be well-moded and this has led to the common understanding that these programs can be considered to be the ``functional part of logic programs. As a consequence of this it has become widely accepted that ``complex logical variables, the possibility of a dynamic selection rule, and general properties of non-well-moded programs are exclusive features of logic programs. This is not quite true, as some of these features are naturally found in lazy functional languages. We readdress the old question of what features are exclusive to the logic programming paradigm by defining a simple translation applicable to a wider range of logic programs, and demonstrate that the current circumscription is unreasonably restrictive.
Recursive definitions of predicates are usually interpreted either inductively or coinductively. Recently, a more powerful approach has been proposed, called flexible coinduction, to express a variety of intermediate interpretations, necessary in some cases to get the correct meaning. We provide a detailed formal account of an extension of logic programming supporting flexible coinduction. Syntactically, programs are enriched by coclauses, clauses with a special meaning used to tune the interpretation of predicates. As usual, the declarative semantics can be expressed as a fixed point which, however, is not necessarily the least, nor the greatest one, but is determined by the coclauses. Correspondingly, the operational semantics is a combination of standard SLD resolution and coSLD resolution. We prove that the operational semantics is sound and complete with respect to declarative semantics restricted to finite comodels. This paper is under consideration for acceptance in TPLP.
We introduce a generalized logic programming paradigm where programs, consisting of facts and rules with the usual syntax, can be enriched by co-facts, which syntactically resemble facts but have a special meaning. As in coinductive logic programming, interpretations are subsets of the complete Herbrand basis, including infinite terms. However, the intended meaning (declarative semantics) of a program is a fixed point which is not necessarily the least, nor the greatest one, but is determined by co-facts. In this way, it is possible to express predicates on non well-founded structures, such as infinite lists and graphs, for which the coinductive interpretation would be not precise enough. Moreover, this paradigm nicely subsumes standard (inductive) and coinductive logic programming, since both can be expressed by a particular choice of co-facts, hence inductive and coinductive predicates can coexist in the same program. We illustrate the paradigm by examples, and provide declarative and operational semantics, proving the correctness of the latter. Finally, we describe a prototype meta-interpreter.
Programming in Prolog is hard for programmers that are used to procedural coding. In this manual the method of drawing search trees is introduced with the aim to get a better understanding of how Prolog works. After giving a first example of a Prolog database, query and search tree, the art of drawing search trees is systematically introduced giving guidelines for queries with variables, conjunction, disjunction, and negation. Further examples are provided by giving the complete search trees that are shown in Learn Prolog Now!
Paisley is an extensible lightweight embedded domain-specific language for nondeterministic pattern matching in Java. Using simple APIs and programming idioms, it brings the power of functional-logic processing of arbitrary data objects to the Java platform, without constraining the underlying object-oriented semantics. Here we present an extension to the Paisley framework that adds pattern-based control flow. It exploits recent additions to the Java language, namely functional interfaces and lambda expressions, for an explicit and transparent continuation-passing style approach to control. We evaluate the practical impact of the novel features on a real-world case study that reengineers a third-party open-source project to use Paisley in place of conventional object-oriented data query idioms. We find the approach viable for incremental refactoring of legacy code, with significant qualitative improvements regarding separation of concerns, clarity and intentionality, thus making for easier code understanding, testing and debugging.
The original paper on Mixed Sessions introduce the side A of the tape: there is an encoding of classical sessions into mixed sessions. Here we present side B: there is a translation of (a subset of) mixed sessions into classical session types. We prove that the translation is a minimal encoding, according to the criteria put forward by Kouzapas, Perez, and Yoshida.