Given the Prolog code motherlinajack fathertonyjack femaleju
Given the Prolog code:
mother(lina,jack).
father(tony,jack).
female(julia).
male(ken).
man(X):-father(X,_).
grandfather(X):-father(X,Y),father(Y,Z).
grandfather(X):-father(X,Y),mother(Y,Z).
Use only the above code to give one example of:
(a) an antecedent.
(b) a consequent.
(c) a fact.
(d) a rule.
(e) a variable.
(f) a constant.
(g) a conjunction (logical ‘and’) relation.
(h) a “don’t care” condition.
Now, based on the above program, give one example of:
(i) a query.
(j) a Prolog resolution.
(k) a Prolog instantiation.
Solution
Solution:-
(a) Antecedant-
In the given prolog Rule \"grandfather(X):-father(X,Y),father(Y,Z).\"
father(X,Y),father(Y,Z). is an antecedent.
An antecedent is true if Consequent is true.
(b) Consequent-
In the given prolog Rule \"grandfather(X):-father(X,Y),father(Y,Z).\"
grandfather(X) is consequent.
If Consequent is true then Antecent is true.
(c) Fact-
In the given prolog code \"female(julia)\". is a fact.
(d) Rule-
In the given prolog code \"grandfather(X):-father(X,Y),father(Y,Z).\" is rule.
(e) Variable-
In the given prolog code X,Y and Z are variables. In prolog Variable starts from capital letters.
(f) Constant-
In the given prolog code lina,jack,tony,julia and ken are constants as they are atomic values.
(g) Conjunction-
In the given prolog code \"grandfather(X):-father(X,Y),father(Y,Z).\"
father(X,Y),father(Y,Z) is a conjunction (logical ‘and’) relation. Conjuction is representeted in prolog as \',\'
(h) “Don’t care” condition-
In the given prolog code \"man(X):-father(X,_).\"
father(X,_) is a Don\'t care condition. Don\'t care condition represented as \'_\' in Prolog.
(i) Query-
\"?- mother(lina,X).\" is a query for the given prolog program and returnes X=jack.
(j) Prolog resolution-
\"grandfather(X):- man(X).\" is a resolution as it is derived from two rules and introduced a new rule.
(k) Prolog instantiation-
\"mother(lina,jack).\" and \"mother(Y,Z).\" it is derived that Y=lina. and Z=jack.
this is called instantiation. By instantiation we can derive the required variables values from tw same facts or rules.

