Re: How to solve a problem with an infinite loop [beginners question]



On Oct 8, 6:08 am, philipp.str...@xxxxxxxxx wrote:
thank you very much for your answers.
[snip]
What is the theoretical (complexity) reason that this behavior is not
implemented by Prolog itself?

Someone answered my post via E-Mail, informing me about a Prolog
system called xsb (http://xsb.sf.net) that has exactly this feature
(Thanks).

Best wishes to everybody

Philipp

As Neng-Fa Zhou mentions below, there is an extension to
Prolog's resolution procedure called tabled resolution.
The basic idea is not to try reproving "facts" that are
already once proven. The transitive closure/connectivity
problem is an often used illustration of the need for an
extension of this kind, see for example:

[Programming in Tabled Prolog (very) Draft]
http://www.cs.sunysb.edu/~warren/xsbbook/book.html

Of course it makes sense to allow for Prolog to operate
without such universal restriction as never reproving
the same goal twice, because many "hacks" like the
repeat predicate would then no longer "work".

regards, chip

.