## Surreal Nimbers: No, that's not a typo!

(A substantial part of this post was rewritten since it was first posted. I managed to mangle things while editing, and the result was not particularly comprehensible: for example, in the original version of the post, I managed to delete the definition of "mex", which continuing to use mex in several other definitions. I've tried to clear it up. Sorry for the confusion!)

This is actually a post in the surreal numbers series, even though it's not going to look like one. It's going to look like an introduction to another very strange system of numbers, called nimbers. But nimbers are a step on the path from
surreal numbers to games and game theory.

Nimbers come from a very old game called Nim. We'll talk more about Nim later, but it's one of the oldest strategy games known. The basic idea of it is that you have
a couple of piles of stones. Each turn, each player can take some stones from one of the piles. Whoever is left making the last move loses. It seems like a very trivial game. But it turns out that you can reduce pretty much every impartial game to some variation of Nim.

Analyzing Nim mathematically, you wind up finding that it re-creates the concept of ordinal numbers, which is what surreals are also based on. In fact, creating nimbers can end up re-creating the surreals. But that's not what we're going to do here: we're going to create the nimbers and the basic nimber addition and multiplication
operations.

## A Great New SciBling!

Our corporate masters at Seed have added a new blog to ScienceBlogs, and it looks like a real winner. It's called the Denialism Blog, and it's off to a roaring great start with "The Unified Theory of the Crank. Go check it out!

## Why am I doing this Pi-Calculus Language Thing?

Since my post on datatypes for my π-calculus language, I've gotten a bunch of
questions from people who (I guess) picked up on the series after the original post where
I said that the idea of the series was to see if I could create a programming language
based on it. The questions are all variations on "Why design another programming language? Do you really think anyone will ever use it?"

## True Pathology: A Multilingual Quine

While browser over at programming.reddit.com, I came across something simultaneously hideous and amazing.

I've showed quines before as part of the pathological programming posts: a quine is a program which, when run, generates itself as an output. I've even written about a programming language where the only way to create a loop is through quining the program.

But I've never seen anything like this before. It's a multilingual quine: the program below is not just a quine, but it's simultaneously a quite in three different languages: OCaml, Haskell, and Scheme. I have no idea how the author managed to figure out how to do this; and I probably don't want to. ðŸ™‚

## From Beautiful to Twisted in One Syntactic Step: False

Today's friday programming language insanity is a tad different. I'm going to look at another twisted stack-based language. I've got a peculiar fondness for these buggers, because back in the day, I was a serious Forth addict. One of the ideas that's actually come up in serious programming languages in the last few years is creating a sort of cross between functional languages and stack-based languages, producing what are known as concatenative languages. An excellent example of an extremely powerful and useful member of this family is called Factor, by Slava Pestov.

But serious useful languages aren't the realm of my regular friday pathology. So I'm going to tell you about a not-really-serious version of a concatenative language, called False. Semantically, False is actually not a horrible language. In fact, if it weren't for the bogglingly awful syntax, it's something I could imagine using for tiny file-filtering utilities. But the syntax is designed to be truly horrible, and when you blend the natural potential for confusion that you get from doing everything backwards on a stack with a syntax that looks like line-noise, you get something that can really sprain your brain.

## Legal Threats (Updated)

(This issue came to a happy conclusion. After the uproar generated by this being publicized by so many blogs and websites, the publisher got in touch with Shelley, gave her permission to use the figures, apologized, and promised to do some internal legal education so that this won't happen again.)

This doesn't affect me personally, but my friend and fellow ScienceBlogger Shelly Batts of
Retrospectacle has been threatened by
lawyers from the Journal of the Science of Food and Agriculture, one of the Wiley group's journals, for reproducing a part of one figure from an article that she was writing about.

In a sane world, this would be a clear case of "fair use": Shelley was not stealing or taking credit for anyone's work. She did not reprint the article. She did not write about the work without giving credit to the original authors: she provided a full and appropriate citation of the article. All she was doing is what many bloggers do regularly: she was writing about an interesting piece of research that had been published in her area. But her article doesn't fit the spin that the authors/publishers wanted to put on it. So they resorted to legal threats to try to shut her down.

There's really nothing bloggers like us can do to stop publishers from pulling obnoxious stunts like this, except to publicize it, so that they realize there is some cost to them associated with this kind of behavior. That's why I'm writing this. Wiley needs to recognize that as a publisher of scientific journals, it's absolutely unreasonable and unacceptable to threaten lawsuits against other scientists who reference their work.

## Selective Quoting of Statistics: More Dishonest Quote Mining from DI

When I'm bored, I'll periodically take a look at the blogs published by
the bozos at the Discovery Institute. I can generally find something good for a laugh. So I was doing that tonight, and came across yet another example of how they try to distort
reality and use slimily dishonest math to try to criticize the evidence for evolution. This time, it's an article by "Logan Gage" called What exactly does genetic similarity demonstrate?.

## Sign Expansions of Infinity

Finally, as I promised a while ago, it's time to look at the sign-expanded forms of infinites in the surreal numbers. Once you've gotten past the normal forms of surreal numbers, it's pretty easy to translate them to sign-expanded form.

## Process Equivalence in π-calculus

Before moving on, there's one question that I thought was important enough to promote up to the front page, instead of just answering it in the comments. A commenter asked about process replication, !P, wanting to know if it terminates.

The answer comes in two parts.

• !P does process creation on demand. It's not an infinite parallel group of processes; it's just a way of writing that there are as many of P as you need. So you can think of it like tape cells in a Turing machine: we never say that a Turing machine tape is infinitely long; but there's always enough cells. !P isn't an infinite replication of P; it's a notation for "enough copies of P". So when you're done using replicas of P, you can think of !P disappearing.
• Often in π-calculus, we actually don't worry about termination of every process. You can think of it in terms of garbage collection: we're running some group of processes to perform a computation. When they're done, they terminate. Any process which has no ports that are reachable by any other active process can simply be collected.

The next place to go in our exploration of π-calculus is considering just what it really means for two processes to be equivalent. The fundamental equivalence relation in
π-calculus is called bisimulation. The idea of bisimulation is roughly a kind of observational equivalence: two processes are equivalent under bisimulation if they exhibit the same visible behavior under all tests by an external observer.