这就是我到目前为止所拥有的。我需要证明,如果两个站通过第三个站连接,它们是相互连接的
station(hamburg).
station(bremen).
station(hannover).
station(berlin).
station(leipzig).
station(osnabruck).
station(stuttgart).
station(fulda).
station(munich).
adjacent(hamburg, bremen).
adjacent(hamburg, berlin).
adjacent(berlin, hannover).
adjacent(berlin, leipzig).
adjacent(leipzig, fulda).
adjacent(fulda, hannover).
adjacent(hannover, osnabruck).
adjacent(osnabruck, bremen).
adjacent(stuttgart, munich).
/* insert your clauses here */
adjacent_(X,Y) :-adjacent(Y,X) .
adjacent_(X,Y) :-adjacent(X,Y) .
connected(X,Y) :-adjacent(X,Y) .
connected(X,Z) :-connected(X,Y), adjacent_(Y,Z) .