Recursion for going through a family tree and selecting cousins

I have looked at all of the other cousin prolog questions on stack overflow and here. My school decided to complicate it so it’s a lot different in my opinion. I’ll add the requirements below:

  • For your basic facts you are not allowed to use any other predicate than male/1, female/1 and child/2. This means that everything else has to be deduced through Prolog rules.
  • For performance reasons, we want the rule implemented in #3 (isSingleChild/1) to be mostly efficient and only check if the person has at least one sibling: we don’t want Prolog to go through all of the actual siblings beyond the first one. To achieve that, you may use the cut “!” (!/0)
  • You must provide screenshots displaying how you ran your program and the entire output of your program.

As for reimplementing append/3 and member/2, I think the issue is I don’t really understand list functions all of the examples I’ve read and found online are a lot simpler. Are these functions pre-implemented in the ide? There are no rules against using library predicates. Lastly, I figured recursion would help but it is not a requirement.