im trying to write a program in prolog that determine if there is a way from place to place. these are the relations:
road(ny,florida). road(washington,flori
First, we need a symmetric definition:
:- meta_predicate symm(2, ?, ?). symm(P_2, A, B) :- call(P_2, A, B). symm(P_2, A, B) :- call(P_2, B, A).
Now, using closure0/3
there_is_way(A, B) :- closure0(symm(road), A, B).