next up previous contents
Next: Exercise Chapter 2.6 Up: Solutions and Comments Previous: Exercise Chapter 2.4

Exercise Chapter 2.5

  1. british(X):- welsh(X).
    british(X):- english(X).
    british(X):- scottish(X).
    british(X):- northern_irish(X).

    Note that we have preserved the order of nationalities as described in the statement. This has no logical significance.

  2. eligible_social_security(X):- earnings(X,Y), less_than(Y,28).
    eligible_social_security(X):- oap(X).

    In the first part of the disjunction, we have introduced an additional predicate less_than/2 which has the reading that the relation holds when the first argument is less than the second.

    Also, note that the original statement does not make it clear whether or not someone could qualify both as an old age pensioner (oap) and as someone earning very little. This could become an important issue.

  3. sportsperson(X):- plays(X,football).
    sportsperson(X):- plays(X,rugger).
    sportsperson(X):- plays(X,hockey).

Paul Brna
Mon May 24 20:14:48 BST 1999