Categories
Intelligent Design

Finding Dawkins’ Weasels

weaselBack in the days of the Apple II, biologist Richard Dawkins wrote a small Basic program, called Weasel,  that demonstrated how the random mutation and selection in evolution could generate information.  The program used “critters” whose DNA were strings of characters.   The program is “dirt simple” but succeeds in achieving its goal after only fifty cycles of generations.  The goal is for the random mutation and selection process to end up with the given target string.  Dawkin’s choice of strings was a line from Hamlet, “Methinks it is like a weasel.” I wrote a version in Typescript so I could embed it in a blog article.

In the following demonstration, simply hit Reset and then Run and watch the program converge on the target string.   (Sorry, it only works in recent versions of Chrome.  I will update it when I fix the IE and Edge problems).

Dawkins’ Weasels

%CODE1%

Some Intelligent Design proponents criticized the value of Dawkins’ Weasel program on a number of points that were readily answered by Dawkins and others.  However, one such criticism is worth discussion and that is that the program itself already contains the information that is supposedly created by the process.  Although the program is carefully written so that the random mutation process does not have access to that information (only the selection process does), the drama of the program is somewhat undermined for those who don’t appreciate the significance of that.

Recently, I set out to write a new Weasel program that generates what the ID community would call Complex Specified Information (which they insist is a signature of something produced by an intelligence) where the information is not present in the program itself. I call the program Steiner Weasels, because the program ends up generating Steiner Trees between a set of given points using generations of weasels that are randomly mutated and selected based on criteria that is much simpler than a Steiner Tree.

In the following demonstration, hit Reset, then Run and watch the weasels create Steiner Trees whose specification is not contained in the program.  Let it run for about 150 generations.  Reset and Run it a few times to see how it deals with different layouts. Also, feel free to hit Earthquake a few times while it is running to see how it scrambles to adapt to new layouts.

Steiner Weasels

%CODE2%

If you would like to know more about Steiner Weasels, I invite you to read an in depth explanation in Shakespeare, Evolution, and Weasels.

Categories
Intelligent Design

Shakespeare, Evolution, and Weasels

Note: This article contains a number of interactive demonstrations which only work in the later versions of Chrome.   They do not yet work in Internet Explorer or Edge.

Monkeys With Typewriters

How long would it take for an infinite number of monkeys banging on typewriters to come up with the complete works of Shakespeare? Most of us would probably answer with “never”and dismiss the question as one of those rhetorical questions that interest people with too much time on their hands. But suppose we lower the bar somewhat and ask the same question about a single monkey and a single line from a Shakespeare play.

So let’s start over and ask how long it would take for a roomful of  monkeys to come up with the line, “Methinks it is like a weasel.” (Hamlet: Act 3, Scene 2)? This seems more manageable, and perhaps more interesting, because we can almost imagine the possibility that monkeys pounding away on typewriters might manage to come up with a particular line of Shakespeare that has only 27 characters (including spaces and punctuation).  It turns out that if you gave a monkey a typewriter and he managed to stay focused long enough to randomly hit 27 keys, the chances of him producing the weasel passage is 1 in 10^53 (1 followed by 53 zeros).   It seems as if a monkey would not live long enough to accomplish this.

But what is so special about that particular line of Shakespeare? Is the monkey less likely to produce that line than any other string of 27 characters.  The answer is no, not really.  Choose any string of 27 characters, such as “uvm(%%$ejis &^ mcn..?/[!}”, and the chances are the same 1 in 10^53 that the monkey will produce that particular string.  So mathematically, there is nothing special about the weasel passage or any other 27 character string.

Shakespeare from Space

awesome vlaIntelligent Design proponent William Dembski offers a different approach to this.  He asks us how we would react if we received a signal from deep space that had a phrase like, “Methinks it is like a weasel.”, compared to how we would react if we got some random 27 elements of gibberish.  In the first case we would be astounded, whereas in the second case we would not be surprised at all.   His point is that although either string has the same mathematical probability, the weasel passage is recognizable by a criteria that stands outside of the mathematics.  It is not only a specific string, but it is specific to human English language.  It is not only specific but it has a “specification”, which in this case would be “a line of Shakespeare.”  His opinion is that an unlikely sequence or arrangement of things that can be described by a brief external specification is one sign that the sequence or arrangement is unlikely to arise out of natural random processes or natural laws of nature (repeatedly) , and must be signs of intelligent origin.

Dembski’s Complex Specified Information

A line of Shakespeare, a line of English text of any sort, the carving of a human face, or a sequence of the first 50 prime numbers, are all examples of sequences or arrangements that have an easily identifiable specification. Dembski adds that when a sequence or arrangement of things is both highly complex and readily “specified” as we have just seen, the chances of it occurring without the benefit of guidance by an intelligence is vanishingly small.  For example, the complete works of Shakespeare is far more complex (has more integrated moving parts to it) than the one weasel passage, and it can be readily specified as “the works of Shakespeare.”  Dembski has defined this combination of complexity and specification as Complex Specified Information, or CSI.  If the monkeys produced the works of Shakespeare or we received the works of Shakespeare in a signal from deep space, he says we would have to conclude that there was some from of intelligent guidance involved somewhere.  According to Dembski, a high degree of CSI is a “signature” of the involvement of an intelligent agent.

CSI in DNA

Dembski then turns our attention to living creatures and shines his CSI flashlight on the information that we find in the gene sequences of DNA. Genes consist of specific arrangements of four types of amino acids that specify the structure of a specific proteins that the cell should produce for a specific functions. Dembski says that gene sequences are both complex and specified to such a large degree that their arrangements could not have come about through any natural processes. He insists that an intelligence must have guided the formation of the information in DNA.

He asks how a process like evolution that uses chance mutations that is as random as monkeys with typewriters could produce such complex information that specifies something as nuanced and functional as the human eye, for example. The usual answer from biology is  natural selection.  But for some that answer is not very satisfying since all it does is eliminate information. If natural selection is the “survival of the fittest”, how can a random process bring about the “arrival of the fittest”?  Or using the monkeys analogy, how could simply selecting out and discarding the pages that are not scenes from Shakespeare ever help the monkeys produce anything but gibberish?

Dawkins’ Weasels and CSI

weaselWay back in the days of the Apple II, evolutionary biologist Richard Dawkins wrote a simple computer program to demonstrate how random mutation and natural selection (RM + NS) could produce complex specified information.  His program is often called the Weasel Program because the goal of the program was to use random mutation and selection to generate the line from Hamlet, “Methinks it looks like a weasel.”  WEASEL works as follows:

 

  1. Generate a string of random characters and call it the Parent String.
  2. Make 1000 copies of the Parent String and call them the Children Strings.
  3. Go through each of the child strings one by one and make a small number of random mutations.  The mutations happen at random places in the string.  They can add or substitute a character for another randomly chosen character.  Or they can simply delete a character.
  4. Compare each child string to the target string, “Methinks it is like a weasel.”
  5. Select the child string whose mutations have brought it closer to being like the target string.
  6. Declare the selected child string to be the new Parent String.
  7. Repeat steps  2 through 7 using the new Parent String.

 

The important things to keep in mind is that the mutations that occur in step 3 happen randomly with no foresight about the target string about weasels.  After that step is complete, each child string is still very much like its Parent String, but each has a few of its own particular random variations. The selection process for choosing the “fittest” child string happens without knowing how the child strings were produced.  It simply selects from what it is given by comparing them with the target.

Since you have had the persistence to get this far, your reward is a demonstration of Dawkins Weasels right here in your very own browser. In the demo window below, you may enter a target string of your own or leave it as it is.  Press Reset, then press Run.  The program will cycle through a number of generations to evolve the initial random string into the target string (each generation is numbered to the right of its fittest string.)  When it has found its weasel, you can hit the Stop button or let it run for a while to see what happens (nothing happens).

Scenario 1: Dawkins’ Weasels

%CODE1%

Notice that for a string about the size of the weasel passage it achieves its goal in somewhere between 30 and 60 generations. Pretty good for such a simpleminded process. But how did it get to its goal so fast when we already established that no amount of monkeys could do the same thing in their lifetime? Does the weasel program cheat? The answer is yes, but it “cheats” in the way that evolution cheats.  The secret is that there is a step in the weasel scenario that is not in the monkey scenario.  That would be step 6, where each “best” child becomes the parent of the next generation, allowing the next generation to start with a better string than the last one.  That way, the string for each new parent rachets towards the goal with small but relentless steps.

Weasels Cheat at Poker

weasels_with_flowers_background_card_decks-rc9c83bc88aa04d21864f6d98d27729cb_zaeo3_324In biology, this is called Inheritance.   It cheats like you would be cheating if you kept the best cards in your pretty good poker hand for use in the next game, improving on the hand each game through discards and the random replacement cards from the top of the deck. In only a few games you could build yourself a Royal Flush.

WEASEL is dramatic in that such a mindlessly simple program running on an Apple II demonstrates that a random process followed by a selection process can generate CSI repeatedly.  However, Dawkins’ critics in the Intelligent Design movement raised a number of objections claiming that the program cheats in other ways that are not found the process proposed by the theory of evolution.  Most of the objections were inconsequential, but one is interesting enough to spend some time on since it gets to the heart of another question that Intelligent Design proponents ask, which is “How can a process unguided by intelligence produce information?”.

Are Dawkin’s Weasels Guided?

The complaint is that the WEASEL program has the actual target string built into it.  In other words, the information that the program is supposed to be generating through RM + NS, is already built into the program.  As such, it does not answer the question about how information can be generated by an “unguided” process such as evolution.  The first answer to this objection is that the program is carefully written so that the process that produces mutated children from the parent works in complete isolation from the process that evaluates each child in respect to the target string.  In other words there is an information barrier such that information only flows out of the genes of the children but never flowing in from the outside world.

Imagine two black boxes: a Copy Box and a Selector Box.  You place a weasel in the Copy Box, a bell rings, and you take out the 1000 children it has produced (all with slight random variations).  You place the 1000 children in the Selector Box which selects one child weasel and disposes of all the others.  You take out the selected child weasel and put it into the Copy Box.  Rinse and repeat.

The Copy Box doesn’t know or care what criteria  the Selector Box used to select the one child weasel because the important point is that there is no information about that criteria flowing from Selector Box to the Copy Box.  The child producing process in the Copy Box is not informed by any information from the outside world.  It simply waits for someone to give it a weasel and then proceeds to make 1000 copies of that weasel.  But since the Copy Box is not perfect, the copies are not exact replicas of the original weasel.  They have a small number of random variations in their weasel strings.  The process that produces the variations is no more guided than the bounces of a well made pair of dice thrown against a wall.

Introducing Steiner Weasels

So what happens if we model the same process with a computer program that does not have the target built into it?  Is that possible, and will it be able to produce CSI?  If CSI is defined as information that can be seen to have a separate specification, how can a simple computer program generate that kind of information if it does not already contain the specification?

Having got this far, please be entertained for a moment by running the next demo Scenario 1 below.  Hit Reset, then Run.   After it seems to have settled down, hit Stop and read the explanation below it.

Scenario #1: Weasels Find Some Food Sources

%CODE2%

The remaining scenarios all are various versions of a weasel program of my own called Steiner Weasels.  The back story is that Steiner Weasels s are very dumb weaselly creatures that move across a field in straight lines, stopping for a moment to eat stuff on the ground.  After eating, they then move in another straight line (often in another direction) for a while until the stop and eat again. The locations where they stop and eat are each determined by an individual gene in their DNA.  In Scenario #1, their DNA contains five genes. (In all the remaining scenarios, the thin lines are the “paths”, and the small solid dots at the end of the lines are where the Steiner Weasels s stop and eat.)

Steiner Weasels burn calories as they move along, in proportion to the length of their travel.  The longer they travel between eating stops, the more calories they burn.  Not surprisingly, Steiner Weasels  acquire calories when they stop and eat.  The field on which they are moving and eating has a number of different kinds of food sources.  At each stop they make, the Steiner Weasels can only get calories from a different kind of food source, so if it makes three stops, it has to eat a different food type at each stop.  (The food sources are denoted by the green circles).

Finally, each different kind of food comes from its own source on the field, but the food is dispersed somewhat by wind and so forth, so a Steiner Weasel can get some amount of food of the required type at each stop even if it is not close to the source. However, the closer a food stop is to a particular source, the more food it can eat of that type when it stops.  When the Steiner Weasels have traveled to all their stops, they try to reproduce, but only the Steiner Weasel with the most calories gets that privilege, with the rest of them dying off.   That means that the surviving SW is the one whose total calories (cals consumed – cals spent) is the one who gets to reproduce.  Like in Dawkins’ Weasel program, the surviving weasel produces thousands of children by replicating itself.   And also like Dawkins’ program, the replication is imperfect such that the children end up inheriting the parent’s genes, but with a small number or degree of mutations.

Its important to note here that the Steiner Weasels are not intelligent.  They make no decisions about where they stop and eat or how many stops they make.  Those things are completely determined by their genes.

In scenario #1, the mutations that occur in the genes of the children are small random variations in the location of where they stop to eat.  The scenario starts with a parent with three genes, each set to a random location.  A few thousand children are then replicated from the parent, and then each one is mutated randomly.  Then each child is examined for how many calories it spent and how many it acquired.  The one with the most calories left over is the one that is chosen to be the next parent, and the remaining ones are killed off. This cycle of generations happens over and over until you hit the stop button.

The location of the food sources on the field is chosen randomly when the Reset button is pressed and the parent weasel is established.  The weasel world starts (or resumes) its generation cycles when the Run button is pressed. Reset and Run it again and watch the food stops acquire food sources and slowly move towards them to get as close as possible. You might notice that some stops get closer to the source than others.  This is because the selection for most calories is somewhat of a tradeoff.  The closer to a food source the more calories acquired, but it also makes the path longer which increases the calories spent getting to the source.

The Earthquake Button.  I am guessing you already pressed it being the curious reader that you are.  The Earthquake button causes a random number of food sources, to shift in location by random amounts.  After the weasels have found their food source, while the world is still running, hit the Earthquake button a few times and watch the weasels adapt to their newly relocated sources.

Without further ado, Scenario #2 is the same as scenario #1, but a new mutation type has been added where new genes can be added or deleted randomly. Since each gene specifies the location of a food stop, the weasels evolve additional genes until there is one gene per food source so all of the sources can be covered.  Any children who evolve more genes than food sources will be less fit, because they will waste calories moving along paths to stops that do not produce any calories.

Run scenario #2 and watch it work until it settles down, then hit the Earthquake button a few times and watch the weasels evolve new food stops and match the new food source locations.

Scenario #2: Weasels Find All the Food Sources

%CODE2%

The astute reader might have realized that so far Steiner Weasels are not much better than Dawkins Weasels when it comes to a built-in target.  The astute reader would be correct.  Although the program generates food sources and places them in random locations, once that happens, the program has a fixed target to work with.  But have patience.  The first few scenarios are meant to introduce you to the back story of Steiner Weasels and how their world evaluates them for fitness.

In the previous scenarios, the SW children improved their fitness by evolving food stops that were closer to their food sources. But the paths that they take from one source to another looks to be wasteful in terms of calories.  If you recall from the description above, the DNA of a weasel contains a set of genes each of which contains the location of a food stop.  In addition to a food stops, genes also contains information about the paths that a weasel follows from stop to stop.  If you run any of the SW scenarios above, you can see that the paths for a tree-like structure, where a given stop might have one or more paths to other stops.

Here is where it starts to get interesting.  If we add another mutation type that switches a path from one randomly chosen stop to another randomly chosen stop, the total length of the route a weasel takes will get either longer or shorter as a consequence.  Since a shorter route means less calories expended, child weasels can become fitter by getting as close to their food stops as possible, but also traveling between the stops by the more efficient route.  Run Scenario #3 and watch how it finds all the food sources, and sorts out a very efficient route.  It won’t always find the absolute most efficient route unless you let it run for a very long time, but it is amazing how quickly it approaches that ideal.

Scenario #3: Weasels Optimize Their Routes to Food Sources

%CODE2%

Now for the $50,000 question.  Where does the information in the genes come from about the most efficient route? There is nowhere in the program where that information can be found.  Not only are the mutations of genetic information occurring randomly with no regard to how the results will be evaluated, but the selection process knows nothing about the possible routes, either.  It simply subtracts the calories spent from the calories gained and chooses the child with the highest remaining calories.

Consider that the number of possible tree routes that can be drawn between all the food sources is astronomically high.  There is the most efficient route, the least efficient route and every route in between.  Next, consider that for a purely random process, any given tree route between all the 15 food sources is equally likely, just like any combination of 15 letters from monkeys typing is equally likely.  But where the number of possibilities is so high, it is better to say that they are also all equally unlikely.  Like the monkeys producing a line of Shakespeare by pure chance is extremely unlikely, so is the weasels producing the most efficient route between points by pure chance extremely unlikely. (The answer is that the process of random variation and selection is not “pure” chance, but an elegantly simple ballet of chance and necessity.)

Furthermore, according to Dembski, what makes the line of Shakespeare special among all possible combination of letters is that it has a “specification”.  It can be specified as to its line number, scene, and act in a particular play, in a particular language, written by a particular author. Similarly, the most efficient route between the food sources also has a specification, which is the “minimal traversal tree” between a set of points.  In fact, the minimal traversal tree is extremely valuable information when it comes to shipping logistics because profitability in a shipping company is maximized by minimizing fuel costs and delivery time.

But wait, that’s not all.  One final scenario that raises the bar to another level. This one is almost spooky. In Scenario #4 below, one more mutation type has been added, where a newly created gene with a random stop is inserted between existing stops.  Run scenario #4 and let it settle down for a while then read the commentary that follows it.

Scenario #4: Weasels Find Shortcuts With Steiner Points

%CODE2%

Looking at the results of running Scenario #4, you might have noticed that there seems to be something broken about it. It looks like some stops are far from a food source and show no signs of getting closer. On closer inspection you might notice that there are no free food sources and these wayward stops are extra stops. There are more stops than food sources. (If you did not get any extra stops, hit Reset and Run again and let it settle down. Usually two out of three runs produce at least one of these mysterious stops.)

The scenario is not broken. If you look more carefully, you will see that the weasels found some shortcuts. Although there is no calorie value in the extra stops (because all the food types have been consumed by other food stops), the extra stops shorten the lengths of a few paths. These stops are called Steiner Points and the weasels have created a Steiner Tree out of an ordinary tree. They had no idea they were creating a Steiner Tree, but they managed to do so because the addition of the extra points lowered the calories spent in moving from one food source to another.

Its important to remember that in all the Steiner Weasel scenarios, the process that copies and mutates genes is completely isolated from any information about where the food sources are, or even how many calories are acquired and spent.  The process that evaluates and selects for the fittest weasel has no information about how the genes in the weasels are altered.  And yet after about 100 – 150 generations, the genes of the fittest weasel has values that put that weasel closest to each food source and following the most efficient route including a few shortcuts.

Where Does the Steiner Tree Information Come From?

Where does that information come from in the genes of that weasel?  Since the processes that alter the contents of the genes have no knowledge of where the food sources are, or of optimum paths, or of how to make shortcuts, one can say that the information is newly “created” in the genes.  That would be reasonable from the point of view of the gene itself because the genes are closed off from information coming in from the outside.  They can only mutate their own contents in random amounts.

But another way to look at it is that the genes are just a kind of storage medium for information, whereas the process itself (variation, selection, inheritance) is where all the action is.  One could say that the process “discovers” the information and stores it in the genes.  But that is not quite right, since the information about the optimum route between the food sources, or information about where to place shortcuts is not anywhere in the program or its environment.

Consider that if I gave you fifteen different random points on a graph, there is no place you could go to look up on the Internet or anywhere else what the optimum route is between them. There is no mathematical formula where you could just plug in the numbers and get the answer.  You would have to figure it out by trial and error using lots of intelligence with full knowledge of where the points are on the graph.  So it is difficult to say that the process discovers the right information, because the information is not hanging around to be discovered.

My answer is given that the only information that is available is the location of the points, the process discovers something that is a logical consequence of that information.

Whatever the answer is about where the information comes from, it is a mistake to look at only one part of the process.  It does not come from the pure chance of random mutation.  It does not come from selection.  And it does not come from inheritance.  It comes as a result of all three of those steps repeated over and over again.

Finally, can we say that this extremely simple process generates Complex Specified Information?  Yes we can.  It manages to generate something highly unlikely , which is a Steiner Tree between a set of points. The chances of getting a Steiner Tree by pure chance is vanishingly small whereas, this process generates them over and over again.  Is the information “complex”?  You could argue that with only fifteen points, the information is not very complex.  But except for computing resources the process can deal with any number of points.  I chose fifteen because it was enough points to be interesting, but not so many that it took forever to produce results.