Recursive predicate definitions
If you have not already done so, do the exercise about family relationships.
Extend the family tree that you defined in that exercise by adding great-grandparents for Harry.
Now, define a predicate
be true if
X is an ancestor of
Your predicate definition should work correctly even if you add
Harry's great-great-grandparents, his
great-great-great-grandparents, his great-great-... to the
Ask queries to test your definition. For example:
- Is Albert an ancestor of Harry?
- Who are the ancestors of Harry?
- Is Dudley an ancestor of Harry?
- Who are the descendants of james?
Ctrl-c. Then type
a to abort.