【发布时间】:2020-05-02 02:40:45
【问题描述】:
该程序将使用 SWI Prolog 进行测试。
Family.pl 包含有关家庭成员、谁与谁结婚等信息。
必须在底部添加规则并提交修改后的文件。
写一个
motherInLaw(X,Y)谓词,表示X是Y的岳母。编写一个
grandParent(X,Y)谓词,表示X是Y的祖父母。写一个
grandMother(X,Y)谓词,表示X是Y的祖母。
谢谢你们!
这是我自己的答案,请您看看并告诉我它们是否正确?谢谢
motherInLaw(X, Y) : mother(X, Z),couple(Z, Y)
grandParent(X, Y) : parent(X, Z),parent(Z, Y)
grandMother(Z, Y) : mother(X, Z),parent(Z, Y)
【问题讨论】:
-
如果你能发布整个
Family.pl源就太好了。
标签: prolog