X = [:-,f(:-),(-)-1,(-)+(-)].
You should get back the same text as answer.
Maybe with some extra layout spaces, and maybe without
the . at the end.
If you see something else, Prolog text generated by your system
is most probably not portable. Chances are, some terms
cannot even be read back by such a system.
There is a standard for this: ISO/IEC 13211-1 published 1995-06-01.
Which systems produce the desired output? Please tell only
about working systems!
Here are the ones I have access to and that work for above test:
B, ECLiPSe, GNU, SWI, YAP
http://www.complang.tuwien.ac.at/ulrich/iso-prolog/ppq/1.txt
SICStus 4.0.2 (x86-linux-glibc2.3): Tue Nov 6 14:50:51 CET 2007
Licensed to SP4kuleuven.ac.be
| ?- X = [:-,f(:-),(-)-1,(-)+(-)].
X = [:-,f(:-),(-)-1,(-)+ -] ?
yes
XSB Version 3.1 (Incognito) of August 10, 2007
[i686-pc-linux-gnu; mode: optimal; engine: slg-wam; gc: indirection;
scheduling: local]
| ?- X = [:-,f(:-),(-)-1,(-)+(-)].
X = [:-,f(:-),- - 1,- + -]
yes
The term returned by XSB, when given to SICStus and SWI produces
different things:
SWI:
?- X = [:-,f(:-),- - 1,- + -].
X = [ (:-), f((:-)), - -(1), - + (-)].
SICStus
| ?- X = [:-,f(:-),- - 1,- + -].
X = [:-,f(:-),-(-1),(-)+ -] ?
BTW, is the following an allowed output ?
?- X = [:-,f(:-),(-)-1,(-)+(-)].
X = [(:-),f((:-)),(-) - 1,(-) + (-)]
It has a bit more () than necessary, but is read back in the same (I
think).
Cheers
Bart Demoen
>SWI:
>
>?- X = [:-,f(:-),- - 1,- + -].
>X = [ (:-), f((:-)), - -(1), - + (-)].
Old version, 5.9.3 works correctly.
>BTW, is the following an allowed output ?
>
>?- X = [:-,f(:-),(-)-1,(-)+(-)].
>
>X = [(:-),f((:-)),(-) - 1,(-) + (-)]
>
>It has a bit more () than necessary, but is read back in the same (I
>think).
This is not allowed (7.10.5). Of course this is relatively
harmless, but it is a clear indication that the implementor did
not fully understand the role of nonterminal arg (6.3.3.1).
There are two rules for it. By consequence more errors of that
kind are to be expected.
Also, these parentheses make the term unnecessarily bigger.
Often have I heard that ISO demands to add "many" additional
parentheses otherwise not needed. This is a case where
ISO demands less than what many non ISO systems do.
(I started with this example, because it is very easy to fix.)
You have this habit of suggesting that things are
contradictory when they are not...
Another funny rule, already in DEC10, comes to mind.
Namely the ( directly or not directly following
an atom:
-(a, b) =.. [F,X,Y] gives F=(-), X=a, Y=b
- (a, b) =.. [F,X] gives F=(-), X=(a,b)
The other rule is the ) following an atom:
op(1200, xfx, -) works.
mode(-, -) should not work.
mode((-), -) works.
Maybe some prologs allow more than only ) to follow
an atom. Things like , and ]?
Are there some prologs that require the ) to directly
follow the atom, or can there be space inbetween?
Best Regards
The first is functional notation which can be read
in regardless of the operator declarations.
>The other rule is the ) following an atom:
There is no rule for this.
> op(1200, xfx, -) works.
>
> mode(-, -) should not work.
Should work regardless of the operator declaration!
See 6.3.3.1 Arguments!
> mode((-), -) works.
>
>
>Maybe some prologs allow more than only ) to follow
>an atom. Things like , and ]?
This rule is yours only. But it is close to what actually
is the reason: In both the argument list of functional
notation (6.3.3) and the elements of a list (6.3.5) you have
terms of the form arg (6.3.3.1).
It depends on how you implement the parser. If you have
ambiguous grammar rules, you have to do something. When you
don't want a non-deterministic parser, you can work with
a computed set of terminals which follows a non-terminal, and
use this during parsing as a decision aid (*).
In DEC10 the rules were already ambiguous:
term(N) --> op(N,fx)
| op(N,fx) subterm(N-1)
{ if subterm starts with a '('
op must be followed by a space }
etc..
How do you decide how you can stop after op(N,fx) or need
to continue after op(N,fx). The ISO standard (refering to
a draft) has in effect the same problem:
6.3.1.3 Atoms
term = atom
a a
Priority 1201
Condition a is an operator
6.3.4.1 Operand
term = lterm
6.3.4.2 Operators as functors
lterm = op, term
f(a) f a
Priority n n n-1
Specifier fx
Condition: The first token of a is not open ct
One good enough stopping rule after the operator would
be the appearance of ')'. Actually I don't see any hint
in the ISO standard as to how implement the parser
effectively, so it has the same defect.
Bye
(*)
See PL0 book by N. Wirth, or some other books on
recursive decent parsing with some look ahead.
>to continue after op(N,fx). The ISO standard (refering to
>a draft) has in effect the same problem:
I can only repeat what I told you already once:
If you want to discuss the ISO standard you really have
to have it in front of you. I cannot second-guess what
"a draft" is. There have been changes to make certains
parts easier to implement. I will not go down tracing
things draft-by-draft.
SICStus 4.1 beta seems OK
A.L.
> If you want to discuss the ISO standard you really have
> to have it in front of you. I cannot second-guess what
> "a draft" is. There have been changes to make certains
> parts easier to implement. I will not go down tracing
> things draft-by-draft.
I am not asking you to answer this posting. This is
not personal bilateral e-mail. This is usenet, anybody
can drop his penny of thought. If you can't based on
what I have copied into the posting, don't worry.
Bye
BTW: Its common practice for example in academia to
have good draft versions of important papers. This
way students can also have cheap access.
I think its relatively perverted to discuss ISO
stuff in a puplic forum, when no such a draft
is around. Unless you want not that the discussion
is open.
The covington darft for example ist quiet good.
There is no difference in the sections I was citing.
The only difference is that in the ISO PDF version
my company name will be printed on the bottom.
Please note I am not promoting some copyright infringement
or some such. Of course a company should buy a license
from ISO. In the same way a company should buy software
licenses.
But I am somehow promoting the use of drafts parallel
to licenses, if possible. Also when new radical
additions or versions of ISO prolog should be published
in the future, it is probably good advice to have a
good draft available, before becoming officially published.
Bye
Amzi! Prolog 7.6.9 produces this:
?- X = [:-,f(:-),(-)-1,(-)+(-)].
X = [:-, f(:-), - - 1, - + -]
yes
Although the term displayed has the same display,
it does not unify with the original expression:
?- [:-,f(:-),(-)-1,(-)+(-)] = [:-, f(:-), - - 1, - + -].
no
So this example omits parentheses essential to
the internal representation.
regards, chip
Non sequitur: there is no reason to believe that a system that
decides not to conform to the standard has a higher chance of
having an internal writeq/read bug.
>
> There is a standard for this: ISO/IEC 13211-1 published 1995-06-01.
The standard does not mention a "toplevel", there is no requirement
for a toplevel to print any specific format. What you want to test
instead is that writeq/1,2 produces a format that can be read back
with read/1,2.
The distinction between conforming and non conforming systems is not
that sharp. Systems do not conform fully simply because conforming is
quite an effort. So this is not a willful act. It starts with
getting the documents:
Professional programmers get it from their national member body. It
can be written off anyway. And there are situations were you will
appreciate that protection. There is also the free first corrigendum
ISO/IEC 13211-1/Cor1:2007
Private individuals get literally same content for 2 x USD 30 from
webstore.ansi.org thanks to INCITS:
INCITS/ISO/IEC 13211-1-1995 (R2007)
INCITS/ISO/IEC 13211-2-2000 (R2006)
USD 60 is big investment, I admit.
But as long as the direction is the right one, things will converge.
And here is the reason why chances of defects are higher on a
non-conforming system - ceteris paribus indeed: Less coverage.
If you conform to the standard you probably went through the examples
of 13211-1. One by one. Or at least you had someone who knew them
and tested your system against them. Also users have less hesitations
reporting a divergence to the standard than another difference since
chances are higher that the defect will be removed.
There are several test suites more or less building on previous tests
suites which ultimately came from the examples in 13211-1. One of it
is from Peter Szeredi's group. The suites as they stand produced
quite some differences to systems I know of, which subsequently were
improved.
There is also more synergy between standard conforming systems than
otherwise.
For example on the level of defect detection. In my experience, this
happens very frequently in connection with the ISO error system. In
standard conforming systems, the same tests can be run on different
systems since I can rely on the error-term produced (literally: I can
rely on *part* of the error term - some part is implementation
defined, some is implementation dependent). See 7.12.2. A summary I
made while searching for a name for a new error class is:
http://www.complang.tuwien.ac.at/ulrich/iso-prolog/error_k#error_classes
So when I run a test, why not paste it into another system at the same
time?
On a non-conforming system you need to produce your own examples and
tests and decide if they are valid or not. That is a lot of work and
chances are a non-conforming system has not enough resources behind to
do this diligently.
Also, on a non-conforming system it is never clear what will be the
reaction of the implementor to a report of a defect: Will the report
be welcomed? Is the system still maintained? Shall I dare to ask?
After all, the system ignored an international standard for more than
14 years.
>> There is a standard for this: ISO/IEC 13211-1 published 1995-06-01.
>
>The standard does not mention a "toplevel", there is no requirement
>for a toplevel to print any specific format. What you want to test
>instead is that writeq/1,2 produces a format that can be read back
>with read/1,2.
You insist on a very literal reading level!
In 3.185 top level is defined thus "mentioned". But there is no
requirement at all to support this concept. Nevertheless, there are
many notions in the standard that rely on 3.185. Think of 3.143!
I hesitated to include such a formal point as yours since all systems
I know of use write for the top level. And I did not take an example
as
?- X = (+).
where I expect the top level should answer with a valid Prolog term
and not X = + which is invalid Prolog text. Same for X = (1=1).
And then there is another aspect: This posting was not only about
making systems a tiny little bit more conformant - but also to ensure
that users will now see valid Prolog text on the toplevel.
Concerning writeq/1,2: also the regular write should produce in the
example I gave valid Prolog text.
BTW: Which system did *decide* not to conform?
I think this is a little bit misleading. No you don't get the full
ISO standard for 30 USD. All you get with INCITS/ISO/IEC
13211-1-1995 (R2007):
This part of ISO/IEC 13211 specifies: a)The representation of
Prolog text, b)The syntax and constraints of the Prolog
language, c) The semantic rules for interpreting Prolog
text, d)the representation of input data to be processed
by Prolog, e)The representation of output produced by
Prolog, and f)The restrictions and limits imposed on
a conforming Prolog processor.
How much is this? Section 5) Compliance and 6) Syntax of the
full report? What about section 7) Language concepts and
semantics, 8) Built-in predicates and 9) Evaluable functors.
The full standard still costs USD 365 without membership.
This is much more expensive as when you order it from
www.iso.org, where it is CHF 252.
When you are member, you still pay USD 292, taking
the current exchange rate this is CHF 282, still above
the cost from taking it directly from www.iso.org.
And www.iso.org does not demand membership.
Bye
Bye
My response here is to other readers that might get confused
by your false claim that "you do not ge the full ISO standard
for USD 30". You, Jan Burse, please ignore this answer.
Above poster quotes from the beginning of Scope 1 13211-1.
That is, in the *full* document of Part 1 in front of me
on page 1 I find this paragraph.
The locution "This part of ISO/IEC 13211" in 13211-1 means
invariably "13211-1". And that always means the entire document.
Never part of that part 1. Same with all other parts
and ISO standards.
>The full standard still costs USD 365 without membership.
>This is much more expensive as when you order it from
>www.iso.org, where it is CHF 252.
These high prices are here for professionals. Of course
ANSI will charge more since an ANSI document has a different
(better) legal status in the US than an international
document. A document of a national member body is in most
countries like law - so it's not just some evidence.
> My response here is to other readers that might get confused
> by your false claim that "you do not ge the full ISO standard
> for USD 30". You, Jan Burse, please ignore this answer.
Ok, I got it. You really get the full version, its ca. 200
pages. I don't find any hint to whether the ISO version and
this ANSI version shows up a different content or a different
license model. Can somebody confirm that these are identical?
Bye
Riddle solved, the BS means British Standards Institution, so
the expensive version in the ansi webstore is the one
branded by BSi. There are even more versions:
CSA ISO/IEC 13211-1:1997
Canadian Standards Association
PDF EUR 155.33
NEN ISO/IEC 13211-1:1995
Netherlands Normalisatie Instituut
Paper EUR 272.24
(http://infostore.saiglobal.com)
Globalization is quite confusing.
Bye
I was confused as well, so I went to look.
If I go to ANSI's webstore (http://webstore.ansi.org)
and do keyword "Prolog" search, it returns six priced
and one free download. Each is labelled by ISO/IEC
document numbers, promising identical content as far
as I can tell. It is confusing but the same ISO/IEC
number is on offer for differing prices!
The offerings seem to group up into three kinds.
Prices shown are for non-members:
BS ISO/IEC 13211-1:1995
>>> Prolog. General core $365
ISO/IEC 13211-1:1995
>>> Prolog - Part 1: General core $249
INCITS/ISO/IEC 13211-1-1995 (R2007)
(Amended by INCITS/ISO/IEC 13211-1-1995)
>>> Prolog Language Part 1: General Core $30
BS ISO/IEC 13211-2:2000
>>> Prolog. Modules $192
ISO/IEC 13211-2:2000
>>> Prolog -- Part 2: Modules $104
INCITS/ISO/IEC 13211-2-2000 (R2006)
(Amended by INCITS/ISO/IEC 13211-2-2000)
>>> Prolog - Part 2: Modules
(formerly ANSI/ISO/IEC 13211-2-2000) $30
ISO/IEC 13211-1/Cor1:2007
>>> Prolog - Part 1: General core - Corrigendum
(revises ISO/IEC 13211-1:1995) $0 (free download)
Newer documents are sharply lower priced,
which may reflect a business judgement that
marketing of Prolog specs is now predominantly
to the small shop or the individual developer.
regards, chip
Prices are in a certain proportion to the number
of pages of a document.
Well, you've confused me once again, Ulrich, If
the reason the later documents are less expensive
(revisions done in 2006 and 2007 of 2000 and 1995
standards) is a reduction in "the number of pages",
does it follow the $30 versions are not complete?
regards, chip
LoL
Maybe he is refering to the difference between
XXX/ISO/IEC 13211-1 and XXX/ISO/IEC 13211-2.
The former is the core and the later is the
module standard. Here are the number of pages:
XXX/ISO/IEC 13211-1 ca. 200 pages
XXX/ISO/IEC 13211-2 ca. 20 pages
Well it does not quite work out, at least a
linear model would not. BTW I don't think
that R2006 and R2007 are revision, more release
dates of the branding, right?
Bye
> ... BTW I don't think
> that R2006 and R2007 are revision, more release
> dates of the branding, right?
The titles specify that these are amended versions:
INCITS/ISO/IEC 13211-1-1995 (R2007)
(Amended by INCITS/ISO/IEC 13211-1-1995)
Prolog Language Part 1: General Core $30
INCITS/ISO/IEC 13211-2-2000 (R2006)
(Amended by INCITS/ISO/IEC 13211-2-2000)
Prolog - Part 2: Modules
(formerly ANSI/ISO/IEC 13211-2-2000) $30
The timing of the former would agree with an
incorporation of the corrections to Part 1:
General core (Cor1:2007, the free download).
However I'm at a loss to explain the R2006
timing for the Prolog modules part. Even
if it were the INCITS adoption that were
rebranding, surely the second part of the
standard would not be adopted earlier than
the first part... perhaps a devious plot
to get "logic programmers" to pay out $60
for the answer?
ISO itself only "knows" about the two
parts of the Prolog standard and the
corrigendum, but provides description
of the pages, at least, in each part.
INCITS provides no details but points
to ANSI for purchase/downloads.
regards, chip
No, there is no such added value by INCITS.
Lets take a sample from ISO (The more expensive
stuff that can be obtained from ISO):
ISO/IEC 13211-1-1995
8.8.1.1 d) Chooses the first element of the list L,
and the goal succeeds.
ISO/IEC 13211-1-1995_Corr
8.8.1.1 d)
Replace
Chooses the first element of the list L
by
Chooses the first element of the list L,
unifies it with the term clause(Head,Body)
Now lets take a sample from INCITS (The
stuff offered by ANSI for USD 30):
INCITS/ISO/IEC 13211-1-1995
8.8.1.1 d) Chooses the first element of the list L,
and the goal succeeds,
So "amended" does not mean incorporating a corrigenda
here. The only difference I feel is that the PDF from
ANSI is less scrambled compared to the ISO one,
Adobe copy/paste directly works.
Bye
Oops, well not really, the two columns layout goes
criss cross... For both versions. Problem of the
production process of the PDF version, probably
OCR from paper... Poor.
Bye
While the text (= images) visible is the real text, the accompanied
ASCII-text within the PDF is OCR'd. And that means you have 1-l
ambiguities, no _ characters and the like. But still be happy: Some
national member bodies (ex. DIN, Beuth-Verlag) remove even the textual
information.
This is a general issue of ISO documents, in no way specific to 13211.
If you feel the inclination to change that - you really have to
address another level than WG17. I.e. go to your national member
body.
Use the Linux tool pdftotext and then cut out things
"rectangularily" with, e.g. Emacs.