users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interpreted prolog


From: cvb
Subject: Re: interpreted prolog
Date: Sat, 08 Sep 2001 23:48:00 -0400

Christer Johansson wrote:
while I thought that a query like : xerox(tantric, meditation). should
just fail - the gprolog compiler gives an 'existence error'.
That is what most prolog machines do, e.g.,
aisun1[Sun Sep  9 00:10:23 EDT 2001]bancroft prolog
Quintus Prolog Release 3.3 (Sun 4, SunOS 5.5.1)
Originally developed by Quintus Corporation, USA.
Copyright (C) 1996, AI International Ltd.  All rights reserved.
Castle Chambers, High Street, Berkhamsted, Herts, UK. +44 (0)1442 873873
Email: address@hidden    WWW: http://www.aiil.co.uk
Licensed to Artificial Intelligence Center University of Georgia

| ?- xerox(tantric, meditation).
! Existence error in xerox/2
! procedure user:xerox/2 does not exist
! goal:  xerox(tantric,meditation)

| ?- halt.
aisun1[Sun Sep  9 00:10:23 EDT 2001]bancroft sicstus
SICStus 3.8.5 (sparc-solaris-5.7): Fri Oct 27 10:12:22 MET DST 2000
Licensed to ai.uga.edu
| ?- xerox(tantric, meditation).
{EXISTENCE ERROR: xerox(tantric,meditation): procedure user:xerox/2 does not exist}

Is there a way around this - a way to run prolog in interpreted prolog? Some way to turn off the existence errors?
To do so may be making a sort of meta "closed world" assumption, claiming "unknown predicates are false."

Given a set of literal facts from xerox.pl, such that,

| ?- [xerox].
[xerox].
compiling /usr/home/bancroft/src/prolog/gpvn/xerox.pl for byte code...
/usr/home/bancroft/src/prolog/gpvn/xerox.pl compiled, 5 lines read - 530 bytes written, 33 ms

(10 ms) yes
| ?- listing.
listing.

xerox(zen, meditation).
xerox(hatha, yoga).
xerox(kundalini, yoga).

yes
| ?- xerox(tantric, meditation).
xerox(tantric, meditation).

no
| ?-

One can tell that the predicate as defined does not contain the desired literal.  This is slightly different than not having a definition for the predicate!

In any case, the following may be what you are asking for,

main :-
  repeat,
  format( "] ?- ", [] ),
  read(X),
  catch(X,_,(format("no.~n",[]),fail)),
  format("yes.~n",[]),
  fail.
Was this a homework question ?

more,
l8r,
v


reply via email to

[Prev in Thread] Current Thread [Next in Thread]