The king is dead
King Basil has died without saying who should rule next.
To find the rightful heir, we look at the royal family records, given as parent and deceased facts:
parent("basil", "edmund"). parent("basil", "diana"). parent("basil", "george").
parent("edmund", "alice"). parent("edmund", "bob"). parent("diana", "eve").
parent("diana", "frank"). parent("george", "henry"). parent("george", "kate").
parent("bob", "carol").
deceased("basil"). deceased("edmund"). deceased("bob"). deceased("george").
The crown passes to a living descendant of Basil, across any number of generations: here recursion solves the problem!