File: Mathlib/SetTheory/Surreal/Basic.lean

full_name: SetTheory.PGame.Numeric
code: /-- 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. -/
def Numeric : PGame → Prop
  
goal: SetTheory.PGame → Prop

full_name: SetTheory.PGame.numeric_def
code: theorem numeric_def {x : PGame} :
    Numeric x ↔
      (∀ i j, x.moveLeft i < x.moveRight j) ∧
        (∀ i, Numeric (x.moveLeft i)) ∧ ∀ j, Numeric (x.moveRight j) 
goal: x.Numeric ↔
  (∀ (i : x.LeftMoves) (j : x.RightMoves), x.moveLeft i < x.moveRight j) ∧
    (∀ (i : x.LeftMoves), (x.moveLeft i).Numeric) ∧ ∀ (j : x.RightMoves), (x.moveRight j).Numeric

full_name: SetTheory.PGame.Numeric.mk
code: theorem mk {x : PGame} (h₁ : ∀ i j, x.moveLeft i < x.moveRight j) (h₂ : ∀ i, Numeric (x.moveLeft i))
    (h₃ : ∀ j, Numeric (x.moveRight j)) : Numeric x 
goal: x.Numeric

full_name: SetTheory.PGame.Numeric.left_lt_right
code: theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
    x.moveLeft i < x.moveRight j 
goal: x.moveLeft i < x.moveRight j

full_name: SetTheory.PGame.Numeric.moveLeft
code: theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) 
goal: (x.moveLeft i).Numeric

full_name: SetTheory.PGame.Numeric.moveRight
code: theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) 
goal: (x.moveRight j).Numeric

full_name: SetTheory.PGame.Numeric.isOption
code: lemma isOption {x' x} (h : IsOption x' x) (hx : Numeric x) : Numeric x' 
goal: x'.Numeric

full_name: SetTheory.PGame.numeric_rec
code: @[elab_as_elim]
theorem numeric_rec {C : PGame → Prop}
    (H : ∀ (l r) (L : l → PGame) (R : r → PGame), (∀ i j, L i < R j) →
      (∀ i, Numeric (L i)) → (∀ i, Numeric (R i)) → (∀ i, C (L i)) → (∀ i, C (R i)) →
      C ⟨l, r, L, R⟩) :
    ∀ x, Numeric x → C x
  
goal: x.Numeric → C x

full_name: SetTheory.PGame.Relabelling.numeric_imp
code: theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) : Numeric y 
goal: y.Numeric

full_name: SetTheory.PGame.Relabelling.numeric_congr
code: /-- Relabellings preserve being numeric. -/
theorem Relabelling.numeric_congr {x y : PGame} (r : x ≡r y) : Numeric x ↔ Numeric y 
goal: x.Numeric ↔ y.Numeric

full_name: SetTheory.PGame.lf_asymm
code: theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x 
goal: x ⧏ y → ¬y ⧏ x

full_name: SetTheory.PGame.le_of_lf
code: theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y 
goal: x ≤ y

full_name: SetTheory.PGame.lt_of_lf
code: theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y 
goal: x < y

full_name: SetTheory.PGame.lf_iff_lt
code: theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y 
goal: x ⧏ y ↔ x < y

full_name: SetTheory.PGame.le_iff_forall_lt
code: /-- Definition of `x ≤ y` on numeric pre-games, in terms of `<` -/
theorem le_iff_forall_lt {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
    x ≤ y ↔ (∀ i, x.moveLeft i < y) ∧ ∀ j, x < y.moveRight j 
goal: x ≤ y ↔ (∀ (i : x.LeftMoves), x.moveLeft i < y) ∧ ∀ (j : y.RightMoves), x < y.moveRight j

full_name: SetTheory.PGame.lt_iff_exists_le
code: /-- Definition of `x < y` on numeric pre-games, in terms of `≤` -/
theorem lt_iff_exists_le {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
    x < y ↔ (∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y 
goal: x < y ↔ (∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y

full_name: SetTheory.PGame.lt_of_exists_le
code: theorem lt_of_exists_le {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
    ((∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y) → x < y 
goal: ((∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y) → x < y

full_name: SetTheory.PGame.lt_def
code: /-- The definition of `x < y` on numeric pre-games, in terms of `<` two moves later. -/
theorem lt_def {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
    x < y ↔
      (∃ i, (∀ i', x.moveLeft i' < y.moveLeft i) ∧ ∀ j, x < (y.moveLeft i).moveRight j) ∨
        ∃ j, (∀ i, (x.moveRight j).moveLeft i < y) ∧ ∀ j', x.moveRight j < y.moveRight j' 
goal: x < y ↔
  (∃ i,
      (∀ (i' : x.LeftMoves), x.moveLeft i' < y.moveLeft i) ∧
        ∀ (j : (y.moveLeft i).RightMoves), x < (y.moveLeft i).moveRight j) ∨
    ∃ j,
      (∀ (i : (x.moveRight j).LeftMoves), (x.moveRight j).moveLeft i < y) ∧
        ∀ (j' : y.RightMoves), x.moveRight j < y.moveRight j'

full_name: SetTheory.PGame.not_fuzzy
code: theorem not_fuzzy {x y : PGame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y 
goal: ¬x ‖ y

full_name: SetTheory.PGame.lt_or_equiv_or_gt
code: theorem lt_or_equiv_or_gt {x y : PGame} (ox : Numeric x) (oy : Numeric y) :
    x < y ∨ (x ≈ y) ∨ y < x 
goal: x < y ∨ x ≈ y ∨ y < x

full_name: SetTheory.PGame.numeric_of_isEmpty
code: theorem numeric_of_isEmpty (x : PGame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x 
goal: x.Numeric

full_name: SetTheory.PGame.numeric_of_isEmpty_leftMoves
code: theorem numeric_of_isEmpty_leftMoves (x : PGame) [IsEmpty x.LeftMoves] :
    (∀ j, Numeric (x.moveRight j)) → Numeric x 
goal: (∀ (j : x.RightMoves), (x.moveRight j).Numeric) → x.Numeric

full_name: SetTheory.PGame.numeric_of_isEmpty_rightMoves
code: theorem numeric_of_isEmpty_rightMoves (x : PGame) [IsEmpty x.RightMoves]
    (H : ∀ i, Numeric (x.moveLeft i)) : Numeric x 
goal: x.Numeric

full_name: SetTheory.PGame.numeric_zero
code: theorem numeric_zero : Numeric 0 
goal: SetTheory.PGame.Numeric 0

full_name: SetTheory.PGame.numeric_one
code: theorem numeric_one : Numeric 1 
goal: SetTheory.PGame.Numeric 1

full_name: SetTheory.PGame.Numeric.neg
code: theorem Numeric.neg : ∀ {x : PGame} (_ : Numeric x), Numeric (-x)
  
goal: x.Numeric → (-x).Numeric

full_name: SetTheory.PGame.insertLeft_numeric
code: /-- Inserting a smaller numeric left option into a numeric game results in a numeric game. -/
theorem insertLeft_numeric {x x' : PGame} (x_num : x.Numeric) (x'_num : x'.Numeric)
    (h : x' ≤ x) : (insertLeft x x').Numeric 
goal: (x.insertLeft x').Numeric

full_name: SetTheory.PGame.insertRight_numeric
code: /-- Inserting a larger numeric right option into a numeric game results in a numeric game. -/
theorem insertRight_numeric {x x' : PGame} (x_num : x.Numeric) (x'_num : x'.Numeric)
    (h : x ≤ x') : (insertRight x x').Numeric 
goal: (x.insertRight x').Numeric

full_name: SetTheory.PGame.Numeric.moveLeft_lt
code: theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x 
goal: x.moveLeft i < x

full_name: SetTheory.PGame.Numeric.moveLeft_le
code: theorem moveLeft_le {x : PGame} (o : Numeric x) (i) : x.moveLeft i ≤ x 
goal: x.moveLeft i ≤ x

full_name: SetTheory.PGame.Numeric.lt_moveRight
code: theorem lt_moveRight {x : PGame} (o : Numeric x) (j) : x < x.moveRight j 
goal: x < x.moveRight j

full_name: SetTheory.PGame.Numeric.le_moveRight
code: theorem le_moveRight {x : PGame} (o : Numeric x) (j) : x ≤ x.moveRight j 
goal: x ≤ x.moveRight j

full_name: SetTheory.PGame.Numeric.add
code: theorem add : ∀ {x y : PGame} (_ : Numeric x) (_ : Numeric y), Numeric (x + y)
  
goal: x.Numeric → y.Numeric → (x + y).Numeric

full_name: SetTheory.PGame.Numeric.sub
code: theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) 
goal: (x - y).Numeric

full_name: SetTheory.PGame.numeric_nat
code: /-- Pre-games defined by natural numbers are numeric. -/
theorem numeric_nat : ∀ n : ℕ, Numeric n
  
goal: (↑n).Numeric

full_name: SetTheory.PGame.numeric_toPGame
code: /-- Ordinal games are numeric. -/
theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric 
goal: o.toPGame.Numeric

full_name: Surreal
code: /-- 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. -/
def Surreal 
goal: Type (u_1 + 1)

full_name: Surreal.mk
code: /-- Construct a surreal number from a numeric pre-game. -/
def mk (x : PGame) (h : x.Numeric) : Surreal 
goal: Surreal

full_name: Surreal.instZero
code: instance : Zero Surreal 
goal: Zero Surreal

full_name: Surreal.instOne
code: instance : One Surreal 
goal: One Surreal

full_name: Surreal.instInhabited
code: instance : Inhabited Surreal 
goal: Inhabited Surreal

full_name: Surreal.mk_eq_mk
code: lemma mk_eq_mk {x y : PGame.{u}} {hx hy} : mk x hx = mk y hy ↔ x ≈ y 
goal: Surreal.mk x hx = Surreal.mk y hy ↔ x ≈ y

full_name: Surreal.mk_eq_zero
code: lemma mk_eq_zero {x : PGame.{u}} {hx} : mk x hx = 0 ↔ x ≈ 0 
goal: Surreal.mk x hx = 0 ↔ x ≈ 0

full_name: Surreal.lift
code: /-- Lift an equivalence-respecting function on pre-games to surreals. -/
def lift {α} (f : ∀ x, Numeric x → α)
    (H : ∀ {x y} (hx : Numeric x) (hy : Numeric y), x.Equiv y → f x hx = f y hy) : Surreal → α 
goal: Surreal → α

full_name: Surreal.lift₂
code: /-- Lift a binary equivalence-respecting function on pre-games to surreals. -/
def lift₂ {α} (f : ∀ x y, Numeric x → Numeric y → α)
    (H :
      ∀ {x₁ y₁ x₂ y₂} (ox₁ : Numeric x₁) (oy₁ : Numeric y₁) (ox₂ : Numeric x₂) (oy₂ : Numeric y₂),
        x₁.Equiv x₂ → y₁.Equiv y₂ → f x₁ y₁ ox₁ oy₁ = f x₂ y₂ ox₂ oy₂) :
    Surreal → Surreal → α 
goal: Surreal → Surreal → α

full_name: Surreal.instLE
code: instance instLE : LE Surreal 
goal: LE Surreal

full_name: Surreal.mk_le_mk
code: @[simp]
lemma mk_le_mk {x y : PGame.{u}} {hx hy} : mk x hx ≤ mk y hy ↔ x ≤ y 
goal: Surreal.mk x hx ≤ Surreal.mk y hy ↔ x ≤ y

full_name: Surreal.zero_le_mk
code: lemma zero_le_mk {x : PGame.{u}} {hx} : 0 ≤ mk x hx ↔ 0 ≤ x 
goal: 0 ≤ Surreal.mk x hx ↔ 0 ≤ x

full_name: Surreal.instLT
code: instance instLT : LT Surreal 
goal: LT Surreal

full_name: Surreal.mk_lt_mk
code: lemma mk_lt_mk {x y : PGame.{u}} {hx hy} : mk x hx < mk y hy ↔ x < y 
goal: Surreal.mk x hx < Surreal.mk y hy ↔ x < y

full_name: Surreal.zero_lt_mk
code: lemma zero_lt_mk {x : PGame.{u}} {hx} : 0 < mk x hx ↔ 0 < x 
goal: 0 < Surreal.mk x hx ↔ 0 < x

full_name: Surreal.mk_moveLeft_lt_mk
code: /-- Same as `moveLeft_lt`, but for `Surreal` instead of `PGame` -/
theorem mk_moveLeft_lt_mk {x : PGame} (o : Numeric x) (i) :
    Surreal.mk (x.moveLeft i) (Numeric.moveLeft o i) < Surreal.mk x o 
goal: Surreal.mk (x.moveLeft i) ⋯ < Surreal.mk x o

full_name: Surreal.mk_lt_mk_moveRight
code: /-- Same as `lt_moveRight`, but for `Surreal` instead of `PGame` -/
theorem mk_lt_mk_moveRight {x : PGame} (o : Numeric x) (j) :
    Surreal.mk x o < Surreal.mk (x.moveRight j) (Numeric.moveRight o j) 
goal: Surreal.mk x o < Surreal.mk (x.moveRight j) ⋯

full_name: Surreal.instAdd
code: /-- 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}`. -/
instance : Add Surreal 
goal: Add Surreal

full_name: Surreal.instNeg
code: /-- Negation for surreal numbers is inherited from pre-game negation:
the negation of `{L | R}` is `{-R | -L}`. -/
instance : Neg Surreal 
goal: Neg Surreal

full_name: Surreal.orderedAddCommGroup
code: instance orderedAddCommGroup : OrderedAddCommGroup Surreal 
goal: OrderedAddCommGroup Surreal

full_name: Surreal.mk_add
code: lemma mk_add {x y : PGame} (hx : x.Numeric) (hy : y.Numeric) :
    Surreal.mk (x + y) (hx.add hy) = Surreal.mk x hx + Surreal.mk y hy 
goal: Surreal.mk (x + y) ⋯ = Surreal.mk x hx + Surreal.mk y hy

full_name: Surreal.mk_sub
code: lemma mk_sub {x y : PGame} (hx : x.Numeric) (hy : y.Numeric) :
    Surreal.mk (x - y) (hx.sub hy) = Surreal.mk x hx - Surreal.mk y hy 
goal: Surreal.mk (x - y) ⋯ = Surreal.mk x hx - Surreal.mk y hy

full_name: Surreal.zero_def
code: lemma zero_def : 0 = mk 0 numeric_zero 
goal: 0 = Surreal.mk 0 SetTheory.PGame.numeric_zero

full_name: Surreal.instLinearOrderedAddCommGroup
code: noncomputable instance : LinearOrderedAddCommGroup Surreal 
goal: LinearOrderedAddCommGroup Surreal

full_name: Surreal.instAddMonoidWithOne
code: instance : AddMonoidWithOne Surreal 
goal: AddMonoidWithOne Surreal

full_name: Surreal.toGame
code: /-- Casts a `Surreal` number into a `Game`. -/
def toGame : Surreal →+o Game 
goal: Surreal →+o SetTheory.Game

full_name: Surreal.zero_toGame
code: theorem zero_toGame : toGame 0 = 0 
goal: Surreal.toGame 0 = 0

full_name: Surreal.one_toGame
code: @[simp]
theorem one_toGame : toGame 1 = 1 
goal: Surreal.toGame 1 = 1

full_name: Surreal.nat_toGame
code: @[simp]
theorem nat_toGame : ∀ n : ℕ, toGame n = n 
goal: Surreal.toGame ↑n = ↑n

full_name: Surreal.bddAbove_range_of_small
code: /-- A small family of surreals is bounded above. -/
lemma bddAbove_range_of_small {ι : Type*} [Small.{u} ι] (f : ι → Surreal.{u}) :
    BddAbove (Set.range f) 
goal: BddAbove (Set.range f)

full_name: Surreal.bddAbove_of_small
code: /-- A small set of surreals is bounded above. -/
lemma bddAbove_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddAbove s 
goal: BddAbove s

full_name: Surreal.bddBelow_range_of_small
code: /-- A small family of surreals is bounded below. -/
lemma bddBelow_range_of_small {ι : Type*} [Small.{u} ι] (f : ι → Surreal.{u}) :
    BddBelow (Set.range f) 
goal: BddBelow (Set.range f)

full_name: Surreal.bddBelow_of_small
code: /-- A small set of surreals is bounded below. -/
lemma bddBelow_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddBelow s 
goal: BddBelow s

full_name: Ordinal.toSurreal
code: /-- Converts an ordinal into the corresponding surreal. -/
noncomputable def toSurreal : Ordinal ↪o Surreal 
goal: Ordinal.{u_1} ↪o Surreal