The surreal numbers are a
superset of the
real numbers, invented by
John Conway for the analysis of
games, although the name was coined by
Donald Knuth. The idea is that the notation { L | R } represents a position in a game between two players (who we will call "left" and "right") which is guaranteed to eventually end and in which the
winner is the player who moves last (that is, the one who leaves the
opponent with no legal move). L is the set of positions that left can put the game in, if it is left's turn. Likewise, R is the set of positions that right can put the game in, if it is right's turn.
Given a position, who is winning, and by how much? These are the questions that surreal numbers were invented to answer. For simplicity, we'll combine these two questions into "How much is left winning by?" and answer with a negative number if right is winning.
For starters, consider the position {|} - that is, neither player has any legal moves, so whoever's turn it is will lose. We will call this 0. Now consider {0|} - left can make one move (reducing the game to 0), right can't. Since left is one move ahead, we will call this 1. Other values can be derived by means of the addition operator. To add two games, we make a larger game out of them. On your turn, you can play in either game. The winner of this sum game is, as in its two subgames, the one who doesn't run out of legal moves. Now we stipulate that the value of the sum of two games should be the sum of those games' values. (To express this symbolically: Let x+S, where x is a number and S is a set of numbers, denote the set obtained by adding x to all elements of S. Then we can define addition recursively: where x = {xL | xR} and y = {yL | yR}, x+y = {y+xL U x+yL | y+xR U x+yR}.) In particular, if playing two games simultaneously this way yields a position where the next player to move will eventually lose regardless of whether that player is left or right, then their values should sum to 0.
From this we can derive that {|0} should be -1, {1|} should be 2 (and in general {x|} = x+1), {0|1} should be 1/2 (because adding two copies of it to -1 yields a second-player win), and so on. Infinite ordinal numbers are also easy to generate, given that the sets L and R need not be finite: omega = {1, 2, 3, 4... |}. Likewise, {|1, 1/2, 1/4, 1/8...} is demonstrably greater than 0 but less than all positive fractions, and thus becomes the basis for infinitesimals.
But that's not all. From the way I've described it above, it's pretty easy to create values that don't act like numbers at all. This is where the surrealism comes in. Consider {0|0} - whoever goes next is the winner. This is called * (pronounced "star"), and despite being distinct from 0, it is its own additive inverse: *+* = 0. In fact, it's just the first element of a a chain of distinct numbers with that property: 2* = {*, 0|*,0}, 3*={2*,*,0|2*,*,0}, and so on. These have been called "nimbers", as they correspond to individual piles of stones in the game of nim. Because they are their own additive inverses, there's no difference between adding a nimber and subtracting it. If a*+b*=c*, then a*+c*=b* and b*+c*=a*. This is only the start as far as mathematical weirdness goes; Winning Ways, the definitive work on combinatorial game theory by Berlekamp, Conway, and Guy, becomes in its more advanced chapters a veritable menagerie of anomalies.
To eliminate such abominations, there is usually an additional requirement placed upon surreal numbers. First, define an ordering on the surreals: If x = {xL | xR} and y = {yL | yR}, then x <= y if and only if y is less than or equal to no member of xL and no member of yR is less than or equal to x. The new restriction is that { L | R } is only well-formed if all members of L are strictly less than every member of R. The well-formed surreals include the real, infinite, and infinitesimal numbers, as well as their sums, but exclude nimbers and anything else that would prevent the ordering from being a total ordering. Knuth referred to numbers that are not well-formed as "pseudo-numbers", and even though they aren't numbers in the conventional sense, they're still useful in the analysis of games.