Description
This assignment includes both conceptual and code questions. It must be completed individually. You may not collaborate with other students, share code, or exchange partial answers. Questions involving answers or code must be emailed to the instructor or TAs directly or discussed during o ce hours. Your answers to the conceptual questions must be uploaded to Moodle as a pdf le titled \Assign3 UnityID.pdf”. Your sourcecode must be submitted as a self-contained zip. All code must be clear, readable, and well-commented. Note: The code will be tested on the NCSU VCL system(\CSC520 VCL”). You are advised to test your code there before submission.
Question 1 (20 pts)
Consider the following English sentences.
Sodium is an alkali metal.
Some alkali metals can react with all nonmetals except the noble gases. If the nonmetal is a noble gas, then no alkali metal can react with it. Xenon is a nonmetalic noble gas.
-
(5 pts) Convert the sentences into rst-order predicate logic. Use the following lexicon:
alkali (X) X is an alkali metal. nonmetal(X) – X is a nonmetal. noble (Y) Y is a noble gas. react (X, Y) X can react with Y.
-
(10 pts) Follow the steps on text book to convert the logic statements into CNF.
-
(5 pts) ) Using FOPL resolution prove the conclusion that Xenon cannot react with Sodium. Number your clauses, and indicate explicitly step-by-step what resolves together, and under what substitution.
1
Here is a database of facts and rules.
There are two types of animals: Carnivores and Herbivores. Deer is a type of Herbivore.
Bat is another type of herbivore. Ron is a Bat.
Buckshot is a deer. Junior is a deer.
Dexter is a Carnivore.
-
(5 pts) Draw this taxonomy as a frame-based knowledge base and label the edges and nodes appropriately.
-
(5 pts) Using as a top-level rule head the syntax rel(SourceNode, RelationshipType, Destina-tionNode) and any other predicates you need, write a set of one or more rules to allow the inference that:
-
-
Ron is a Bat, it is also a herbivore, and also an animal.
-
-
-
Buckshot is a deer, it is also a herbivore, and also an animal.
-
-
-
Junior is a deer, it is also a herbivore, and also an animal.
-
-
-
Dexter is a carnivore, and an animal.
-
Your rules must follow strict Prolog syntax, and should allow inference over hierarchies of any depth, not just the depth in this example.
-
(10 pts)Now enhance your knowledge base optained in part (a) to represent following knowl-edge and show the complete gure:
-
-
Animals’ habitat is land but Bat’s is Air.
-
-
-
Skin color of a deer is yellow but Buckshot is black.
-
-
-
Animals have 4 legs but Dexter and Ron have 2 legs.
-
-
-
Ron and Buckshot are friends of each other.
-
-
-
Junior is a friend of Dexter but Dexter is not a friend of Junior.
-
2
-
-
Ron’s habitat is air.
-
-
-
Junior’s habitat is land.
-
-
-
Buckshot is black.
-
-
-
Ron has 2 legs.
-
-
-
Junior is a friend of Dexter and so are Ron and Buckshot .
-
Note: Submit one le for each of the sub-questions above named 32b.pl 32d.pl respectively. The nal Prolog code should derive all the inferences whether di-rectly stated or implied from the knowledge base and not just those stated in above parts.
Question 3 Extra Credit (25pts)
Consider the following English sentences.
Tom is in the client user group.
Some user in the client group can access all databases that have no password protection. If the database has password protection, no user in the client group can access it.
MongoDB has password protection.
-
(5 pts) Convert the sentences into rst-order predicate logic. Use the following lexicon:
client(X) { X is in the client user group. password(Y) { database Y is password protected. access(X,Y) { X can access the database Y.
-
(10 pts) Following the steps on text book to convert the logic statements into CNF.
-
(5 pts) Using FOPL resolution prove the conclusion that Tom can’t access MongoDB. Number your clauses, and indicate explicitly step-by-step what resolves together, and under what substitution.
-
(5pts) Implement a prolog database of rules that mirrors the logic above and is capable of executing the same query. Submit one le named 33d.pl.
3