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
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
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,030 |
Nodes: | 10 (0 / 10) |
Uptime: | 02:27:43 |
Calls: | 13,343 |
Calls today: | 6 |
Files: | 186,574 |
D/L today: |
5,195 files (1,537M bytes) |
Messages: | 3,357,237 |