From prolog-request@swi.psy.uva.nl Thu Nov 27 08:36 PST 1997 Status: O (5.65c/IDA-1.4.4/SWI-1.1m for dick@csci.csusb.edu); Thu, 27 Nov 1997 17:33:00 +0100 Resent-Date: Thu, 27 Nov 1997 17:31:36 +0100 X-Organisation: Social Science Informatics, University of Amsterdam X-Address: Roetersstraat 15, 1018 WB Amsterdam, The Netherlands. X-Phone: +31 20 5256789 X-Fax: +31 20 5256896 Date: Thu, 27 Nov 1997 17:31:36 +0100 Message-Id: <199711271631.RAA10536@oorlam.swi.psy.uva.nl> From: Jan Wielemaker Subject: Re: Prolog for the Mac To: pnugues@greyc.ismra.fr In-Reply-To: Pierre Nugues's message of Thu, 27 Nov 1997 13:57:09 +0100 Phone: +31 - 20 - 525 6121 Cc: prolog@swi.psy.uva.nl Resent-Message-Id: <"kvgXl.A.TME.MAaf0"@swi> Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: formail -q- -D 8192 msgid.cache X-Loop: prolog@swi.psy.uva.nl Pierre, > I am using SWI-Prolog in my University and for my students. I found it > really great. At home, I have a Mac. Have you got a version for it? If > not, does the C code contains peculiarities specific to Windows or Unix. > (Do you think it is easy to port) As far as I'm aware, there is no version for the Mac, though I think it compiles on Mac Unix. The source is fairly portable and does not contain too many OS dependencies, though it uses various OS specialities when detected by the configuration script. There are three potentional problem areas: # File-name mapping Is internally Unix. On windows, the library uxnt (source available in the win32libs/uxnt.zip) provides emulation for the required Unix view on files for Win32. This shouldn't be too hard to reimplement for another OS. # Handling of memory for the stacks. If possible, SWI-Prolog wants hardware support for detection stack-overflows, and it wants to do `sparse-allocation' of the stacks. In Unix, this is implemented based on mmap() and handling segementation faults. On Windows, we use VirtualAlloc() and friends wit software overflow checks, as exception-based checking doesn't work reliable on all Windows versions. If none of this is availble, the stacks are managed using malloc() realloc() and possibly shifted. Using malloc()/realloc(), the system needs to be able to perform a malloc() returning the combined global and local stack. So, 64 K limits are deadly. # Handling (character) IO. All I/O is handled by the module pl-stream.c, implementing Prolog I/O streams. These streams are structures, containing pointers for the various operations (write, read, seek). By default, they are bound to reading/writing to fileno(stdin), etc. For the Win32 plwin.exe they are redefinined to read/write the I/O window. Otherwise, the code should run on any (32 or more)-bit processor. Some gcc extensions are used when available (goto var). If you have a port for a real Unix bourne shell (bash?), you could try to run the configure script to get many things configured automatically. Don't even try quick-and-dirty sh look-alikes, they almost surely will break on configure. Otherwise you'll have to copy config.h.in to config.h and edit the options by hand. I'd be glad to receive your results. Regards --- Jan From prolog-request@swi.psy.uva.nl Tue Mar 24 08:29 PST 1998 Status: O (5.65c/IDA-1.4.4/SWI-1.1m for dick@csci.csusb.edu); Tue, 24 Mar 1998 17:25:40 +0100 Resent-Date: Tue, 24 Mar 1998 08:11:30 -0800 X-Organisation: Social Science Informatics, University of Amsterdam X-Address: Roetersstraat 15, 1018 WB Amsterdam, The Netherlands. X-Phone: +31 20 5256789 X-Fax: +31 20 5256896 From: dick@csci.csusb.edu (Dr. Richard Botting) Date: Tue, 24 Mar 1998 08:11:30 -0800 Message-Id: <199803241611.IAA35776@csci.csusb.edu> To: jan@swi.psy.uva.nl, prolog@swi.psy.uva.nl Subject: Suffix/Extension for Prolog source files on the WWW Resent-Message-Id: <"cZDV4B.A.wnE.749F1"@swi> Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: formail -q- -D 8192 msgid.cache X-Loop: prolog@swi.psy.uva.nl My students tripped over the following little problem when trying to view some sample prolog this quarter. If you use *.pl for source code files and place them on the WWW then Netscape thinks they are PERL programs and refuses to display them... or in some circumstance could execute the Prolog as a PERL program with intriguing results! I would suggestthat we adopt *.plg as the suffix or extension for Prolog source files. By the way... has anyone set up netscape to use SWI as a plugin? Prolog applets even? dick botting http://www.csci.csusb.edu/dick/signature.html Junk EMail will be deleted unread. Disclaimer: CSUSB may or may not agree with this message. Copyright(1998): Copy freely but say where it came from. From jhodgson@betelgeuse.sju.edu Tue Mar 24 11:31 PST 1998 Date: Tue, 24 Mar 1998 14:40:56 -0500 From: jhodgson@mailhost.sju.edu (Jonathan Hodgson) Message-Id: <199803241940.OAA15184@wilkes.sju> To: dick@csci.csusb.edu Subject: Re: Suffix/Extension for Prolog source files on the WWW X-Sun-Charset: US-ASCII Status: O I have always used .pro as my prolog extension. Jonathan Hodgson Dept. of Math/CSC St. Joseph's University Philadelphia. PA 19131 USA (610) 660-1571 From prolog-request@swi.psy.uva.nl Tue Feb 22 03:27:04 2000 Resent-Date: Tue, 22 Feb 2000 12:05:09 +0100 (MET) From: Jan Wielemaker Organization: SWI, University of Amsterdam To: prolog@gollem.swi.psy.uva.nl Subject: Version 3.3.2 uploaded Date: Tue, 22 Feb 2000 11:32:02 +0100 MIME-Version: 1.0 Message-Id: <00022211432901.20611@gollem> Resent-Message-ID: Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: archive/latest/465 X-Loop: prolog@swi.psy.uva.nl Status: O Hi, Please find SWI-Prolog 3.3.2 at the usual places. Please *don't* use the 3.3.1, as this one got a horrible mistake. Highlights (relative to 3.3.0): * Fairly well tested to run on Linux/Alpha machines (with thanks to Gert-Jan van Noord for testing and providing access to their machine). Please note that most patches are for 64-bit machines in general. * Fixed a problem on some architectures handling clauses with >1000 variables (Win32, Solaris and other platform that used software guarded stacks). * Fixed fatal crashes after catching stack-overflow exceptions. * Fixed problems with the PPC processor (and possibly others, depending on the implementation of stdarg handling). causing crashes on affected processors. * Singleton mistakes are warnings again (instead of errors). Regards --- Jan ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/ From prolog-request@swi.psy.uva.nl Tue Mar 23 06:38 PST 1999 Status: O (5.65c/IDA-1.4.4/SWI-1.1m for dick@csci.csusb.edu); Tue, 23 Mar 1999 15:38:34 +0100 Resent-Date: Tue, 23 Mar 1999 06:38:07 -0800 (PST) X-Organisation: Social Science Informatics, University of Amsterdam X-Address: Roetersstraat 15, 1018 WB Amsterdam, The Netherlands. X-Phone: +31 20 5256789 X-Fax: +31 20 5256896 From: Jan Wielemaker To: prolog@swi.psy.uva.nl, "Benjamin Hirsch" Subject: Re: precision of floating Date: Tue, 23 Mar 1999 15:30:47 +0100 Message-Id: <9903231537400B.00851@oorlam> Resent-Message-Id: <"7_dYZC.A.b4F.bc692"@swi> Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: archive/latest/64 X-Loop: prolog@swi.psy.uva.nl On Tue, 23 Mar 1999, Benjamin Hirsch wrote: >I was wandering about the precision of floting point computations, and >whether there is a way to change it (make it more precise). Floats are handled as C-doubles. On most machines this implies IEEE 64-bits floats. Precision of operations depends on the environment into which SWI-Prolog was compiled/runs. The feature float_format defines the format-specifier used for default printing of floats. So, using ?- set_feature(float_format, '%.15f'). ?- A is pi. A = 3.141592653589793 >secondly, it seems to me that retractall is not working. I had to use a >forall/2 clause in order to get rid of asserted facts. Please include an example. In general it works just fine. Please note however that the argument just describes the *head* of the clause. This is simply how it is defined to work. >Thirdly I wonder what exaclty happens when I reconsult a file. Does it first >retract all the clauses, or does it append? First step, it deletes all clauses it has loaded from the file before. Please note that the administration is clause-based, so clauses coming from other files (multifile) or dynamic stuff are not removed. Next, clauses are added as they are read (after expanding them using expand_term/2). Regards --- Jan From prolog-request@swi.psy.uva.nl Sun Jan 9 21:04:28 2000 Resent-Date: Mon, 10 Jan 2000 04:13:46 +0100 (MET) Date: Mon, 10 Jan 2000 15:45:54 +1300 (NZDT) From: "Richard A. O'Keefe" Message-Id: <200001100245.PAA29545@hermes.otago.ac.nz> To: merkosh@planet-interkom.de, prolog@swi.psy.uva.nl Subject: Re: predicate logic & using accumulater Resent-Message-ID: Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: archive/latest/371 X-Loop: prolog@swi.psy.uva.nl Status: RO Uwe Mayer wrote: I am learning from a book, called "Clause and Effect" by William F. Clocksin. In worksheet 6 he introduces the use of an accumulator in a procedure, calculating the length of a list: 1. length([], 0). length([H|T], N) :- length(T, Nt), N is Nt+1. 2. length(L,N) :- accumulate(L, 0, N). accumulate([], A, A). accumulate([H|T], A, N) :- A1 is A+1, accumulate(T, A1, N). Furthermore he states that the second version should be preferred. WHY? For debugging purposes? It has nothing to do with debugging, and everything to do with converting body recursion to tail recursion. The point is that the second version can be executed in bounded (and rather small) memory space, while the first version cannot. This really has very little to do with Prolog per se; efficient techniques for compiling tail calls and the accumulator passing method for converting body calls to tail calls were first developed for functional languages. my second question is more theoretical. in analysis phrases like "for all" and "there exists" (dt. Quantoren) are used. "quantifiers" in English. my second book states that we are only using first order predicate logic in prolog. (fine) Not even all of that. and that in first order predicate logic we use these on individuals and varriables (fine) Not true. Quantifiers introduce logical variables, which stand for individuals. You cannot "use quantifiers on" individuals. BUT that in second (and higher) predicate logic these work on predicate varriables. (not fine) On the contrary, extremely fine and very important. They may also work on function variables. i have problems immagening such a construction. Here is an example of a second-order predicate: for all binary relations P: S x S -> Bool <- second order quantifier reflexive(P) if and only if for all elements X: S <- first order quantifier P(X, X) If you want to say that the composition of any two reflexive relations is reflexive, but the composition of two transitive relations is not necessarily transitive, that's a second-order statement. Prolog cannot quantify over functions or predicates (you _can_ with a bit of work quantify over *names* of existing predicates, but that is not true higher order quantification) but there are logic programming languages that can, to some degree. first case is clear, f.e.: define a partial map censor such that the goal censor(X,Y) maps the input list X of words onto the output list Y of words in which no prohibited words from prohibit(Z) appears. prohibit(bother). prohibit(blast). prohibit(drat). prohibit(fiddlestick). censor([],[]). censor([X|T],[X|L]) :- not prohibit(X), censor(T,L). censor([X|T],L) :- prohibit(X), censor(T,L). the second clause of censor can be described as "censor matches the head of the input list to the head of the output list, if FOR ALL VALUES of the head of the input list: prohibit(head of input list) fails and recurse on the tail of the input list". In fact the second clause is (forall X) (forall T) (forall L) ~prohibit(X) & censor(T, L) => censor([X|T], [X|L]). this would be quantifying (using ) on varriables. *All* quantifiers of *any* order involve variables. The question is what the possible *values* of those variables might be. In this clause, the implicit universal quantifiers do NOT in any useful sense quantify over "variables", they quantify over terms in the Herbrand Universe (the set of labelled trees that can be made using functors that appear in the program consistently with their arities). Can anyone give me an example of quantifying on predicate varriables? censor(Filter, [], []). censor(Filter, [X|T], [X|L]) :- ~Filter(X), censor(Filter, T, L). censor(Filter, [X|T], L ) :- Filter(X), censor(Filter, T, L). Here the values of Filter would be predicates. In Prolog, the values of Predicates can be closures; *names* of existing predicates together with zero or more arguments already supplied. (Pure) Prolog, however, cannot construct *new* predicates or functions as part of its solution process (some logic programming languages can). Why are such constructions not possible in Prolog? Because propositional calculus (no quantifiers) is decidable unary function-free predicate calculus is decidable first-order predicate calculus is *semi*-decidable second-order predicate calculus is *un*-decidable in general. and higher-order programming (with *given* function or predicate values) as in functional programming can be "faked" quite easily by automatically augmenting each Prolog program with the definitions % call/1 call(p(X1,X2,X3)) :- p(X1, X2, X3). ... % call/2 call(p(X1,X2), X3) :- p(X1, X2, X3). ... % call/3 call(p(X1), X2, X3) :- p(X1, X2, X3). ... % call/4 call(p, X1, X2, X3) :- p(X1, X2, X3). ... where each predicate in the program is represented in each of these tables. That allows code like censor(Filter, [], []). censor(Filter, [X|T], L) :- ( call(Filter, X) -> L = R ; L = [X|R] ), censor(Filter, T, R). why are they useless? They are NOT useless. Higher-order quantifiers are quite useful. Prolog is just one point in the spectrum of possible logic programming languages. Certain engineering choices were made, which permitted efficient implementation on 1970s hardware with 1970s knowledge. ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/ From prolog-request@swi.psy.uva.nl Wed Mar 1 10:18:55 2000 Resent-Date: Wed, 1 Mar 2000 19:12:51 +0100 (MET) Date: Wed, 1 Mar 2000 17:55:43 +0000 (GMT) From: Elias To: Farhang Obohhat cc: "prolog@swi.psy.uva.nl" Subject: Re: Book on Prolog In-Reply-To: Message-ID: MIME-Version: 1.0 Resent-Message-ID: Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: archive/latest/494 X-Loop: prolog@swi.psy.uva.nl Status: O Prolog: Programming for Artificial Intelligence by Ivan Bratko There is another useful book by Clocksin and Mellish. The best way to learn in my opinion is to look at sample programs and experiment. Elias On Wed, 1 Mar 2000, Farhang Obohhat wrote: > Hi every one, > I am Just beginning to learn Prolog and > I do not know where to start, > Please if you know any book or site that has > beginner jump start let me know > Thank you > Farhan > > __________________________________________________ > Do You Yahoo!? > Talk to your friends online with Yahoo! Messenger. > http://im.yahoo.com > > > ---------------- > * To UNSUBSCRIBE, please use the HTML form at > > http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist > > or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" > (without the quotes) and *no* message body. > > ** An ARCHIVE of this list is maintained at > > http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/ > ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/ From prolog-request@swi.psy.uva.nl Wed Mar 1 11:08:45 2000 Resent-Date: Wed, 1 Mar 2000 20:05:10 +0100 (MET) Message-ID: <38BD66FD.5BB2FF52@noe.ubi.pt> Date: Wed, 01 Mar 2000 18:52:45 +0000 From: Paulo Moura Reply-To: pmoura@noe.ubi.pt Organization: University of Beira Interior, Portugal X-Accept-Language: en,pdf MIME-Version: 1.0 To: Farhang Obohhat CC: "prolog@swi.psy.uva.nl" Subject: Re: Book on Prolog X-MIME-Autoconverted: from quoted-printable to 8bit by swi.psy.uva.nl id TAA09796 Resent-Message-ID: Resent-From: prolog@swi.psy.uva.nl X-Mailing-List: archive/latest/495 X-Loop: prolog@swi.psy.uva.nl Status: O Farhang Obohhat wrote: > > Hi every one, > I am Just beginning to learn Prolog and > I do not know where to start, > Please if you know any book or site that has > beginner jump start let me know You can find some links to Prolog tutorials (and other resources) in the following page: http://www.ci.uc.pt/logtalk/links.html Regards, Paulo ----------------------------------------------------------- Paulo Jorge Lopes de Moura Dep. of Mathematics and Informatics Office 4.32 Ext. 3251 University of Beira Interior Phone: +351 275319700 6200 Covilhã Fax: +351 275319732 Portugal mailto:pmoura@noe.ubi.pt http://www.ci.uc.pt/logtalk/pmoura.html ----------------------------------------------------------- ---------------- * To UNSUBSCRIBE, please use the HTML form at http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe" (without the quotes) and *no* message body. ** An ARCHIVE of this list is maintained at http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/