我正在学习 Prolog,我想要的是对一个简单的家庭成员进行简单的“计算”(我不知道它在 Prolog 中是如何调用的)。
例如我有:
1)father of steve is petter
2)brother steve is john
3)A person is a son to a Father when the brother of the person has as father the Father
(当它不在我的脑海里时,它看起来很有趣并且完全不合逻辑:))
father(steve,petter).
brother(john,steve).
father(X,Y):-brother(X,Z),father(Z,Y)).
我的问题是约翰的父亲是谁(正确的遮阳篷应该是皮特)
?-father(john,X).
但它总是给我虚假。