0
votes

This program will be tested using SWI Prolog.

Family.pl contains facts about family members, who is married to whom, sorts of things.

Rules must be added at the bottom and submit the modified file.

  1. Write a motherInLaw(X,Y) predicate that means X is Y’s mother-in-law.

  2. Write a grandParent(X,Y) predicate that means X is Y's Grandparent.

  3. Write a grandMother(X,Y) predicate that means X is Y's Grandmother.

Thank you guys!

here are my own answers, could you please take a look and tell me if they are correct? Thanks

motherInLaw(X, Y) : mother(X, Z),couple(Z, Y)

grandParent(X, Y) : parent(X, Z),parent(Z, Y)

grandMother(Z, Y) : mother(X, Z),parent(Z, Y)
1
It would be super if you could post the entire Family.pl source. - Enigmativity

1 Answers

3
votes

You need to write :- instead of : and . at the end of each clause

The grandmother/2 predicate looks very strange. Actually I think the head of the clause should be grandMother(X,Y).