Answer by Michal Forišek:

The Hydra game!

Imagine that you are Hercules and you were given the task to slay the Hydra. Here is one possible hydra:

Okay, so our hydra is a rooted tree. The root (black, at the bottom) is the body, and the leaves (blue) are its heads. Just like Hercules, you are going to cut off its heads, one at a time. But, just like with the mythical Hydra, each time you cut off one head, it may grow some more in other places. Here's the rule:

You can cut off a head that is connected directly to the root. In that case, nothing grows back. In all other cases, you grow new heads as follows:

  • Let x be the vertex where the head you just cut off was attached to the hydra.
  • Go down one edge from x, let y be the new vertex.
  • Grow two new copies of the entire subtree you just came from. (We will call this the growth rule.)

A picture is better than words, so here's what happens when you cut off one head of our hydra. Below, the head we decided to cut off is now dashed, and we show the vertices x and y:

And now we take the subtree we just came from (vertex x and two leaves) and we add two new copies of that subtree at y:

Okay, so we just cut off one head and got four new heads in return. Not good. Let's try that one more time, this time cutting off the second head from the bottom.

Oh crap, now we have 19 heads. Looks like this hydra will be pretty tough to kill. You can kill the head at the bottom to go down to 18, but then any next kill will increase the number of heads again.

At this moment your intuition probably tells you that killing a hydra is a hard job. Sure, some tiny hydras can be killed — if you have just a body and a few heads, you cut off the heads and that's it. But if you try killing any non-trivial hydra, after the first few cuts your situation will look like in our example.

Don't just take my word for it, try it yourself. Here's a Java applet where you can play the hydra game: The Hydra game. Go play. Restart the game a few times, and in each game click a few times to see how quickly the hydra grows. Then come back.

The applet was created by Andrej Bauer. It is free and open source, available under the BSD license. You can dowload it from his cool website on the Hydra game here:…

Now, it wouldn't be too surprising if I told you that you can always win the hydra game. Instead, I'll tell you something you certainly don't expect.

Here's the real kicker: You cannot ever lose the hydra game. You will always kill the hydra in finitely many turns, regardless of how large the hydra is, and in which order you kill the heads.

And it gets better. Let's make the game harder. See the word "two" in the growth rule? Let's change it to forty-seven. Even with 47 new copies of a subtree added in each turn, you still cannot lose the game.

Let's now change the growth rule as follows:

  • If this is turn N of the game, grow N new copies of the entire subtree you just came from.

That is, the longer you play, the faster the hydra grows.
Oops, but you still cannot lose the game. Regardless of how you play, the hydra is still guaranteed to die in finitely many steps.

Here's the most awesome version of the growth rule:

  • Pick any positive integer N. Go ahead, make it as large as you wish. You can even pick a different N each time, and make each choice greater than the previous one.
    Grow N new copies of the entire subtree you just came from.

Guess what? You still cannot lose. Each possible game still has to be finite. There is no way to make an infinite sequence of valid moves.

Here's a sketch of the proof: We can assign an ordinal to each possible hydra using a recursive formula: a single node gets the ordinal 0, and a node with children a_1 through a_k gets the ordinal \omega^{\alpha_1} + \cdots + \omega^{\alpha_k}, where \alpha_i is the ordinal assigned to the tree rooted at a_i. It can now be shown that every valid move decreases the ordinal assigned to the hydra. And as there is no infinite decreasing sequence of ordinals, every possible game must be finite.

If you just got lost and scared, here's a bit of intuition behind what's going on in the proof. We basically say that whenever something goes on K steps away from the root, it's infinitely times worse than anything that is going on K-1 steps away from the root. Now, whenever you kill a head, you very slightly simplified something that is K steps away. And even though you get a lot of new crap in return, all that crap is only K-1 steps away and hence the entire result is still simpler than it was before. (That's as good a description as I can give you in one paragraph.)

And to top it all off: You may now ask for a simpler proof. You won't get one. Proving that the hydra game is finite is hard. In particular, in 1982 Kirby and Paris proved the following theorem: "Any proof technique that proves that the hydra game is always finite must be strong enough to prove that Peano arithmetic is consistent."

View Answer on Quora