65 638
Assignments Done
99,2%
Successfully Done
In October 2018

Questions: 23

Free Answers by our Experts: 11

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

The objective of this project is to build a Prolog program that can transform
Well-formed formulas (fbf) of a first order logical language to normal form (conjunctive
cnf or normal form).

To properly handle the existential variables we introduce a new rewrite rules,
Skolemizzazione said:

exist(X, p(X)) -> p(sk00042)

Note how sk00042 'and a constant and not variable. Note also that this operation 'and realt'a
pi'u complicated in the presence of variables universally quantified.

every(Y, exist(X, p(X, Y))) -> every(Y, p(sf666(Y), Y))

A variable existential can be replaced by a function (called Skolem) which is applied
variables pi'u universal "external".

You'll need the following code to manage the operation of Skolemization:

skolem_variable(V, SK) :- var(V), gensym(skv, SK).
skolem_function([], SF) :- skolem_var(_, SF).
skolem_function([A | ARGS], SF) :-
gensym(skf, SF_op),
SF =.. [SF_op, A | ARGS].
1. Using Prolog as the programming language for LOGIC, construct the relevant command to do the following tasks:-

a. Prolog Lists - A list is either empty or it is composed of a first element (head) and a tail, which is a list itself. In Prolog we represent the empty list by the atom [] and a non-empty list by a term [H|T] where H denotes the head and T denotes the tail.
(NOTE:- Given list MySenarai= [a,b,c,d,e,f, g, h] for the tasks listed below)

i. Find the last element of a list.
?-
Output:-

ii. Find the K'th element of a list. (K=5)
?-
Output:-

iii. Eliminate consecutive duplicates of list elements.
?-
Output:-

iv. Find the number of elements of a list.
?-
Output:-

v. Reverse a list.
?-
Output:-

vi. Find out whether a list is a palindrome.
?-
Output:-
vii. Duplicate the elements of a list.
?-
Output:-

viii. Drop every N'th element from a list. (N=3)
?-
Output:-

ix. Insert an element at a given position into a list. (element = zzz)
?-
Output:-

x. Extract a slice from a list. (I = 2; k = 5)
Given two indices, I and K, the slice is the list containing the elements between the I'th and K'th element of the original list (both limits included). Start counting the elements with 1
?-
Output:-
overground(newcrossgate,brockley,2).
overground(brockley,honoroakpark,3).
overground(honoroakpark,foresthill,3).
overground(foresthill,sydenham,2).
overground(sydenham,pengewest,3).
Write a rule that displays all of the stations that are within reach from a specified station given a time. e.g. what stations are reachable from Richmond in 15 minutes?
I am doing a Prolog assignment based on the London Overground. I have to create a rule that calculates how long a journey takes between two stations, from the answer provided in a previous query. eg(southkenton,kenton). Any Ideas on how I can start the rule of, and how I should structure it.
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
Submit