这是一个 Prolog 程序,我想检查 Linux 包之间的依赖关系以及是否存在任何冲突。
dep(gnome1,gcc7).
confl(gcc7,gcc8).
% recursive chain dependency
depend(X,Y):- dep(X,Y).
depend(X,Y):- dep(X,Z), depend(Z,Y).
% conflict(X,Y) holds if X and Y depend
on two packages which conflict, conflict between two
packages should be a symmetric relation.
% my poor attempt
conflict(X,Y):- depend(X,A), depend(Y,B), (confl(A,B) | confl(B,A)).