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. 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. Compare and contrast the representational power they provide with that of propositional logic.
Logical implementations generally distinguish the basic operations
of TELL
and ASK
.
Does Prolog support this distinction? If
so, how; if not, why not?
Save your program in lab_1.pl
.
Prolog does its inferencing using backtracking and unification. This exercise references LPN! Chapter 2.
Read LPN! Chapter 2 and do the following exercises:
Does inference in propositional logic use unification? Why or why not?
Does Prolog inferencing use resolution? Why or why not?
Save your program in lab_2.pl
.
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.
Save your program in lab_3.pl
.
This serves as a warning that even logic can go tragically wrong.
We will grade your work according to the following criteria:
See the policies page for lab due-dates and times.