Newsgroups: comp.lang.prolog,comp.lang.misc
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!howland.reston.ans.net!cam.news.pipex.net!pipex!edi.news.pipex.net!pipex!sunic!sunic.sunet.se!liuida!mikpe
From: mikpe@ida.liu.se (Mikael Pettersson)
Subject: continuation-passing models of backtracking
X-Nntp-Posting-Host: sen14.ida.liu.se
Message-ID: <DBEsDE.Jtp@ida.liu.se>
Sender: news@ida.liu.se
Organization: CIS Dept, Univ of Linkoping, Sweden
Date: Sat, 8 Jul 1995 17:53:37 GMT
Lines: 63
Xref: glinda.oz.cs.cmu.edu comp.lang.prolog:13442 comp.lang.misc:22251

I am trying to trace the history of the use of continuations in
modeling backtracking control flow, esp. for languages like Prolog.

One popular model, call it the "single-continuation model", explains
backtracking by mapping it to a traditional non-backtracking language
with procedure closures. "And"-control is modeled by passing a procedure
(the success continuation) to the first conjunct. When it succeeds,
it applies the success continuation it was given. This continuation
then proceeds with the second conjunct. When all solutions have been
computed, just "return".
The ordinary recursion stack deals with "or"-control. Disjunctions
simply become: "prove first disjunct; prove second disjunct".

The earliest references I've seen that make exactly this connection
are [MellishHardy84] and [Carlsson84]. (Many later papers reference
one of these two.) A slightly different thread is [Nilsson83]
which references [Sandewall76]. Sandewall's conversion uses
"remainder procedures" (his terminology). As far as I can see,
they are equivalent to success continuations.

If you know denotational semantics, then you'll also know that
the ordinary recursion stack can be modeled with continuations.
Applying this knowledge to the single-continuation model, one realizes
that "return stack" == "failure continuation". The earliest papers
I've seen that use this _explicit_ double-continuation model are
[NicholsonFoo89] and [deBruin89].

Any help in locating earlier references for the single- or double-
continuation models would be much appreciated. E-mail answers are
preferred. I'll summarize here in about two weeks (around July 20th).

(I'm not terribly interested in papers that use mappings to Scheme's
call/cc or to languages with built-in support for coroutines.)


/Mikael


References:

[Carlsson84] "On Implementing Prolog in Functional Programming".
New Generation Computing, Vol. 2, pages 347-359. 1984.

[deBruin89] "Continuation Semantics for PROLOG with Cut".
Proc. TAPSOFT'89, Vol. 1: CAAP'89, pages 178-192. LNCS-351. 1989.

[MellishHardy84] "Integrating Prolog in the POPLOG environment".
In: Tick and Succi (eds.) "Implementations of Logic Programming
Systems", pages 147-162. 1984.

[NicholsonFoo89] "A Denotational Semantics for Prolog".
ACM TOPLAS 11(4), pages 650-665. 1989.

[Nilsson83] "On the compilation of a domain-based Prolog".
In: Mason (ed.) "Information Processing 83", pages 293-298. 1983.

[Sandewall76] "Conversion of Predicate-Calculus Axioms to Corresponding
Deterministic Programs". IEEE Transactions on Computers, Vol. C-25,
No. 4, pages 342-346. 1976.
--
Mikael Pettersson                                | Email: mpe@ida.liu.se
Department of Computer and Information Science   | Phone: +46 13282683
Linkoping University, S-581 83 Linkoping, SWEDEN | Fax  : +46 13282666
