CS 250 - Programming Languages          Assignment 5 - Logic Programming

Due 5:00pm April 12, 2004

These questions relate to readings in Chapter 9 of your text. 
  1. Answer questions 9.1, 9.2, and 9.3 on page 284.
  2. Read the on-line tutorial for Prolog and use Prolog in the Linux lab to help answer the following questions.
  3. Answer questions 9.5, 9.7, 9.10, 9.11, 9.12, 9.15, 9.22, 9.30, and 9.31 on page 285.  (The programs for all examples in this chapter can be copied from the directory /home/allen/cs250/pl/logic in the Linux lab.)
  4. The following problems are more difficult, so you should solve only one of them in Prolog.  Extra credit will be given if you crack two or more problems!
  5. a.  Question 9.26
    b.  Question 9.29

    c.  Mr and Mrs Astor, Mr and Mrs Blake, Mr and Mrs Crane, and Mr and Mrs Davis were seated around a circular table. Mrs Astor was insulted by Mr Blake, who sat next to her on her left. Mr Blake was insulted by Mrs Crane, who sat opposite him across the center of the table. Mrs Crane was insulted by the hostess, who was the only person to sit next to each one of a married couple. The hostess was insulted by the only person to sit next to each one of two men. Who insulted the hostess?
     
    d.  Tom, Elliott, Bill, and Vic had to cross a river using a canoe that held only two persons. In each of three crossings from the left to the right bank, the canoe had two persons, and in each of the two crossings from the right to the left bank, the canoe had one person. Tom was unable to paddle when someone else was in the canoe with him. Elliott was unable to paddle when anyone else but Bill was in the canoe with him. Each person paddled for at least one crossing. Who paddled twice?

    e.  Four people were playing a tennis game, Winifred, her father, her husband, and her daughter.  One of these people gave the following information about the opening game of the first set:  "I was directly across the net from the server's daughter.  My partner was directly across the net from the receiver's father.  The server was diagonally across the net from the receiver (of course)."  Who was the speaker?