1

I am currently learning about predicate logic in Prolog. I am having trouble answering a question on the topic and would like to know the steps one one take to solve such a question using Prolog predicates. I have a scenario which must be represented in Prolog predicates using only two different predicate names.

  1. A and B are married
  2. B likes C
  3. C and D are married
  4. D likes E
  5. F likes B
  6. E likes B
  7. E and G are married
  8. A likes G
4

1 回答 1

2

只需写下它所说的。

are_married(a,b).

likes(b,c).

等等。到目前为止,我们已经使用了两个谓词名称。

在 Prolog 中,原子由以小写字母开头的标识符表示。以大写字母或下划线开头的标识符_表示逻辑变量。

于 2013-05-12T06:32:12.877 回答