The surreal numbers (**No**) were developed (or discovered, depending on what you think mathematics is) by John “Don’t mention Game of Life” Conway. He first introduced them in lectures in the 1970s (see Conway, 2001). The name, surreal numbers, was coined by Donald Knuth (1974) in the first book on the surreals, an undergrad maths text thinly disguised as a novelette (hear Knuth talk about the book).

I’ve been fiddling with the dyadic rational part of the surreals in the eves for the past couple of weeks in R and am now beginning to wrap my head around \(\omega\) and beyond. These notes explain where I’ve got to. You can check out the R over here, which currently gets as far as addition and a few other useful functions.

### Familiar friends

All the kinds of numbers we are already familiar with are special cases of surreal:

**Natural numbers (\(\mathbb{N}\))**are in there:

0, 1, 2, 3, 4, …- As are the
**integers (\(\mathbb{Z}\))**, the natural numbers and their negation:

…, -4, -3, -2, -1, 0, 1, 2, 3, 4, … **Rational numbers (\(\mathbb{Q}\))**: the numbers that can be expressed as a fraction of two integers, \(p/q\), where \(q \ne 0\). We get the integers by setting \(q = 1\).- The
**real numbers (\(\mathbb{R}\))**: everything above, plus irrational numbers, such as \(\pi\) and \(\sqrt{2}\), that lie between rationals.

So, next time you calculate \(2 + 2\) or \(\pi r^2\) you could say you are doing surreal arithmetic.

But there’s much more in the surreals: infinitely big numbers, bigger than any real number, and infinitesimally small numbers, smaller than any positive real but yet bigger than zero. An amazing feature of the surreals is that all the above, from naturals to these huge and miniscule numbers, can be defined in a concise way.

### Defining the surreals

This is how to define them:

If

(a) \(L\) and \(R\) are two sets of surreal numbers and

(b) there is no \(l \in L, r \in R\) such that \(l \ge r\),

then \((L|R)\) is a surreal number.

The notation \(x \in A\) means that \(x\) is a member of set \(A\). For instance, \(42 \in \{ 7, 27, 42 \}\).

This definition is recursive, i.e., defined in terms of itself. A surreal, \((L|R)\), is an ordered pair of sets of surreals, \(L\) and \(R\), left and right. It works because as you follow the \(L\) and \(R\) threads, you eventually reach an empty set and can stop, as we shall see.

I’m using a blend of the notation by Conway (2001) and Knuth (1974).Β To make it easier refer to the left and right parts of a surreal, \(x= ( L | R )\) can be written \(( x_L | y_R )\). Note that \(L\) or \(R\) can be infinitely big sets. That turns out to be how interesting surreals are built.

Something to ponder: to define the surreals in this way, we already needed some notion of set theory that allows infinitely big sets and ordered pairs. To what extent is the structure of the surreals determined by the structure of the chosen set theory? (I don’t have an answer.)

### Zero

Surreals are pairs of sets of surreals, but we don’t have any surreals yet. The only way to bootstrap them into existence is with empty sets (\(\emptyset\) or \(\{ \}\)), so the simplest surreal number is \((\emptyset | \emptyset)\). It turns out that this is zero – the same zero we know and love, so we can call it 0. We can also write this as \(( | )\) or \((\{ \} | \{ \} )\).

How can we tell if \(( | )\) really is zero? We could try to prove if it behaves like a zero, e.g., \(x + 0 = x\) and \(0x = 0\), for all \(x\). Not today. But let’s check something simpler: is 0 at least a surreal number? We need to check that there is no \(l \in 0_L, r \in 0_R\) such that \(l \ge r\). That’s easy to do since \(0_L = 0_R = \{ \}\). There’s nothing at all in either set, so 0 passes the test and is indeed surreal.

### One and minus one

Our next candidate surreal numbers are built by plugging zero into left, right, or both:

- \(( 0 |Β )\)
- \((Β | 0 )\)
- \(( 0 | 0 )\)

The first two are fine, by a similar argument to the one we used for 0: since one of the pair is the empty set, there’s nothing in there to threaten the absence of the greater-than-or-equal-to condition.

The interpretation of these numbers is:

- \(( 0 | ) = 1\)
- \(( | 0 ) = -1\)

Intuitively, \(( 0 | 0 )\) isn’t a surreal number since left and right are equal. But we haven’t actually defined a way to think about this yet.

Let’s now define \(\ge\).

\((x_L | x_R) \ge (y_L | y_R)\) if and only if

(a) there is no \(x_R\) such that \(y \ge x_R \) and

(b) there is no \(y_L\) such that \(y_L \ge x\).

Note how this definition is recursive, mirroring how surreals are constructed. Again, it relies on the empty set to stop. If there is no \(x_R\) or \(y_L\) at all then it’s vacuously true.

Let’s use this to test if \((0|0) =( (\{\}|\{\})|(\{\}|\{\}))\) is surreal.

We want nothing on the left to be greater than or equal to anything on the right, so we* don’t* want \(0 \ge 0\). But this does hold.

\(0 \ge 0\), that is \((\{\}|\{\}) \ge (\{\}|\{\})\), if and only if (a) there is no element \(0_R\) such that \(0 \ge 0_R\) and (b) no \(0_L Β \ge 0\). Both conditions do hold:

(a) \(0_R = \{ \}\). There is nothing there, so nothing that 0 could be greater than or equal to.

(b) \(0_L = \{ \}\), so again nothing that could be greater than or equal to 0.

Therefore \(0 \ge 0\) and thus \((0|0)\) is not a surreal number.

### Other numbers up to Ο

Next comes

- \(( 1 | ) = 2\)
- \(( | 1 ) = -2\)

To make the numbers explicit, we can paste in their constituent surreals, e.g.,

\(( 1 | ) = ( ( 0 | ) | ) = ( ( (\emptyset | \emptyset) | ) | )\)

We also get the first rationals:

- \(( 0 | 1) = 1/2\)
- \(( -1 | 0) = -1/2\)

And, amongst other numbers, a new representation for zero:

- \(( -1 | 1) = 0\)

This is analogous to how \(1/2 = 2/4 = 3/6 = \ldots\)

How did Conway convince himself that these really are the numbers represented by this notation? I expect first by trying arithmetic on a few of them to get a sense of how they work, e.g., is \(1/2 + 1/2 = 1\)? He then proved the properties of arithmetic for all surreals (see, e.g., Conway, 2001, Chapter 1).

Let’s go back to the naturals, which are also surreals. As you create 0, 1, 2, 3, …, put them in a set. So now we have a set of infinitely many surreals, \(\{ 0, 1, 2, 3, … \}\), which can be used to make another surreal, \(\omega\):

\(\omega = (0, 1, 2, 3, \ldots | )\)

That is, \(\omega_L = \{ 0, 1, 2, 3, … \} \) and \(\omega_R = \{Β \} \).

This is the first transfinite surreal number and the first number that isn’t a natural, integer, rational, or real.

There’s a lot more in there, but I’ll stop here for now. Here’s a map by Simons (2017, p. 37) of the landscape of surreals and the order they are created.

### What does the (*L* | *R*) notation mean?

Now I’m going to depart from the many formal introductions of surreals which prove that everything works (see the further reading below) and move onto the intuitive meaning of \((L|R)\), drawing on Conway and Guy (1996, pp. 283-291).

The notation \((L = a, b, c, \ldots | R = d, e, f, \ldots)\) refers to the simplest number strictly greater than everything in \(L\) and strictly less than everything in \(R\).

Apparently to understand “simplest” you need to learn about a two-player game called Hackenbush. I am not joking, this is not the name of a new BBC Radio 4 comedy. It’s part of the field of combinatorial game theory, and what prompted the discovery of the surreals in the first place. Tom Davis has written a program that allows you can play Hackenbush against the computer. It’s actually quite easy to play and requires no knowledge of the surreals. The idea is that surreals can be represented as states in the game, and which of the two players can win tells you something about the value of the number. But Hackenbush is for another blog post.

The examples Conway and Guy provide illustrate the general idea.

- \(( | ) = 0\), “the simplest number of all” (ibid., p. 283).
- \((0|) = 1\), the simplest number greater than 0.

Many distinct representations can refer to the same number, e.g., these are all 2:

- \((0,1|) = 2\), the simplest number greater than 0 and 1.
- \((1|) = 2\), the simplest number greater than 1.
- \(( -1, 0, 1|) = 2\), the simplest number greater than -1, 0, and 1.

Here’s how fractions work:

- \((0|1) = 1/2\), the simplest number greater than 0 and less than 1.

And negative numbers:

- \((|0) = -1\), the simplest number less than 0.
- \((| -1 ) = -2\), the simplest number less than -1.

So, to make sense of a surreal expressed as \((L|R)\), the trick is first to strip out numbers in \(L\) and \(R\) which don’t constrain the number. Leave the biggest in \(L\) and the smallest in \(R\).

One way to think of “simplest” is in terms of the order in which the surreals were created, e.g., 0 first, then -1, 1, and so on. The simplest is the earliest created.

Wise words from Matthew Roughan (I have mildly edited the notation):

“naively, you might expect that the form \(( 3 | 17 )\) could be mapped to the mean of the two sets, i.e., 10. However, \((x_L | x_R)\) is the simplest number such that \(x_L < x < x_R\), so, in fact, this form is equivalent to 4.”

This checks out in my R, which is a relief:

> equal(surreal(dali(3,0), dali(17,0)), dali(10,0)) [1] FALSE > equal(surreal(dali(3,0), dali(17,0)), dali(4,0)) [1] TRUE

Where \(\mathit{surreal}(l, r) = (l|r)\), \(\mathit{dali}(n, k)\) gives the surreal of \(n/2^k\), and \(\mathit{equal}(x, y) \equiv x = y\).

As you might guess from how vague this section is, I don’t completely get this yet and this is a note to future me. Stay tuned.

### Automagically building dyadic rational surreals

Here are the first few surreals with singleton sets left and right, courtesy of R, for your arithmetical pleasure (let me know if I’ve missed any or added too many):

Let's make some surreal numbers! Day 0 Starting with: β Checking: (β | β ) - Yes Day 1 Starting with: β , (β | β ) Checking: (β | (β | β )) - Yes Checking: ((β | β ) | β ) - Yes Checking: ((β | β ) | (β | β )) - No Day 2 Starting with: β , (β | β ), (β | (β | β )), ((β | β ) | β ) Checking: (β | (β | (β | β ))) - Yes Checking: (β | ((β | β ) | β )) - Yes Checking: ((β | β ) | (β | β )) - No Checking: ((β | β ) | (β | (β | β ))) - No Checking: ((β | β ) | ((β | β ) | β )) - Yes Checking: ((β | (β | β )) | β ) - Yes Checking: ((β | (β | β )) | (β | β )) - Yes Checking: ((β | (β | β )) | (β | (β | β ))) - No Checking: ((β | (β | β )) | ((β | β ) | β )) - Yes Checking: (((β | β ) | β ) | β ) - Yes Checking: (((β | β ) | β ) | (β | β )) - No Checking: (((β | β ) | β ) | (β | (β | β ))) - No Checking: (((β | β ) | β ) | ((β | β ) | β )) - No Day 3 Starting with: β , (β | β ), (β | (β | β )), ((β | β ) | β ), (β | (β | (β | β ))), (β | ((β | β ) | β )), ((β | β ) | ((β | β ) | β )), ((β | (β | β )) | β ), ((β | (β | β )) | (β | β )), ((β | (β | β )) | ((β | β ) | β )), (((β | β ) | β ) | β ) Checking: (β | (β | (β | (β | β )))) - Yes Checking: (β | (β | ((β | β ) | β ))) - Yes Checking: (β | ((β | β ) | ((β | β ) | β ))) - Yes Checking: (β | ((β | (β | β )) | β )) - Yes Checking: (β | ((β | (β | β )) | (β | β ))) - Yes Checking: (β | ((β | (β | β )) | ((β | β ) | β ))) - Yes Checking: (β | (((β | β ) | β ) | β )) - Yes Checking: ((β | β ) | (β | β )) - No Checking: ((β | β ) | (β | (β | β ))) - No Checking: ((β | β ) | (β | (β | (β | β )))) - No Checking: ((β | β ) | (β | ((β | β ) | β ))) - No Checking: ((β | β ) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: ((β | β ) | ((β | (β | β )) | β )) - No Checking: ((β | β ) | ((β | (β | β )) | (β | β ))) - No Checking: ((β | β ) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: ((β | β ) | (((β | β ) | β ) | β )) - Yes Checking: ((β | (β | β )) | (β | (β | β ))) - No Checking: ((β | (β | β )) | (β | (β | (β | β )))) - No Checking: ((β | (β | β )) | (β | ((β | β ) | β ))) - Yes Checking: ((β | (β | β )) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: ((β | (β | β )) | ((β | (β | β )) | β )) - Yes Checking: ((β | (β | β )) | ((β | (β | β )) | (β | β ))) - Yes Checking: ((β | (β | β )) | ((β | (β | β )) | ((β | β ) | β ))) - Yes Checking: ((β | (β | β )) | (((β | β ) | β ) | β )) - Yes Checking: (((β | β ) | β ) | (β | β )) - No Checking: (((β | β ) | β ) | (β | (β | β ))) - No Checking: (((β | β ) | β ) | ((β | β ) | β )) - No Checking: (((β | β ) | β ) | (β | (β | (β | β )))) - No Checking: (((β | β ) | β ) | (β | ((β | β ) | β ))) - No Checking: (((β | β ) | β ) | ((β | β ) | ((β | β ) | β ))) - No Checking: (((β | β ) | β ) | ((β | (β | β )) | β )) - No Checking: (((β | β ) | β ) | ((β | (β | β )) | (β | β ))) - No Checking: (((β | β ) | β ) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: (((β | β ) | β ) | (((β | β ) | β ) | β )) - Yes Checking: ((β | (β | (β | β ))) | β ) - Yes Checking: ((β | (β | (β | β ))) | (β | β )) - Yes Checking: ((β | (β | (β | β ))) | (β | (β | β ))) - Yes Checking: ((β | (β | (β | β ))) | ((β | β ) | β )) - Yes Checking: ((β | (β | (β | β ))) | (β | (β | (β | β )))) - No Checking: ((β | (β | (β | β ))) | (β | ((β | β ) | β ))) - Yes Checking: ((β | (β | (β | β ))) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: ((β | (β | (β | β ))) | ((β | (β | β )) | β )) - Yes Checking: ((β | (β | (β | β ))) | ((β | (β | β )) | (β | β ))) - Yes Checking: ((β | (β | (β | β ))) | ((β | (β | β )) | ((β | β ) | β ))) - Yes Checking: ((β | (β | (β | β ))) | (((β | β ) | β ) | β )) - Yes Checking: ((β | ((β | β ) | β )) | β ) - Yes Checking: ((β | ((β | β ) | β )) | (β | β )) - No Checking: ((β | ((β | β ) | β )) | (β | (β | β ))) - No Checking: ((β | ((β | β ) | β )) | ((β | β ) | β )) - Yes Checking: ((β | ((β | β ) | β )) | (β | (β | (β | β )))) - No Checking: ((β | ((β | β ) | β )) | (β | ((β | β ) | β ))) - No Checking: ((β | ((β | β ) | β )) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: ((β | ((β | β ) | β )) | ((β | (β | β )) | β )) - No Checking: ((β | ((β | β ) | β )) | ((β | (β | β )) | (β | β ))) - No Checking: ((β | ((β | β ) | β )) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: ((β | ((β | β ) | β )) | (((β | β ) | β ) | β )) - Yes Checking: (((β | β ) | ((β | β ) | β )) | β ) - Yes Checking: (((β | β ) | ((β | β ) | β )) | (β | β )) - No Checking: (((β | β ) | ((β | β ) | β )) | (β | (β | β ))) - No Checking: (((β | β ) | ((β | β ) | β )) | ((β | β ) | β )) - Yes Checking: (((β | β ) | ((β | β ) | β )) | (β | (β | (β | β )))) - No Checking: (((β | β ) | ((β | β ) | β )) | (β | ((β | β ) | β ))) - No Checking: (((β | β ) | ((β | β ) | β )) | ((β | β ) | ((β | β ) | β ))) - No Checking: (((β | β ) | ((β | β ) | β )) | ((β | (β | β )) | β )) - No Checking: (((β | β ) | ((β | β ) | β )) | ((β | (β | β )) | (β | β ))) - No Checking: (((β | β ) | ((β | β ) | β )) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: (((β | β ) | ((β | β ) | β )) | (((β | β ) | β ) | β )) - Yes Checking: (((β | (β | β )) | β ) | β ) - Yes Checking: (((β | (β | β )) | β ) | (β | β )) - No Checking: (((β | (β | β )) | β ) | (β | (β | β ))) - No Checking: (((β | (β | β )) | β ) | ((β | β ) | β )) - Yes Checking: (((β | (β | β )) | β ) | (β | (β | (β | β )))) - No Checking: (((β | (β | β )) | β ) | (β | ((β | β ) | β ))) - No Checking: (((β | (β | β )) | β ) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: (((β | (β | β )) | β ) | ((β | (β | β )) | β )) - No Checking: (((β | (β | β )) | β ) | ((β | (β | β )) | (β | β ))) - No Checking: (((β | (β | β )) | β ) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: (((β | (β | β )) | β ) | (((β | β ) | β ) | β )) - Yes Checking: (((β | (β | β )) | (β | β )) | β ) - Yes Checking: (((β | (β | β )) | (β | β )) | (β | β )) - Yes Checking: (((β | (β | β )) | (β | β )) | (β | (β | β ))) - No Checking: (((β | (β | β )) | (β | β )) | ((β | β ) | β )) - Yes Checking: (((β | (β | β )) | (β | β )) | (β | (β | (β | β )))) - No Checking: (((β | (β | β )) | (β | β )) | (β | ((β | β ) | β ))) - Yes Checking: (((β | (β | β )) | (β | β )) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: (((β | (β | β )) | (β | β )) | ((β | (β | β )) | β )) - Yes Checking: (((β | (β | β )) | (β | β )) | ((β | (β | β )) | (β | β ))) - No Checking: (((β | (β | β )) | (β | β )) | ((β | (β | β )) | ((β | β ) | β ))) - Yes Checking: (((β | (β | β )) | (β | β )) | (((β | β ) | β ) | β )) - Yes Checking: (((β | (β | β )) | ((β | β ) | β )) | β ) - Yes Checking: (((β | (β | β )) | ((β | β ) | β )) | (β | β )) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | (β | (β | β ))) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | ((β | β ) | β )) - Yes Checking: (((β | (β | β )) | ((β | β ) | β )) | (β | (β | (β | β )))) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | (β | ((β | β ) | β ))) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | ((β | β ) | ((β | β ) | β ))) - Yes Checking: (((β | (β | β )) | ((β | β ) | β )) | ((β | (β | β )) | β )) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | ((β | (β | β )) | (β | β ))) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: (((β | (β | β )) | ((β | β ) | β )) | (((β | β ) | β ) | β )) - Yes Checking: ((((β | β ) | β ) | β ) | β ) - Yes Checking: ((((β | β ) | β ) | β ) | (β | β )) - No Checking: ((((β | β ) | β ) | β ) | (β | (β | β ))) - No Checking: ((((β | β ) | β ) | β ) | ((β | β ) | β )) - No Checking: ((((β | β ) | β ) | β ) | (β | (β | (β | β )))) - No Checking: ((((β | β ) | β ) | β ) | (β | ((β | β ) | β ))) - No Checking: ((((β | β ) | β ) | β ) | ((β | β ) | ((β | β ) | β ))) - No Checking: ((((β | β ) | β ) | β ) | ((β | (β | β )) | β )) - No Checking: ((((β | β ) | β ) | β ) | ((β | (β | β )) | (β | β ))) - No Checking: ((((β | β ) | β ) | β ) | ((β | (β | β )) | ((β | β ) | β ))) - No Checking: ((((β | β ) | β ) | β ) | (((β | β ) | β ) | β )) - No

### Further reading

Conway (2001) and Knuth (1974) provide the classic introductions. Former GCHQ mathematician turned teacher, Jim Simons (2017), has written an accessible intro with loads of proofs, as has retired software engineer Claus TΓΈndering (2019). I found Matthew Roughan’s (2019) paper handy too and have just started playing with his Julia implementation (on GitHub). Frans Faase has written a neat web-based calculator in JavaScript that does simple sums and (in)equalities. Here’s Tom Davis’s implementation of Hackenbush which includes a tutorial. Elwyn Berlekamp produced a great YouTube video which explains how to play Hackenbush. Finally, here’s my attempt to implement surreal addition and a few other bits and pieces in R.

### References

Conway, J. H. (2001). *On numbers and games* (2nd ed.). A. K. Peters, Ltd.

Conway, J. H., & Guy, R. K. (1996). *The book of numbers*. Springer-Verlag.

Knuth, D. E. (1974). *Surreal numbers*. Addison-Wesley.

Roughan, M. (2019). Practically surreal: Surreal arithmetic in Julia. *SoftwareX*, *9*, 293β298.

Simons, J. (2017). Meet the surreal numbers. Handout to accompany a talk at the 2017 annual conference of the Mathematical Association.

TΓΈndering, C (2019). Surreal Numbers β An Introduction (Version 1.7). Unpublished note.