## Algebra of Logic Programming (1999)

### Cached

### Download Links

Venue: | International Conference on Logic Programming |

Citations: | 20 - 3 self |

### BibTeX

@INPROCEEDINGS{Seres99algebraof,

author = {Silvija Seres and Michael Spivey and Tony Hoare},

title = {Algebra of Logic Programming},

booktitle = {International Conference on Logic Programming},

year = {1999},

pages = {184--199},

publisher = {Palgrave MacMillan}

}

### Years of Citing Articles

### OpenURL

### Abstract

A declarative programming language has two kinds of semantics. The more abstract helps in reasoning about specifications and correctness, while an operational semantics determines the manner of program execution. A correct program should reconcile its abstract meaning with its concrete interpretation. To help in this, we present a kind of algebraic semantics for logic programming. It lists only those laws that are equally valid for predicate calculus and for the standard depth-first strategy of Prolog. An alternative strategy is breadth-first search, which shares many of the same laws. Both strategies are shown to be special cases of the most general strategy, that for tree searching. The three strategies are defined in the lazy functional language Haskell, so that each law can be proved by standard algebraic reasoning. The laws are an enrichment of the familiar categorical concept of a monad, and the links between such monads are explored. 1 Introduction In an earlier p...

### Citations

8511 |
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... |

3395 | 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... |

1854 |
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 ... |

1307 | Lectures on constructive functional programming
- Bird
- 1989
(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 ... |

960 |
Negation as failure
- Clark
- 1977
(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... |

943 |
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... |

731 | 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.... |

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

570 | A Transformation System for Developing Recursive Programs
- Burstall, Darlington
- 1976
(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... |

458 | Comprehending Monads
- Wadler
- 1990
(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.... |

439 | 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... |

424 |
Introduction to Higher Order Categorical Logic
- 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... |

400 | Deforestation: Transforming programs to eliminate trees - Wadler - 1990 |

394 |
Category Theory for Computing 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)... |

332 | 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... |

332 | 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... |

226 | Purely Functional Data Structures
- Okasaki
- 1999
(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... |

215 |
Introduction to Functional Programming using Haskell, 2nd edition
- 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... |

213 | 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... |

211 | 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... |

188 |
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)]... |

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

170 |
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 ... |

166 |
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... |

156 |
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... |

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

139 | 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... |

121 | Essentials of Logic Programming - Hogger - 1990 |

110 |
Narrowing as the operational semantics of functional languages", Unpublished report
- 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 ... |

102 | Parametricity and local variables
- O’Hearn, Tennent
- 2008
(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 |

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 | Predicate logic as a computational formalism - Clark - 1979 |

86 | Algebraic Approaches to Program Semantics - Manes, Arbib - 1986 |

86 |
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... |

80 |
Categories for Types
- Crole
- 1993
(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... |

72 |
Automated Theorem-Proving for Theories with Simpli ers
- 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... |

65 | 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... |

61 | 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... |

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... |

55 | 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... |

55 | 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 ... |

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

54 |
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... |

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 ... |

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