GNU Prolog:断言列表是根据另一个列表排序的

GNU Prolog : assert that list is ordered based on another list

我有两个整数列表,XsYs。我想使用 GNU 声明以下内容:

对于 i,j 这样 Xs[i]=Xs[j], i < j 表示 Ys[i]<Ys[j].

如有任何帮助,我们将不胜感激!

注意:这样的断言是可能的,因为 Ys 由完全不同的整数组成。

neg_ass(Xs, Ys) :-
    nth0(I, Xs, X),
    nth0(J, Xs, X),
    I < J,
    nth0(I, Ys, YI),
    nth0(J, Ys, YJ),
    YI >= YJ.
    
assertion(Xs, Ys) :-
   \+neg_ass(Xs, Ys).