Questions: 69

Answers by our Experts: 50

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

3) Define prolog rules for the following:
a. sibling
b. sister
c. grandmother
d. grandfather

4) Do query on
a) Who are the grandpas’ of Najib? (10 marks)
b) Who are the grandmas of Nasrun? (10 marks)
c) Who are the siblings of Nadia? (10 marks)
d) Who is the sister of Najib? (5 marks)
e) Who are the parents of Najmah? (10 marks)
f) Who is the mother of Nadia? (5 marks)
g) Who is the father of Najmah? (5 marks)
h) Who is the grandpa of Najmah? (5 marks)
i) Who is the mother of Nazari? (5 marks)
j) Who is the father of Nasrun? (5 marks)

?- sibling(najib,X).
X = najib ;
X = nasrun .
Given:

Mohd is the father of Nazari. Fatimah is the mother of Nazari. Najmah is the wife of Nazari. Noriah is the mother of Najmah and Sulaiman is the father of Najmah. Nazari and Najmah are the parents of Najib, Nasrun and Nadia.
3) Define prolog rules for the following:

a. sibling


b. sister
c. grandmother
d. grandfather

4) Do query on
a) Who are the grandpas’ of Najib? (10 marks)
b) Who are the grandmas of Nasrun? (10 marks)
c) Who are the siblings of Nadia? (10 marks)
d) Who is the sister of Najib? (5 marks)
e) Who are the parents of Najmah? (10 marks)
f) Who is the mother of Nadia? (5 marks)
g) Who is the father of Najmah? (5 marks)
h) Who is the grandpa of Najmah? (5 marks)
i) Who is the mother of Nazari? (5 marks)
j) Who is the father of Nasrun? (5 marks)


?- sibling(najib,X).
X = najib ;
X = nasrun .
hi how can I create exe file?
Assignment - Cooking
The task is to create a simple decision support system for cooking.
Predicate in the database has the following syntax:

at_home ([ingredient (rice, 2), ingredient (water, 10)]).

The predicate at_home, so is
rice ingredient and 2 represent the amount of rice available at home.

Recipe (boiled_rice, [ingredient (rice, 4), ingredient (salt, 3), ingredient (water, 5)]).
recipe (chicken, [ingredient (chicken, 2), ingredient (salt, 1), ingredient (pepper, 1)]).

The predicate recipe, so is rice (or chicken) dish and the second argument is a list of ingredients needed to cook the dish.
Information

After defining the database (and added some recipes), you will write two predicates:
First Cook (X) provides an answer to what can be repaired by the ingredients available at home.
The question can also be "Can I cook dish X". Responses should be the various options available to cook.
Second buy (X, L), the quantities of different ingredients that must be purchased in order to cook the dish x.
The program shall gather Required ingredients and quantities in the list L. The question must also be able to buy (X, L). which shall enumerate (with ';') all known recipes and what needs to be purchased in order to cook them.
A possible solution to buy (Rice, L), from the above example, can be: L = [ingredient (rice, 2), ingredient (salt, 3)]
It is appropriate to break down and preached in the sub-tasks as using predicates can take care of. Examples of such may be (but there are more ways to divide the problem): at_home (Type, Amount): talking about how much it is home of the ingredient type. need_to_buy (Needed, BuyList): creates a shopping list (BuyList) given a list of the essential ingredients (Needed). Since both the cook and buy to enumerate solutions should be the declarative predicate
1. Consider the following Horn clauses.

b(x, t) <- t is x-2.

a(0, 1) <- .

a(x, y) <- x > 0, b(x, y).


Using cancellation and unification, show how each of the following queries resolve.

<-a(5,m).

<-a(0,b).
% Author:
% Date: 08-Sep-11
person(may,female,25,blue).
person(john,male,30,blue).
match:-person(Fn,'female',Fage,Fatt),
person(Mn,'male',Mage,Matt),
Fage<=Mage,
Fatt=Matt,
write(Fn ,'-- match with----',Mn).


error message :55 ?- match.
ERROR: Undefined procedure: match/0
ERROR: However, there are definitions for:
ERROR: catch/3
false.


can someone help me how to find the matching partner and display their name ...and i using swi prolog
How can I write Program that reads marks of a students and displays grade with prolog programing?
where i can download prolog swi ?
Give the following predicates:

A) precede_list (X, Y) is true when the list X precedes Y list. Example:

?-precede_list ([1,2], [1, 2, 3]).
Yes

B) proceed_list (X, Y) is true when the X-list following the CC list. Example:

?-procede_list ([1,2], [2]).
Yes

C) included_list (X, Y) is true when X is a non-empty sub-list of CC list. Example:

?-included_list ([1,2], [0, 1, 2, 3]).
Yes

D) common_list (X, Y) is true when the two lists have at least one common element. Example:

?-common_list ([1,2, 3], [0, 3, 4]).
Yes

E) pair_list (X, Y) in a computer returns to the data pairs of X List. Example:

?-pair_list ([1,2, 3, 4, 5, 6], [[1, 2], [3, 4], [5, 6]]).
Yes
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS