PROLOG-REQUEST@SU-SCORE.ARPA (Chuck Restivo, The Moderator) (03/31/86)
PROLOG Digest Monday, 31 Mar 1986 Volume 4 : Issue 12 Today's Topics: Query - Multi Processor Compilation & Snips & Economy, Implementation - C Prolog Bug ---------------------------------------------------------------------- Date: Mon 10 Mar 86 08:41:27-EST From: Vijay <Vijay.Saraswat@C.CS.CMU.EDU> Subject: Query on multi-processor implementations of I am looking into the possibility of implementing the language CP[!,|,&] on the Supercomputer Workbench (a shared memory multi-processor) here at CMU. I would very much appreciate leads/pointers to actual/proposed work on the implementations of conc. Logic programming languages on REAL parallel machines. (I am not looking for feasibility studies, or numbers obtained from multi-processor simulations.) Also, if there are such implementations, I would be interested in bench-marks on `standard' problems. Answers may be sent to me directly (Saraswat@c.c. cmu.edu) or to the Prolog Digest: I'll summarise and post to the Digest if there is enough interest. -- Vijay Saraswat. ------------------------------ Date: 10 Mar 86 21:27:00 GMT From: Mark Gooley <Gooley@ucbvax.berkeley.edu> Subject: Prolog compilation? A reference that keeps appearing in article after article about Prolog is D. H. D. Warren's "Implementing Prolog -- compiling predicate logic programs" (D.A.I. Research Reports 39 and 40, Dept. of Artificial Intelligence, University of Edinburgh, 1977). Is it just being mentioned as a matter of form (as the over-rated Mead & Conway VLSI textbook is in its field), or is it genuinely useful? (I'm interested in optimizing Prolog but I don't want to "re-invent the wheel.") I haven't been able to look at a copy: the C.S. Dept. library here describes all technical reports that nobody marks as immediately useful, the inter-library loan people tell me that no U. S. library has a copy, and my letter to Edinburgh has been absorbed by a black hole. Has some better, more-readily-available book or report on compiling Prolog been written? Failing that, could someone lend me a copy of the Warren reports? Many thanks. -- Mark Gooley ------------------------------ Date: Fri 14 Mar 86 16:02:12-EST From: Vijay <Vijay.Saraswat@C.CS.CMU.EDU> Subject: Implementation of snips? Is there a fast implementation of snips (i.e cuts which allow the next clause to be chosen, without the goals in the current clause from the head to the currently failing goal being retries) for DEC-20 Prolog? Thank you. -- Vijay ------------------------------ Date: 19 Mar 86 12:53:39 GMT From: allegra!dep@ucbvax.berkeley.edu Subject: Making Recursion Affordable in Prolog ? I had a similar problem. I have written a Prolog program to explore the problems of creating and maintaining a very large data base (using my record collection of 1500 records as an example, with full information about composers, performers, and pieces performed). With about one quarter of the records entered I encountered the stack overflow problem and started extending the stacks and other data structures. But of course as the data base grew bigger, the stacks had to be enlarged as well - a rather hopeless task. My solution to the problem is as follows (using the side-effect aspects of Prolog): I had a main program something like getlist(L1), sort(L1,L2), putindb(L2), processdblist, ... the putindb goes like this: putindb([]). putindb([H|T]) :- assert( something(H) ), or maybe assertz putindb(T), !. then processdblist is processdblist :- something(H) # process(H), fail, processdblist. The database has things in the order desired and you process each member of the original list in the desired order. The # operator means "succeed only once - unbind on backtracking" (a very nice operator to bring a bit of sanity to loops in Prolog). The stack problem has gone away because you dont hve to keep all the previous environments around in case you unwind to them while backtracking. -- Dewayne ------------------------------ Date: 18 Mar 86 02:35:34 GMT From: DCGoricanec@ucbvax.berkeley.edu Subject: Making Recursion Affordable in Prolog ? <chomp> Hello world. Examine the following : rubik_cube([],New_perm) :- write(New_perm),!. rubik_cube([H|T],New_perm) :- move_generator(H,New_perm,Newer_perm), rubik_cube(T,Newer_perm). This predicate is invoked by a list of cube moves such as rubik_cube([u,r2,l,r2],Resultant_perm)? Fine. I can submit a list of 25 such moves to a program on my IBM-XT with 512k running plvp+ but 26 moves causes a stack overflow.I would like 225 moves in my list ... My question is : Since this program is list-driven and only recurses to split the list, how can I kill the thousands of instantiations cluttering the stack when I move on to the next list element? i.e. kind of like a cut but instead of inhibiting backtracking, I want to inhibit recursive memory of past events) Currently my program is 15k long and can solve u-face efficiently by using the tables published by Singmaster. Generalization to the whole cube group is trivial once I get prolog to handle a big list splitting. ------------------------------ Date: Thu, 20 Mar 86 14:57:26 cst From: Srinivas Sataluri <Sataluri%UIowa.csnet@CSNET-RELAY> Subject: A Bug in C-Prolog Version 1.5 A bug was found in the C-Prolog, version 1.5, implementation of exponentiation. The behavior is mysterious and worth documenting. Consider the following Prolog rules, each of which is an encoding of the relation: P = X ** (N-I) rule0(P,X,N,I) :- I >= 0, P is X^(N-I). rule1(P,X,N,I) :- I >= 0, Y is N-I, P is X^Y. rule2(P,X,N,I) :- I >= 0, Y is N-I, Z is X^Y, P is Z. The following is the observed behavior of the interpreter: | ?- rule0(1,5,2,2). yes | ?- rule1(1,5,2,2). yes | ?- rule2(1,5,2,2). yes | ?- rule0(5,5,2,1). no | ?- rule1(5,5,2,1). no | ?- rule2(5,5,2,1). yes | ?- rule0(25,5,2,0). no | ?- rule1(25,5,2,0). no | ?- rule2(25,5,2,0). yes | ?- ^D [ Prolog execution halted ] An execution trace revealed that CProlog succeeds for "1 is 5^0", and fails for "5 is 5^1" and "25 is 5^2". Rule2 avoids all these cases, by always having a variable on the left hand side of "is", and shows correct behavior. ------------------------------ Date: Fri, 21 Mar 86 18:47:20 MET From: Neideck%Germany.csnet@CSNET-RELAY Subject: C-Prolog-Bug In reply to the question of Toshiya Toba concerning C-Prolog: I have tried your test on our C-Prolog and found the same error you got. The solution is to fix a few lines in "dbase.c", which are somewhat too restrictive regarding system objects. The relevant function is "erase(r)": if (key == CLAUSE) d = SkelP(d)->Fn; if ((FunctorP(d)->flgsoffe)&RESERVED) { ErrorMess = "! Attempt to erase a system object"; return FALSE; } should be changed to if (key == CLAUSE) { d = SkelP(d)->Fn; if ((FunctorP(d)->flgsoffe)&RESERVED) { ErrorMess = "! Attempt to erase a system object"; return FALSE; } } to permit erasing of recorded entries for system identifiers without sacrificing the safety of the built-in protection mechanism. -- Burkhard Neidecker ------------------------------ End of PROLOG Digest ********************