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

PROLOG HELP NEEDED !!! Create a Prolog program to answer questions in English ab

ID: 667493 • Letter: P

Question

PROLOG HELP NEEDED !!!

Create a Prolog program to answer questions in English about “your family”.

A sample family is available in familydb.pl and sample rules are available in familyrules.pl. Skeleton code in family.pl must be.

Detail 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)
I have Already done this.

3.) 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?

I need help in converting the english sentences to prolog ones and how to run this program using queries where user can ask questions.

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