Explanation of Solution
Extended prolog program:
The prolog program to find the family relationship using the prolog rule is shown below:
%"carol" is a female
female(carol).
%"sue" is a female
female(sue).
%"bill" is a male
male(bill).
%"john" is a male
male(john).
%"john" is parent of "carol"
parent(john, carol).
%"sue" is parent of "carol"
parent(sue, carol).
%This rule for find the mother for given child
mother(X, Y) :- parent(X, Y), female(X).
%This rule for find the father for given child
father(X, Y) :- parent(X, Y), male(X).
%This rule for sibling
%It means that X is Y's sibling if X and Y have a common parent
sibling(X, Y) :- parent(Z, X), parent(Z, Y), X\=Y.
%Rule for find the relationship of uncle
uncle(U,N):- male(U),sibling(U,Z),parent(Z,N).
%Rule for find the relationship of aunt
aunt(X,N):- female(X),sibling(X,Z),parent(Z,N).
%Rule for find the relationship of grandParent
grandParent(G,N):- parent(G,P),parent(P,N).
%Rule for find the relationship of cousin
cousin(X1,X2) :-
parent(Y1,X1),
parent(Y2,X2),
sibling(Y1,Y2).
%Rule for find the parents of Z's.
parents(X, Y, Z):- parent(X, Z), parent(Y, Z).
Prolog Code Explanation:
The given program is used to find the family relationship using prolog rule.
- From the above code, first assign the two females “carol” and “sue” by using prolog rule “female(carol)” and “female(sue)” respectively.
- Then assign the two males “bill” and “john” by using prolog rule “male(bill)” and “male(john)” respectively.
- The rule “parent(john, carol)” implies “john” is parent of “carol”.
- The rule “parent(sue, carol)” implies “sue” is parent of “carol”...
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Computer Science: An Overview (12th Edition)
- Prologarrow_forwardEstablish the limits of global and local variables. You should use whole sentences.arrow_forwardImplement Thirsty problem using semaphore. Write the code in C/C++ Scenario: To drink, a thirsty person must have three things; water, ice and a glass. There are three thirsty people, each having a different one (and only one) of the three required items. A fourth person, a server has unlimited supply of all three items. If nobody is drinking, the server places two of the three items (chosen at random) onto table. Thirsty person who can make a drink from those two items will pick them up and drink a glass of ice water. When done, thirsty person will notify the server and the process will repeat.arrow_forward
- Answer with proper explanation and step by step solution. Question: Write a denotational semantics mapping function for java for loop Please explain and everystep!!!arrow_forwardIs there any reason why modern programming languages can't do without pass-by-value and pass-by-reference constructs? Why is it that we can't just choose one of these? Please address the benefits of having both and the drawbacks of having either alone in your answer.arrow_forwardPlease provide your responses on the following questions about the Java grammar: Find the "synchronised statement" that has the smallest possible length.You do not need to supply a derivation. Please only provide the very last string. It is possible for import statements to occur in a Java file at any place they like. Provide an explanation that makes use of correct grammar.arrow_forward
- Objective: The objective of this discussion is to be aware of the field of logic. Problem Statement: Consider the statement: "There is a person x who is a student in CSEN 5303 and has visited Mexico" Explain why the answer cannot be 3r (S(x)→ M(x)).arrow_forwardTake the tupple and initialize it with some value . You can assume the size of tupple is 9 units and Destructuring it and print the variable which obtained from tupple destructing in julia language.arrow_forwardIN C PROGRAMMING LANGUAGE AND COMMENT EVERY STEP PLEASE Write a program that takes verbs and forms their past tense on the basis of these rules: a. If verb ends in “e”, add “d”. b. If verb ends in “ss” or “gh”, add “ed”. c. In all other cases, inform the user that the verb may have an irregular past tense. Print each verb and its past tense. Try the following data: smile discuss confess declare laugh run cough teach buyarrow_forward
- Translate the following statements to English. Be as precise as possible. The domain is all Vehicles. a. ¬∃x (luxurious(x) ∧ cheap(x) ∧ cheap(x)) b. (¬∃x luxurious(x)) → ∀x (cheap(x) ∨ car(x))) c. ∀x (fast(x)∧ car(x)) → (sports(m) ∧ economic(m)), where m =“mini cooper”arrow_forwardlink(a,b). link(a,c). link(b,c). link(b,d). link(c,d). link(d,e). link(d,f). link(e,f). link(f,g). Using the above Formulate the appropriate Prolog predicate "path(X,Y,N)" which is true if (and only if) there is a path of length "N" from node "X" to node "Y". For example, there is a path of lengtharrow_forwardLet Q(x) be the statement “x hasn’t developed a program in JAVA”, where the domain consist of the students in ICS. Express each quantifications in English statement. 1.) ƎxQ(x) 2.) ¬ƎxQ(x) 3.) Ǝx¬Q(x)arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education