logicwa@utecfa.UUCP (Earl Fogel) (09/04/85)
Here are the results from running Chris Moss' cut tests on
MProlog. I've added one more test (5a) since it appeared
to be meaningful for MProlog.
Earl Fogel
Implementation Test 1 2 3 4 5 5a 6
MPROLOG 1.5 cut Y Y Y Y N N N
MPROLOG 2.1 cut Y Y Y Y Y N N
MPROLOG 2.1 slash Y N N Y Y N N
where Y means did cut, and N means did not cut.
Note: identical results are achieved with tracing.
For comparison purposes, here are the reported results
from other Prologs:
Implementation Test 1 2 3 4 5 6
DEC-10 Compiler Y Y Y Y Y Y
Waterloo, MU-Prolog Y Y Y Y Y N
DEC-10 int, C-Prolog Y Y Y N N N
POPLOG Y Y Y I I I
micro, Sigma Y N N Y Y N
where Y and N are as above, and I means
that it was trapped as an illegal use and failed.
CONCLUSIONS:
The MProlog "cut" is like the Waterloo and MU-Prolog cuts,
while the "slash" is like the micro and Sigma Prolog cuts.
Here's the program:
----------------------------------------------------------
/* Tests to distinguish various implementations of cut */
/* Chris Moss, Imperial College, June 1985 */
/* 5a added by Earl Fogel, Logicware Inc., July 1985 */
/* note: replace "true" by "succeed" for MProlog */
test1 :- do('Testing that cut is implemented). ', t1).
test2 :- do('Test if cut acts within disjunction', t2).
test3 :- do('Test if it cuts prev. choice within disjunction',t3).
test4 :- do('Test if cut acts when passed as metacall', t4).
test5 :- do('Test if & cut acts within metacall', t5 ).
test5a :- do('Test if & & cut acts within metacall', t5a ).
test6 :- do('Test if cut acts through not', t6).
do(Message,Test) :- w(Message), Test.
do(Message,Test) :- w('Does act').
w(X) :- write(X), nl.
t :- w('Does not act').
t1 :- (true;w('Did not cut alternatives correctly'),fail),
!, w('Succeeds going forwards'), fail.
t1 :- w('Failed to cut goal').
t2 :- (!;w('Fails to cut disjoint alternatives')), fail.
t2 :- t.
t3 :- t3a(X),(!,fail;w('Fails to cut disjunction')).
t3 :- t.
t3a(!).
t3a(X) :- w('Did not cut alternatives'), fail.
t4 :- t3a(X), X, w('Ok going forwards'),fail.
t4 :- t.
t5 :- t5(X), X, fail.
t5 :- t.
t5((true,!)).
t5a :- t5a(X), X, fail.
t5a :- t.
t5a((true,true,!)).
t6 :- not(not(!)), fail.
t6 :- t.