1. Exercize 2.3 (p. 64 of textbook). Use the same format as in the related examples.
2. Exercize 2.7 a & 2.7b (p. 65 of textbook) Use the same format as in the related examples.
3. Encode facts and rules as a Datalog KB so that the KB could be used to answer queries of the form:
?prescribe(Patient, Remedy)For example, given your KB, the query
?prescribe(nancy, R)would be answered with
R=aspirinIt is not necessary to turn your answer into Prolog and run it on a computer. Write the Datalog in the form used in Figure 2.3 in the textbook. In other words, document each predicate in a comment and give one or more lines of Datalog under each comment (beginning with %) and use a similar style of indentation. For example, under the following comment
R=soup
% prescribe(Patient, Remedy) is true if the Remedy should be prescribed for the Patientyou would give the facts and/or rules in Datalog for the binary predicate, prescribe.
Only use features of Datalog covered in chapter 2 of the textbook. It is not necessary to use lists. Here is the only knowledge that should be encoded in your KB:
Prescribe aspirin for fever, antibiotic for pneumonia, soup for flu or a cold, and pain killer for broken ribs.
A patient with a fever and aches has flu.
A patient with a fever and runny nose has a cold.
A patient with chest pain and fever has pneumonia.
A patient with chest pain and who was in an accident has broken ribs.
nancy's symptoms are fever and runny nose.
dilbert's symptoms are chest pain and he was in an accident.
snoopy's symptom is fever and he was in an accident.
kathy's symptoms are fever, coughing, and chest pain.