Relations

Families provide many examples of relations between individuals in both the familial and mathematical senses – mother, father, parent, child-of, sibling, grandparent, aunt, uncle, and so on. Siblings have the same parents (one could define sibling as having at least one parent in common). An aunt or uncle is the sibling of a parent (ie., directly) or is the spouse of an aunt or uncle (i.e., by marriage). However, unless care is taken this allows 'X' to be a sibling of his or herself and potentially gives multiple ways for X to be someone's aunt or uncle. The solution is to insist that siblings, while sharing the same parents, must be different individuals; see sibling(.,.) below:


-- The House of Windsor --

Comment out 'and not equal(X,Y)' above and see what happens. How can 'aORu(.,.)' be used to find nieces and nephews of an individual?

There are more Prolog examples here.