【发布时间】:2012-10-23 16:06:38
【问题描述】:
我正在学习 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).
但它总是给我假。
【问题讨论】:
标签: prolog logic family-tree