0

I need to model the folowing puzzle in Prover9

There are 5 ships in a port:

  1. The Greek ship leaves at six and carries coffee.
  2. The Ship in the middle has a black chimney.
  3. The English ship leaves at nine.
  4. The French ship with blue chimney is to the left of a ship that carries coffee.
  5. To the right of the ship carrying cocoa is a ship going to Marseille.
  6. The Brazilian ship is heading for Manila.
  7. Next to the ship carrying rice is a ship with a green chimney.
  8. A ship going to Genoa leaves at five.
  9. The Spanish ship leaves at seven and is to the right of the ship going to Marseille.
  10. The ship with a red chimney goes to Hamburg.
  11. Next to the ship leaving at seven is a ship with a white chimney.
  12. The ship on the border carries corn.
  13. The ship with a black chimney leaves at eight.
  14. The ship carrying corn is anchored next to the ship carrying rice.
  15. The ship to Hamburg leaves at six.

Which ship goes to Port Said? Which ship carries tea?

As far as I've seen prover9 accepts first order logic clauses. But I'm really not got at converting natural language to fol. Could someone tell me how to model this in first order logic please, maybe show me how to convert the first statement?

false
  • 10,264
  • 13
  • 101
  • 209
Sami0806
  • 41
  • 4
  • Is Port Said a port? Where is the existence of Port Said implied in any of the 15 statements? Do we know that any ship carries tea? I mean... is there more information here... something like "there are 5 ships, one carries tea, one corn, one rice, one coffee, and one cocoa"? Do we have 5 ships leaving at 5 different times, and 5 ships with 5 different chimney colors, going to 5 different ports? Do we know the names of all 5 ports? – Doug Spoonwood Jan 19 '15 at 18:19
  • that's the nature of such quests ... for three entities (flag, color of chimney, departure time) the 15 statements give five values, but only four for destination and freight. These missing values are given in the final question ... (you could write the final question as 16. One ship carries tea, one ship goes to Port Said) ... but the statements are enough to leave just two holes in the matrix of ships. – MikeD Jan 19 '15 at 19:04

2 Answers2

0

I feel like this isn't a complete statement of the problem.

That said, I believe that this problem is similar to one that Larry Wos poses and then presents a solution for in OTTER here. OTTER and Prover9 do have some differences, but have many similarities also, so that might be helpful, along with checking the manual for Prover9.

Doug Spoonwood
  • 236
  • 1
  • 11
0
set(arithmetic).  % For the "right neighbor", "left neighbour"... relations.
assign(domain_size, 5).  % The five ships are {0, 1, 2, 3, 4}.

list(distinct).      % Objects in each list are distinct.
   [Greek, English, French, Brazilian, Spanish].        % nationalities are distinct
   [Black, Blue, Green, Red, White].          % exteriors are distinct
   [Nine, Five, Seven, Eight, Six].        % leaves at distinct hour
   [Hamburg, Genoa, Marseille, Manila, Port_Said].   % destination is distinct
   [Tea, Coffee, Cocoa, Rice, Corn].  % cargo is distinct
end_of_list.

formulas(assumptions). 
   % Definitions of "right_neighbor"...
   right_neighbor(x, y) <-> x < y.
   left_neighbor(x, y) <-> x > y.
   middle(x) <-> x = 2.
   border(x) <-> x = 0 | x = 4.
   neighbors(x, y) <-> right_neighbor(x, y) | left_neighbor(x, y). 

    Greek = Six.
    Greek = Coffee.
    middle(Black).  
    English = Nine.
    French = Blue.
    left_neighbor(Coffee, French).
    right_neighbor(Cocoa, Marseille).
    Brazilian = Manila.
    neighbors(Rice, Green).
    Genoa = Five.
    Spanish = Seven.
    right_neighbor(Marseille, Spanish).
    Hamburg = Red.
    neighbors(Seven, White).
    border(Corn).
    Black = Eight.
    neighbors(Corn, Rice).
    Hamburg = Six.

end_of_list.

Save it as ships.in

Run it with this command : mace4 -c -f ships.in | interpformat