Question

1. For your family (or any other real or hypothetical family) write a PROLOG program family.pro that is based on the follow

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solved the first 4 sub-parts of the question as per Chegg's answering guidelines.

All the explanation is in the code comments. Hope this helps!

Code:

%facts ------------
is_male(tom).
is_male(jim).
is_male(mann).
is_female(ann).
is_female(alice).
is_parent_of(ann, tom).
is_parent_of(ann, alice).
is_parent_of(mann, jim).
is_parent_of(mann, alice).

% inference rules ----------------------------

% part a)
% mother - mother is parent of child and is female.
mother(MOTHER, CHILD):-
is_parent_of(MOTHER, CHILD),
is_female(MOTHER).
% part b)
% father - father is parent of child and is male.
father(FATHER, CHILD):-
is_parent_of(FATHER, CHILD),
is_male(FATHER).

% part c)
% sibling1 - name1 and name2 should have 1 common parent
% and name1 and name should be different.
sibling1(NAME1, NAME2):-
is_parent_of(X, NAME1),
is_parent_of(X, NAME2),
NAME1 \== NAME2.
% part d)
% brother1 - name1 and name2 should have 1 common parent,
% both of them should be male
% and name1 and name should be different.
brother1(NAME1, NAME2):-
is_parent_of(X, NAME1),
is_parent_of(X, NAME2),
is_male(NAME1),
is_male(NAME2),
NAME1 \== NAME2.

Sample run:

mother(X, Y). X = ann, = tom X = ann, Y = alice father(X, Y). X = mann, Y = jim X = mann, Y = alice sibling1(X, Y). X = tom,

Code screenshots:

facts ----------- is_male (tom). is_male(jim). is_male (mann). is_female (ann). is_female(alice). is_parent_of (ann, tom). is

Add a comment
Know the answer?
Add Answer to:
1. For your family (or any other real or hypothetical family) write a PROLOG program "family.pro"...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 Given the following relationships in Prolog clauses: father(X,Y) /* X is the father of...

    QUESTION 1 Given the following relationships in Prolog clauses: father(X,Y) /* X is the father of Y */ mother(X,Y) /* X is the mother of Y */ male(X) /* X is male */ female(X) /* X is female */ parent(X,Y) /* X is a parent of Y */ diff(X,Y) /* X and Y are different */ Write Prolog clauses to define rules for the following relationships: is_mother(X) /* X is a mother */ is_father(X) /* X is a father */...

  • I have have been stuck on this in prolog Design a set of predicates that encode...

    I have have been stuck on this in prolog Design a set of predicates that encode genealogical relationships.. • male((XX)) - X is male.. • female((XX)) - X is female.. • parent((XX,,YY)) - X is the parent of Y.. • mother((XX,,YY)) - X is the mother of Y.. • father((XX,,YY)) - X is the father of Y.. • child((XX,,YY)) - X is the child of Y.. • sibling//22 (rreflexive)) • grandparent((XX,,YY)) - X is the grandparent of Y.. • grandmother((XX,,YY))...

  • 4. [201 Use Prolog (e.g., SWI-Prolog) to create a knowledge base for the family tree of...

    4. [201 Use Prolog (e.g., SWI-Prolog) to create a knowledge base for the family tree of Figure 1 and then ask queries about the family tree. Assume the intended interpretation of all predicates of the form p(x.y) is that "x is the p of y" George eMum r-Kydd Elizabeth Philip Margaret Diana-Charles Anne-Mark Andrew Sarah E William Harry Peter Zara Beatrice Eugenie Figure 1. A typical family tree. The symbol-connects spouses and arrows point to children. Enter the information from...

  • Creating a pedigree chart from a family history and hypothesizing pattern of inheritance A family with...

    Creating a pedigree chart from a family history and hypothesizing pattern of inheritance A family with a new disease caused by a mutant gene has been found. The family history has been collected and recorded. You will now create a pedigree chart from their family history and use the pedigree to predict the pattern of inheritance the disease follows. • Read the following family history: Patient 1 and Patient 2 visited a genetics counselor and provided their family histories. As...

  • Styles 6. Insert a picture of your pedigree chart for this family with genotypes filled in...

    Styles 6. Insert a picture of your pedigree chart for this family with genotypes filled in here. 7. Which pattern of inheritance do you think the disease shows? Explain your reasoning. 8. Patient 1 and Patient 2 in the pedigree chart would like to know what the chances are that they will have a child with the disease. What do you tell them? Use a Punnett Square to show your work. Using Punnett Squares for human conditions and diseases The...

  • Creating a pedigree chart from a family history and hypothesizing pattern of inheritance A family with...

    Creating a pedigree chart from a family history and hypothesizing pattern of inheritance A family with a new disease caused by a mutant gene has been found. The family history has been collected and recorded. You will now create a pedigree chart from their family history and use the pedigree to predict the pattern of inheritance the disease follows. • Read the following family history: Patient 1 and Patient 2 visited a genetics counselor and provided their family histories. As...

  • Mishka is a 16-year-old female, who attends your school. A year ago, Mishka lost both her...

    Mishka is a 16-year-old female, who attends your school. A year ago, Mishka lost both her parents to a murder-suicide (committed by her father) which was hard for her to accept. Mishka was present during the ordeal as she hid behind the sofa as her parents argues. At first, Mishka would tell family members and friends that she would still see her parents and they were not dead. After reality struck, she bargained with God, asking him to return her...

  • The Case of High Cholesterol Part I Renee and Karl have been married for six years,...

    The Case of High Cholesterol Part I Renee and Karl have been married for six years, and have two active children, ages 2 and 5. The kids keep both parents busy, chasing the kids around and, recently, preparing the oldest child for kindergarten. In addition, both Renee and Karl work full time, so there isn’t a lot of free time to do things that are important to their health, like see the doctor for regular physicals. Both are healthy, so...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT