/* definition of some family relationships */ parent(X,Y) :- mother(X,Y). /* X is the parent of Y if ... */ parent(X,Y) :- father(X,Y). /* Or if ... */ gparent(X,Y) :- /* X is grandparent of Y if */ parent(X,A), /* X is parent of (someone) A, */ parent(A,Y). /* and A is parent of Y. */ ggparent(X,Y) :- /* X is the great-grandparent of Y if */ gparent(X,A), /* X is the grandparent of (someone) A */ parent(A,Y). /* and A is the parent of Y. */ /* N.B. alternative: "X is parent of A */ /* and A is gparent of Y". It's the */ /* same thing here - why? If you went */ /* on to define 'gggparent' for use in */ /* the "stuart" database, the choice */ /* WOULD matter. Why? look at the file */ /* "ai2_stuart" ... */ sibling(X,Y) :- /* X and Y are brother or sister to */ parent(A,X), /* each other if they have a parent in */ parent(A,Y). /* common. */