# A subtle difference between XSB and SWI-Prolog about mode directed tabling `po(PI)`

Firstly, the document of `po(PI)` is confusion.

po (PI)

Partial Ordering . The new answer is added iff `call(PI, +Old, +Answer)` succeeds. For example, `po('<'/2)` accumulates the largest result. In SWI-Prolog the arity (2) may be omitted, resulting in `po(<)` .

IMO, the `po('<'/2)` should accumulate the smallest result instead of the largest result.

For example,

``````:- table
path(_,po('<'/2)).

path(X,P) :-
(   X=1,P=1
;   X=1,P=3
).

?- path(X,P).
X = P, P = 1.
``````

Clearly, it is accumulating smallest result, otherwise the result should be `X=1,P=3`.

Secondly, there is a subtle difference between XSB and SWI-Prolog about mode directed tabling `po(PI)`.

For example,

``````:- table
path(_,po(myls/2)).

myls(1,2).
myls(3,4).

path(X,P) :-
(   X=1,P=1
;   X=1,P=2
).
``````

In SWI-Prolog

``````?- path(X,P).
X = P, P = 1.
``````

In XSB

``````| ?- path(X,P).
X = 1
P = 1;
no
``````

That is correct.

However, the following example,

``````:- table
path(_,po(myls/2)).

myls(1,2).
myls(3,4).

path(X,P) :-
(   X=1,P=1
;   X=1,P=3
).
``````

In SWI-Prolog

``````?- path(X,P).
X = 1,
P = 3.
``````

In XSB

``````In XSB
| ?- path(X,P).

X = 1
P = 3;

X = 1
P = 1
``````

I think the XSB result is correct, because `po(PI)` means partial ordering, not total ordering. However, the `po(PI)` in SWI-Prolog means total ordering.

That is just a documentation typo, no? Thanks for spotting. Fixed.

This seems really fundamental. Answer subsumption was supposed to be a deterministic process. In this example it is not. I don’t think that is easily fixed in the current design for answer subsumption and thus I’m afraid this should be on the pile of remaining open issues Of course, unless someone fixes it or makes the resources available to get this fixed.

1 Like