%% 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,c,[[a,b],[b,c]],_). %% ?- traverse(a,d,[[a,c],[c,d],[a,b],[b,c]],_). traverse(A,C,List) :- traverse1(A,C,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,C,List,List4) :- delete(List,[A,B],List1), delete(List1,[B,C],List2), traverse1(A,B,List2,List3), traverse1(B,C,List3,List4).