# mathlib3documentation

set_theory.surreal.basic

# Surreal numbers #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

The basic theory of surreal numbers, built on top of the theory of combinatorial (pre-)games.

A pregame is numeric if all the Left options are strictly smaller than all the Right options, and all those options are themselves numeric. In terms of combinatorial games, the numeric games have "frozen"; you can only make your position worse by playing, and Left is some definite "number" of moves ahead (or behind) Right.

A surreal number is an equivalence class of numeric pregames.

In fact, the surreals form a complete ordered field, containing a copy of the reals (and much else besides!) but we do not yet have a complete development.

## Order properties #

Surreal numbers inherit the relations ≤ and < from games (surreal.has_le and surreal.has_lt), and these relations satisfy the axioms of a partial order.

## Algebraic operations #

We show that the surreals form a linear ordered commutative group.

One can also map all the ordinals into the surreals!

### Multiplication of surreal numbers #

The proof that multiplication lifts to surreal numbers is surprisingly difficult and is currently missing in the library. A sample proof can be found in Theorem 3.8 in the second reference below. The difficulty lies in the length of the proof and the number of theorems that need to proven simultaneously. This will make for a fun and challenging project.

The branch surreal_mul contains some progress on this proof.

### Todo #

• Define the field structure on the surreals.

## References #

def pgame.numeric  :
pgame Prop

A pre-game is numeric if everything in the L set is less than everything in the R set, and all the elements of L and R are also numeric.

Equations
theorem pgame.numeric_def {x : pgame} :
theorem pgame.numeric.mk {x : pgame} (h₁ : (i : x.left_moves) (j : x.right_moves), x.move_left i < x.move_right j) (h₂ : (i : x.left_moves), (x.move_left i).numeric) (h₃ : (j : x.right_moves), (x.move_right j).numeric) :
theorem pgame.numeric.left_lt_right {x : pgame} (o : x.numeric) (i : x.left_moves) (j : x.right_moves) :
theorem pgame.numeric.move_left {x : pgame} (o : x.numeric) (i : x.left_moves) :
theorem pgame.numeric.move_right {x : pgame} (o : x.numeric) (j : x.right_moves) :
theorem pgame.numeric_rec {C : pgame Prop} (H : (l r : Type u_1) (L : l pgame) (R : r pgame), ( (i : l) (j : r), L i < R j) ( (i : l), (L i).numeric) ( (i : r), (R i).numeric) ( (i : l), C (L i)) ( (i : r), C (R i)) C (pgame.mk l r L R)) (x : pgame) :
x.numeric C x
theorem pgame.relabelling.numeric_imp {x y : pgame} (r : x.relabelling y) (ox : x.numeric) :

Relabellings preserve being numeric.

theorem pgame.lf_asymm {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x.lf y ¬y.lf x
theorem pgame.le_of_lf {x y : pgame} (h : x.lf y) (ox : x.numeric) (oy : y.numeric) :
x y
theorem pgame.lf.le {x y : pgame} (h : x.lf y) (ox : x.numeric) (oy : y.numeric) :
x y

Alias of pgame.le_of_lf.

theorem pgame.lt_of_lf {x y : pgame} (h : x.lf y) (ox : x.numeric) (oy : y.numeric) :
x < y
theorem pgame.lf.lt {x y : pgame} (h : x.lf y) (ox : x.numeric) (oy : y.numeric) :
x < y

Alias of pgame.lt_of_lf.

theorem pgame.lf_iff_lt {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x.lf y x < y
theorem pgame.le_iff_forall_lt {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x y ( (i : x.left_moves), x.move_left i < y) (j : y.right_moves), x < y.move_right j

Definition of x ≤ y on numeric pre-games, in terms of <

theorem pgame.lt_iff_exists_le {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x < y ( (i : y.left_moves), x y.move_left i) (j : x.right_moves), x.move_right j y

Definition of x < y on numeric pre-games, in terms of ≤

theorem pgame.lt_of_exists_le {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
(( (i : y.left_moves), x y.move_left i) (j : x.right_moves), x.move_right j y) x < y
theorem pgame.lt_def {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x < y ( (i : y.left_moves), ( (i' : x.left_moves), x.move_left i' < y.move_left i) (j : (y.move_left i).right_moves), x < (y.move_left i).move_right j) (j : x.right_moves), ( (i : (x.move_right j).left_moves), (x.move_right j).move_left i < y) (j' : y.right_moves), x.move_right j < y.move_right j'

The definition of x < y on numeric pre-games, in terms of < two moves later.

theorem pgame.not_fuzzy {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
theorem pgame.lt_or_equiv_or_gt {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
x < y x.equiv y y < x
theorem pgame.numeric.neg {x : pgame} (o : x.numeric) :
theorem pgame.numeric.move_left_lt {x : pgame} (o : x.numeric) (i : x.left_moves) :
x.move_left i < x
theorem pgame.numeric.move_left_le {x : pgame} (o : x.numeric) (i : x.left_moves) :
theorem pgame.numeric.lt_move_right {x : pgame} (o : x.numeric) (j : x.right_moves) :
theorem pgame.numeric.le_move_right {x : pgame} (o : x.numeric) (j : x.right_moves) :
theorem pgame.numeric.add {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
(x + y).numeric
theorem pgame.numeric.sub {x y : pgame} (ox : x.numeric) (oy : y.numeric) :
(x - y).numeric
theorem pgame.numeric_nat (n : ) :

Pre-games defined by natural numbers are numeric.

theorem pgame.numeric_to_pgame (o : ordinal) :

Ordinal games are numeric.

def surreal  :
Type (u_1+1)

The type of surreal numbers. These are the numeric pre-games quotiented by the equivalence relation x ≈ y ↔ x ≤ y ∧ y ≤ x. In the quotient, the order becomes a total order.

Equations
Instances for surreal
def surreal.mk (x : pgame) (h : x.numeric) :

Construct a surreal number from a numeric pre-game.

Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
def surreal.lift {α : Sort u_1} (f : Π (x : pgame), x.numeric α) (H : {x y : pgame} (hx : x.numeric) (hy : y.numeric), x.equiv y f x hx = f y hy) :

Lift an equivalence-respecting function on pre-games to surreals.

Equations
def surreal.lift₂ {α : Sort u_1} (f : Π (x : pgame) (y : pgame), x.numeric y.numeric α) (H : {x₁ : pgame} {y₁ : pgame} {x₂ : pgame} {y₂ : pgame} (ox₁ : x₁.numeric) (oy₁ : y₁.numeric) (ox₂ : x₂.numeric) (oy₂ : y₂.numeric), x₁.equiv x₂ y₁.equiv y₂ f x₁ y₁ ox₁ oy₁ = f x₂ y₂ ox₂ oy₂) :

Lift a binary equivalence-respecting function on pre-games to surreals.

Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]

Addition on surreals is inherited from pre-game addition: the sum of x = {xL | xR} and y = {yL | yR} is {xL + y, x + yL | xR + y, x + yR}.

Equations
@[protected, instance]

Negation for surreal numbers is inherited from pre-game negation: the negation of {L | R} is {-R | -L}.

Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations

Casts a surreal number into a game.

Equations
@[simp]
theorem surreal.one_to_game  :
@[simp]
theorem surreal.nat_to_game (n : ) :
theorem surreal.upper_bound_numeric {ι : Type u} {f : ι pgame} (H : (i : ι), (f i).numeric) :
theorem surreal.lower_bound_numeric {ι : Type u} {f : ι pgame} (H : (i : ι), (f i).numeric) :

A small set s of surreals is bounded above.

A small set s of surreals is bounded below.

noncomputable def ordinal.to_surreal  :

Converts an ordinal into the corresponding surreal.

Equations