Skip to main content
Reading Time: 9 minutes

Updating The Infinite Monkey Theorem

Million Monkey Theorem
The Million Monkey Thereom

There is an old saying that if you got a million monkeys to randomly punch the keys on a typewriter long enough, you would eventually produce all of the works of Shakespeare. In philosophy this thought experiment is known as the Infinite Monkey Theorem. There is an implicit assumption, which is that the monkeys will truly hit the keys randomly and not, for example, be attracted to a specific shiny key or start throwing feces at it.

The thought experiment assumes that the monkeys will dutifully type away for nearly all eternity and because, given a near infinite length of time, almost any random event will happen – not matter how improbable – then it is assumed that they will actually produce coherent output no matter how incoherent the input. This is an interesting philosophical inquiry that has an application to many deep philosophical questions. For example, does the apparent order of things suggest a designer or is it random? Are the patterns that we see in chaos, such as strange attractors, merely the random output of metaphysical monkeys, or do they arise from a deeper pattern, a signal within the noise?

Don't Use a Type Writer for the Infinite Monkey THeorem
Don’t Use a Type Writer

Updating the Million Monkey Theorem

Those are all great questions. However it occurs to me that the thought experiment is outdated and too restricted. After all, who uses type writers any more? And we all know that even the fastest monkey typist could generate only the equivalent of about 120 words a minute. At that rate, it would take eternity to produce Shakespeare by pure chance, and by then all the people capable of understanding it would have forgotten how to speak English or perhaps by then even the human race would have become extinct. Perhaps even now monkeys are generating the lost works of an Atlantean poet, but because no one speaks Atlantean any more we do not recognize the masterpiece for what it is.

The fact is that we do not have to wait for a million monkeys or use type writers. We can test this theory by speeding up the process. For example, we can get a computer or even a million computers to generate random text at a much faster rate and a higher volume so that the sought after random event may happen a lot faster. We could also tweak the odds a bit. For example, the original example assumes that every character typed is random. This way it is a minor stroke of luck to get even one coherent sentence or correctly spelled word, let alone a full length book. We could still have randomness, but more productive randomness, by having our hypothetical moneky/computer churn out words found in the English dictionary. Their arrangement and the length of a sentence would still be govern by chance, but having the individual units of output be already meaningful dramatically increases the odds of producing a reasonable copy of Shakespeare.

An Infinite Library

The Argentine fantasy writer, Jorge Luis Borges, wrote a short story entitled the Library of Babel that posited the idea of an infinite library whose books contain all real and fictitious books, all real facts and wrong facts. In this Library there would be books that say that Columbus discovered the New World in 1999 and also that the Aztecs discovered and conquered Europe in 1492. All the myriad possibilities in between, together with what we recognize as reality and history, would also exist contemporaneously in such a library.

Borges envisioned an actual physical library housing an infinite number of books, each with an infinite number of pages. Of course, physical limitations make such a creation impossible. But is a digital alternative possible?

One ingenious website called the Library of Babel has actually attempted this impossible task, creating a library with every permutation of the English alphabet. The resulting near infinite mass of text contains every work of fiction and nonfiction ever written, every invention that will ever be discovered, future histories of the real future and of timelines that will never be.

Borges Infinite Library

According to their about page says:

The Library of Babel is a place for scholars to do research, for artists and writers to seek inspiration, for anyone with curiosity or a sense of humor to reflect on the weirdness of existence – in short, it’s just like any other library. If completed, it would contain every possible combination of 1,312,000 characters, including lower case letters, space, comma, and period. Thus, it would contain every book that ever has been written, and every book that ever could be – including every play, every song, every scientific paper, every legal decision, every constitution, every piece of scripture, and so on. At present it contains all possible pages of 3200 characters, about 104677 books.

Since I imagine the question will present itself in some visitors’ minds (a certain amount of distrust of the virtual is inevitable) I’ll head off any doubts: any text you find in any location of the library will be in the same place in perpetuity. We do not simply generate and store books as they are requested – in fact, the storage demands would make that impossible. Every possible permutation of letters is accessible at this very moment in one of the library’s books, only awaiting its discovery. We encourage those who find strange concatenations among the variations of letters to write about their discoveries in the forum, so future generations may benefit from their research.

You can test their system by looking up anything you want. For example, you can search your own name. You will find it. And sometimes you will find it in context, little snippets of the life you may lead or may never have. It is all infinite, all possible.

The site raises interesting questions about copyright. For example, if the Library of Babel does really contain every permutation of the English alphabet then this article, and everything that has ever been or ever will be written, already exists inside its database waiting to be discovered. Nothing you or I write can ever be original. Fortunately it is unlikely anyone will be able to steal your unfinished novel simply by copying text from the Library of Babel.

The Problem With Infinite Writing

The problem with the Library of Babel and any system relying on the random output of monkeys is that the output is so big that you cannot parse it. The flaw in the Million Monkeys theorem is that it would require an even larger number of humans an infinite amount of time to read the output and separate the meaningful output from the random gibberish. Similarly, the problem with the Library of Babel project is that you usually never find anything interesting. Noise drowns out meaningful chance output.

So I wondered if there was a way to modify the Million Monkeys theorem to achieve more meaningful output. Perhaps this is cheating, but neural networks offer a solution to making the idea into a practical reality. Neural networks are not the same thing as artificial intelligence, but they are able to link concepts together.

What if a neural network was given the task of producing random text, though with some grammatical rules or even topics to focus its output. While still essentially random, it would be more likely to produce something worth reading.

As a wacky experiment I asked a neural network to write about A Million Monkeys. Interestingly, without any prompting it “understood” I wanted it to talk about the Million Monkey Theorem and not, for example, the number of monkey attacks in New Delhi. It produced an eerily on point script in the form of a conversation on the subject, which then veered off into a weird yet oddly related discussion about Canadian stamps.

The pseudo-random text is reproduced on the next page.

Pages: 1 2