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 #
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.
Relabellings preserve being numeric.
Alias of pgame.le_of_lf
.
Alias of pgame.lt_of_lf
.
Definition of x ≤ y
on numeric pre-games, in terms of <
Definition of x < y
on numeric pre-games, in terms of ≤
The definition of x < y
on numeric pre-games, in terms of <
two moves later.
Pre-games defined by natural numbers are numeric.
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
Construct a surreal number from a numeric pre-game.
Equations
- surreal.mk x h = ⟦⟨x, h⟩⟧
Equations
Equations
Equations
- surreal.inhabited = {default := 0}
Lift an equivalence-respecting function on pre-games to surreals.
Equations
- surreal.lift f H = quotient.lift (λ (x : {x // x.numeric}), f x.val _) _
Lift a binary equivalence-respecting function on pre-games to surreals.
Equations
- surreal.lift₂ f H = surreal.lift (λ (x : pgame) (ox : x.numeric), surreal.lift (λ (y : pgame) (oy : y.numeric), f x y ox oy) _) _
Equations
- surreal.has_le = {le := surreal.lift₂ (λ (x y : pgame) (_x : x.numeric) (_x : y.numeric), x ≤ y) surreal.has_le._proof_1}
Equations
- surreal.has_lt = {lt := surreal.lift₂ (λ (x y : pgame) (_x : x.numeric) (_x : y.numeric), x < y) surreal.has_lt._proof_1}
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}
.
Negation for surreal numbers is inherited from pre-game negation:
the negation of {L | R}
is {-R | -L}
.
Equations
- surreal.ordered_add_comm_group = {add := has_add.add surreal.has_add, add_assoc := surreal.ordered_add_comm_group._proof_1, zero := 0, zero_add := surreal.ordered_add_comm_group._proof_2, add_zero := surreal.ordered_add_comm_group._proof_3, nsmul := add_comm_group.nsmul._default 0 has_add.add surreal.ordered_add_comm_group._proof_4 surreal.ordered_add_comm_group._proof_5, nsmul_zero' := surreal.ordered_add_comm_group._proof_6, nsmul_succ' := surreal.ordered_add_comm_group._proof_7, neg := has_neg.neg surreal.has_neg, sub := add_comm_group.sub._default has_add.add surreal.ordered_add_comm_group._proof_8 0 surreal.ordered_add_comm_group._proof_9 surreal.ordered_add_comm_group._proof_10 (add_comm_group.nsmul._default 0 has_add.add surreal.ordered_add_comm_group._proof_4 surreal.ordered_add_comm_group._proof_5) surreal.ordered_add_comm_group._proof_11 surreal.ordered_add_comm_group._proof_12 has_neg.neg, sub_eq_add_neg := surreal.ordered_add_comm_group._proof_13, zsmul := add_comm_group.zsmul._default has_add.add surreal.ordered_add_comm_group._proof_14 0 surreal.ordered_add_comm_group._proof_15 surreal.ordered_add_comm_group._proof_16 (add_comm_group.nsmul._default 0 has_add.add surreal.ordered_add_comm_group._proof_4 surreal.ordered_add_comm_group._proof_5) surreal.ordered_add_comm_group._proof_17 surreal.ordered_add_comm_group._proof_18 has_neg.neg, zsmul_zero' := surreal.ordered_add_comm_group._proof_19, zsmul_succ' := surreal.ordered_add_comm_group._proof_20, zsmul_neg' := surreal.ordered_add_comm_group._proof_21, add_left_neg := surreal.ordered_add_comm_group._proof_22, add_comm := surreal.ordered_add_comm_group._proof_23, le := has_le.le surreal.has_le, lt := has_lt.lt surreal.has_lt, le_refl := surreal.ordered_add_comm_group._proof_24, le_trans := surreal.ordered_add_comm_group._proof_25, lt_iff_le_not_le := surreal.ordered_add_comm_group._proof_26, le_antisymm := surreal.ordered_add_comm_group._proof_27, add_le_add_left := surreal.ordered_add_comm_group._proof_28}
Equations
- surreal.linear_ordered_add_comm_group = {add := ordered_add_comm_group.add surreal.ordered_add_comm_group, add_assoc := _, zero := ordered_add_comm_group.zero surreal.ordered_add_comm_group, zero_add := _, add_zero := _, nsmul := ordered_add_comm_group.nsmul surreal.ordered_add_comm_group, nsmul_zero' := _, nsmul_succ' := _, neg := ordered_add_comm_group.neg surreal.ordered_add_comm_group, sub := ordered_add_comm_group.sub surreal.ordered_add_comm_group, sub_eq_add_neg := _, zsmul := ordered_add_comm_group.zsmul surreal.ordered_add_comm_group, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, le := ordered_add_comm_group.le surreal.ordered_add_comm_group, lt := ordered_add_comm_group.lt surreal.ordered_add_comm_group, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, le_total := surreal.linear_ordered_add_comm_group._proof_1, decidable_le := classical.dec_rel has_le.le, decidable_eq := linear_order.decidable_eq._default ordered_add_comm_group.le ordered_add_comm_group.lt ordered_add_comm_group.le_refl ordered_add_comm_group.le_trans ordered_add_comm_group.lt_iff_le_not_le ordered_add_comm_group.le_antisymm (classical.dec_rel has_le.le), decidable_lt := linear_order.decidable_lt._default ordered_add_comm_group.le ordered_add_comm_group.lt ordered_add_comm_group.le_refl ordered_add_comm_group.le_trans ordered_add_comm_group.lt_iff_le_not_le ordered_add_comm_group.le_antisymm (classical.dec_rel has_le.le), max := linear_order.max._default ordered_add_comm_group.le ordered_add_comm_group.lt ordered_add_comm_group.le_refl ordered_add_comm_group.le_trans ordered_add_comm_group.lt_iff_le_not_le ordered_add_comm_group.le_antisymm (classical.dec_rel has_le.le), max_def := surreal.linear_ordered_add_comm_group._proof_2, min := linear_order.min._default ordered_add_comm_group.le ordered_add_comm_group.lt ordered_add_comm_group.le_refl ordered_add_comm_group.le_trans ordered_add_comm_group.lt_iff_le_not_le ordered_add_comm_group.le_antisymm (classical.dec_rel has_le.le), min_def := surreal.linear_ordered_add_comm_group._proof_3}
Converts an ordinal into the corresponding surreal.
Equations
- ordinal.to_surreal = {to_embedding := {to_fun := λ (o : ordinal), surreal.mk o.to_pgame _, inj' := ordinal.to_surreal._proof_1}, map_rel_iff' := ordinal.to_pgame_le_iff}