5. Questions..
• a)Was George I the parent of Charles I?
• Query:
• ?-parent(charles1, george1).
• false
• b)Who was Charles I's parent?
• Query:
• ?- parent(charles1,X).
• X=james1
• c)Who were the children of Charles 1
• Query:
• ?-parent(X,charles1).
• X=Catherine
• X=charls2
• X=james2
6. Explanation of rules..
• M is the mother of X if she is a parent of X and is female
• mother(M,X):-parent(M,x),female(M).
• F is the father of X if he is a parent of X and is male
• father(F,X):-parent(F,X),male(F).
• X is a sibling of Y if they both have the same parent.
• sibling(X,Y):-parent(X,Z),parent(Y,Z).
7. Questions based on rules…
• who is mother of sophia?
• ?-mother(sophia,X)
• X=elizabeth.
• who is father of charles1?
• ?- father(charles1,X).
• X = james1.