LOGIC4FUN

Login ∨ Register

Return To The RailwayMore Advanced Topics

We are now in position to reconsider the puzzle with which these notes began: the Philosophical Railway. This one is quite tricky for human solvers, but easy for computers because it amounts only to permuting the five jobs and assigning them to the philosophers until the constraints all come out true.

Philosophical Railway

It happened, in the days when trains used to call at the tiny village of Much Tittering in the Woods, that the 1215 once pulled up there and stood for the best part of an hour. Nobody now remembers why. At any rate, the driver, the porter, the signalman, the stationmaster and the guard spent the time in such merry conversation as is customary among employees of railway companies. Their names, in alphabetical order, were James, Kant, Locke, Mill and Nietzsche. For reasons lost in the mists of railway history, they agreed to make two statements each, one true and the other false. They said:

MILL: Nietzsche is the stationmaster.
James is either the guard or the porter.
LOCKE: Neither Kant nor Nietzsche is the signalman.
Mill is not the stationmaster.
KANT: Mill’s second statement was false.
Locke’s first statement was true.
NIETZSCHE: Either James is the porter or I am.
Neither Locke nor Mill is the guard.
JAMES: I am not the signalman.
Nietzsche’s second statement was false.

What was the driver’s name?

Take a look at my suggested formalisation of this problem on the SOLVER at the side of the page. You will see that I have opted for two sorts: philosophers and occupations. That means “job” is a function from philosophers to occupations, which is a little contrived as vocabulary goes, but which suffices.

The binary relation, “is_a”, is theoretically redundant, but makes the constraints read a bit more smoothly. It is the relation corresponding to the function “job”, as the second constraint says. The advantage of having the function as well as the relation is that it is easily stipulated to be injective (all_different), thus avoiding some clumsy constraints. The puzzle actually asks only for the driver’s name, so I have also added a constant “The_driver” which is the only thing to be printed out.

Now the main point of this puzzle is that one of each pair of statements is true and the other is false. The neat way to express this is to say that their truth values are different. We use the two functions “First” and “Second” to pick out the truth values of each philosopher’s first and second statement respectively. Hence the third constraint is exactly what we need to say that for each philosopher, x, the two statements made by x have opposite values.

The rest of the constraints are transcriptions of the statements. Some, like the one defining First(Mill), are obvious. Others need a little thought. Consider this constraint, for instance:

First(Locke) = NOT(Kant is_a signalman OR Nietzsche is_a signalman).

Locke’s first statement was “Neither Kant nor Nietzsche is the signalman.” This is the negation of “Either Kant or Nietzsche is the signalman” and so can easily be expressed using NOT and OR.

Kant’s statements are about the statements of other philosophers (this is true to life, in which most statements of philosophers are about statements of other philosophers). They have been written in the forms:

First(Kant) = (Second(Mill) = FALSE).

Second(Kant) = (First(Locke) = TRUE).

Equivalently they could have been expressed:

NOT(First(Kant) = Second(Mill)).

Second(Kant) = First(Locke).

Make sure you understand why. Then you’re on your way to mastering the logic of “=” relations.

Solver

Insert a logical symbol:
  
Powered by:                 

  Auto Parser Results

No errors found.