We describe relations on trees. The tree is stored as a sequence of unconditional facts:
is_a(abel,male). is_a(adam,male). ... etc ... is_a(amanda,female). is_a(anjali,female). ... etc ... is_father_of(abel,bert). is_father_of(abel,belinda). ... etc ... is_mother_of(anjali,bill). is_mother_of(anjali,bridget). ... etc ... is_grandparent_of(X, Z) :- is_parent_of(X, Y), is_parent_of(Y, Z). is_parent_of(X, Y) :- is_mother_of(X, Y). is_parent_of(X, Y) :- is_father_of(X, Y). is_half_sister_of(X, Y) :- is_a(X, female), is_parent_of(Z, X), is_parent_of(Z, Y), X \= Y.