Submit all parts together.
Due: Thursday April 29, 2021
Deliverables: Turn in your writeup of written questions, a copy of your code, and a file of your logged output from testing (or separate files), and a written report that discusses the results you got for each part. Also include a README file that describes how to run each part.
Materials can be found here http://www.filefactory.com/file/6asoo6n46whm/Materials.rar
Represent the following logic puzzle in First Order Logic . Then, provide a FOL resolution proof using answer extraction to determine who wore the plaid mask. Note that, with answer extraction, unlike a normal refutation proof, you do NOT assert that someone did not wear the plaid mask and find a contradiction! Instead, you assert [~hasMask(x, plaid) v Answer(x)], and create a proof that derives [Answer(PERSON)] where PERSON is the name of the plaid-masked person.
The logic task is to match four students, Anika, Maya, Rico and Yi, to their unique mask and to the unique female family member who made it for them. (For the puzzle, we will treat mother and grandmother as unique types even though “grandmother” is a subclass of “mother”.)
- The plaid mask was not a made by anyone’s mother.
- Anika’s mask did not have rainbows or tye dye.
- Yi’s mask was not made by his sister.
- The tiedye mask was not made by a grandmother.
- One of Maya and Yi have a plaid mask and the other one has a mask made by his/her aunt.
- Rico’s mask was made by his grandmother.
The solution should provide a sentence for each person giving both the design and the relative, e.g., something like the following (but, no-spoilers, this sentence may not be part of the real solution):
- Rico has a tiedye mask made by his grandmother.
- represent the information as a Prolog program; then ii)
- provide 2 interesting conclusions that can be proved from this program
Try to express and solve this same puzzle as a Prolog program (similar to the minizebra) example. Provide your code and include a log or screencast of what happens when you run the program. In your report, discuss the main differences in the two types of representations and any difficulties you encountered. You can use negation as failure \+ rather than FOL operator ~.
You should use SWI-Prolog: https://www.swi-prolog.org/ (Links to an external site.)
If you wish to use some other Prolog, please ask the TA or instructor first.
Question 2 (parts A and B)
We want to capture a specification and contents of the “Knowledge Base” as described below using 2 formats Prolog (A) and Description Logic (B). Also, for each subpart, provide some conclusions that can be inferred as either true or false, based only on the representation provided.
i) represent the information as a Prolog program; then ii)
ii) provide 2 interesting conclusions that can be proved from this program
i) represent it as a set of Description logic expressions. Not that here roles can have quantifiers such as ≥1 or =1, as in (≥1 hasClothing. Hat), for has at least one hat). To avoid special characters you can also use equivalent text forms such as: ALL, AND, AT-MOST, EXISTS, FILLS, ONE-OF, SOME-OF, and UNION. Note that [SOMEOF r d] says that some of the fillers of the role satisfy the description, [ONE-OF r d] says exactly 1 satisfy the description; [AT-MOST n r] allows us to specify a maximum (vs the minimum expressed by EXISTS); [Union c1 c2 .. cn] allows you to combine concept sets, which is like “OR” (vs AND which takes an intersection.)
ii) provide 2 interesting conclusions that can be proved from this representation. For EXTRA CREDIT, download a copy of the Protege ontology tool (or use the web based version) and save the KB as an OWL file. In your report contrast the main differences/difficulties between Prolog vs a Description logic.
For the first 17 use only the concept names** Vehicle, Boat, Motor, Car, Structure, Wheel, Engine, Hub, Rolling, Water Human, Driver, Adult, Child and predicate or role names hasPart, getPowerFrom, capableOf, movesOn, drives.
**For Prolog use lower case for these symbols and upper case for variables; for DL use upper case for Concept names (as above) and lower case for names of predicates.
Treat the first five as definitions (ie as both necessary and sufficient conditions).
- Cars are vehicles with wheels and get power from an engine.
- Bicycles are vehicles with wheels and get power from a human.
- Boats are vehicles that move on water.
- Wheels are structures that have a hub and are capable of rolling.
- Drivers are humans who drive a vehicle.
Treat 6 to 13 as true, but not necessarily sufficient.
- Boats do not have any wheels.
- Cars and bicycles do not move on water.
- Drivers of cars are adults.
- Humans are not vehicles.
- Neither wheels nor engines are human.
- Humans are either adults or children.
- Adults are not children.
- A sportscar is a car with a big engine.
Treat 14-17 as assertions (facts).
- Ralph drives a sportscar.
- Ralph is human.
- Ralph drives Boaty_McBoatface
- Boaty_McBoatface is a vehicle that moves on water.
For 18 to 24, express these more complex statements using possibly multiple expressions. You should try to use the concepts and roles from Part 1 if you can, otherwise add new ones as needed (e.g., for “broken”).
18. Cars can have between three and four wheels.
19. Bicycles always have just two wheels.
20. A human who legally drives a car has a license and is an adult.
21. A vehicle is driven by exactly one human.
22. A car with a broken part is broken.
23. Ralph drives a sportscar with a wheel that has a broken hub.
24. Boaty_McBoatface is not broken.
For the logic programming in your Homework, you can use any free version of prolog. SWI is probably the easiest to use. The more complex versions are good for larger projects because often they can be compiled, linked to webpages, or include more powerful constraint solvers built-in. You may also find the documentation helpful.
Some useful resources::