[SOLVED] html prolog Contents

$25

File Name: html_prolog_Contents.zip
File Size: 188.4 KB

5/5 - (1 vote)

Contents
1 Assignment 1 (5 marks) 1
2 Submission Information 3
3 Marking Rubric 3
1 Assignment 1 (5 marks)
Prolog is probably unlike any other programming language you have used until now. You should try to develop prolog code as logic definitions. This will be frustrating at first, but when you finally get the hang of it, you will find that you can write much more understandable code.
Prolog is a very good prototyping language!!! While Prolog programs can be made to be efficient, it often decreases the understandability of the program. You should start with a program that is obviously correct and then you can transform it into a more efficient program as needed.
The logic needed for the first two questions will be introduced in the 2nd week, the prolog needed for the last two questions will be introduced in the 3rd week, and the assignment is submitted early in the 4th week. You will not have a lot of time for the last part of the assignment, so you must plan your time accordingly.
1. Propositional Logic Problem (1 mark)
Write a half-sister relation in propositional calculus for Mary and Ann, where Marys mother is Sue and her father is Ed and Anns mother is Sue and her father is Sam. Here is an example of a full-brother relation to help you.
Mark-full-brother-of-Luke Mark-father-John Luke-father-John Mark- mother-Sara Luke-mother-Sara Mark-is-male
2. Predicate Logic Problem (1 mark)
Write a general half-sister definition, halfSisterOf(HalfSister, Person), in predicate calculus only using standard quantifiers, connectives, and the predicates:
female(Person)
parentOf(Parent, Person) not(BooleanExpression) =(X, Y)
3. Prolog Logic Problem (1 mark)
Translate your predicate calculus definition of halfSister into a Prolog pro- gram. As in your predicate definitions, only use the predicates mentioned above.
1

4. Einsteins 5 Houses Logic Puzzle (2 marks)
Below is Einsteins five houses riddle taken from (https://udel.edu/
~os/riddle.html):
The situation:
There are 5 houses in five different colors. In each house lives a person with a different nationality. These five owners drink a certain type of beverage, smoke a certain brand of cigar and keep a certain pet. No owners have the same pet, smoke the same brand of cigar or drink the same beverage.
The question is: Who owns the fish? Hints:
the Brit lives in the red house
the Swede keeps dogs as pets
the Dane drinks tea
the green house is on the left of the white house the green houses owner drinks coffee
the person who smokes Pall Mall rears birds
the owner of the yellow house smokes Dunhill
the man living in the center house drinks milk
the Norwegian lives in the first house
the man who smokes blends lives next to the one who keeps cats
the man who keeps horses lives next to the man who smokes Dunhill the owner who smokes BlueMaster drinks beer
the German smokes Prince
the Norwegian lives next to the blue house
the man who smokes blend has a neighbor who drinks water
You will need to write at least the following 2 predicates:
solution(Persons)
ownerOfFish(Persons, Owner)
where solution/1 generates the matrix used to determine the fish owner and ownerOfFish/2 extracts the owner of the fish from that matrix. You may create as many other predicates as you want.
Shortly, we will provide an example of another logic puzzle formulated as a prolog program as part of the resources for this assignment.
2

2
1.
2.
3
1. 2.
3.
Submission Information
What to submit
You need to submit a zip archive, yourUpi.zip (e.g., mbar098.zip) con- taining 3 files: halfSister.pdf, halfSister.pl, and einstein.pl. The first file has the answers for questions 1 and 2. The second one is the halfSister prolog code. The third is the prolog code for computing the answer to Einsteins 5 houses riddle.
When and where to submit
You need to submit this to Canvas by 13 August 23:59. You will be informed when Canvas is ready to receive submissions.
Marking Rubric
halfSister marking
The marking for the 3 halfSister questions is straightforward.
5 houses marking
Your prolog program for this question MUST figure out the answer, of who owns the fish, FOR ITSELF!!!!! You will get a zero for this question, if the answer is hard-coded into the prolog code. You also must translate the hints, etc., into prolog code yourself, see warning below.
WARNING
You may be tempted to just use someone elses code, DONT!!!! The assignment you submit MUST BE your own work!! You can talk aboout it with others and we recommend that you do, but if we detect that you copied any of the assignment from another source, you will get a ZERO for the ENTIRE ASSIGNMENT!!
3

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] html prolog Contents
$25