Results 1 - 10
of
28
Modelling Prolog Control
, 1992
"... The goal of this paper is to construct a semantic basis for the abstract interpretation of Prolog programs. Prolog is a well-known logic programming language which applies a depth-first search strategy in order to provide a practical approximation of Horn clause logic. While pure logic programming h ..."
Abstract
-
Cited by 28 (13 self)
- Add to MetaCart
The goal of this paper is to construct a semantic basis for the abstract interpretation of Prolog programs. Prolog is a well-known logic programming language which applies a depth-first search strategy in order to provide a practical approximation of Horn clause logic. While pure logic programming has clean fixpoint, model-theoretic and operational semantics the situation for Prolog is different. Difficulties in capturing the declarative meaning of Prolog programs have led to various semantic definitions which attempt to encode the search strategy in different mathematical frameworks. However semantic based analyses of Prolog are typically achieved by abstracting the more simple but less precise declarative semantics of pure logic Programs. We propose instead to model Prolog control in a simple constraint logic language which is presented together with its declarative and operational semantics. This enables us to maintain the usual approach to declarative semantics of logic programs wh...
Deriving Backtracking Monad Transformers
- In The International Conference on Functional Programming (ICFP
, 2000
"... In a paper about pretty printing J. Hughes introduced two fundamental techniques for deriving programs from their specication, where a specication consists of a signature and properties that the operations of the signature are required to satisfy. Briey, the rst technique, the term implementation, r ..."
Abstract
-
Cited by 25 (1 self)
- Add to MetaCart
In a paper about pretty printing J. Hughes introduced two fundamental techniques for deriving programs from their specication, where a specication consists of a signature and properties that the operations of the signature are required to satisfy. Briey, the rst technique, the term implementation, represents the operations by terms and works by dening a mapping from operations to observations | this mapping can be seen as dening a simple interpreter. The second, the context-passing implementation, represents operations as functions from their calling context to observations. We apply both techniques to derive a backtracking monad transformer that adds backtracking to an arbitrary monad. In addition to the usual backtracking operations | failure and nondeterministic choice | the prolog cut and an operation for delimiting the eect of a cut are supported. Categories and Subject Descriptors D.1.1 [Programming Techniques]: Applicative (Functional) Programming; D.3.2 [Programming La...
A rational deconstruction of Landin’s SECD machine
- Implementation and Application of Functional Languages, 16th International Workshop, IFL’04, number 3474 in Lecture Notes in Computer Science
, 2004
"... Abstract. Landin’s SECD machine was the first abstract machine for applicative expressions, i.e., functional programs. Landin’s J operator was the first control operator for functional languages, and was specified by an extension of the SECD machine. We present a family of evaluation functions corre ..."
Abstract
-
Cited by 23 (16 self)
- Add to MetaCart
Abstract. Landin’s SECD machine was the first abstract machine for applicative expressions, i.e., functional programs. Landin’s J operator was the first control operator for functional languages, and was specified by an extension of the SECD machine. We present a family of evaluation functions corresponding to this extension of the SECD machine, using a series of elementary transformations (transformation into continuation-passing style (CPS) and defunctionalization, chiefly) and their left inverses (transformation into direct style and refunctionalization). To this end, we modernize the SECD machine into a bisimilar one that operates in lockstep with the original one but that (1) does not use a data stack and (2) uses the caller-save rather than the callee-save convention for environments. We also identify that the dump component of the SECD machine is managed in a callee-save way. The caller-save counterpart of the modernized SECD machine precisely corresponds to Thielecke’s doublebarrelled continuations and to Felleisen’s encoding of J in terms of call/cc. We then variously characterize the J operator in terms of CPS and in terms of delimited-control operators in the CPS hierarchy. As a byproduct, we also present several reduction semantics for applicative expressions
From Interpreter to Logic Engine by Defunctionalization
, 2004
"... Starting from a continuation-based interpreter for a simple logic programming language, propositional Prolog with cut, we derive the corresponding logic engine in the form of an abstract machine. The derivation originates in previous work (our article at PPDP 2003) where it was applied to the la ..."
Abstract
-
Cited by 19 (12 self)
- Add to MetaCart
Starting from a continuation-based interpreter for a simple logic programming language, propositional Prolog with cut, we derive the corresponding logic engine in the form of an abstract machine. The derivation originates in previous work (our article at PPDP 2003) where it was applied to the lambda-calculus. The key transformation here is Reynolds's defunctionalization that transforms a tail-recursive, continuation-passing interpreter into a transition system, i.e., an abstract machine. Similar denotational and operational semantics were studied by de Bruin and de Vink (their article at TAPSOFT 1989), and we compare their study with our derivation. Additionally, we present a direct-style interpreter of propositional Prolog expressed with control operators for delimited continuations.
A Denotational Semantics for Prolog
"... In this paper we propose a denotational semantics for Prolog and an approach to the abstract interpretation of Prolog programs; we deal with the control rules of Prolog and the cut operator. Moreover, we get a simple denotation for negation as finite failure. The abstract analysis is proposed both f ..."
Abstract
-
Cited by 15 (6 self)
- Add to MetaCart
In this paper we propose a denotational semantics for Prolog and an approach to the abstract interpretation of Prolog programs; we deal with the control rules of Prolog and the cut operator. Moreover, we get a simple denotation for negation as finite failure. The abstract analysis is proposed both for computed answers analysis and for call patterns analysis. In both cases the abstract semantics is finitely computable. Two examples show the usefulness of our approach for the analysis of Prolog programs. 1 Introduction A semantics can be useful as a tool for program understanding, as a tool for defining an equivalence relation between programs (in relation to program transformations), or as a tool for program analysis. The latter is our main interest. The first question to be answered is why we look for a new semantics of a subset of Prolog (more precisely, of Prolog without database and set operations). There exist many formalizations for subsets of Prolog, and there exists even a for...
Oracle Semantics for Prolog
- ALGEBRAIC AND LOGIC PROGRAMMING, PROCEEDINGS OF THE THIRD INTERNATIONAL CONFERENCE, VOLUME 632 OF LECTURE NOTES IN COMPUTER SCIENCE
, 1992
"... This paper proposes to specify semantic definitions for logic programming languages such as Prolog in terms of an oracle which specifies the control strategy and identifies which clauses are to be applied to resolve a given goal. The approach is quite general. It is applicable to Prolog to specify b ..."
Abstract
-
Cited by 15 (5 self)
- Add to MetaCart
This paper proposes to specify semantic definitions for logic programming languages such as Prolog in terms of an oracle which specifies the control strategy and identifies which clauses are to be applied to resolve a given goal. The approach is quite general. It is applicable to Prolog to specify both operational and declarative semantics as well as other logic programming languages. Previous semantic definitions for Prolog typically encode the sequential depth-first search of the language into various mathematical frameworks. Such semantics mimic a Prolog interpreter in the sense that following the "leftmost" infinite path in the computation tree excludes computation to the right of this path from being considered by the semantics. The basic idea in this paper is to abstract away from the sequential control of Prolog and to provide a declarative characterization of the clauses to apply to a given goal. The decision whether or not to apply a clause is viewed as a query to an oracle wh...
Prolog's Control Constructs in a Functional . . .
- INTERNATIONAL JOURNAL OF FOUNDATIONS OF COMPUTER SCIENCE
"... The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control constructs ..."
Abstract
-
Cited by 10 (5 self)
- Add to MetaCart
The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control constructs including the cut, all solution collecting functions, and error handling facilities. Embedded Prolog lacks some concepts such as logical variables but it inherits all of Haskell's strengths, eg static polymorphic typing, higher order functions etc. Technically, the integration is achieved using monads and monad transformers. One of the main innovations is the de nition of a backtracking monad transformer, which allows us to combine backtracking with exception handling and interaction. Second, we work towards an axiomatization of the operations, through which the computational features are accessed. Equations are used to lay down the meaning of the various operations and their interrelations enabling the programmer to reason about programs in a simple calculational style. The axiomatization is applied to show that each nite computation has a simple canonical form.
A Logical Semantics for Depth-First Prolog with Ground Negation
- Theoretical Computer Science
, 1993
"... : A sound and complete semantics is given for sequential, depth-first logic programming with a version of negation as failure. The semantics is logical in the sense that it is built up only from valuation functions (multi-valued logic interpretations in the style of Fitting and Kunen) and logically- ..."
Abstract
-
Cited by 9 (3 self)
- Add to MetaCart
: A sound and complete semantics is given for sequential, depth-first logic programming with a version of negation as failure. The semantics is logical in the sense that it is built up only from valuation functions (multi-valued logic interpretations in the style of Fitting and Kunen) and logically-motivated equivalence relations between formulas. The notion of predicate folding and unfolding with respect to a program (Tamaki, Sato, Levi et al.) and the universal notion of "disjunctive unfolding" (Andrews) are important elements of this semantics. The negation used is the version which returns an error indication whenever it is invoked on a non-ground goal. It is theoretically interesting that this form of negation, along with the left-to-right processing of depth-first logic programming, can be characterized logically with four-valued interpretations over an extended alphabet of terms. The fourth truth value, N , can be read operationally as "floundering on negation". The extension of...
Sequence-Based Abstract Interpretation of Prolog
, 1997
"... Abstract interpretation [19] is a general methodology for systematic development of program analyses. It has been applied to various formalisms and paradigms including flow-charts and imperative, functional, logic, and constraint programming. ..."
Abstract
-
Cited by 7 (6 self)
- Add to MetaCart
Abstract interpretation [19] is a general methodology for systematic development of program analyses. It has been applied to various formalisms and paradigms including flow-charts and imperative, functional, logic, and constraint programming.

