Exercise 4.69: Beginning with the data base and
the rules you formulated in Exercise 4.63, devise a rule for adding
“greats” to a grandson relationship. This should enable the system to deduce
that Irad is the great-grandson of Adam, or that Jabal and Jubal are the
great-great-great-great-great-grandsons of Adam. (Hint: Represent the fact
about Irad, for example, as ((great grandson) Adam Irad). Write rules
that determine if a list ends in the word grandson. Use this to express
a rule that allows one to derive the relationship ((great . ?rel) ?x
?y), where ?rel is a list ending in grandson.) Check your rules
on queries such as ((great grandson) ?g ?ggs) and (?relationship
Adam Irad).
练习 4.69:从练习 4.63 中你所制定的数据库和规则出发,设计一条规则以在孙子关系中添加"great"。这应使系统能推导出:Irad 是 Adam 的曾孙,或者 Jabal 和 Jubal 是 Adam 的第五代曾孙。(提示:以 ((great grandson) Adam Irad) 这样的形式表示关于 Irad 的事实。编写能判断一个表是否以单词 grandson 结尾的规则。以此表达一条能推导关系 ((great . ?rel) ?x ?y) 的规则,其中 ?rel 是一个以 grandson 结尾的表。)在如 ((great grandson) ?g ?ggs) 和 (?relationship Adam Irad) 这样的查询上检验你的规则。