%% traverse(+Antecedent,+Consequent,+List) %% Checks an argument is valid, or proven by parts given %% An argument is given by If , then %% List is a list of reasons for the argument %% ?- traverse(a,b,[[a,c],[c,b]],_). %% ?- traverse(a,b,[[a,c],[c,b],[a,d],[d,c]],_). traverse(A,B,List) :- traverse1(A,B,List,_). %% traverse(+Antecedent,+Consequent,+List,-List) %% Most of the variables are the same as for traverse/3 %% List2 is List with all the found reasons removed traverse1(_,_,[],[]). traverse1(A,B,List,List4) :- delete(List,[A,C],List1), delete(List1,[C,B],List2), traverse1(A,C,List2,List3), traverse1(C,B,List3,List4).