New chapter in cut opaqueness. It has rather to do with inlining--- Synchronet 3.20a-Linux NewsLink 1.114
of disjunction and if-then-else, and whetherwe can also inline
negation as failure (\+)/1 and once so easily.
Now I am facing this test case:
p(a).
p(b).
q(b).
test(X,Y,Z) :- \+ (X,Y,Z).
GNU Prolog gives me:
/* GNU Prolog 1.5.0 */
?- \+((p(X),!,q(X))).
yes
?- test(p(X),!,q(X)).
yes
SWI-Prolog gives me:
/* SWI Prolog 9.1.17 */
?- \+((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
false.
If I use negation/1 the bug goes away:--- Synchronet 3.20a-Linux NewsLink 1.114
p(a).
p(b).
q(b).
negation(X) :- X, !, fail.
negation(_).
test(X,Y,Z) :- negation((X,Y,Z)).
Now Trealla Prolog and SWI-Prolog also,
behaves consistently:
/* Trealla Prolog v2.29.42 */
?- negation((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
But the test case works fine in formerly Jekejeke Prolog:--- Synchronet 3.20a-Linux NewsLink 1.114
/* Jekejeke Prolog 1.6.4 */
?- \+((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
And also in my Dogelog Player for JavaScript, Python and Java:
/* Dogelog Player 1.1.3 */
?- \+((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
The Java version is new, but the 3 Amigos behave exactly the same.
Mild Shock schrieb am Dienstag, 31. Oktober 2023 um 02:29:31 UTC+1:
If I use negation/1 the bug goes away:
p(a).
p(b).
q(b).
negation(X) :- X, !, fail.
negation(_).
test(X,Y,Z) :- negation((X,Y,Z)).
Now Trealla Prolog and SWI-Prolog also,
behaves consistently:
/* Trealla Prolog v2.29.42 */
?- negation((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
A big Prolog system, that doesn’t consider (\+)/2 a control construct with body conversion, unlike SWI-Prolog, is the XSB Prolog system. I get this result, twice success, moving out a subterm doesn’t change anything:--- Synchronet 3.20a-Linux NewsLink 1.114
/* XSB Version 5.0-beta */
?- \+((p(X),!,q(X))).
X = _h387
yes
?- Y=!, \+((p(X),Y,q(X))).
Y = !
X = _h465
Was using May 15, 2022 version of XSB. Don’t know whether
there are other versions that would behave differently. No wonder,
XSB is also a Prolog system that champions user defined predicate
inlining in certain circumstance, if I am not mistaken.
Mild Shock schrieb am Dienstag, 31. Oktober 2023 um 02:35:53 UTC+1:
But the test case works fine in formerly Jekejeke Prolog:
/* Jekejeke Prolog 1.6.4 */
?- \+((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
And also in my Dogelog Player for JavaScript, Python and Java:
/* Dogelog Player 1.1.3 */
?- \+((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
The Java version is new, but the 3 Amigos behave exactly the same.
Mild Shock schrieb am Dienstag, 31. Oktober 2023 um 02:29:31 UTC+1:
If I use negation/1 the bug goes away:
p(a).
p(b).
q(b).
negation(X) :- X, !, fail.
negation(_).
test(X,Y,Z) :- negation((X,Y,Z)).
Now Trealla Prolog and SWI-Prolog also,
behaves consistently:
/* Trealla Prolog v2.29.42 */
?- negation((p(X),!,q(X))).
true.
?- test(p(X),!,q(X)).
true.
What can we say to the Prolog systems developers out there?--- Synchronet 3.20a-Linux NewsLink 1.114
********************************************************
Don't worry your headache will soon
go away, and replaced by a full migraine. ********************************************************
Just joking, my suspicions, its not that grave. Ideas popping up.
Disclaimer: I only found this book today through google search of “memberchk”. It also explains the difference between (\+)/1 and not/1. At least for the Prolog system they were dealing with:--- Synchronet 3.20a-Linux NewsLink 1.114
Computing with logic - 1988 https://archive.org/details/computingwithlog0000maie/page/322/mode/2up
So the bootstrapping would be maybe rather:
not(X) :- must_be(ground, X), \+ X.
Or NU-Prolog style with some freeze as well. The idea back then
was that ground argument to (\+)/1 is “safe”, has the desired semantics of a logical negation. Meanwhile I guess it penetrated that variants
with non-ground arguments to (\+)/1 can also receive some declarative reading using the idea of an existential quantifier. But the unsafe aspect is still, how do we know what quantifier is intended and realized?
If I am not mistaken some of this idea of not/1 still survives in XSB tabling
not, and made it back into SWI-Prologs tnot/1. Not 100% sure. SWI-Prologs tnot/1 does a delay and can elicit missing model or ambigious model.
Mild Shock schrieb am Donnerstag, 2. November 2023 um 18:48:01 UTC+1:
What can we say to the Prolog systems developers out there?
********************************************************
Don't worry your headache will soon
go away, and replaced by a full migraine. ********************************************************
Just joking, my suspicions, its not that grave. Ideas popping up.
Concerning XSB , I guess was expecting too much good.
It has the same bug when consulting the test case:
p(a).q1 :- \+((p(X),!,q(X))).
p(b).
q(b).
q2 :- Y=!, \+((p(X),Y,q(X))).
?- q1.
yes
?- q2.
no
On Friday, 3 November 2023 at 12:32:07 UTC+1, Mild Shock wrote:
Concerning XSB , I guess was expecting too much good.
It has the same bug when consulting the test case:
p(a).q1 :- \+((p(X),!,q(X))).
p(b).
q(b).
q2 :- Y=!, \+((p(X),Y,q(X))).
?- q1.
yes
?- q2.
no
The "bug" in that case is more generally the fact that Y translates
to call(Y), which I guess you are "supposed to know", and which I
cannot say if it's standard since our standard is behind a paywall
(and I have lost my copy and I won't buy it again since I'd be rather
working on a better Prolog than the ISO, too many fundamental
issues), but is certainly all over the place...
Julio
In my opinion the GNU Result is Ok and according
to the ISO core standard, since (\+)/1 is not included
in the list of control constructs that are subject
to body conversion, i.e. call/1 wrapping:
/* GNU Prolog 1.5.0 */
p(a).
p(b).
q(b).
q1 :- \+((p(X),!,q(X))).
q2 :- Y=!, \+((p(X),Y,q(X))).
?- q1.
yes
?- q2.
yes
You have just to lookup section 7.6 of the ISO core
standard to see that (\+)/1 has no part in the
call/1 wrapping. But it seems that Prolog systems
do not all implement section 7.6 this way, the
way it was specified. A further problem is that some
Prolog system sometimes implement section 7.6 correctly,
and sometimes implement section 7.6 wrong. For example
without a dynamic directive XSB does it wrong,
thats what is seen in your quote. But if you add
a dynamic/1 directive, it turns out to be like this:
/* XSB Version 5.0-beta */
p(a).
p(b).
q(b).
:- dynamic q1/0.
q1 :- \+((p(X),!,q(X))).
:- dynamic q2/0.
q2 :- Y=!, \+((p(X),Y,q(X))).
?- q1.
yes
?- q2.
yes
Now with dynamic directive XSB and GNU agree. Without
dynamic directive XSB and GNU disagree.
Julio Di Egidio schrieb:
On Friday, 3 November 2023 at 12:32:07 UTC+1, Mild Shock wrote:
Concerning XSB , I guess was expecting too much good.
It has the same bug when consulting the test case:
p(a).q1 :- \+((p(X),!,q(X))).
p(b).
q(b).
q2 :- Y=!, \+((p(X),Y,q(X))).
?- q1.
yes
?- q2.
no
The "bug" in that case is more generally the fact that Y translates
to call(Y), which I guess you are "supposed to know", and which I
cannot say if it's standard since our standard is behind a paywall
(and I have lost my copy and I won't buy it again since I'd be rather
working on a better Prolog than the ISO, too many fundamental
issues), but is certainly all over the place...
Julio
?- q1.
yes
?- q2.
yes
You have just to lookup section 7.6 of the ISO core
the code that is wrong is actually the one
you are calling right.
On Saturday, 4 November 2023 at 02:52:03 UTC+1, Mild Shock wrote:
?- q1.
yes
?- q2.
yes
You have just to lookup section 7.6 of the ISO core
Which I have explained I have no access to.
OTOH you completely miss the point which has
nothing to do with body conversion in '\+', that
just calling 'Y' is a short-hand, whether ISO or
not you have not told, for 'call(Y)', which is the
right way to write that code in Prolog and what
that code is in fact translated to in systems
where that short-hand is supported (most of
them probably): and since 'call' per se *is*
opaque to cuts (it does make cut scope)...
the code that is wrong is actually the one
you are calling right.
Julio
On Saturday, 4 November 2023 at 02:52:03 UTC+1, Mild Shock wrote:
?- q1.
yes
?- q2.
yes
You have just to lookup section 7.6 of the ISO core
Which I have explained I have no access to.
OTOH you completely miss the point which has
nothing to do with body conversion in '\+', that
just calling 'Y' is a short-hand, whether ISO or
not you have not told, for 'call(Y)', which is the
right way to write that code in Prolog and what
that code is in fact translated to in systems
where that short-hand is supported (most of
them probably): and since 'call' per se *is*
opaque to cuts (it does make cut scope)...
the code that is wrong is actually the one
you are calling right.
Julio
There is no call/1 in q1 or q2, you
can use listing/1 in recent GNU Prolog:
/* GNU-Prolog 1.5.0, ISO conforming */
?- listing(q2).
q2 :-
A = !,
\+ (p(B), A, q(B)).
This is in conformity with section 7.6 of
the ISO core standard, which doesn't
say that call/1 is placed inside (\+)/1
at compile time. listing/1 usually shows
call/1 where one was instered at compile time,
but it doesn't show one. Where do you get the
idea from that there is a call/1 around Y?
This happens erroreously in SWI-Prolog
in violation of section 7.6 of the ISO core standard:
/* SWI-Prolog 9.1.17, Not ISO conforming */
?- listing(q2).
q2 :-
A=!,
\+ ( p(B),
call(A),
q(B)
).
Julio Di Egidio schrieb:
On Saturday, 4 November 2023 at 02:52:03 UTC+1, Mild Shock wrote:
?- q1.
yes
?- q2.
yes
You have just to lookup section 7.6 of the ISO core
Which I have explained I have no access to.
OTOH you completely miss the point which has
nothing to do with body conversion in '\+', that
just calling 'Y' is a short-hand, whether ISO or
not you have not told, for 'call(Y)', which is the
right way to write that code in Prolog and what
that code is in fact translated to in systems
where that short-hand is supported (most of
them probably): and since 'call' per se *is*
opaque to cuts (it does make cut scope)...
the code that is wrong is actually the one
you are calling right.
Julio
There is no call/1 in q1 or q2, you
can use listing/1 in recent GNU Prolog:
On Saturday, 4 November 2023 at 18:12:13 UTC+1, Mild Shock wrote:--- Synchronet 3.20a-Linux NewsLink 1.114
There is no call/1 in q1 or q2, youLOL, you are a joke: which is exactly the reason why, for a
can use listing/1 in recent GNU Prolog:
correct definition of correct Prolog code, it *fails* your test.
Whether that is ISO or not I'll leave those interested to find out.
Have fun.
Julio
On Saturday, 4 November 2023 at 18:12:13 UTC+1, Mild Shock wrote:--- Synchronet 3.20a-Linux NewsLink 1.114
There is no call/1 in q1 or q2, youLOL, you are a joke: which is exactly the reason why, for a
can use listing/1 in recent GNU Prolog:
correct definition of correct Prolog code, it *fails* your test.
Whether that is ISO or not I'll leave those interested to find out.
Have fun.
Julio
Denial of a bug?--- Synchronet 3.20a-Linux NewsLink 1.114
Creating a smoke screen?
How low can one get?
LoL
Julio Di Egidio schrieb am Samstag, 4. November 2023 um 20:43:01 UTC+1:
On Saturday, 4 November 2023 at 18:12:13 UTC+1, Mild Shock wrote:
There is no call/1 in q1 or q2, youLOL, you are a joke: which is exactly the reason why, for a
can use listing/1 in recent GNU Prolog:
correct definition of correct Prolog code, it *fails* your test.
Whether that is ISO or not I'll leave those interested to find out.
Have fun.
Julio
Actually a test case is quite rare in ISO Prolog. There is no--- Synchronet 3.20a-Linux NewsLink 1.114
explicit test case for (\+)/1 that tests the matter. But a related
one for call/1, which can be adapted to also test (\+)/1:
Take these two facts:
a(1).
a(2).
Now perform these tests, the test case has also a nice
explanation in the ISO core standard itself:
/* ISO 7.8.3.4, ISO 7 */
?- Z = !, call( (Z=!, a(X), Z) ).
Z = !,
X = 1.
/* ISO 7.8.3.4, ISO 8 */
?- call( (Z=!, a(X), Z) ).
Z = !,
X = 1 ;
Z = !,
X = 2.
So sometimes Z gets wrapped into call(Z) and sometimes
not. Can you explain what happens Culio?
Mild Shock schrieb am Sonntag, 5. November 2023 um 20:38:54 UTC+1:
Denial of a bug?
Creating a smoke screen?
How low can one get?
LoL
Julio Di Egidio schrieb am Samstag, 4. November 2023 um 20:43:01 UTC+1:
On Saturday, 4 November 2023 at 18:12:13 UTC+1, Mild Shock wrote:
There is no call/1 in q1 or q2, youLOL, you are a joke: which is exactly the reason why, for a
can use listing/1 in recent GNU Prolog:
correct definition of correct Prolog code, it *fails* your test.
Whether that is ISO or not I'll leave those interested to find out.
Have fun.
Julio
Actually a test case is quite rare in ISO Prolog.
There is no explicit test case for (\+)/1 that tests the matter.
Take these two facts:
a(1).
a(2).
Now perform these tests,
/* ISO 7.8.3.4, ISO 7 */
?- Z = !, call( (Z=!, a(X), Z) ).
Z = !,
X = 1.
/* ISO 7.8.3.4, ISO 8 */
?- call( (Z=!, a(X), Z) ).
Z = !,
X = 1 ;
Z = !,
X = 2.
So sometimes Z gets wrapped into call(Z)
and sometimes not.
Can you explain what happens Culio?
On Sunday, 5 November 2023 at 21:02:31 UTC+1, Mild Shock wrote:
Actually a test case is quite rare in ISO Prolog.LOL. Test cases are the *only* thing available around here!!
There is no explicit test case for (\+)/1 that tests the matter.Nor \+ has anything to do with this matter.
Take these two facts:
a(1).
a(2).
Now perform these tests,Where Z does *not* become call(Z).
/* ISO 7.8.3.4, ISO 7 */
?- Z = !, call( (Z=!, a(X), Z) ).
Z = !,
X = 1.
/* ISO 7.8.3.4, ISO 8 */
?- call( (Z=!, a(X), Z) ).
Z = !,
X = 1 ;
Z = !,
X = 2.
So sometimes Z gets wrapped into call(Z)
and sometimes not.
Apparently.
Can you explain what happens Culio?
Thanks for that, Burp. I can't. Can you?
On Sunday, 5 November 2023 at 21:14:49 UTC+1, Julio Di Egidio wrote:
On Sunday, 5 November 2023 at 21:02:31 UTC+1, Mild Shock wrote:
Actually a test case is quite rare in ISO Prolog.LOL. Test cases are the *only* thing available around here!!
There is no explicit test case for (\+)/1 that tests the matter.Nor \+ has anything to do with this matter.
Take these two facts:
a(1).
a(2).
Now perform these tests,Where Z does *not* become call(Z).
/* ISO 7.8.3.4, ISO 7 */
?- Z = !, call( (Z=!, a(X), Z) ).
Z = !,
X = 1.
/* ISO 7.8.3.4, ISO 8 */
?- call( (Z=!, a(X), Z) ).
Z = !,
X = 1 ;
Z = !,
X = 2.
So sometimes Z gets wrapped into call(Z)
and sometimes not.
Apparently.
Can you explain what happens Culio?
Thanks for that, Burp. I can't. Can you?P.S. Which is why the best practice is to just
never write a nude call to a variable...
--- Synchronet 3.20a-Linux NewsLink 1.114Can you explain what happens Culio?Thanks for that, Burp. I can't. Can you?
Julio
Just read the ISO core standard moron.--- Synchronet 3.20a-Linux NewsLink 1.114
The test cases have an explanation comment.
You cant get any lower. Dont come back before
you have read it and understood it, show brains.
Julio Di Egidio schrieb am Sonntag, 5. November 2023 um 21:14:49 UTC+1:
Can you explain what happens Culio?Thanks for that, Burp. I can't. Can you?
Julio
Just read the ISO core standard moron.
The test cases have an explanation comment.
On Sunday, 5 November 2023 at 21:57:35 UTC+1, Mild Shock wrote:--- Synchronet 3.20a-Linux NewsLink 1.114
Just read the ISO core standard moron.You are a fucking lost cause.
The test cases have an explanation comment.
*Plonk*
Julio
Do you say you need to go to the ISO core standard to understand--- Synchronet 3.20a-Linux NewsLink 1.114
the call/1 and the cut? Aren't there millions of tutorials around?
Come on, Culio. You can do it. Go, Go!
Julio Di Egidio schrieb am Sonntag, 5. November 2023 um 22:56:30 UTC+1:
On Sunday, 5 November 2023 at 21:57:35 UTC+1, Mild Shock wrote:
Just read the ISO core standard moron.You are a fucking lost cause.
The test cases have an explanation comment.
*Plonk*
Julio
Its not a bug if the Prolog system doesn't claim ISO compatibility.--- Synchronet 3.20a-Linux NewsLink 1.114
I have added a couple of new test cases for `(\+)/1` and `once/1`,
The test cases are here in the file "reference | control | logical":
https://www.novacuor.ch/srctab/doclet/docs/13_comply/package.jsp
Mild Shock schrieb am Sonntag, 5. November 2023 um 23:25:17 UTC+1:
Do you say you need to go to the ISO core standard to understand
the call/1 and the cut? Aren't there millions of tutorials around?
Come on, Culio. You can do it. Go, Go!
Julio Di Egidio schrieb am Sonntag, 5. November 2023 um 22:56:30 UTC+1:
On Sunday, 5 November 2023 at 21:57:35 UTC+1, Mild Shock wrote:
Just read the ISO core standard moron.You are a fucking lost cause.
The test cases have an explanation comment.
*Plonk*
Julio
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 919 |
Nodes: | 10 (1 / 9) |
Uptime: | 71:46:39 |
Calls: | 12,186 |
Calls today: | 1 |
Files: | 186,526 |
Messages: | 2,236,745 |