Deutsch   English   Français   Italiano  
<vtasmn$11lt5$1@solani.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Mild Shock <janburse@fastmail.fm>
Newsgroups: comp.lang.prolog
Subject: Elaboration Test 3 (Re: How to project variables? [PIP-4711: Marked
 Variables])
Date: Fri, 11 Apr 2025 12:59:12 +0200
Message-ID: <vtasmn$11lt5$1@solani.org>
References: <vtarm5$11ove$1@solani.org> <vtas0v$11p8c$1@solani.org>
 <vtasbe$11pah$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Apr 2025 10:59:35 -0000 (UTC)
Injection-Info: solani.org;
	logging-data="1103781"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101
 Firefox/128.0 SeaMonkey/2.53.20
Cancel-Lock: sha1:QAD2SiADgGh4mpimuZQ1pzYQlDk=
X-User-ID: eJwNycEBwCAIA8CVgEDQcRRk/xHa+16Aykpn0GNiGnxuDvGoIwbbE9SeeyqkBcuXAsmyo2lwkdx8t+WvsM0PJ30Tyg==
In-Reply-To: <vtasbe$11pah$1@solani.org>
Bytes: 4783
Lines: 176

Hi,

We can also make a test case where both SWI-Prolog
and Trealla Prolog fail. Still Dogelog Player does
it as specified.
It is only the following query:

q(Y, Z, _X) :- _X = Y, Z = f(Y,Y).

The projection would be:

p(Y, Z) :- q(Y, Z, _X).

?- p(Y, Z).
Z = f(Y,Y).

Here are the testing results:

Trealla Prolog 2.68.11-5: Fail

?- _X = Y, Z = f(Y,Y).
    Z = f(_X,_X).    %%% expected Z = f(Y,Y)
?- Y = _X, Z = f(Y,Y).
    Z = f(Y,Y).

SWI-Prolog 9.3.21: Fail

?- _X = Y, Z = f(Y,Y).
Z = f(Y,Y).
?- Y = _X, Z = f(Y,Y).
Y = _X,
Z = f(_X,_X).    %%% expected Z = f(Y,Y)

Dogelog Player 1.3.2: Pass

?- _X = Y, Z = f(Y,Y).
Z = f(Y, Y).
?- Y = _X, Z = f(Y,Y).
Z = f(Y, Y).

Bye

Mild Shock schrieb:
> Test 2 is only minorly more complex than Test 1.
> It is only the following query:
> 
> q(Y, Z, _X) :- _X = Y, _X = Z.
> 
> The projection would be:
> 
> p(Y, Z) :- q(Y, Z, _X).
> 
> ?- p(Y, Z).
> Y = Z.
> 
> Here are the testing results:
> 
> Trealla Prolog 2.68.11-5: Fail
> 
> ?- _X = Y, _X = Z.
>     true.    %%% expected Z = Y
> ?- Y = _X, _X = Z.
>     Z = Y.
> ?- _X = Y, Z = _X.
>     true.    %%% expected Z = Y
> ?- Y = _X, Z = _X.
>     Z = Y.
> 
> SWI-Prolog 9.3.21: Pass
> 
> ?- _X = Y, _X = Z.
> Y = Z.
> ?- Y = _X, _X = Z.
> Y = Z.
> ?- _X = Y, Z = _X.
> Y = Z.
> ?- Y = _X, Z = _X.
> Y = Z.
> 
> Dogelog Player 1.3.2: Pass
> 
> ?- _X = Y, _X = Z.
> Y = Z.
> ?- Y = _X, _X = Z.
> Y = Z.
> ?- _X = Y, Z = _X.
> Y = Z.
> ?- Y = _X, Z = _X.
> Y = Z.
> 
> Mild Shock schrieb:
>> Test 1 is probably the most simple test case.
>> It is only the following query:
>>
>> q(Y, _X) :- _X = Y.
>>
>> The projection would be:
>>
>> p(Y) :- q(Y, _X).
>>
>> ?- p(Y).
>> true.
>>
>> Here are the testing results:
>>
>> Trealla Prolog 2.68.11-5: Pass
>>
>> ?- _X = Y.
>>     true.
>> ?- Y = _X.
>>     true.
>>
>> SWI-Prolog 9.3.21: Fail
>>
>> ?- _X = Y.
>> true.
>> ?- Y = _X.
>> Y = _X.    %%% expected true
>>
>> Dogelog Player 1.3.2: Pass
>>
>> ?- _X = Y.
>> true.
>> ?- Y = _X.
>> true.
>>
>> Mild Shock schrieb:
>>> Hi,
>>>
>>> Now I am writing a new Prolog Improvement Proposal
>>> (PIP), which is PIP-4711: Marked Variables. Can
>>> we easily specify what marked variables should
>>>
>>> do in the top-level? Oh yes. If you have a query
>>> that contains unmarked and marked variables,
>>> just like this here:
>>>
>>> ?- q(N1, .., Nn, _M1, .., _Mm)
>>>
>>> Then the above query should work as:
>>>
>>> p(N1, .., Nn) :- q(N1, .., Nn, _M1, .., _Mm).
>>>
>>> ?- p(N1, .., Nn).
>>>
>>> The above specification assures that no information
>>> is lost, because it relies on the existential
>>> quantifier of Clark Completion. One can read the
>>>
>>> definition of q/n logically in first order logic
>>> as follows, namely with existential quantifiers:
>>>
>>> p(N1, .., Nn) <=> EXISTS(_M1, .., _Mm):q(N1, .., Nn, _M1, .., _Mm)
>>>
>>> Do some Prolog systems satisfy the above specification.
>>> Amazingly most Prolog systems cannot do it. They
>>> have problems archiving the above result, in very
>>>
>>> small test cases. The main problem is some permutation
>>> dependency, how the query q/n+m is formulated. It
>>> seems most Prolog systems do not use a
>>>
>>> permutation agnostic algorithm, whereas the
>>> first order logic specification doesn't have some
>>> permutation dependency and should be immune.
>>>
>>>                  Test1   Test2
>>> Trealla Prolog  Pass    Fail
>>> SWI-Prolog      Fail    Pass
>>> Dogelog Player  Pass    Pass
>>>
>>> Bye
>>>
>>>
>>
>