In this lab, we'll work with Prolog, a logic-based programming language that has been influential in artificial intelligence and in other areas. We’ll use SWI Prolog.
Prolog supports the representation of basic facts and rules, an responds to queries on those facts and rules. Learn Prolog Now! (LPN!) provides a nice introduction to the language.
Read LPN! Chapter 1 and do the following exercises:
Consider the well-known modus ponens (see Section 7.5.1 and your lecture notes). Does Prolog implement a version of modus ponens in propositional logic form? If so, demonstrate how it’s done; if not, explain why not. If it doesn’t, can you implement one? Why or why not?
Prolog supports representations in the form of Horn clauses (see Section 7.5.3). Compare and contrast the representational power they provide with that of propositional logic.
The text distinguishes the basic operations of
TELL
and
ASK
(see Section 7.1). Does Prolog support this distinction? If so,
how; if not, why not?
Prolog does its inferencing using backtracking and unification. This exercise references LPN! Chapter 2.
Read LPN! Chapter 2 and do the following exercises:
This chapter discusses unification. Does inference in propositional logic use unification? Why or why not?
The text discussed the use of resolution for theorem proving in propositional logic. Does Prolog inferencing use resolution? Why or why not?
The following exercise is based on the well-known “Burn
the Witch” sketch from
Monty Python’s The Holy Grail (see, also, the
sketch’s full script
).
Create a Prolog program that implements the ridiculous inferences used by Sir Bedevere (Terry Jones) to justify the burning of the witch (Connie Booth) in Monte Python's Holy Grail. Load your rules and demonstrate that the woman is indeed a witch.
This serves as a warning that even logic can go tragically wrong.
Submit the files specified above in Moodle under lab 11.