| Christopher T. Haynes. Logic continuations. The Journal of Logic Programming, 4(2):157--176, June 1987. |
....the natural way in which to do this. Instead of having a single calling context # to which it always returns normally, a sub program that has a notion of finite failure can be supplied with two continuations, # and # , which it may invoke respectively in the event of success and failure [Hay87, Thi01]. This translation is not the one that we obtain from disjunction (cf. Proposition 10.6) but does fall naturally out of the interpretation of coproducts (disjoint unions) in [B, Section 11] 11.6. Remark. There are several reasons why pure Prolog should arise as the intermediate or object ....
Christopher Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....(f h) h) This fails to typecheck since h, which is # bound and hence linear, is passed to f as both its return continuation and argument. Similar backtracking behaviour can be seen in snobol and Prolog, and their continuation semantics do not obey a discipline of linearly used continuations [14, 7]. 6. REIFIED CONTINUATIONS, AND UPWARD VERSUS DOWNWARD It might be expected that the reason continuations are used linearly in the call return and exceptions cases is that they are not reified, which is to say directly named by program variables, as callcc achieves. After all, source language ....
C. T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
.... operations: rst class continuations like those given by call cc in Scheme [4] dynamic control in the sense of Lisp, and typeable in a way reminiscent of checked exceptions; a return operation, which can be re ned into the J operator invented by Landin in 1965 and ancestral to call cc [4, 6, 7, 13]. We examine these constructs in turn, giving a simple type system in each case. An unusual feature of these type judgements is that, because we have two continuations, there are two types in the succedent on the right of the turnstile, as in M : A; B: The rst type on the right accounts for ....
....11(3) 7 105, 1998. 5] J. Kim, K. Yi, and O. Danvy. Assessing the overhead of ML exceptions by selective CPS transformation. In Proceedings of the 1998 ACM SIGPLAN Workshop on ML, 1998. 6] P. J. Landin. A generalization of jumps and labels. Report, UNIVAC Systems Programming Research, Aug. 1965. [7] P. J. Landin. A generalization of jumps and labels. Higher Order and Symbolic Computation, 11(2) 1998. Reprint of [6] 8] G. Plotkin. Call by name, call by value, and the calculus. Theoretical Computer Science, 1(2) 125 159, 1975. 9] J. C. Reynolds. De nitional interpreters for ....
[Article contains additional citation context not shown here]
C. T. Haynes. Logic continuations. Journal of Logic Programming, 4:157-176, 1987.
....(f h) h) This fails to typecheck since h, which is bound and hence linear, is passed to f as both its return continuation and argument. Similar backtracking behaviour can be seen in snobol and Prolog, and their continuation semantics do not obey a discipline of linearly used continuations [14, 7]. 6. REIFIED CONTINUATIONS, AND UPWARD VERSUS DOWNWARD It might be expected that the reason continuations are used linearly in the call return and exceptions cases is that they are not rei ed, which is to say directly named by program variables, as callcc achieves. After all, source language ....
C. T. Haynes. Logic continuations. Journal of Logic Programming, 4:157-176, 1987.
....of Prolog, especially the work in evolving algebra by Borger and Rosenzweig [BR90, BR92] will be interesting. Continuation Passing Style The specification presented in this paper is similar in spirit to the continuation passing style used in functional programming implementation of Prolog [Hay87, EF91]. In P (s; f; b) the s can be treated as the address of the success continuation process which is invoked when P sends s; the f can be treated as the address of failure continuation process which is invoked when P sends f ; and the b is used to pass the address of failure continuation to the ....
C.T. Haynes. Logic continuations. Journal of Logic Programming, 4(2):157--176, 1987.
....variations on logic programming languages, this chapter should provide enough detail and techniques for the rapid implementation of a modi ed interpreter of related languages. Our approach is to write a true interpreter, and not to embed Prolog in ML the way Prolog is embedded in Scheme in [9] and [17]. The primary di erence is that we separate carefully the name space of predicates of the logic programming language from the name space of functions in ML. We do not address the use of the SML module system, nor do we discuss a number of features of Prolog such as its module system, ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4(2):157-176, June 1987.
....the remaining computation of the program. A continuation may be viewed as a function of one argument. The argument is required because the current expression s value may affect the control of the remaining computation. Further information on continuations may be found in [Ste76] Ste78] Dyb87][Hay87]. 3.2 Continuation passing Style The interpreter described in this report is written in CPS a style of programming in which continuations are given explicitly to direct control flow. This implementation technique is known as the continuation passing style (CPS) Ste76] The use of CPS for this ....
....application. An example use of Scheme s call cc is shown below. k is bound to call cc s continuation and is immediately called with 12 as its parameter. The effect is that the entire expression evaluates to 12 and the addition is never performed. call cc (lambda (k) 4 (k 12) HF86][Hay87][HF87] describe a variety of control mechanisms, including coroutines and non blind backtracking, that may be implemented by the programmer using the call cc mechanism. So, let s integrate Scheme s call cc with our interpreter. First, we recognize that the call cc argument must be a function of ....
Christopher T. Haynes. Logic continuations. The Journal of Logic Programming, 4(2):157-176, June 1987.
....7 for the engine selects A (the only choice in this case) as the next goal to prove. A choice point (written c.p. in the figure) is created from all clauses in the database and all 6 There are other methods for handling the need for recursive calls. Another embedding of Prolog into Scheme [Hay87] used the fact that Scheme has first class continuations to enable backtracking through recursive calls, and used continuations for non blind backtracking or lateral control transfers. We avoided using continuations because, although they do provide a handle into the Scheme control stack, they ....
C. T. Haynes. Logic continuations. The Journal of Logic Programming, 4:157--176, 1987.
....that coreferences do not only occur between different addresses of one term but also within different parts of a clause. The bound unbound effect of logical variables is replaced by a gradual refinement of nodes. The resolution prover we implemented is an extension of the one described by Haynes [12]. Its control structure is based on socalled upward failure continuations : The theorem prover returns a failure continuation which is invoked when backtracking is necessary. Failure continuations are implemented as SCHEME continuations. The theorem prover works with a structure copying ....
....which store a specific control context can be obtained at the functional top level, our embedding is not yet complete, because an arbitrary invocation of failure continuations can violate Prolog s semantics. But the embedding can be completed by incorporating Haynes state space model (cf. [12]) ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....[76] then employ partial evaluation to produce quite good Lisp code for naive reverse with modes. Research at Indiana University showed that Horn clauses could be translated into Scheme by fairly straightforward means [55, 77] and that some care was needed to extend Prolog with continuations [66]. In particular, a generalized trail was required to suspend and resume a proof tree branch. Such operations are beyond the scope of this paper; all our failure continuations obey a stack like discipline. Paper B Debray [44] and Sehr [123, 124] use control flow graphs to optimize sequential ....
....[76] then employ partial evaluation to produce quite good Lisp code for naive reverse with modes. Research at Indiana University showed that Horn clauses could be translated into Scheme by fairly straightforward means [55, 77] and that some care was needed to extend Prolog with continuations [66]. In particular, a generalized trail was required to suspend and resume a proof tree branch. Such operations are beyond the scope of this paper; all our failure continuations obey a stack like discipline. 2.3 TRANSLATION TO CONTINUATION PASSING STYLE We assume predicates have been rewritten into ....
C. Haynes, Logic continuations, Journal of Logic Programming, 4(2):157--176, June 1987. f17, 28g
....on logic programming languages, this chapter should provide enough detail and techniques for the rapid implementation of a modified interpreter of related languages. Our approach is to write a true interpreter, and not to embed Prolog in ML the way Prolog is embedded in Scheme in [9] and [17]. The primary difference is that we separate carefully the name space of predicates of the logic programming language from the name space of functions in ML. We do not address the use of the SML module system, nor do we discuss a number of features of Prolog such as its module system, ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4(2):157--176, June 1987.
....way to provide access to the flow of evaluation in functional languages. The ability to seize the current continuation (control state of the evaluator) provides a simple and natural basis for defining numerous higher level constructs such as coroutines [22] exceptions [41] and logic variables [8, 19], for supporting multiple threads of control [6, 20, 28, 40] for providing asynchronous signal handlers [29] and for implementing non blind backtracking [15] and dynamic barriers such as unwind protect [21] Tractable logics for reasoning about program equivalence in the presence of first class ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....way to provide access to the flow of evaluation in functional languages. The ability to seize the current continuation (control state of the evaluator) provides a simple and natural basis for defining numerous higherlevel constructs such as coroutines [16] exceptions [42] and logic variables [8, 19], for supporting multiple threads of control [41, 18, 29, 6] for providing asynchronous signal handlers [30] and for implementing non blind backtracking [14] and dynamic barriers such as unwind protect [17] Tractable logics for reasoning about program equivalence in the presence of first class ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
.... mechanisms, particularly exceptions, are useful: ml style exceptions are an efficient, elegant and systematic way to recover from errors ; and continuations can be used to implement a host of sophisticated control features such as coroutines [19] multiple threads of control [43] logic variables [18], and even concurrent constructs [35] Early theoretical work in the area is mainly concerned with developing reasoning principles for functional programs with control constructs based on a minimal programming calculus. The research of Felleisen and his coworkers [11, 12] see also [41] exemplify ....
C. T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....was further analysed in Felleisen s expressiveness framework [6] In both cases, downward continuations are considered. Here, by contrast, we focus on upward continuations and control effects that are quite different from those of downward continuations. In Haynes s paper on logic continuations [11], upward failure continuations are used to implement nondeterminism (already mentioned by Reynolds [24] by way of backtracking. We found this connection to backtracking illuminating even for the highly idealised (stateless) setting of the present paper. 1.2. Outline We recall the standard ....
.... (lambda (testee) let ( ratchet (list anything #f #t) let ( f (testee) begin (set ratchet (cdr ratchet) f anything) car ratchet) backtrack arg fc) #t (backtrack arg fc proc) #f A better metaphor than state may be backtracking by way of upward failure continuations [11]. The function x:throwk (y:x) which is passed to the current continuation k could be seen as an upward failure continuation in the sense that once it is applied to an argument x, it fails, by causing backtracking, so that the constant function y:x is returned to k instead. 11 Although the very ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....that coreferences do not only occur between different addresses of one term but also within different parts of a clause. The bound unbound effect of logical variables is replaced by a gradual refinement of nodes. The resolution prover we implemented is an extension of the one described by Haynes [10]. Its control structure is based on so called upward failure continuations : the theorem prover returns a failure continuation which is invoked when backtracking is necessary. The failure continuations are implemented as Scheme continuations. The theorem prover works with a structure copying ....
....which store a specific control context can be obtained at the functional top level, our embedding is not yet complete, because an arbitrary invocation of failure continuations can violate PROLOG s semantics. But the embedding can be completed by incorporating Haynes state space model (see [10]) Type expansion A type of the type hierarchy can be defined as a ffi term with additional relational constraints. If a ffi term is of such a type, the type has to be expanded. This is done by unifying the ffi term with the defined term and evaluating the relational constraints. In a system ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
....way to provide access to the flow of evaluation in functional languages. The ability to seize the current continuation (control state of the evaluator) provides a simple and natural basis for defining numerous higher level constructs such as coroutines [22] exceptions [41] and logic variables [8, 19], for supporting multiple threads of control [6, 20, 28, 40] for providing asynchronous signal handlers [29] and for implementing non blind backtracking [15] and dynamic barriers such as unwind protect [21] Tractable logics for reasoning about program equivalence in the presence of first class ....
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
No context found.
Christopher T. Haynes. Logic continuations. The Journal of Logic Programming, 4(2):157--176, June 1987.
No context found.
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
No context found.
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157--176, 1987.
No context found.
Christopher T. Haynes. Logic continuations. Journal of Logic Programming, 4:157-- 176, 1987.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC