1

All implementations of the functional programming language are required to perform whenever it is applicable.

Does have this one and / or similar requirements?

It's clear to me that Prolog processor features like first argument principal functor indexing and atom garbage collection are widely adopted, but are not prescribed by the ISO standard.

But what about ?

Make believe that some Prolog system gets the semantics right, but does not guarantee that ...

rep.
rep :- !, rep.
rep.

?- rep, false.

... can run forever with constant stack space?

Could that system still be ISO-Prolog compliant?

repeat
  • 18,496
  • 4
  • 54
  • 166
  • 1
    I think these type of questions are great but they are at another level beyond me. If only they were on another forum for more advanced Prolog then I would haven't to spend so much time looking for them here. – Guy Coder Apr 12 '19 at 12:11
  • @GuyCoder. Let's keep the discussion here at SO, for the Prolog community is dispersed enough already... in the meantime, have U read https://mitpress.mit.edu/books/art-prolog-second-edition yet (out of press, free pdf download)? – repeat Apr 12 '19 at 13:05
  • I have that book and `The Craft of Prolog` and the ISO standard. I know, I should read them more. :) – Guy Coder Apr 12 '19 at 13:31
  • @repeat: I believe from what you said that you indeed have read the standard. If it does not mention those requirements then a prolog processor shouldn't be requiered to meet them in order to be complaint. – gusbro Apr 12 '19 at 13:34
  • @repeat: Regarding those other features that are widely adopted... GNU Prolog which is supposedly almost ISO-Compliant does not have atom garbage collection (there is some code to do that but for some reason it is not included by default when you build the processor). – gusbro Apr 12 '19 at 13:39
  • @gusbro. To be perfectly honest, I'm still have not read it front to back, so that's why I'm asking:) Regarding GNU Prolog... I think that Ulrich Neumerkel's big page http://www.complang.tuwien.ac.at/ulrich/iso-prolog/conformity_testing refers to *syntax* (basically read_term and write_term). Other pages in his web of pages http://www.complang.tuwien.ac.at/ulrich/iso-prolog/ are about DCGs, builtin predicates, evaluable functors, and other important details, but I couldn't deduce if (or to what degree) GNU Prolog is more conformant than, say, SICStus Prolog or not. – repeat Apr 12 '19 at 15:11

1 Answers1

3

Whenever you are reading a standard, first look at its scope (domaine d'application, область применения, Anwendungsbereich). Thus whether or not the standard applies to what you want to know. And in 13211-1:1995, 1 Scope there is a note:

NOTE - This part of ISO/IEC 13211 does not specify:

a) the size or complexity of Prolog text that will exceed the
capacity of any specific data processing system or language
processor, or the actions to be taken when the corresponding
limits are exceeded;

b) the minimal requirements of a data processing system
that is capable of supporting an implementation of a Prolog
processor;

...

Strictly speaking, this is only a note. But if you leaf through the standard, you will realize that there are no such requirements. For a similar situation see also this answer.

Further, resource errors (7.12.2 h) and system errors may occur at "any stage of execution".

Historically, the early implementations of DEC10 did not contain last call optimizations and a lot of effort was invested by programmers to either use failure driven loops or enable logarithmic stack usage.

In your example rep, a conforming system may run out of space. And that overflow may be signaled with a resource error, but even that is not required since the system might bail out with a system error. What is more irritating to me is the following program

rep2 :- rep2.
rep2.

Even this program may run infinitely without ever running out of space! And this although nobody cuts away the extra choice point.

In summary, recall that conformance with a standard is just a precondition for a working system.

Community
  • 1
  • 1
false
  • 10,264
  • 13
  • 101
  • 209