本次英国代写是Prolog知识库建立的一个Coursework
Build Your Own Knowledge Base
For this part of the assignment you will create a Knowledge Base (KB) formulated as a Prolog program.
As a starting point, you are given the program brandons kb.pl, which contains an example knowledge base
(expressed as a set of facts and a set of inference rules) as well as a simple but quite powerful inference mechanism.
You can get to it via the following url:
https://swish.swi-prolog.org/p/bb_kb_2021.pl
You should examine the program and run it in SWISH (some other Prolog), before attempting the questions.
In order to modify the code you need to copy it using the fork option in the SWISH \Save new version” dialogue,
that you get to by choosing \Save …” on the drop down \File” menu. You should rename your version to
username kb.pl.
Initial Experimentation
Before attempting this question, you are advised to do some initial experimentation with the given database
and go through the following questions, which will help you think about how the system works:
1. Specify a rule which enforces the condition: \Cats hate all dogs except puppies”.
(Ensure that your rule gives the expected inferences.)
2. Specify a relational composition rule that will enable the implied fact
[rex, is grandfather of, champ] to be inferred from the KB.
3. A programmer is considering adding the following \genesis” rule to the KB:
rule( genesis, [[X, isa, dog]] ==> [[fatherof(X), isa, dog]] ).
Add this rule to the KB and run the inference mechanism, before answering these questions:
(a) What is the meaning/purpose of this rule?
(b) Explain what happens when the inference system is run with this rule present and why it could be
problematic.
4. Consider the function of the weak negation operator \+ that can be applied to premisses of a rule. A
weakly negated premiss takes the form \+[r, … ] and means that the rule can only be applied if the
fact [r, … ] is not in the database. This can be useful but can lead to unforseen behaviour of the
inference system when rule are reordered or further rules are added. Explain how this can happen.
Making your own Knowledge Base
To answer this question you must replace the simple example facts and rules with a more substantial KB of
your own devising (you will probably want to keep the ‘logic’ rules for subclass reasoning). Your answer to this
question should be submitted in the form of a PDF document. Your Prolog code should also be submitted as
a separate file on Gradescope. Grading will normally be done just by reading your PDF report, but we will
check the code file if we think the report may not give an accurate account of the results you obtained from
your code.
Preparation: You must chose a domain for your KB. This should be focused enough so that it has a
distinctive vocabulary of key concepts, relations and specific facts; but also substantial enough that moderately
complex inference rules are required to draw relevant and interesting conclusions. I suggest you do a bit of
experimentation with adding new information to the current KB before deciding on the domain your want to
work on.