Reputation: 1463
I have two lists of integers, Xs, and Ys. I want to assert the following using GNU :
For i,j such that Xs[i]=Xs[j], i < j implies Ys[i]<Ys[j].
Any help would be appreciated!
Note : such an assertion would be possible since Ys is made up of integers that are all different.
Upvotes: 1
Views: 67
Reputation: 3753
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).
Upvotes: 3