need a proof in Prolog

I am My own grandpa in ProLog

Many, many years ago when I was twenty-three
I was married to a widow who was pretty as could be.
This widow had a grown-up daughter who had hair of red.
My father fell in love with her and soon they, too, were wed.

This made my dad my son-in-law and changed my very life
For my daughter was my mother, ’cause she was my father’s wife.
To complicate the matter, even though it brought me joy
I soon became the father of a bouncing baby boy.

My little baby then became a brother-in-law to dad
And so became my uncle, though it made me very sad
For if he was my uncle, then that also made him brother
To the widow’s grown-up daughter, who, of course, was my step-mother.

My father’s wife then had a son who kept them on the run
And he became my grand-child, ’cause he was my daughter’s son.
My wife is now my mother’s mother, and it makes me blue
Because, although she is my wife, she’s my grandmother too.

If my wife is my grandmother, then I am her grandchild
And every time I think of it, it nearly drives me wild
For now I have become the strangest case you ever saw
(This has got to be the strangest thing I ever saw)
As husband of my grandmother, I am my own grandpaw.


husband(me, pretty_widow).
husband(my_dad, pretty_widow_daughter).

wife(X, Y) :- husband(Y, X).

father(me, bouncing_baby_boy).
father(my_dad, me).
father(my_dad, my_dad_new_son).

mother(pretty_widow, bouncing_baby_boy).
mother(pretty_widow, pretty_widow_daughter).
mother(pretty_widow_daughter, my_dad_new_son).

married(X, Y) :- husband(X, Y).
married(X, Y) :- wife(X, Y).

parent(X, Y) :- parent0(X, Y).
parent(X, Y) :- step_parent(X, Y).

step_parent(X, Z) :-
    married(X, Y),
    parent0(Y, Z),
    \+ parent0(X, Z).

parent_in_law(X, Z) :-
    married(Y, Z),
    parent(X, Y),
    \+ parent(X, Z).

parent0(X, Y) :- father(X, Y).
parent0(X, Y) :- mother(X, Y).

grandparent(X, Z) :-
    parent(X, Y),
    parent(Y, Z).

sibling(X, Y) :- distinct(sibling0(X, Y)).

sibling_in_law(X, Y) :- sibling_in_law0(X, Y).
sibling_in_law(X, Y) :- sibling_in_law0(Y, X).

sibling_in_law0(X, Z) :-
    married(X, Y),
    sibling(Y, Z).

sibling0(X, Y) :-
    parent(Z, X),
    parent(Z, Y),
    X \= Y.
  • I need to satisfy the proof below. Do I need to make sure I have all these subgoals below satisfied before hand ?
  • And can I have my own names for them ?
  • How would I go about this ?

proof(ME) :- daughter(A,ME), mother(A,ME), son_in_law(D,ME), brother(B, D), 
             uncle(E,ME), brother(B,A), grandchild(F,ME), mother(C,A), 
             grandmother(C,ME), grandchild(ME,C), grandfather(ME,ME).

Leave a Reply

Your email address will not be published. Required fields are marked *