Question: SWI-Prolog Write your prolog code. Copy-paste your queries and their outputs in the answer The family relation is given in the picture (the arrow X
SWI-Prolog
Write your prolog code.
Copy-paste your queries and their outputs in the answer
The family relation is given in the picture (the arrow X Y symbolizes that X is a parent of Y):

Define the predicate parent(X,Y) which is true when X is a parent of Y, and the predicate male(X) (female(X)) which is true when X is a male (a female). Check the following queries:
Note that ; enforces Prolog interpreter to look for the next success whereas
Using the above predicates define the predicates: mother(X,Y) (father(X,Y)) to be true when X is a mother (a father) of Y. Check now who is a mother of jim and of joe.
(pam tom bob liz ann pat joe jim 12 | ? - "is tom male? | ? - "who is male? ? who is a parent of liz? ? "is bob a parent of pat?" ? find parent-child relationship" |? who is a grandparent of jim? 1 ? who are tom's grandchildren
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
