name = 'cousin/2' slug = 'the cousin relation' description = '''\
cousin(X, Y)
: X
is a cousin of Y
.
?- cousin(andrew, X). X = vanessa ; X = patricia.
Family trees are
described with predicates parent/2
, male/1
, and
female/1
.
Perhaps you can make use of the solution to one of the previous exercises?
But of course it's also possible to solve without any of the previous solutions...
''', '''\If PX
is a parent of X
and
PY
is a parent of Y
and if
PX
and PY
are siblings,
then X
is a cousin to Y
.
Is gender really important?
''', 'gender_is_irrelevant_markup': '''\Is this necessary?
''', 'precedence_fail': '''\Did you mix up the precedence of operators or & and?
Operator and has higher precedence than operator or. If you wish to change that you can always use the brackets.
''', 'cousin_vs_sibling': '''\How can a cousin X
at the same time also be a sibling of Y
?
Did you perhaps forget that the parents of X
and Y
should not be the same?
(Be careful: if both a mother and a father are listed in the database, then prolog could find them as two
different parents, which is logically absolutely correct.)
How can someone be a cousin to him- or herself?
Perhaps X
and Y
have the same parent?
Try this query: ?- cousin(X, X).
A cousin doesn't need to have children...
''', 'predicate_always_false': '''\It seems your predicate is always "false". Did you give it the correct name, or is it perhaps misspelled?
If the name is correct, check whether something else is misspelled, perhaps there is a full stop instead of a comma or vice versa, or maybe you typed a variable name in lowercase?
It is, of course, also possible that your conditions are too restrictive, or even impossible to satisfy
(as would be, for example, the condition that X
is both a parent and a sister of Y
, or
something similarly impossible).
Zanimivost: nalogo bi lahko rešil tudi z uporabo rešitve za relacijo "sister".
# Teta je namreč sestra od starša od Y
.