%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Check whether all elements of a set S are pairs, % i.e., they have the form [x1,x2], for any x1 and x2 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all_pairs(S) :- forall(X in S, exists([X1,X2], X = [X1,X2])). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Sample goal: % % {log}=> all_pairs({[peter,ann],[tom,mary],[john,ann]}). % % yes