Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a natural language front end to your family database which works like t

ID: 3879281 • Letter: 1

Question

1. Write a natural language front end to your family database which works like this:

Yes? Print each daughter of fred.

winnie alma esther

Yes? Do you know what a cousin is ?

No, what is a cousin?

Yes? Does fred have a daughter?

Yes.

Yes? Find every cousin of jill.

Sorry, I don’t know what cousins are!

Yes? Does frd have a son?

Sorry, I don’t know who frd is!

2. Predicates are to be included for the following relations only (others must be learnt): father,mother,son,daughter,brother,sister,wife,husband/2 male,female,person/1 (child/3 & married/2 will be needed in defining these)

3. To assist you in the programming task some procedures are provided in the file $ai/prolog/family.pl which you MUST incorporate in your program (there are also additional hints and optional help predicates in this file).

4. Sentences of these types should be recognized by the system:

DO you know what AN R is ?

DOES P have AN R ?

PRINT EACH R of P.

PRINT EACH R. DO you know P ?

Explanation / Answer

i came to know this similar one

%trace
predicates
father(symbol,symbol)
mother(symbol,symbol)
male(symbol)
female(symbol)
sister(symbol,symbol)
brother(symbol,symbol)
uncle(symbol,symbol)
wife(symbol,symbol)
aunty(symbol,symbol)
bhabhi(symbol,symbol)
cousin(symbol,symbol)
nephew(symbol,symbol)
grand_son(symbol,symbol)
grand_duaghter(symbol,symbol)
clauses
sister(X,Y) :- father(X,A),father(Y,A),female(Y).
father(dhanjiBhai,vithhaldas).
father(chuniBhai,vithhaldas).
father(harshad,dhanjibhai).
father(darshan,dhanjibhai).
father(nilam,dhanjibhai).
father(kiran,dhanjibhai).
father(kamleshbhai,chunibhai).
mother(harshad,prabhaben).
mother(X,Y) :- father(X,Z),wife(Y,Z).
brother(X,Y) :- father(X,A),father(Y,A),male(X).
% brother(X,Y) :- brother(Y,X).
male(harshad).
male(darshan).
male(dhanjibhai).
male(chunibhai).
female(nilam).
female(kiran).
female(prabhaben).
female(nimishaben).
female(kokilaben).
wife(prabhaben,dhanjibhai).
wife(nimishaben,kamleshbhai).
Wife(kokilaben,chunibhai).
grand_son(X,Y) :- father(A,Y),father(X,A),male(X).
grand_duaghter(X,Y) :- father(A,Y),father(X,A),female(Y).
uncle(X,Y) :- father(X,Z),brother(Y,Z).
aunty(X,Y) :- wife(Y,Z),
              brother(Z,W),
              father(X,W).
bhabhi(X,Y) :- wife(X,Z),cousin(Y,Z),female(X).
cousin(X,Y) :- father(X,A),father(Y,B),brother(A,B).
nephew(X,Y) :- wife(Y,A),brother(A,B),father(X,B),male(X)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote