## The Algebra of Logic Programming (2001)

### Cached

### Download Links

Citations: | 20 - 3 self |

### BibTeX

@MISC{Seres01thealgebra,

author = {Silvija Seres},

title = {The Algebra of Logic Programming},

year = {2001}

}

### Years of Citing Articles

### OpenURL

### Abstract

At present, the field of declarative programming is split into two main areas based on different formalisms; namely, functional programming, which is based on lambda calculus, and logic programming, which is based on firstorder logic. There are currently several language proposals for integrating the expressiveness of these two models of computation. In this thesis we work towards an integration of the methodology from the two research areas. To this end, we propose an algebraic approach to reasoning about logic programs, corresponding to the approach taken in functional programming. In the first half of the thesis we develop and discuss a framework which forms the basis for our algebraic analysis and transformation methods. The framework is based on an embedding of definite logic programs into lazy functional programs in Haskell, such that both the declarative and the operational semantics of the logic programs are preserved. In spite of its conciseness and apparent simplicity, the embedding proves to have many interesting properties and it gives rise to an algebraic semantics of logic programming. It also allows us to reason about logic programs in a simple calculational style, using rewriting and the algebraic laws of combinators. In the embedding, the meaning of a logic program arises compositionally from the meaning of its constituent subprograms and the combinators that connect them. In the second

### Citations

8982 |
Introduction to Algorithms
- Cormen, Leiserson, et al.
- 1990
(Show Context)
Citation Context ...dynamic programming was first popularised by Bellman in 1 The nomenclature in the dynamic programming literature is somewhat inconsistent, so in what follows we have chosen to follow a neutral source =-=[32]-=-. 132s[107], where he introduced the Principle of Optimality which states that an optimal solution is composed of optimal solutions to subproblems. This is the essential (though only sufficient and no... |

3606 | Communicating sequential processes
- Hoare
- 1978
(Show Context)
Citation Context ...the search tree, or down by one row in the matrix. Informally, step provides a “timed” interpretation of logic programming, and can be thought of as a tick in the timed models of processes, as in CSP =-=[64]-=-. The difference in the shape of the tree, or alternatively in the structure of the matrix, can be captured by manipulating occurences of step, and the laws we present in this section capture the mani... |

1913 |
Foundations of Logic Programming
- LLoyd
- 1987
(Show Context)
Citation Context ...as atoms, is based on this unification algorithm for terms. This and the next section are compiled and adapted from a tutorial by Apt in [4] (for the most part) and the books by Apt, Lloyd and Spivey =-=[2, 76, 131]-=-. 2.2 Logic programming Let R = {r1,r2,...} be a set of relation symbols with given arities, including the predefined constant relations true and false. Then A = {p1,p2,...} denotes the set of atomic ... |

1347 | Imperative functional programming
- Jones, Wadler
- 1993
(Show Context)
Citation Context ...m of this section is to present the mathematical framework which will help us explore and express the relationships between our three models. Moggi introduced in [88], and Wadler later popularised in =-=[144, 145]-=-, the idea that many aspects of functional programming, for example laziness or eagerness of evaluation, and even non-functional aspects such as nondeterminism or handling of input and output, can be ... |

977 |
Negation as failure
- Clark
- 1978
(Show Context)
Citation Context ...mes a function definition in Haskell. This transformation is a well known technique in logic programming. It is 26scalled the completion process of predicates, and was first proposed in 1987 by Clark =-=[26]-=- in order to deal with the semantics of negation in definite logic programs. Using the same process, Clark translates logic programs to first-order formulas, while we translate them to Haskell functio... |

972 |
A machine-oriented logic based on the resolution principle
- Robinson
- 1965
(Show Context)
Citation Context ...m that terminates with failure if the terms are not unifiable, and that otherwise produces one of their most general unifiers, in fact a strong one. The first unification algorithm is due to Robinson =-=[113]-=-; another well-known unification algorithm is by Martelli and Montanari [83], and we present this one because it suits our framework better. It is this basic unification algorithm that we shall be usi... |

762 | Notions of Computation and Monads
- Moggi
- 1991
(Show Context)
Citation Context ...ated work. Category theory has been successfully used to give a mathematical treatment of several aspects of the syntax and the semantics of programming languages [101], such as types [35, 72], state =-=[88, 89, 94, 130, 143]-=-, non-determinism [96] or polymorphism [102]. The reason for the popularity of this approach is that it captures the desired features in a generic and implementation independent, yet rigorous, manner.... |

734 | The semantics of predicate logic as a programming language - Emden, Kowalski - 1976 |

596 | A transformation system for developing recursive programs
- Burstall, Darlington
- 1977
(Show Context)
Citation Context ...ategies, metarules which prescribe suitable sequences of applications of rules. The central rule in this technique is “unfoldfold”, originally introduced by Burstall and Darlington already in 1977 in =-=[23]-=-. In the alternative approach, based on schemas, the program derivation 164sis guided by recognition of higher-order clichés, that is, recursion schemes of universal nature. Traditionally, schemas are... |

466 | Combining Monads
- King, Wadler
- 1993
(Show Context)
Citation Context ...ated work. Category theory has been successfully used to give a mathematical treatment of several aspects of the syntax and the semantics of programming languages [101], such as types [35, 72], state =-=[88, 89, 94, 130, 143]-=-, non-determinism [96] or polymorphism [102]. The reason for the popularity of this approach is that it captures the desired features in a generic and implementation independent, yet rigorous, manner.... |

455 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ...monads. 6.1 Three search monads The aim of this section is to present the mathematical framework which will help us explore and express the relationships between our three models. Moggi introduced in =-=[88]-=-, and Wadler later popularised in [144, 145], the idea that many aspects of functional programming, for example laziness or eagerness of evaluation, and even non-functional aspects such as nondetermin... |

448 |
Introduction to higher order categorical logic, volume 7 of Cambridge studies in advanced mathematics
- Lambek, Scott
- 1986
(Show Context)
Citation Context ...opic for our related work. Category theory has been successfully used to give a mathematical treatment of several aspects of the syntax and the semantics of programming languages [101], such as types =-=[35, 72]-=-, state [88, 89, 94, 130, 143], non-determinism [96] or polymorphism [102]. The reason for the popularity of this approach is that it captures the desired features in a generic and implementation inde... |

421 | Deforestation: transforming programs to eliminate trees - Wadler - 1990 |

418 |
Category theory for computer science
- Barr, Wells
- 1999
(Show Context)
Citation Context ...af ]=id fgraft · fmap [Leaf ]=id, both of which follow from the definitions of fgraft, concat and fmap. Given any monad T , we can define a composition operator �T called the Kleisli composition (cf. =-=[10]-=-), such that: (�) ::(a → Tb) → (b → Tc) → (a → Tc), (6.8) p � T q = join T · map T q · p. (6.9) The operator � T is associative with unit element unit T : unit T � p = p, (6.10) p � unit T = p, (6.11)... |

348 | The Integration of Functions into Logic Programming: From Theory to Practice
- Hanus
- 1994
(Show Context)
Citation Context ... constraints for the values of variables. The list of languages that have been proposed in an attempt to incorporate the expressive power of both functional and logic paradigms is long and impressive =-=[13, 59]-=-. Our research goal is different from the one set by these projects. They aspire to build an efficient language that can offer programmers the most useful features of both worlds; to achieve this addi... |

346 | An Efficient Unification Algorithm
- Martelli, Montanari
- 1982
(Show Context)
Citation Context ...wise produces one of their most general unifiers, in fact a strong one. The first unification algorithm is due to Robinson [113]; another well-known unification algorithm is by Martelli and Montanari =-=[83]-=-, and we present this one because it suits our framework better. It is this basic unification algorithm that we shall be using in our implementation. It works on unifying a finite set of pairs of term... |

242 | Purely Functional Data Structures
- Okasaki
- 1996
(Show Context)
Citation Context ...s. So far, we have focused on program transformation. However, there are other areas of research in functional programming that seem amenable to migration to other declarative styles. For example, in =-=[95]-=-, Okasaki presents a suite of efficient, purely declarative data-structures supporting features such as random access or efficient catenation. Since the embedding is placed in the same lazy setting of... |

225 |
Introduction to Functional Programming using Haskell
- Bird
- 1998
(Show Context)
Citation Context ...for understanding of our embedding and equational proofs. However, some knowledge of lazy functional programming is assumed throughout the thesis, and for additional reading the reader is referred to =-=[17]-=- by Bird. A functional program is a collection of function definitions. Such definitions are often expressed as a set of guarded recursion equations, each defining a relationship between inputs and ou... |

225 | Hilog: A Foundation for Higher-Order Logic Programming
- Chen, Kifer, et al.
- 1993
(Show Context)
Citation Context ...ied here make a good case for functional logic programming languages, as we found that we needed the best of both worlds for a simple and clear presentation. Originally we wrote the examples in HiLog =-=[24]-=-, a higher-order logic programming language which supports tabling (in XSB). This language provided relations and non-determinism, which were required by the theorems and the examples. In [18] the exa... |

221 | XSB as an efficient deductive database engine
- Sagonas, Swift, et al.
- 1994
(Show Context)
Citation Context ...e following program: edit2 ((s1,s2), out)= (s1 . = nil & s2 . = nil & out . = nil) � (∃x, bag, bag1. bagof (x, step(x, (s1,s2)), bag) & consmap (edit2, bag, bag1) & best (lleq, bag1, out)). Using XSB =-=[119]-=-, or some other tabling Prolog system, edit2 can be automatically tabled and the execution complexity becomes polynomial2 because there are only m ∗ n different subproblems, where m and n are the leng... |

194 |
From Logic Programming to Prolog
- Apt
- 1997
(Show Context)
Citation Context ...=-=[1, 2, 3]-=-, to each of the answers in the stream resulting from the computation of the equation a . = nil on the given input. Expressed as a rewriting, the computation is as follows: concat (map (b . =[1, 2, 3]) ((a . = nil) ([], 0)) ) = concat (map (b . =[1, 2, 3]) [([(a, nil)], 0)] ) = concat [(b . =[1, 2, 3]) ([(a, nil)], 0)] = concat [[([(a, nil), (b, [1, 2, 3])], 0)]] =[([(a, nil), (b, [1, 2, 3])], 0)]... |

191 | Contributions to the theory of logic programming - Apt, Emden - 1982 |

187 |
Unifying Theories of Programming
- Hoare, He
- 1998
(Show Context)
Citation Context ...ropriate for program transformation of logic programs. The particular approach that we have taken is inspired by the following two sources. On an abstract level, the Unifying Theories of Hoare and He =-=[65]-=- use algebraic descriptions to classify and compare different programming paradigms. Such a description consists of a set of laws, which may be used for syntactical, rather than semantical, reasoning ... |

169 |
Canonical Forms and Unification
- Hullot
- 1980
(Show Context)
Citation Context ...th many infinite paths even for a small program. In order to use narrowing as a practical operational semantics, further restrictions are necessary. One possible restriction is called basic narrowing =-=[67]-=-. Here the narrowing step may only be performed at a subterm which is not part of a computed substitution, but belongs to an original program clause or query. Basic narrowing is also sound and complet... |

159 | Essentials of Programming Languages - Friedman, Wand, et al. - 2001 |

159 |
Logic programming with functions and predicates: The language BABEL
- Moreno-Navarro, Rodr¶guez-Artalejo
- 1992
(Show Context)
Citation Context ...d within a unified system based on narrowing. This is being successfully done in several major projects, including the integrated functional logic programming languages Curry [60], Escher [78], Babel =-=[90]-=-, Mercury [129], and others. This research mainly focuses on unifying the expressiveness of the two underlying programming models; however, it is also important to unify the underlying methodology, th... |

140 | Transformation of logic programs: Foundations and techniques
- Pettorossi, Proietti
- 1994
(Show Context)
Citation Context ...in logic program transformation can be divided in two main categories: approaches based on “rules and strategies”, and approaches based on “schemata”. For an excellent survey of these techniques, see =-=[98]-=- by Pettorossi and Proietti. In short, the rules and strategies approach has a set of fine grained, elementary rules, and the application of these rules is guided by strategies, metarules which prescr... |

127 | Introduction to Logic Programming - Hogger - 1984 |

114 |
Narrowing as the Operational Semantics of Functional Languages
- Reddy
- 1985
(Show Context)
Citation Context ...tricted set of functional logic programs, called constructor-based functional logic programs, the deterministic strategies of functional programming can be simulated with innermost [49] and outermost =-=[91, 109]-=- nar171srowing strategies, corresponding to eager and lazy evaluation in functional programming. Another improvement is selection narrowing [19], where a selection rule, similar to the selection rule ... |

104 | Parametricity and local variables
- O’Hearn, Tennent
- 1995
(Show Context)
Citation Context ...ated work. Category theory has been successfully used to give a mathematical treatment of several aspects of the syntax and the semantics of programming languages [101], such as types [35, 72], state =-=[88, 89, 94, 130, 143]-=-, non-determinism [96] or polymorphism [102]. The reason for the popularity of this approach is that it captures the desired features in a generic and implementation independent, yet rigorous, manner.... |

96 | Algorithmics — towards programming as a mathematical activity - Meertens - 1986 |

94 | Predicate logic as a computational formalism - Clark - 1979 |

92 |
SLOG: A Logic Programming Language Interpreter Based on Clausal Superposition and Rewriting
- Fribourg
- 1985
(Show Context)
Citation Context ...ministic. For a restricted set of functional logic programs, called constructor-based functional logic programs, the deterministic strategies of functional programming can be simulated with innermost =-=[49]-=- and outermost [91, 109] nar171srowing strategies, corresponding to eager and lazy evaluation in functional programming. Another improvement is selection narrowing [19], where a selection rule, simila... |

91 |
How to replace failure by a list of successes
- Wadler
- 1985
(Show Context)
Citation Context ...e the predicate is solved, and produces a lazy stream of answers, each corresponding to a solution of the predicate that is consistent with the input. This approach is similar to that taken by Wadler =-=[141]-=- and by Jones and Mycroft [70]. An unsatisfiable query results in an empty stream, and a query with infinitely many answers results in an infinite stream. 1 type Predicate = Answer → Stream Answer. An... |

90 | Algebraic approaches to program semantics - Arbib, Manes - 1986 |

82 |
Categories for Types
- Crole
- 1994
(Show Context)
Citation Context ...opic for our related work. Category theory has been successfully used to give a mathematical treatment of several aspects of the syntax and the semantics of programming languages [101], such as types =-=[35, 72]-=-, state [88, 89, 94, 130, 143], non-determinism [96] or polymorphism [102]. The reason for the popularity of this approach is that it captures the desired features in a generic and implementation inde... |

76 |
Automated theorem-proving for theories with simplifiers, commutativity and associativity
- Slagle
- 1974
(Show Context)
Citation Context ...e computation of such atoms until they are sufficiently instantiated. The first approach is called narrowing and the second residuation. The fundamental idea behind narrowing, as introduced by Slagle =-=[125]-=-, is to use unification rather than matching in the rewrite step, if the function call contains free variables. The unification required to do this is computed with respect to a set E of axioms, and i... |

67 | Programming in an integrated functional and logic language
- Lloyd
- 1999
(Show Context)
Citation Context .... In order to easier contrast the approach taken by different flp languages and our embedding, we now present a summary of the execution principles of flp. This summary is based on Hanus [59], and on =-=[13, 38, 77, 79, 112]-=-. The integration of the operational principles of functional and logic programming can be approached from both styles, but in both cases it yields similar results. One way of allowing function defini... |

63 | Mercury: an efficient purely declarative logic programming language
- Somogyi, Henderson, et al.
- 1995
(Show Context)
Citation Context ...fied system based on narrowing. This is being successfully done in several major projects, including the integrated functional logic programming languages Curry [60], Escher [78], Babel [90], Mercury =-=[129]-=-, and others. This research mainly focuses on unifying the expressiveness of the two underlying programming models; however, it is also important to unify the underlying methodology, that is, their ap... |

59 |
Top-Down Synthesis of Divide-and-Conquer Algorithms
- Smith
- 1985
(Show Context)
Citation Context ...same six algorithms using the divide-and-conquer paradigm; they show how their system can automatically construct the programs, and analyse the facts and rules used in the process. Smith describes in =-=[127, 126]-=- yet another method for derivation and classification of the first four sorting algorithms by top-down decomposition of specifications into subproblem specifications, followed by a synthesis of concre... |

58 |
Algebraic identities for program calculation
- Bird
- 1989
(Show Context)
Citation Context ...antic framework for logic programs, we investigated how well the analysis and transformation 158smethods of algebraic semantics, already known to work well for functional programming (see for example =-=[15, 16]-=-), specialise to logic programs. For this purpose, we have chosen two groups of examples: one consists of wellknown problems of program transformation, where standard techniques are used, and the othe... |

57 | Denotational and Operational Semantics for Prolog - Debray, Mishra - 1988 |

56 | Declarative Programming in Escher
- Lloyd
- 1995
(Show Context)
Citation Context ...n be subsumed within a unified system based on narrowing. This is being successfully done in several major projects, including the integrated functional logic programming languages Curry [60], Escher =-=[78]-=-, Babel [90], Mercury [129], and others. This research mainly focuses on unifying the expressiveness of the two underlying programming models; however, it is also important to unify the underlying met... |

54 | Continuation-based program transformation strategies
- Wand
- 1980
(Show Context)
Citation Context ...extension of a definite logic program with goals as predicate arguments. This allows them to apply some of the ideas from higher-order based transformations [18] or continuation based transformations =-=[146]-=- in functional programming. They provide a set of transformational rules together with a correctness theorem, which ensures that if a goal succeeds or fail in the given program, then also the derived ... |

53 | Curry: A Truly Functional Logic Language
- Hanus, Kuchen, et al.
- 1995
(Show Context)
Citation Context ...l of these can be subsumed within a unified system based on narrowing. This is being successfully done in several major projects, including the integrated functional logic programming languages Curry =-=[60]-=-, Escher [78], Babel [90], Mercury [129], and others. This research mainly focuses on unifying the expressiveness of the two underlying programming models; however, it is also important to unify the u... |

53 |
Stepwise Development of Operational and Denotational Semantics for Prolog
- Jones, Mycroft
- 1984
(Show Context)
Citation Context ...produces a lazy stream of answers, each corresponding to a solution of the predicate that is consistent with the input. This approach is similar to that taken by Wadler [141] and by Jones and Mycroft =-=[70]-=-. An unsatisfiable query results in an empty stream, and a query with infinitely many answers results in an infinite stream. 1 type Predicate = Answer → Stream Answer. An answer is (in principle) just... |

46 |
The relation between logic and functional languages: a survey
- Bellia, Levi
- 1986
(Show Context)
Citation Context ... constraints for the values of variables. The list of languages that have been proposed in an attempt to incorporate the expressive power of both functional and logic paradigms is long and impressive =-=[13, 59]-=-. Our research goal is different from the one set by these projects. They aspire to build an efficient language that can offer programmers the most useful features of both worlds; to achieve this addi... |

43 |
A synthesis of several sorting algorithms
- Darlington
- 1978
(Show Context)
Citation Context ...onal semantics, for example, whether they do sorting by insertion, partitioning and so on. More recently top-down program synthesis has been used as a basis for classification. Darlington presents in =-=[37]-=- a family of six sorting algorithms, where the classification is based on program transformation on recursion equations, using fold-unfold as the key transformation rule. He derives and classifies qui... |

43 | Recursive monadic bindings
- Erkök, Launchbury
- 2000
(Show Context)
Citation Context ... have constructs for defining recursive equations over a monadic type, but Launchbury, Lewis and Cook propose in [74] as an extension of Haskell a special fixpoint operator mfix for monadic types. In =-=[45]-=-, Erkök and Launchbury pursue an axiomatic analysis of mfix, by postulating three axioms that characterise the behaviour of mfix and show that these are satisfied in several individual monads, called ... |

43 | Models and equality for logical programming - Goguen, Meseguer - 1987 |