Prolog is … a tool for thinking. — D.H.D. Warren, Foreward to The Art of Prolog, 1986

This week, we continue our work with Prolog using Learn Prolog Now! and SWI Prolog.

More Prolog

As one would imagine, Prolog supports recursion, lists and arithmetic.

Exercise 13.1

Do the following exercises.

  1. Do these exercises from LPN!.
    1. Exercise 3.2
    2. Exercise 4.5
  2. Does Prolog implement a version of generalized modus ponens (i.e., modus ponens with variables and instatiation)? If so, demonstrate how it’s done; if not, explain why not. If it doesn’t, can you implement one? Why or why not?

Be sure that you can explain how you built your system and how Prolog does recursion.

Save your program in lab_1.pl.

More Logic

Here’s one last logic proof, to be done on paper rather than in Prolog.

Exercise 13.2

Do the following exercises.

  1. Consider the following situation in the blocks world:

    block A on block B
		on table

    Given the (separate) facts that:

    • A is on B
    • B is on C
    • The table supports C
    • For any two entities, if the first entity supports the second, then the second is on the first.
    • For any two entities, if the first entity is on the second, then the first is “above” the second.
    • For any three entities, if the first entity is above the second which is above the third, then the first is above the third.

    Write these facts in FOL and use resolution/unification to prove that A is above the table.

    Save your proof in lab_2.txt or as an image of a hand-written solution.

Checking in

We will grade your work according to the following criteria:

See the policies page for lab due-dates and times.