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.
另存为ships.in
使用以下命令运行它:mace4 -c -f ships.in | interpformat