“Scooping the Loop Snooper”

Given a particular input, will a computer program eventually finish running, or will it continue forever?

That sounds straightforward, but in 1936 Alan Turing showed that it’s undecidable: It’s impossible to devise a general algorithm that can answer this question for every possible program and input.

The most charming proof of this was published in 2000 by University of Edinburgh linguist Geoffrey Pullum — he did it in the style of Dr. Seuss:

No program can say what another will do.
Now, I won’t just assert that, I’ll prove it to you:
I will prove that although you might work til you drop,
You can’t predict whether a program will stop.

Imagine we have a procedure called P
That will snoop in the source code of programs to see
There aren’t infinite loops that go round and around;
And P prints the word “Fine!” if no looping is found.

You feed in your code, and the input it needs,
And then P takes them both and it studies and reads
And computes whether things will all end as they should
(As opposed to going loopy the way that they could).

Well, the truth is that P cannot possibly be,
Because if you wrote it and gave it to me,
I could use it to set up a logical bind
That would shatter your reason and scramble your mind.

Here’s the trick I would use — and it’s simple to do.
I’d define a procedure — we’ll name the thing Q —
That would take any program and call P (of course!)
To tell if it looped, by reading the source;

And if so, Q would simply print “Loop!” and then stop;
But if no, Q would go right back to the top,
And start off again, looping endlessly back,
Til the universe dies and is frozen and black.

And this program called Q wouldn’t stay on the shelf;
I would run it, and (fiendishly) feed it itself.
What behaviour results when I do this with Q?
When it reads its own source, just what will it do?

If P warns of loops, Q will print “Loop!” and quit;
Yet P is supposed to speak truly of it.
So if Q’s going to quit, then P should say, “Fine!” —
Which will make Q go back to its very first line!

No matter what P would have done, Q will scoop it:
Q uses P’s output to make P look stupid.
If P gets things right then it lies in its tooth;
And if it speaks falsely, it’s telling the truth!

I’ve created a paradox, neat as can be —
And simply by using your putative P.
When you assumed P you stepped into a snare;
Your assumptions have led you right into my lair.

So, how to escape from this logical mess?
I don’t have to tell you; I’m sure you can guess.
By reductio, there cannot possibly be
A procedure that acts like the mythical P.

You can never discover mechanical means
For predicting the acts of computing machines.
It’s something that cannot be done. So we users
Must find our own bugs; our computers are losers!

Pullum, Geoffrey K. (2000) “Scooping the loop snooper: An elementary proof of the undecidability of the halting problem.” Mathematics Magazine 73.4 (October 2000), 319-320.

(Thanks, Pål.)

Misc

  • There’s no “u” in solipsism.
  • Wagner said the saxophone “sounds like the word Reckankreuzungsklankewerkzeuge.”
  • FDR was related by blood or marriage to 11 other presidents.
  • 3909511 = 53 + 59 + 50 + 59 + 55 + 51 + 51
  • “If you can’t stand the heat, stay out of the chicken.” — Ted Giannoulas, San Diego Chicken

(Thanks, Eric.)

Figurehead

http://commons.wikimedia.org/wiki/File:Albert_Robida.jpg

French science fiction writer Albert Robida has been lost in the shadow of Jules Verne, but in the 1880s he was widely popular for a trilogy of illustrated novels imagining life in the 20th century. He predicted social upheavals around the time of our two world wars and foresaw transatlantic air travel, home shopping, video telephones, and a feminist revolution. But his greatest innovation was one we haven’t reached yet — a president made of wood:

And he is really well made. See the hand that’s holding the pen? It is secured in position. You can try pushing and pulling it all you want, it won’t budge! There is a secret lock. Absolute security! The mechanism is extremely complex; there are three locks and three keys. The prime minister has one, the president of the chamber has another one, and the president of the senate has the third. A minimum of two keys is requested to activate the mechanism. In case of conflict between the prime minister and the president of the chamber, the president of the senate is summoned with his key. He stands with one side or the other and introduces his key into one of the locks. The mechanism is activated, and the automatic president signs away!

“He shall reign, but not govern,” explains a citizen. “The power will remain in the hands of the nation’s representatives. … The monarchists’ main objection to democracy has always been its inherent instability. With this wooden president, democracy equals stability!”

Unquote

http://commons.wikimedia.org/wiki/File:ChelmonskiJozef.1900.Bociany.jpg

“Civilization is a stream with banks. The stream is sometimes filled with blood from people killing, stealing, shouting and doing the things historians usually record, while on the banks, unnoticed, people build homes, make love, raise children, sing songs, write poetry and even whittle statues. The story of civilization is the story of what happened on the banks. Historians are pessimists because they ignore the banks for the river.” — Will Durant, Life, Oct. 18, 1963

A Dedicated Theme

http://216.129.110.22/files/imglnks/usimg/2/25/IMSLP80679-PMLP54627-Cornelius_Trauer_und_Trost_Op3.pdf

Written by German composer Peter Cornelius in 1854, “Ein Ton” has a single note for a melody — the note B is repeated 80 times in 42 bars.

I hear a tone so wondrous sweet
In heart and spirit of repeat.
Is it that breath that from thee fled,
The last faint breath e’er thou wert dead?

Nicolas Slonimsky writes, “Of course, there are constant modulations so that harmonic changes make up for monotony.”

Fields of Gold

fields of gold puzzle

Which of the yellow areas is larger?

Click for Answer

Hoofbeats

http://commons.wikimedia.org/wiki/File:A_Cart-horse_by_James_Ward_watercolour.jpg

On Feb. 29, 1868, London’s Langham Hotel sponsored a “horseflesh dinner” to see whether the popular prejudice against the eating of horses might be overcome in English society. About 150 influential Londoners dined on “saucissons de cheval,” “aloyau de de cheval farci,” and “gelée de pied de cheval au Marasquin.”

“Men looked at each other curiously while eating, and each course ran the gauntlet of puns and satire,” reported Charles Dickens’ All the Year Round.

But the consensus was negative. “There are, no doubt, numerous proofs that the flesh of the horse is, at any rate, a wholesome food, and indeed there seems no reason why it should not be,” opined the Medical Times and Gazette. “The dishes we tasted … were all palatable. … [But] horseflesh leaves a pungency on the palate that is not agreeable — a pungency that reminds one of what one has been eating for some time after the meal is over.”

“I came back from it a wiser and a sadder man,” reported zoologist Francis Trevelyan Buckland. “In my opinion, hippophagy has not the slightest chance of success in this country; for, firstly, it has to fight against prejudice, and, secondly, the meat is not good.”

Also: “During the dinner, photographs of the horses which we were eating were handed round, and the appearance of one of these was, I think, the turning point of the argument.”

United Nations

I don’t know who first observed this — the design of Norway’s flag contains those of six other countries:

norway flag

The similarities are apparently accidental — designer Fredrik Meltzer had chosen the Nordic cross to reflect his nation’s ties with Denmark and Sweden and the tricolor to evoke the liberal ideals of France, the Netherlands, the United Kingdom, and the United States.

(Thanks, Nic.)

“Music and Baldness”

An English statistician has recently been engaged in an original task, that of studying the influence of music on the hair. … While stringed instruments prevent and check the falling out of the hair, brass instruments have the most injurious effects upon it. The piano and the violin, especially the piano, have an undoubted preserving influence. The violoncello, the harp, and the double bass participate in the hair-preserving qualities of the piano. But the hautboy, the clarinet, and the Mute have only a very feeble effect. Their action is not more than a fiftieth part as strong. On the contrary, the brass instruments have results that are deplorable.

Scientific American, Aug. 29, 1896

(Summarizing the same study, the Boston Medical and Surgical Journal reported that “brass instruments have a fatal influence on the growth of the hair, notably the cornet, the French horn, and the trombone, which apparently will depilate a player’s scalp in less than five years. … The baldness which prevails among members of regimental bands has been given the name of ‘trumpet baldness,’ calvitié des fanfares.”)