set_theory.surreal.basic
⟷
Mathlib.SetTheory.Surreal.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
@@ -328,6 +328,34 @@ theorem zero_to_game : to_game 0 = 0 := rfl
@[simp] theorem one_to_game : to_game 1 = 1 := rfl
@[simp] theorem nat_to_game : ∀ n : ℕ, to_game n = n := map_nat_cast' _ one_to_game
+theorem upper_bound_numeric {ι : Type u} {f : ι → pgame.{u}} (H : ∀ i, (f i).numeric) :
+ (upper_bound f).numeric :=
+numeric_of_is_empty_right_moves _ $ λ i, (H _).move_left _
+
+theorem lower_bound_numeric {ι : Type u} {f : ι → pgame.{u}} (H : ∀ i, (f i).numeric) :
+ (lower_bound f).numeric :=
+numeric_of_is_empty_left_moves _ $ λ i, (H _).move_right _
+
+/-- A small set `s` of surreals is bounded above. -/
+lemma bdd_above_of_small (s : set surreal.{u}) [small.{u} s] : bdd_above s :=
+begin
+ let g := subtype.val ∘ quotient.out ∘ subtype.val ∘ (equiv_shrink s).symm,
+ refine ⟨mk (upper_bound g) (upper_bound_numeric $ λ i, subtype.prop _), λ i hi, _⟩,
+ rw ←quotient.out_eq i,
+ show i.out.1 ≤ _,
+ simpa [g] using le_upper_bound g (equiv_shrink s ⟨i, hi⟩)
+end
+
+/-- A small set `s` of surreals is bounded below. -/
+lemma bdd_below_of_small (s : set surreal.{u}) [small.{u} s] : bdd_below s :=
+begin
+ let g := subtype.val ∘ quotient.out ∘ subtype.val ∘ (equiv_shrink s).symm,
+ refine ⟨mk (lower_bound g) (lower_bound_numeric $ λ i, subtype.prop _), λ i hi, _⟩,
+ rw ←quotient.out_eq i,
+ show _ ≤ i.out.1,
+ simpa [g] using lower_bound_le g (equiv_shrink s ⟨i, hi⟩)
+end
+
end surreal
open surreal
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -516,6 +516,7 @@ theorem lowerBound_numeric {ι : Type u} {f : ι → SetTheory.PGame.{u}} (H :
SetTheory.PGame.numeric_of_isEmpty_leftMoves _ fun i => (H _).moveRight _
#align surreal.lower_bound_numeric Surreal.lowerBound_numeric
+#print Surreal.bddAbove_of_small /-
/-- A small set `s` of surreals is bounded above. -/
theorem bddAbove_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddAbove s :=
by
@@ -525,7 +526,9 @@ theorem bddAbove_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddAbove s :=
show i.out.1 ≤ _
simpa [g] using le_upper_bound g (equivShrink s ⟨i, hi⟩)
#align surreal.bdd_above_of_small Surreal.bddAbove_of_small
+-/
+#print Surreal.bddBelow_of_small /-
/-- A small set `s` of surreals is bounded below. -/
theorem bddBelow_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddBelow s :=
by
@@ -535,6 +538,7 @@ theorem bddBelow_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddBelow s :=
show _ ≤ i.out.1
simpa [g] using lower_bound_le g (equivShrink s ⟨i, hi⟩)
#align surreal.bdd_below_of_small Surreal.bddBelow_of_small
+-/
end Surreal
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -468,7 +468,7 @@ noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{
Surreal.orderedAddCommGroup with
le_total := by
- rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical <;>
+ rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical skip <;>
exact Classical.or_iff_not_imp_left.2 fun h => (SetTheory.PGame.not_le.1 h).le oy ox
decidableLe := Classical.decRel _ }
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -468,7 +468,7 @@ noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{
Surreal.orderedAddCommGroup with
le_total := by
- rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical skip <;>
+ rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical <;>
exact Classical.or_iff_not_imp_left.2 fun h => (SetTheory.PGame.not_le.1 h).le oy ox
decidableLe := Classical.decRel _ }
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -469,7 +469,7 @@ noncomputable instance : LinearOrderedAddCommGroup Surreal :=
Surreal.orderedAddCommGroup with
le_total := by
rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical skip <;>
- exact or_iff_not_imp_left.2 fun h => (SetTheory.PGame.not_le.1 h).le oy ox
+ exact Classical.or_iff_not_imp_left.2 fun h => (SetTheory.PGame.not_le.1 h).le oy ox
decidableLe := Classical.decRel _ }
instance : AddMonoidWithOne Surreal :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison
-/
-import Mathbin.Algebra.Order.Hom.Monoid
-import Mathbin.SetTheory.Game.Ordinal
+import Algebra.Order.Hom.Monoid
+import SetTheory.Game.Ordinal
#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
mathlib commit https://github.com/leanprover-community/mathlib/commit/001ffdc42920050657fd45bd2b8bfbec8eaaeb29
@@ -169,7 +169,7 @@ theorem SetTheory.PGame.le_of_lf {x y : SetTheory.PGame} (h : x ⧏ y)
-/
alias lf.le := le_of_lf
-#align pgame.lf.le SetTheory.PGame.Lf.le
+#align pgame.lf.le SetTheory.PGame.LF.le
#print SetTheory.PGame.lt_of_lf /-
theorem SetTheory.PGame.lt_of_lf {x y : SetTheory.PGame} (h : x ⧏ y)
@@ -179,7 +179,7 @@ theorem SetTheory.PGame.lt_of_lf {x y : SetTheory.PGame} (h : x ⧏ y)
-/
alias lf.lt := lt_of_lf
-#align pgame.lf.lt SetTheory.PGame.Lf.lt
+#align pgame.lf.lt SetTheory.PGame.LF.lt
#print SetTheory.PGame.lf_iff_lt /-
theorem SetTheory.PGame.lf_iff_lt {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
mathlib commit https://github.com/leanprover-community/mathlib/commit/442a83d738cb208d3600056c489be16900ba701d
@@ -59,91 +59,97 @@ The branch `surreal_mul` contains some progress on this proof.
universe u
-open scoped PGame
+open scoped SetTheory.PGame
-namespace PGame
+namespace SetTheory.PGame
-#print PGame.Numeric /-
+#print SetTheory.PGame.Numeric /-
/-- 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
+def SetTheory.PGame.Numeric : SetTheory.PGame → Prop
| ⟨l, r, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, numeric (L i)) ∧ ∀ j, numeric (R j)
-#align pgame.numeric PGame.Numeric
+#align pgame.numeric SetTheory.PGame.Numeric
-/
-#print PGame.numeric_def /-
-theorem numeric_def {x : PGame} :
- Numeric x ↔
+#print SetTheory.PGame.numeric_def /-
+theorem SetTheory.PGame.numeric_def {x : SetTheory.PGame} :
+ SetTheory.PGame.Numeric x ↔
(∀ i j, x.moveLeft i < x.moveRight j) ∧
- (∀ i, Numeric (x.moveLeft i)) ∧ ∀ j, Numeric (x.moveRight j) :=
+ (∀ i, SetTheory.PGame.Numeric (x.moveLeft i)) ∧
+ ∀ j, SetTheory.PGame.Numeric (x.moveRight j) :=
by cases x; rfl
-#align pgame.numeric_def PGame.numeric_def
+#align pgame.numeric_def SetTheory.PGame.numeric_def
-/
namespace Numeric
-#print PGame.Numeric.mk /-
-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 :=
- numeric_def.2 ⟨h₁, h₂, h₃⟩
-#align pgame.numeric.mk PGame.Numeric.mk
+#print SetTheory.PGame.Numeric.mk /-
+theorem SetTheory.PGame.Numeric.mk {x : SetTheory.PGame} (h₁ : ∀ i j, x.moveLeft i < x.moveRight j)
+ (h₂ : ∀ i, SetTheory.PGame.Numeric (x.moveLeft i))
+ (h₃ : ∀ j, SetTheory.PGame.Numeric (x.moveRight j)) : SetTheory.PGame.Numeric x :=
+ SetTheory.PGame.numeric_def.2 ⟨h₁, h₂, h₃⟩
+#align pgame.numeric.mk SetTheory.PGame.Numeric.mk
-/
-#print PGame.Numeric.left_lt_right /-
-theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
- x.moveLeft i < x.moveRight j := by cases x; exact o.1 i j
-#align pgame.numeric.left_lt_right PGame.Numeric.left_lt_right
+#print SetTheory.PGame.Numeric.left_lt_right /-
+theorem SetTheory.PGame.Numeric.left_lt_right {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (i : x.LeftMoves) (j : x.RightMoves) : x.moveLeft i < x.moveRight j := by cases x; exact o.1 i j
+#align pgame.numeric.left_lt_right SetTheory.PGame.Numeric.left_lt_right
-/
-#print PGame.Numeric.moveLeft /-
-theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) := by
- cases x; exact o.2.1 i
-#align pgame.numeric.move_left PGame.Numeric.moveLeft
+#print SetTheory.PGame.Numeric.moveLeft /-
+theorem SetTheory.PGame.Numeric.moveLeft {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (i : x.LeftMoves) : SetTheory.PGame.Numeric (x.moveLeft i) := by cases x; exact o.2.1 i
+#align pgame.numeric.move_left SetTheory.PGame.Numeric.moveLeft
-/
-#print PGame.Numeric.moveRight /-
-theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) := by
- cases x; exact o.2.2 j
-#align pgame.numeric.move_right PGame.Numeric.moveRight
+#print SetTheory.PGame.Numeric.moveRight /-
+theorem SetTheory.PGame.Numeric.moveRight {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (j : x.RightMoves) : SetTheory.PGame.Numeric (x.moveRight j) := by cases x; exact o.2.2 j
+#align pgame.numeric.move_right SetTheory.PGame.Numeric.moveRight
-/
end Numeric
-#print PGame.numeric_rec /-
+#print SetTheory.PGame.numeric_rec /-
@[elab_as_elim]
-theorem numeric_rec {C : PGame → Prop}
+theorem SetTheory.PGame.numeric_rec {C : SetTheory.PGame → Prop}
(H :
- ∀ (l r) (L : l → PGame) (R : r → PGame),
+ ∀ (l r) (L : l → SetTheory.PGame) (R : r → SetTheory.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
+ (∀ i, SetTheory.PGame.Numeric (L i)) →
+ (∀ i, SetTheory.PGame.Numeric (R i)) →
+ (∀ i, C (L i)) → (∀ i, C (R i)) → C ⟨l, r, L, R⟩) :
+ ∀ x, SetTheory.PGame.Numeric x → C x
| ⟨l, r, L, R⟩, ⟨h, hl, hr⟩ =>
H _ _ _ _ h hl hr (fun i => numeric_rec _ (hl i)) fun i => numeric_rec _ (hr i)
-#align pgame.numeric_rec PGame.numeric_rec
+#align pgame.numeric_rec SetTheory.PGame.numeric_rec
-/
-#print PGame.Relabelling.numeric_imp /-
-theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) : Numeric y :=
+#print SetTheory.PGame.Relabelling.numeric_imp /-
+theorem SetTheory.PGame.Relabelling.numeric_imp {x y : SetTheory.PGame} (r : x ≡r y)
+ (ox : SetTheory.PGame.Numeric x) : SetTheory.PGame.Numeric y :=
by
- induction' x using PGame.moveRecOn with x IHl IHr generalizing y
+ induction' x using SetTheory.PGame.moveRecOn with x IHl IHr generalizing y
apply numeric.mk (fun i j => _) (fun i => _) fun j => _
· rw [← lt_congr (r.move_left_symm i).Equiv (r.move_right_symm j).Equiv]
apply ox.left_lt_right
· exact IHl _ (ox.move_left _) (r.move_left_symm i)
· exact IHr _ (ox.move_right _) (r.move_right_symm j)
-#align pgame.relabelling.numeric_imp PGame.Relabelling.numeric_imp
+#align pgame.relabelling.numeric_imp SetTheory.PGame.Relabelling.numeric_imp
-/
-#print PGame.Relabelling.numeric_congr /-
+#print SetTheory.PGame.Relabelling.numeric_congr /-
/-- Relabellings preserve being numeric. -/
-theorem Relabelling.numeric_congr {x y : PGame} (r : x ≡r y) : Numeric x ↔ Numeric y :=
+theorem SetTheory.PGame.Relabelling.numeric_congr {x y : SetTheory.PGame} (r : x ≡r y) :
+ SetTheory.PGame.Numeric x ↔ SetTheory.PGame.Numeric y :=
⟨r.numeric_imp, r.symm.numeric_imp⟩
-#align pgame.relabelling.numeric_congr PGame.Relabelling.numeric_congr
+#align pgame.relabelling.numeric_congr SetTheory.PGame.Relabelling.numeric_congr
-/
-#print PGame.lf_asymm /-
-theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x :=
+#print SetTheory.PGame.lf_asymm /-
+theorem SetTheory.PGame.lf_asymm {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
+ (oy : SetTheory.PGame.Numeric y) : x ⧏ y → ¬y ⧏ x :=
by
refine' numeric_rec (fun xl xr xL xR hx oxl oxr IHxl IHxr => _) x ox y oy
refine' numeric_rec fun yl yr yL yR hy oyl oyr IHyl IHyr => _
@@ -152,61 +158,64 @@ theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y →
· exact (le_trans h₂ h₁).not_gf (lf_of_lt (hy _ _))
· exact (le_trans h₁ h₂).not_gf (lf_of_lt (hx _ _))
· exact IHxr _ _ (oyr _) (h₁.lf_move_right _) (h₂.lf_move_right _)
-#align pgame.lf_asymm PGame.lf_asymm
+#align pgame.lf_asymm SetTheory.PGame.lf_asymm
-/
-#print PGame.le_of_lf /-
-theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y :=
- not_lf.1 (lf_asymm ox oy h)
-#align pgame.le_of_lf PGame.le_of_lf
+#print SetTheory.PGame.le_of_lf /-
+theorem SetTheory.PGame.le_of_lf {x y : SetTheory.PGame} (h : x ⧏ y)
+ (ox : SetTheory.PGame.Numeric x) (oy : SetTheory.PGame.Numeric y) : x ≤ y :=
+ SetTheory.PGame.not_lf.1 (SetTheory.PGame.lf_asymm ox oy h)
+#align pgame.le_of_lf SetTheory.PGame.le_of_lf
-/
alias lf.le := le_of_lf
-#align pgame.lf.le PGame.Lf.le
+#align pgame.lf.le SetTheory.PGame.Lf.le
-#print PGame.lt_of_lf /-
-theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
- (lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
-#align pgame.lt_of_lf PGame.lt_of_lf
+#print SetTheory.PGame.lt_of_lf /-
+theorem SetTheory.PGame.lt_of_lf {x y : SetTheory.PGame} (h : x ⧏ y)
+ (ox : SetTheory.PGame.Numeric x) (oy : SetTheory.PGame.Numeric y) : x < y :=
+ (SetTheory.PGame.lt_or_fuzzy_of_lf h).resolve_right (SetTheory.PGame.not_fuzzy_of_le (h.le ox oy))
+#align pgame.lt_of_lf SetTheory.PGame.lt_of_lf
-/
alias lf.lt := lt_of_lf
-#align pgame.lf.lt PGame.Lf.lt
+#align pgame.lf.lt SetTheory.PGame.Lf.lt
-#print PGame.lf_iff_lt /-
-theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
- ⟨fun h => h.lt ox oy, lf_of_lt⟩
-#align pgame.lf_iff_lt PGame.lf_iff_lt
+#print SetTheory.PGame.lf_iff_lt /-
+theorem SetTheory.PGame.lf_iff_lt {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
+ (oy : SetTheory.PGame.Numeric y) : x ⧏ y ↔ x < y :=
+ ⟨fun h => h.lt ox oy, SetTheory.PGame.lf_of_lt⟩
+#align pgame.lf_iff_lt SetTheory.PGame.lf_iff_lt
-/
-#print PGame.le_iff_forall_lt /-
+#print SetTheory.PGame.le_iff_forall_lt /-
/-- 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) :
+theorem SetTheory.PGame.le_iff_forall_lt {x y : SetTheory.PGame} (ox : x.Numeric) (oy : y.Numeric) :
x ≤ y ↔ (∀ i, x.moveLeft i < y) ∧ ∀ j, x < y.moveRight j := by
refine' le_iff_forall_lf.trans (and_congr _ _) <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
-#align pgame.le_iff_forall_lt PGame.le_iff_forall_lt
+#align pgame.le_iff_forall_lt SetTheory.PGame.le_iff_forall_lt
-/
-#print PGame.lt_iff_exists_le /-
+#print SetTheory.PGame.lt_iff_exists_le /-
/-- 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) :
+theorem SetTheory.PGame.lt_iff_exists_le {x y : SetTheory.PGame} (ox : x.Numeric) (oy : y.Numeric) :
x < y ↔ (∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y := by
rw [← lf_iff_lt ox oy, lf_iff_exists_le]
-#align pgame.lt_iff_exists_le PGame.lt_iff_exists_le
+#align pgame.lt_iff_exists_le SetTheory.PGame.lt_iff_exists_le
-/
-#print PGame.lt_of_exists_le /-
-theorem lt_of_exists_le {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
+#print SetTheory.PGame.lt_of_exists_le /-
+theorem SetTheory.PGame.lt_of_exists_le {x y : SetTheory.PGame} (ox : x.Numeric) (oy : y.Numeric) :
((∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y) → x < y :=
- (lt_iff_exists_le ox oy).2
-#align pgame.lt_of_exists_le PGame.lt_of_exists_le
+ (SetTheory.PGame.lt_iff_exists_le ox oy).2
+#align pgame.lt_of_exists_le SetTheory.PGame.lt_of_exists_le
-/
-#print PGame.lt_def /-
+#print SetTheory.PGame.lt_def /-
/-- 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) :
+theorem SetTheory.PGame.lt_def {x y : SetTheory.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' :=
@@ -215,89 +224,100 @@ theorem lt_def {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
refine' or_congr _ _ <;> refine' exists_congr fun x_1 => _ <;> refine' and_congr _ _ <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
-#align pgame.lt_def PGame.lt_def
+#align pgame.lt_def SetTheory.PGame.lt_def
-/
-#print PGame.not_fuzzy /-
-theorem not_fuzzy {x y : PGame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y := fun h =>
- not_lf.2 ((lf_of_fuzzy h).le ox oy) h.2
-#align pgame.not_fuzzy PGame.not_fuzzy
+#print SetTheory.PGame.not_fuzzy /-
+theorem SetTheory.PGame.not_fuzzy {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
+ (oy : SetTheory.PGame.Numeric y) : ¬SetTheory.PGame.Fuzzy x y := fun h =>
+ SetTheory.PGame.not_lf.2 ((SetTheory.PGame.lf_of_fuzzy h).le ox oy) h.2
+#align pgame.not_fuzzy SetTheory.PGame.not_fuzzy
-/
-#print PGame.lt_or_equiv_or_gt /-
-theorem lt_or_equiv_or_gt {x y : PGame} (ox : Numeric x) (oy : Numeric y) :
- x < y ∨ (x ≈ y) ∨ y < x :=
- ((lf_or_equiv_or_gf x y).imp fun h => h.lt ox oy) <| Or.imp_right fun h => h.lt oy ox
-#align pgame.lt_or_equiv_or_gt PGame.lt_or_equiv_or_gt
+#print SetTheory.PGame.lt_or_equiv_or_gt /-
+theorem SetTheory.PGame.lt_or_equiv_or_gt {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
+ (oy : SetTheory.PGame.Numeric y) : x < y ∨ (x ≈ y) ∨ y < x :=
+ ((SetTheory.PGame.lf_or_equiv_or_gf x y).imp fun h => h.lt ox oy) <|
+ Or.imp_right fun h => h.lt oy ox
+#align pgame.lt_or_equiv_or_gt SetTheory.PGame.lt_or_equiv_or_gt
-/
-#print PGame.numeric_of_isEmpty /-
-theorem numeric_of_isEmpty (x : PGame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x :=
- Numeric.mk isEmptyElim isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty PGame.numeric_of_isEmpty
+#print SetTheory.PGame.numeric_of_isEmpty /-
+theorem SetTheory.PGame.numeric_of_isEmpty (x : SetTheory.PGame) [IsEmpty x.LeftMoves]
+ [IsEmpty x.RightMoves] : SetTheory.PGame.Numeric x :=
+ SetTheory.PGame.Numeric.mk isEmptyElim isEmptyElim isEmptyElim
+#align pgame.numeric_of_is_empty SetTheory.PGame.numeric_of_isEmpty
-/
-#print PGame.numeric_of_isEmpty_leftMoves /-
-theorem numeric_of_isEmpty_leftMoves (x : PGame) [IsEmpty x.LeftMoves] :
- (∀ j, Numeric (x.moveRight j)) → Numeric x :=
- Numeric.mk isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty_left_moves PGame.numeric_of_isEmpty_leftMoves
+#print SetTheory.PGame.numeric_of_isEmpty_leftMoves /-
+theorem SetTheory.PGame.numeric_of_isEmpty_leftMoves (x : SetTheory.PGame) [IsEmpty x.LeftMoves] :
+ (∀ j, SetTheory.PGame.Numeric (x.moveRight j)) → SetTheory.PGame.Numeric x :=
+ SetTheory.PGame.Numeric.mk isEmptyElim isEmptyElim
+#align pgame.numeric_of_is_empty_left_moves SetTheory.PGame.numeric_of_isEmpty_leftMoves
-/
-#print PGame.numeric_of_isEmpty_rightMoves /-
-theorem numeric_of_isEmpty_rightMoves (x : PGame) [IsEmpty x.RightMoves]
- (H : ∀ i, Numeric (x.moveLeft i)) : Numeric x :=
- Numeric.mk (fun _ => isEmptyElim) H isEmptyElim
-#align pgame.numeric_of_is_empty_right_moves PGame.numeric_of_isEmpty_rightMoves
+#print SetTheory.PGame.numeric_of_isEmpty_rightMoves /-
+theorem SetTheory.PGame.numeric_of_isEmpty_rightMoves (x : SetTheory.PGame) [IsEmpty x.RightMoves]
+ (H : ∀ i, SetTheory.PGame.Numeric (x.moveLeft i)) : SetTheory.PGame.Numeric x :=
+ SetTheory.PGame.Numeric.mk (fun _ => isEmptyElim) H isEmptyElim
+#align pgame.numeric_of_is_empty_right_moves SetTheory.PGame.numeric_of_isEmpty_rightMoves
-/
-#print PGame.numeric_zero /-
-theorem numeric_zero : Numeric 0 :=
- numeric_of_isEmpty 0
-#align pgame.numeric_zero PGame.numeric_zero
+#print SetTheory.PGame.numeric_zero /-
+theorem SetTheory.PGame.numeric_zero : SetTheory.PGame.Numeric 0 :=
+ SetTheory.PGame.numeric_of_isEmpty 0
+#align pgame.numeric_zero SetTheory.PGame.numeric_zero
-/
-#print PGame.numeric_one /-
-theorem numeric_one : Numeric 1 :=
- numeric_of_isEmpty_rightMoves 1 fun _ => numeric_zero
-#align pgame.numeric_one PGame.numeric_one
+#print SetTheory.PGame.numeric_one /-
+theorem SetTheory.PGame.numeric_one : SetTheory.PGame.Numeric 1 :=
+ SetTheory.PGame.numeric_of_isEmpty_rightMoves 1 fun _ => SetTheory.PGame.numeric_zero
+#align pgame.numeric_one SetTheory.PGame.numeric_one
-/
-#print PGame.Numeric.neg /-
-theorem Numeric.neg : ∀ {x : PGame} (o : Numeric x), Numeric (-x)
+#print SetTheory.PGame.Numeric.neg /-
+theorem SetTheory.PGame.Numeric.neg :
+ ∀ {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x), SetTheory.PGame.Numeric (-x)
| ⟨l, r, L, R⟩, o =>
- ⟨fun j i => neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i => (o.2.1 i).neg⟩
-#align pgame.numeric.neg PGame.Numeric.neg
+ ⟨fun j i => SetTheory.PGame.neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i =>
+ (o.2.1 i).neg⟩
+#align pgame.numeric.neg SetTheory.PGame.Numeric.neg
-/
namespace Numeric
-#print PGame.Numeric.moveLeft_lt /-
-theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x :=
- (moveLeft_lf i).lt (o.moveLeft i) o
-#align pgame.numeric.move_left_lt PGame.Numeric.moveLeft_lt
+#print SetTheory.PGame.Numeric.moveLeft_lt /-
+theorem SetTheory.PGame.Numeric.moveLeft_lt {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (i) : x.moveLeft i < x :=
+ (SetTheory.PGame.moveLeft_lf i).lt (o.moveLeft i) o
+#align pgame.numeric.move_left_lt SetTheory.PGame.Numeric.moveLeft_lt
-/
-#print PGame.Numeric.moveLeft_le /-
-theorem moveLeft_le {x : PGame} (o : Numeric x) (i) : x.moveLeft i ≤ x :=
+#print SetTheory.PGame.Numeric.moveLeft_le /-
+theorem SetTheory.PGame.Numeric.moveLeft_le {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (i) : x.moveLeft i ≤ x :=
(o.moveLeft_lt i).le
-#align pgame.numeric.move_left_le PGame.Numeric.moveLeft_le
+#align pgame.numeric.move_left_le SetTheory.PGame.Numeric.moveLeft_le
-/
-#print PGame.Numeric.lt_moveRight /-
-theorem lt_moveRight {x : PGame} (o : Numeric x) (j) : x < x.moveRight j :=
- (lf_moveRight j).lt o (o.moveRight j)
-#align pgame.numeric.lt_move_right PGame.Numeric.lt_moveRight
+#print SetTheory.PGame.Numeric.lt_moveRight /-
+theorem SetTheory.PGame.Numeric.lt_moveRight {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (j) : x < x.moveRight j :=
+ (SetTheory.PGame.lf_moveRight j).lt o (o.moveRight j)
+#align pgame.numeric.lt_move_right SetTheory.PGame.Numeric.lt_moveRight
-/
-#print PGame.Numeric.le_moveRight /-
-theorem le_moveRight {x : PGame} (o : Numeric x) (j) : x ≤ x.moveRight j :=
+#print SetTheory.PGame.Numeric.le_moveRight /-
+theorem SetTheory.PGame.Numeric.le_moveRight {x : SetTheory.PGame} (o : SetTheory.PGame.Numeric x)
+ (j) : x ≤ x.moveRight j :=
(o.lt_moveRight j).le
-#align pgame.numeric.le_move_right PGame.Numeric.le_moveRight
+#align pgame.numeric.le_move_right SetTheory.PGame.Numeric.le_moveRight
-/
-#print PGame.Numeric.add /-
-theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x + y)
+#print SetTheory.PGame.Numeric.add /-
+theorem SetTheory.PGame.Numeric.add :
+ ∀ {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x) (oy : SetTheory.PGame.Numeric y),
+ SetTheory.PGame.Numeric (x + y)
| ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, ox, oy =>
⟨by
rintro (ix | iy) (jx | jy)
@@ -320,45 +340,46 @@ theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x +
· apply (ox.move_right jx).add oy
· apply ox.add (oy.move_right jy)⟩
decreasing_by pgame_wf_tac
-#align pgame.numeric.add PGame.Numeric.add
+#align pgame.numeric.add SetTheory.PGame.Numeric.add
-/
-#print PGame.Numeric.sub /-
-theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
+#print SetTheory.PGame.Numeric.sub /-
+theorem SetTheory.PGame.Numeric.sub {x y : SetTheory.PGame} (ox : SetTheory.PGame.Numeric x)
+ (oy : SetTheory.PGame.Numeric y) : SetTheory.PGame.Numeric (x - y) :=
ox.add oy.neg
-#align pgame.numeric.sub PGame.Numeric.sub
+#align pgame.numeric.sub SetTheory.PGame.Numeric.sub
-/
end Numeric
-#print PGame.numeric_nat /-
+#print SetTheory.PGame.numeric_nat /-
/-- Pre-games defined by natural numbers are numeric. -/
-theorem numeric_nat : ∀ n : ℕ, Numeric n
- | 0 => numeric_zero
- | n + 1 => (numeric_nat n).add numeric_one
-#align pgame.numeric_nat PGame.numeric_nat
+theorem SetTheory.PGame.numeric_nat : ∀ n : ℕ, SetTheory.PGame.Numeric n
+ | 0 => SetTheory.PGame.numeric_zero
+ | n + 1 => (numeric_nat n).add SetTheory.PGame.numeric_one
+#align pgame.numeric_nat SetTheory.PGame.numeric_nat
-/
-#print PGame.numeric_toPGame /-
+#print SetTheory.PGame.numeric_toPGame /-
/-- Ordinal games are numeric. -/
-theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric :=
+theorem SetTheory.PGame.numeric_toPGame (o : Ordinal) : o.toPGame.Numeric :=
by
induction' o using Ordinal.induction with o IH
apply numeric_of_is_empty_right_moves
simpa using fun i => IH _ (Ordinal.toLeftMovesToPGame_symm_lt i)
-#align pgame.numeric_to_pgame PGame.numeric_toPGame
+#align pgame.numeric_to_pgame SetTheory.PGame.numeric_toPGame
-/
-end PGame
+end SetTheory.PGame
-open PGame
+open SetTheory.PGame
#print Surreal /-
/-- 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 :=
- Quotient (Subtype.setoid Numeric)
+ Quotient (Subtype.setoid SetTheory.PGame.Numeric)
#align surreal Surreal
-/
@@ -366,57 +387,65 @@ namespace Surreal
#print Surreal.mk /-
/-- Construct a surreal number from a numeric pre-game. -/
-def mk (x : PGame) (h : x.Numeric) : Surreal :=
+def mk (x : SetTheory.PGame) (h : x.Numeric) : Surreal :=
⟦⟨x, h⟩⟧
#align surreal.mk Surreal.mk
-/
instance : Zero Surreal :=
- ⟨mk 0 numeric_zero⟩
+ ⟨mk 0 SetTheory.PGame.numeric_zero⟩
instance : One Surreal :=
- ⟨mk 1 numeric_one⟩
+ ⟨mk 1 SetTheory.PGame.numeric_one⟩
instance : Inhabited Surreal :=
⟨0⟩
#print Surreal.lift /-
/-- 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 → α :=
- Quotient.lift (fun x : { x // Numeric x } => f x.1 x.2) fun x y => H x.2 y.2
+def lift {α} (f : ∀ x, SetTheory.PGame.Numeric x → α)
+ (H :
+ ∀ {x y} (hx : SetTheory.PGame.Numeric x) (hy : SetTheory.PGame.Numeric y),
+ x.Equiv y → f x hx = f y hy) :
+ Surreal → α :=
+ Quotient.lift (fun x : { x // SetTheory.PGame.Numeric x } => f x.1 x.2) fun x y => H x.2 y.2
#align surreal.lift Surreal.lift
-/
#print Surreal.lift₂ /-
/-- Lift a binary equivalence-respecting function on pre-games to surreals. -/
-def lift₂ {α} (f : ∀ x y, Numeric x → Numeric y → α)
+def lift₂ {α} (f : ∀ x y, SetTheory.PGame.Numeric x → SetTheory.PGame.Numeric y → α)
(H :
- ∀ {x₁ y₁ x₂ y₂} (ox₁ : Numeric x₁) (oy₁ : Numeric y₁) (ox₂ : Numeric x₂) (oy₂ : Numeric y₂),
+ ∀ {x₁ y₁ x₂ y₂} (ox₁ : SetTheory.PGame.Numeric x₁) (oy₁ : SetTheory.PGame.Numeric y₁)
+ (ox₂ : SetTheory.PGame.Numeric x₂) (oy₂ : SetTheory.PGame.Numeric y₂),
x₁.Equiv x₂ → y₁.Equiv y₂ → f x₁ y₁ ox₁ oy₁ = f x₂ y₂ ox₂ oy₂) :
Surreal → Surreal → α :=
- lift (fun x ox => lift (fun y oy => f x y ox oy) fun y₁ y₂ oy₁ oy₂ => H _ _ _ _ equiv_rfl)
+ lift
+ (fun x ox =>
+ lift (fun y oy => f x y ox oy) fun y₁ y₂ oy₁ oy₂ => H _ _ _ _ SetTheory.PGame.equiv_rfl)
fun x₁ x₂ ox₁ ox₂ h => funext <| Quotient.ind fun ⟨y, oy⟩ => H _ _ _ _ h equiv_rfl
#align surreal.lift₂ Surreal.lift₂
-/
instance : LE Surreal :=
- ⟨lift₂ (fun x y _ _ => x ≤ y) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy => propext (le_congr hx hy)⟩
+ ⟨lift₂ (fun x y _ _ => x ≤ y) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy =>
+ propext (SetTheory.PGame.le_congr hx hy)⟩
instance : LT Surreal :=
- ⟨lift₂ (fun x y _ _ => x < y) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy => propext (lt_congr hx hy)⟩
+ ⟨lift₂ (fun x y _ _ => x < y) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy =>
+ propext (SetTheory.PGame.lt_congr hx hy)⟩
/-- 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 :=
- ⟨Surreal.lift₂ (fun (x y : PGame) ox oy => ⟦⟨x + y, ox.add oy⟩⟧) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy =>
- Quotient.sound (add_congr hx hy)⟩
+ ⟨Surreal.lift₂ (fun (x y : SetTheory.PGame) ox oy => ⟦⟨x + y, ox.add oy⟩⟧)
+ fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy => Quotient.sound (SetTheory.PGame.add_congr hx hy)⟩
/-- Negation for surreal numbers is inherited from pre-game negation:
the negation of `{L | R}` is `{-R | -L}`. -/
instance : Neg Surreal :=
⟨Surreal.lift (fun x ox => ⟦⟨-x, ox.neg⟩⟧) fun _ _ _ _ a =>
- Quotient.sound (neg_equiv_neg_iff.2 a)⟩
+ Quotient.sound (SetTheory.PGame.neg_equiv_neg_iff.2 a)⟩
instance : OrderedAddCommGroup Surreal where
add := (· + ·)
@@ -429,18 +458,18 @@ instance : OrderedAddCommGroup Surreal where
add_comm := by rintro ⟨_⟩ ⟨_⟩; exact Quotient.sound add_comm_equiv
le := (· ≤ ·)
lt := (· < ·)
- le_refl := by rintro ⟨_⟩; apply @le_rfl PGame
- le_trans := by rintro ⟨_⟩ ⟨_⟩ ⟨_⟩; apply @le_trans PGame
- lt_iff_le_not_le := by rintro ⟨_, ox⟩ ⟨_, oy⟩; apply @lt_iff_le_not_le PGame
+ le_refl := by rintro ⟨_⟩; apply @le_rfl SetTheory.PGame
+ le_trans := by rintro ⟨_⟩ ⟨_⟩ ⟨_⟩; apply @le_trans SetTheory.PGame
+ lt_iff_le_not_le := by rintro ⟨_, ox⟩ ⟨_, oy⟩; apply @lt_iff_le_not_le SetTheory.PGame
le_antisymm := by rintro ⟨_⟩ ⟨_⟩ h₁ h₂; exact Quotient.sound ⟨h₁, h₂⟩
- add_le_add_left := by rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩; exact @add_le_add_left PGame _ _ _ _ _ hx _
+ add_le_add_left := by rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩; exact @add_le_add_left SetTheory.PGame _ _ _ _ _ hx _
noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{
Surreal.orderedAddCommGroup with
le_total := by
rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical skip <;>
- exact or_iff_not_imp_left.2 fun h => (PGame.not_le.1 h).le oy ox
+ exact or_iff_not_imp_left.2 fun h => (SetTheory.PGame.not_le.1 h).le oy ox
decidableLe := Classical.decRel _ }
instance : AddMonoidWithOne Surreal :=
@@ -448,7 +477,7 @@ instance : AddMonoidWithOne Surreal :=
#print Surreal.toGame /-
/-- Casts a `surreal` number into a `game`. -/
-def toGame : Surreal →+o Game
+def toGame : Surreal →+o SetTheory.Game
where
toFun := lift (fun x _ => ⟦x⟧) fun x y ox oy => Quot.sound
map_zero' := rfl
@@ -477,14 +506,14 @@ theorem nat_toGame : ∀ n : ℕ, toGame n = n :=
#align surreal.nat_to_game Surreal.nat_toGame
-/
-theorem upperBound_numeric {ι : Type u} {f : ι → PGame.{u}} (H : ∀ i, (f i).Numeric) :
- (upperBound f).Numeric :=
- numeric_of_isEmpty_rightMoves _ fun i => (H _).moveLeft _
+theorem upperBound_numeric {ι : Type u} {f : ι → SetTheory.PGame.{u}} (H : ∀ i, (f i).Numeric) :
+ (SetTheory.PGame.upperBound f).Numeric :=
+ SetTheory.PGame.numeric_of_isEmpty_rightMoves _ fun i => (H _).moveLeft _
#align surreal.upper_bound_numeric Surreal.upperBound_numeric
-theorem lowerBound_numeric {ι : Type u} {f : ι → PGame.{u}} (H : ∀ i, (f i).Numeric) :
- (lowerBound f).Numeric :=
- numeric_of_isEmpty_leftMoves _ fun i => (H _).moveRight _
+theorem lowerBound_numeric {ι : Type u} {f : ι → SetTheory.PGame.{u}} (H : ∀ i, (f i).Numeric) :
+ (SetTheory.PGame.lowerBound f).Numeric :=
+ SetTheory.PGame.numeric_of_isEmpty_leftMoves _ fun i => (H _).moveRight _
#align surreal.lower_bound_numeric Surreal.lowerBound_numeric
/-- A small set `s` of surreals is bounded above. -/
@@ -517,7 +546,7 @@ namespace Ordinal
/-- Converts an ordinal into the corresponding surreal. -/
noncomputable def toSurreal : Ordinal ↪o Surreal
where
- toFun o := mk _ (numeric_toPGame o)
+ toFun o := mk _ (SetTheory.PGame.numeric_toPGame o)
inj' a b h := toPGame_equiv_iff.1 (Quotient.exact h)
map_rel_iff' := @toPGame_le_iff
#align ordinal.to_surreal Ordinal.toSurreal
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -161,7 +161,7 @@ theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) :
#align pgame.le_of_lf PGame.le_of_lf
-/
-alias le_of_lf ← lf.le
+alias lf.le := le_of_lf
#align pgame.lf.le PGame.Lf.le
#print PGame.lt_of_lf /-
@@ -170,7 +170,7 @@ theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) :
#align pgame.lt_of_lf PGame.lt_of_lf
-/
-alias lt_of_lf ← lf.lt
+alias lf.lt := lt_of_lf
#align pgame.lf.lt PGame.Lf.lt
#print PGame.lf_iff_lt /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/63721b2c3eba6c325ecf8ae8cca27155a4f6306f
@@ -6,7 +6,7 @@ Authors: Mario Carneiro, Scott Morrison
import Mathbin.Algebra.Order.Hom.Monoid
import Mathbin.SetTheory.Game.Ordinal
-#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
+#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
/-!
# Surreal numbers
@@ -477,6 +477,36 @@ theorem nat_toGame : ∀ n : ℕ, toGame n = n :=
#align surreal.nat_to_game Surreal.nat_toGame
-/
+theorem upperBound_numeric {ι : Type u} {f : ι → PGame.{u}} (H : ∀ i, (f i).Numeric) :
+ (upperBound f).Numeric :=
+ numeric_of_isEmpty_rightMoves _ fun i => (H _).moveLeft _
+#align surreal.upper_bound_numeric Surreal.upperBound_numeric
+
+theorem lowerBound_numeric {ι : Type u} {f : ι → PGame.{u}} (H : ∀ i, (f i).Numeric) :
+ (lowerBound f).Numeric :=
+ numeric_of_isEmpty_leftMoves _ fun i => (H _).moveRight _
+#align surreal.lower_bound_numeric Surreal.lowerBound_numeric
+
+/-- A small set `s` of surreals is bounded above. -/
+theorem bddAbove_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddAbove s :=
+ by
+ let g := Subtype.val ∘ Quotient.out ∘ Subtype.val ∘ (equivShrink s).symm
+ refine' ⟨mk (upper_bound g) (upper_bound_numeric fun i => Subtype.prop _), fun i hi => _⟩
+ rw [← Quotient.out_eq i]
+ show i.out.1 ≤ _
+ simpa [g] using le_upper_bound g (equivShrink s ⟨i, hi⟩)
+#align surreal.bdd_above_of_small Surreal.bddAbove_of_small
+
+/-- A small set `s` of surreals is bounded below. -/
+theorem bddBelow_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddBelow s :=
+ by
+ let g := Subtype.val ∘ Quotient.out ∘ Subtype.val ∘ (equivShrink s).symm
+ refine' ⟨mk (lower_bound g) (lower_bound_numeric fun i => Subtype.prop _), fun i hi => _⟩
+ rw [← Quotient.out_eq i]
+ show _ ≤ i.out.1
+ simpa [g] using lower_bound_le g (equivShrink s ⟨i, hi⟩)
+#align surreal.bdd_below_of_small Surreal.bddBelow_of_small
+
end Surreal
open Surreal
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison
-
-! This file was ported from Lean 3 source module set_theory.surreal.basic
-! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.Order.Hom.Monoid
import Mathbin.SetTheory.Game.Ordinal
+#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
+
/-!
# Surreal numbers
mathlib commit https://github.com/leanprover-community/mathlib/commit/9240e8be927a0955b9a82c6c85ef499ee3a626b8
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison
! This file was ported from Lean 3 source module set_theory.surreal.basic
-! leanprover-community/mathlib commit ee02a30e209a2a77b93eac1254e8c66e76192f54
+! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.SetTheory.Game.Ordinal
/-!
# 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
mathlib commit https://github.com/leanprover-community/mathlib/commit/8b981918a93bc45a8600de608cde7944a80d92b9
@@ -63,40 +63,53 @@ open scoped PGame
namespace PGame
+#print PGame.Numeric /-
/-- 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
| ⟨l, r, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, numeric (L i)) ∧ ∀ j, numeric (R j)
#align pgame.numeric PGame.Numeric
+-/
+#print PGame.numeric_def /-
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) :=
by cases x; rfl
#align pgame.numeric_def PGame.numeric_def
+-/
namespace Numeric
+#print PGame.Numeric.mk /-
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 :=
numeric_def.2 ⟨h₁, h₂, h₃⟩
#align pgame.numeric.mk PGame.Numeric.mk
+-/
+#print PGame.Numeric.left_lt_right /-
theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
x.moveLeft i < x.moveRight j := by cases x; exact o.1 i j
#align pgame.numeric.left_lt_right PGame.Numeric.left_lt_right
+-/
+#print PGame.Numeric.moveLeft /-
theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) := by
cases x; exact o.2.1 i
#align pgame.numeric.move_left PGame.Numeric.moveLeft
+-/
+#print PGame.Numeric.moveRight /-
theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) := by
cases x; exact o.2.2 j
#align pgame.numeric.move_right PGame.Numeric.moveRight
+-/
end Numeric
+#print PGame.numeric_rec /-
@[elab_as_elim]
theorem numeric_rec {C : PGame → Prop}
(H :
@@ -108,7 +121,9 @@ theorem numeric_rec {C : PGame → Prop}
| ⟨l, r, L, R⟩, ⟨h, hl, hr⟩ =>
H _ _ _ _ h hl hr (fun i => numeric_rec _ (hl i)) fun i => numeric_rec _ (hr i)
#align pgame.numeric_rec PGame.numeric_rec
+-/
+#print PGame.Relabelling.numeric_imp /-
theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) : Numeric y :=
by
induction' x using PGame.moveRecOn with x IHl IHr generalizing y
@@ -118,12 +133,16 @@ theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) :
· exact IHl _ (ox.move_left _) (r.move_left_symm i)
· exact IHr _ (ox.move_right _) (r.move_right_symm j)
#align pgame.relabelling.numeric_imp PGame.Relabelling.numeric_imp
+-/
+#print PGame.Relabelling.numeric_congr /-
/-- Relabellings preserve being numeric. -/
theorem Relabelling.numeric_congr {x y : PGame} (r : x ≡r y) : Numeric x ↔ Numeric y :=
⟨r.numeric_imp, r.symm.numeric_imp⟩
#align pgame.relabelling.numeric_congr PGame.Relabelling.numeric_congr
+-/
+#print PGame.lf_asymm /-
theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x :=
by
refine' numeric_rec (fun xl xr xL xR hx oxl oxr IHxl IHxr => _) x ox y oy
@@ -134,25 +153,33 @@ theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y →
· exact (le_trans h₁ h₂).not_gf (lf_of_lt (hx _ _))
· exact IHxr _ _ (oyr _) (h₁.lf_move_right _) (h₂.lf_move_right _)
#align pgame.lf_asymm PGame.lf_asymm
+-/
+#print PGame.le_of_lf /-
theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y :=
not_lf.1 (lf_asymm ox oy h)
#align pgame.le_of_lf PGame.le_of_lf
+-/
alias le_of_lf ← lf.le
#align pgame.lf.le PGame.Lf.le
+#print PGame.lt_of_lf /-
theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
(lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
#align pgame.lt_of_lf PGame.lt_of_lf
+-/
alias lt_of_lf ← lf.lt
#align pgame.lf.lt PGame.Lf.lt
+#print PGame.lf_iff_lt /-
theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
⟨fun h => h.lt ox oy, lf_of_lt⟩
#align pgame.lf_iff_lt PGame.lf_iff_lt
+-/
+#print PGame.le_iff_forall_lt /-
/-- 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 := by
@@ -160,18 +187,24 @@ theorem le_iff_forall_lt {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
#align pgame.le_iff_forall_lt PGame.le_iff_forall_lt
+-/
+#print PGame.lt_iff_exists_le /-
/-- 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 := by
rw [← lf_iff_lt ox oy, lf_iff_exists_le]
#align pgame.lt_iff_exists_le PGame.lt_iff_exists_le
+-/
+#print PGame.lt_of_exists_le /-
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 :=
(lt_iff_exists_le ox oy).2
#align pgame.lt_of_exists_le PGame.lt_of_exists_le
+-/
+#print PGame.lt_def /-
/-- 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 ↔
@@ -183,61 +216,87 @@ theorem lt_def {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
#align pgame.lt_def PGame.lt_def
+-/
+#print PGame.not_fuzzy /-
theorem not_fuzzy {x y : PGame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y := fun h =>
not_lf.2 ((lf_of_fuzzy h).le ox oy) h.2
#align pgame.not_fuzzy PGame.not_fuzzy
+-/
+#print PGame.lt_or_equiv_or_gt /-
theorem lt_or_equiv_or_gt {x y : PGame} (ox : Numeric x) (oy : Numeric y) :
x < y ∨ (x ≈ y) ∨ y < x :=
((lf_or_equiv_or_gf x y).imp fun h => h.lt ox oy) <| Or.imp_right fun h => h.lt oy ox
#align pgame.lt_or_equiv_or_gt PGame.lt_or_equiv_or_gt
+-/
+#print PGame.numeric_of_isEmpty /-
theorem numeric_of_isEmpty (x : PGame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x :=
Numeric.mk isEmptyElim isEmptyElim isEmptyElim
#align pgame.numeric_of_is_empty PGame.numeric_of_isEmpty
+-/
+#print PGame.numeric_of_isEmpty_leftMoves /-
theorem numeric_of_isEmpty_leftMoves (x : PGame) [IsEmpty x.LeftMoves] :
(∀ j, Numeric (x.moveRight j)) → Numeric x :=
Numeric.mk isEmptyElim isEmptyElim
#align pgame.numeric_of_is_empty_left_moves PGame.numeric_of_isEmpty_leftMoves
+-/
+#print PGame.numeric_of_isEmpty_rightMoves /-
theorem numeric_of_isEmpty_rightMoves (x : PGame) [IsEmpty x.RightMoves]
(H : ∀ i, Numeric (x.moveLeft i)) : Numeric x :=
Numeric.mk (fun _ => isEmptyElim) H isEmptyElim
#align pgame.numeric_of_is_empty_right_moves PGame.numeric_of_isEmpty_rightMoves
+-/
+#print PGame.numeric_zero /-
theorem numeric_zero : Numeric 0 :=
numeric_of_isEmpty 0
#align pgame.numeric_zero PGame.numeric_zero
+-/
+#print PGame.numeric_one /-
theorem numeric_one : Numeric 1 :=
numeric_of_isEmpty_rightMoves 1 fun _ => numeric_zero
#align pgame.numeric_one PGame.numeric_one
+-/
+#print PGame.Numeric.neg /-
theorem Numeric.neg : ∀ {x : PGame} (o : Numeric x), Numeric (-x)
| ⟨l, r, L, R⟩, o =>
⟨fun j i => neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i => (o.2.1 i).neg⟩
#align pgame.numeric.neg PGame.Numeric.neg
+-/
namespace Numeric
+#print PGame.Numeric.moveLeft_lt /-
theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x :=
(moveLeft_lf i).lt (o.moveLeft i) o
#align pgame.numeric.move_left_lt PGame.Numeric.moveLeft_lt
+-/
+#print PGame.Numeric.moveLeft_le /-
theorem moveLeft_le {x : PGame} (o : Numeric x) (i) : x.moveLeft i ≤ x :=
(o.moveLeft_lt i).le
#align pgame.numeric.move_left_le PGame.Numeric.moveLeft_le
+-/
+#print PGame.Numeric.lt_moveRight /-
theorem lt_moveRight {x : PGame} (o : Numeric x) (j) : x < x.moveRight j :=
(lf_moveRight j).lt o (o.moveRight j)
#align pgame.numeric.lt_move_right PGame.Numeric.lt_moveRight
+-/
+#print PGame.Numeric.le_moveRight /-
theorem le_moveRight {x : PGame} (o : Numeric x) (j) : x ≤ x.moveRight j :=
(o.lt_moveRight j).le
#align pgame.numeric.le_move_right PGame.Numeric.le_moveRight
+-/
+#print PGame.Numeric.add /-
theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x + y)
| ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, ox, oy =>
⟨by
@@ -262,19 +321,25 @@ theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x +
· apply ox.add (oy.move_right jy)⟩
decreasing_by pgame_wf_tac
#align pgame.numeric.add PGame.Numeric.add
+-/
+#print PGame.Numeric.sub /-
theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
ox.add oy.neg
#align pgame.numeric.sub PGame.Numeric.sub
+-/
end Numeric
+#print PGame.numeric_nat /-
/-- Pre-games defined by natural numbers are numeric. -/
theorem numeric_nat : ∀ n : ℕ, Numeric n
| 0 => numeric_zero
| n + 1 => (numeric_nat n).add numeric_one
#align pgame.numeric_nat PGame.numeric_nat
+-/
+#print PGame.numeric_toPGame /-
/-- Ordinal games are numeric. -/
theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric :=
by
@@ -282,24 +347,29 @@ theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric :=
apply numeric_of_is_empty_right_moves
simpa using fun i => IH _ (Ordinal.toLeftMovesToPGame_symm_lt i)
#align pgame.numeric_to_pgame PGame.numeric_toPGame
+-/
end PGame
open PGame
+#print Surreal /-
/-- 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 :=
Quotient (Subtype.setoid Numeric)
#align surreal Surreal
+-/
namespace Surreal
+#print Surreal.mk /-
/-- Construct a surreal number from a numeric pre-game. -/
def mk (x : PGame) (h : x.Numeric) : Surreal :=
⟦⟨x, h⟩⟧
#align surreal.mk Surreal.mk
+-/
instance : Zero Surreal :=
⟨mk 0 numeric_zero⟩
@@ -310,12 +380,15 @@ instance : One Surreal :=
instance : Inhabited Surreal :=
⟨0⟩
+#print Surreal.lift /-
/-- 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 → α :=
Quotient.lift (fun x : { x // Numeric x } => f x.1 x.2) fun x y => H x.2 y.2
#align surreal.lift Surreal.lift
+-/
+#print Surreal.lift₂ /-
/-- Lift a binary equivalence-respecting function on pre-games to surreals. -/
def lift₂ {α} (f : ∀ x y, Numeric x → Numeric y → α)
(H :
@@ -325,6 +398,7 @@ def lift₂ {α} (f : ∀ x y, Numeric x → Numeric y → α)
lift (fun x ox => lift (fun y oy => f x y ox oy) fun y₁ y₂ oy₁ oy₂ => H _ _ _ _ equiv_rfl)
fun x₁ x₂ ox₁ ox₂ h => funext <| Quotient.ind fun ⟨y, oy⟩ => H _ _ _ _ h equiv_rfl
#align surreal.lift₂ Surreal.lift₂
+-/
instance : LE Surreal :=
⟨lift₂ (fun x y _ _ => x ≤ y) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy => propext (le_congr hx hy)⟩
@@ -372,6 +446,7 @@ noncomputable instance : LinearOrderedAddCommGroup Surreal :=
instance : AddMonoidWithOne Surreal :=
AddMonoidWithOne.unary
+#print Surreal.toGame /-
/-- Casts a `surreal` number into a `game`. -/
def toGame : Surreal →+o Game
where
@@ -380,20 +455,27 @@ def toGame : Surreal →+o Game
map_add' := by rintro ⟨_, _⟩ ⟨_, _⟩; rfl
monotone' := by rintro ⟨_, _⟩ ⟨_, _⟩; exact id
#align surreal.to_game Surreal.toGame
+-/
+#print Surreal.zero_toGame /-
theorem zero_toGame : toGame 0 = 0 :=
rfl
#align surreal.zero_to_game Surreal.zero_toGame
+-/
+#print Surreal.one_toGame /-
@[simp]
theorem one_toGame : toGame 1 = 1 :=
rfl
#align surreal.one_to_game Surreal.one_toGame
+-/
+#print Surreal.nat_toGame /-
@[simp]
theorem nat_toGame : ∀ n : ℕ, toGame n = n :=
map_natCast' _ one_toGame
#align surreal.nat_to_game Surreal.nat_toGame
+-/
end Surreal
@@ -401,6 +483,7 @@ open Surreal
namespace Ordinal
+#print Ordinal.toSurreal /-
/-- Converts an ordinal into the corresponding surreal. -/
noncomputable def toSurreal : Ordinal ↪o Surreal
where
@@ -408,6 +491,7 @@ noncomputable def toSurreal : Ordinal ↪o Surreal
inj' a b h := toPGame_equiv_iff.1 (Quotient.exact h)
map_rel_iff' := @toPGame_le_iff
#align ordinal.to_surreal Ordinal.toSurreal
+-/
end Ordinal
mathlib commit https://github.com/leanprover-community/mathlib/commit/fdc286cc6967a012f41b87f76dcd2797b53152af
@@ -276,12 +276,12 @@ theorem numeric_nat : ∀ n : ℕ, Numeric n
#align pgame.numeric_nat PGame.numeric_nat
/-- Ordinal games are numeric. -/
-theorem numeric_toPgame (o : Ordinal) : o.toPgame.Numeric :=
+theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric :=
by
induction' o using Ordinal.induction with o IH
apply numeric_of_is_empty_right_moves
- simpa using fun i => IH _ (Ordinal.toLeftMovesToPgame_symm_lt i)
-#align pgame.numeric_to_pgame PGame.numeric_toPgame
+ simpa using fun i => IH _ (Ordinal.toLeftMovesToPGame_symm_lt i)
+#align pgame.numeric_to_pgame PGame.numeric_toPGame
end PGame
@@ -404,9 +404,9 @@ namespace Ordinal
/-- Converts an ordinal into the corresponding surreal. -/
noncomputable def toSurreal : Ordinal ↪o Surreal
where
- toFun o := mk _ (numeric_toPgame o)
- inj' a b h := toPgame_equiv_iff.1 (Quotient.exact h)
- map_rel_iff' := @toPgame_le_iff
+ toFun o := mk _ (numeric_toPGame o)
+ inj' a b h := toPGame_equiv_iff.1 (Quotient.exact h)
+ map_rel_iff' := @toPGame_le_iff
#align ordinal.to_surreal Ordinal.toSurreal
end Ordinal
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -259,8 +259,8 @@ theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x +
· exact ox.add (oy.move_left iy)
· rintro (jx | jy)
· apply (ox.move_right jx).add oy
- · apply ox.add (oy.move_right jy)⟩decreasing_by
- pgame_wf_tac
+ · apply ox.add (oy.move_right jy)⟩
+decreasing_by pgame_wf_tac
#align pgame.numeric.add PGame.Numeric.add
theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -59,7 +59,7 @@ The branch `surreal_mul` contains some progress on this proof.
universe u
-open PGame
+open scoped PGame
namespace PGame
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -73,9 +73,7 @@ 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) :=
- by
- cases x
- rfl
+ by cases x; rfl
#align pgame.numeric_def PGame.numeric_def
namespace Numeric
@@ -86,21 +84,15 @@ theorem mk {x : PGame} (h₁ : ∀ i j, x.moveLeft i < x.moveRight j) (h₂ :
#align pgame.numeric.mk PGame.Numeric.mk
theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
- x.moveLeft i < x.moveRight j := by
- cases x
- exact o.1 i j
+ x.moveLeft i < x.moveRight j := by cases x; exact o.1 i j
#align pgame.numeric.left_lt_right PGame.Numeric.left_lt_right
-theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) :=
- by
- cases x
- exact o.2.1 i
+theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) := by
+ cases x; exact o.2.1 i
#align pgame.numeric.move_left PGame.Numeric.moveLeft
-theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) :=
- by
- cases x
- exact o.2.2 j
+theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) := by
+ cases x; exact o.2.2 j
#align pgame.numeric.move_right PGame.Numeric.moveRight
end Numeric
@@ -354,40 +346,20 @@ instance : Neg Surreal :=
instance : OrderedAddCommGroup Surreal where
add := (· + ·)
- add_assoc := by
- rintro ⟨_⟩ ⟨_⟩ ⟨_⟩
- exact Quotient.sound add_assoc_equiv
+ add_assoc := by rintro ⟨_⟩ ⟨_⟩ ⟨_⟩; exact Quotient.sound add_assoc_equiv
zero := 0
- zero_add := by
- rintro ⟨_⟩
- exact Quotient.sound (zero_add_equiv a)
- add_zero := by
- rintro ⟨_⟩
- exact Quotient.sound (add_zero_equiv a)
+ zero_add := by rintro ⟨_⟩; exact Quotient.sound (zero_add_equiv a)
+ add_zero := by rintro ⟨_⟩; exact Quotient.sound (add_zero_equiv a)
neg := Neg.neg
- add_left_neg := by
- rintro ⟨_⟩
- exact Quotient.sound (add_left_neg_equiv a)
- add_comm := by
- rintro ⟨_⟩ ⟨_⟩
- exact Quotient.sound add_comm_equiv
+ add_left_neg := by rintro ⟨_⟩; exact Quotient.sound (add_left_neg_equiv a)
+ add_comm := by rintro ⟨_⟩ ⟨_⟩; exact Quotient.sound add_comm_equiv
le := (· ≤ ·)
lt := (· < ·)
- le_refl := by
- rintro ⟨_⟩
- apply @le_rfl PGame
- le_trans := by
- rintro ⟨_⟩ ⟨_⟩ ⟨_⟩
- apply @le_trans PGame
- lt_iff_le_not_le := by
- rintro ⟨_, ox⟩ ⟨_, oy⟩
- apply @lt_iff_le_not_le PGame
- le_antisymm := by
- rintro ⟨_⟩ ⟨_⟩ h₁ h₂
- exact Quotient.sound ⟨h₁, h₂⟩
- add_le_add_left := by
- rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩
- exact @add_le_add_left PGame _ _ _ _ _ hx _
+ le_refl := by rintro ⟨_⟩; apply @le_rfl PGame
+ le_trans := by rintro ⟨_⟩ ⟨_⟩ ⟨_⟩; apply @le_trans PGame
+ lt_iff_le_not_le := by rintro ⟨_, ox⟩ ⟨_, oy⟩; apply @lt_iff_le_not_le PGame
+ le_antisymm := by rintro ⟨_⟩ ⟨_⟩ h₁ h₂; exact Quotient.sound ⟨h₁, h₂⟩
+ add_le_add_left := by rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩; exact @add_le_add_left PGame _ _ _ _ _ hx _
noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{
@@ -405,12 +377,8 @@ def toGame : Surreal →+o Game
where
toFun := lift (fun x _ => ⟦x⟧) fun x y ox oy => Quot.sound
map_zero' := rfl
- map_add' := by
- rintro ⟨_, _⟩ ⟨_, _⟩
- rfl
- monotone' := by
- rintro ⟨_, _⟩ ⟨_, _⟩
- exact id
+ map_add' := by rintro ⟨_, _⟩ ⟨_, _⟩; rfl
+ monotone' := by rintro ⟨_, _⟩ ⟨_, _⟩; exact id
#align surreal.to_game Surreal.toGame
theorem zero_toGame : toGame 0 = 0 :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -59,80 +59,80 @@ The branch `surreal_mul` contains some progress on this proof.
universe u
-open Pgame
+open PGame
-namespace Pgame
+namespace PGame
/-- 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
+def Numeric : PGame → Prop
| ⟨l, r, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, numeric (L i)) ∧ ∀ j, numeric (R j)
-#align pgame.numeric Pgame.Numeric
+#align pgame.numeric PGame.Numeric
-theorem numeric_def {x : Pgame} :
+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) :=
by
cases x
rfl
-#align pgame.numeric_def Pgame.numeric_def
+#align pgame.numeric_def PGame.numeric_def
namespace Numeric
-theorem mk {x : Pgame} (h₁ : ∀ i j, x.moveLeft i < x.moveRight j) (h₂ : ∀ i, Numeric (x.moveLeft i))
+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 :=
numeric_def.2 ⟨h₁, h₂, h₃⟩
-#align pgame.numeric.mk Pgame.Numeric.mk
+#align pgame.numeric.mk PGame.Numeric.mk
-theorem left_lt_right {x : Pgame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
+theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
x.moveLeft i < x.moveRight j := by
cases x
exact o.1 i j
-#align pgame.numeric.left_lt_right Pgame.Numeric.left_lt_right
+#align pgame.numeric.left_lt_right PGame.Numeric.left_lt_right
-theorem moveLeft {x : Pgame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) :=
+theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) :=
by
cases x
exact o.2.1 i
-#align pgame.numeric.move_left Pgame.Numeric.moveLeft
+#align pgame.numeric.move_left PGame.Numeric.moveLeft
-theorem moveRight {x : Pgame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) :=
+theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) :=
by
cases x
exact o.2.2 j
-#align pgame.numeric.move_right Pgame.Numeric.moveRight
+#align pgame.numeric.move_right PGame.Numeric.moveRight
end Numeric
@[elab_as_elim]
-theorem numeric_rec {C : Pgame → Prop}
+theorem numeric_rec {C : PGame → Prop}
(H :
- ∀ (l r) (L : l → Pgame) (R : r → Pgame),
+ ∀ (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
| ⟨l, r, L, R⟩, ⟨h, hl, hr⟩ =>
H _ _ _ _ h hl hr (fun i => numeric_rec _ (hl i)) fun i => numeric_rec _ (hr i)
-#align pgame.numeric_rec Pgame.numeric_rec
+#align pgame.numeric_rec PGame.numeric_rec
-theorem Relabelling.numeric_imp {x y : Pgame} (r : x ≡r y) (ox : Numeric x) : Numeric y :=
+theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) : Numeric y :=
by
- induction' x using Pgame.moveRecOn with x IHl IHr generalizing y
+ induction' x using PGame.moveRecOn with x IHl IHr generalizing y
apply numeric.mk (fun i j => _) (fun i => _) fun j => _
· rw [← lt_congr (r.move_left_symm i).Equiv (r.move_right_symm j).Equiv]
apply ox.left_lt_right
· exact IHl _ (ox.move_left _) (r.move_left_symm i)
· exact IHr _ (ox.move_right _) (r.move_right_symm j)
-#align pgame.relabelling.numeric_imp Pgame.Relabelling.numeric_imp
+#align pgame.relabelling.numeric_imp PGame.Relabelling.numeric_imp
/-- Relabellings preserve being numeric. -/
-theorem Relabelling.numeric_congr {x y : Pgame} (r : x ≡r y) : Numeric x ↔ Numeric y :=
+theorem Relabelling.numeric_congr {x y : PGame} (r : x ≡r y) : Numeric x ↔ Numeric y :=
⟨r.numeric_imp, r.symm.numeric_imp⟩
-#align pgame.relabelling.numeric_congr Pgame.Relabelling.numeric_congr
+#align pgame.relabelling.numeric_congr PGame.Relabelling.numeric_congr
-theorem lf_asymm {x y : Pgame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x :=
+theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x :=
by
refine' numeric_rec (fun xl xr xL xR hx oxl oxr IHxl IHxr => _) x ox y oy
refine' numeric_rec fun yl yr yL yR hy oyl oyr IHyl IHyr => _
@@ -141,47 +141,47 @@ theorem lf_asymm {x y : Pgame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y →
· exact (le_trans h₂ h₁).not_gf (lf_of_lt (hy _ _))
· exact (le_trans h₁ h₂).not_gf (lf_of_lt (hx _ _))
· exact IHxr _ _ (oyr _) (h₁.lf_move_right _) (h₂.lf_move_right _)
-#align pgame.lf_asymm Pgame.lf_asymm
+#align pgame.lf_asymm PGame.lf_asymm
-theorem le_of_lf {x y : Pgame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y :=
+theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y :=
not_lf.1 (lf_asymm ox oy h)
-#align pgame.le_of_lf Pgame.le_of_lf
+#align pgame.le_of_lf PGame.le_of_lf
alias le_of_lf ← lf.le
-#align pgame.lf.le Pgame.Lf.le
+#align pgame.lf.le PGame.Lf.le
-theorem lt_of_lf {x y : Pgame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
+theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
(lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
-#align pgame.lt_of_lf Pgame.lt_of_lf
+#align pgame.lt_of_lf PGame.lt_of_lf
alias lt_of_lf ← lf.lt
-#align pgame.lf.lt Pgame.Lf.lt
+#align pgame.lf.lt PGame.Lf.lt
-theorem lf_iff_lt {x y : Pgame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
+theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
⟨fun h => h.lt ox oy, lf_of_lt⟩
-#align pgame.lf_iff_lt Pgame.lf_iff_lt
+#align pgame.lf_iff_lt PGame.lf_iff_lt
/-- 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) :
+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 := by
refine' le_iff_forall_lf.trans (and_congr _ _) <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
-#align pgame.le_iff_forall_lt Pgame.le_iff_forall_lt
+#align pgame.le_iff_forall_lt PGame.le_iff_forall_lt
/-- 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) :
+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 := by
rw [← lf_iff_lt ox oy, lf_iff_exists_le]
-#align pgame.lt_iff_exists_le Pgame.lt_iff_exists_le
+#align pgame.lt_iff_exists_le PGame.lt_iff_exists_le
-theorem lt_of_exists_le {x y : Pgame} (ox : x.Numeric) (oy : y.Numeric) :
+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 :=
(lt_iff_exists_le ox oy).2
-#align pgame.lt_of_exists_le Pgame.lt_of_exists_le
+#align pgame.lt_of_exists_le PGame.lt_of_exists_le
/-- 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) :
+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' :=
@@ -190,63 +190,63 @@ theorem lt_def {x y : Pgame} (ox : x.Numeric) (oy : y.Numeric) :
refine' or_congr _ _ <;> refine' exists_congr fun x_1 => _ <;> refine' and_congr _ _ <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [numeric.move_left, numeric.move_right]
-#align pgame.lt_def Pgame.lt_def
+#align pgame.lt_def PGame.lt_def
-theorem not_fuzzy {x y : Pgame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y := fun h =>
+theorem not_fuzzy {x y : PGame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y := fun h =>
not_lf.2 ((lf_of_fuzzy h).le ox oy) h.2
-#align pgame.not_fuzzy Pgame.not_fuzzy
+#align pgame.not_fuzzy PGame.not_fuzzy
-theorem lt_or_equiv_or_gt {x y : Pgame} (ox : Numeric x) (oy : Numeric y) :
+theorem lt_or_equiv_or_gt {x y : PGame} (ox : Numeric x) (oy : Numeric y) :
x < y ∨ (x ≈ y) ∨ y < x :=
((lf_or_equiv_or_gf x y).imp fun h => h.lt ox oy) <| Or.imp_right fun h => h.lt oy ox
-#align pgame.lt_or_equiv_or_gt Pgame.lt_or_equiv_or_gt
+#align pgame.lt_or_equiv_or_gt PGame.lt_or_equiv_or_gt
-theorem numeric_of_isEmpty (x : Pgame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x :=
+theorem numeric_of_isEmpty (x : PGame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x :=
Numeric.mk isEmptyElim isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty Pgame.numeric_of_isEmpty
+#align pgame.numeric_of_is_empty PGame.numeric_of_isEmpty
-theorem numeric_of_isEmpty_leftMoves (x : Pgame) [IsEmpty x.LeftMoves] :
+theorem numeric_of_isEmpty_leftMoves (x : PGame) [IsEmpty x.LeftMoves] :
(∀ j, Numeric (x.moveRight j)) → Numeric x :=
Numeric.mk isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty_left_moves Pgame.numeric_of_isEmpty_leftMoves
+#align pgame.numeric_of_is_empty_left_moves PGame.numeric_of_isEmpty_leftMoves
-theorem numeric_of_isEmpty_rightMoves (x : Pgame) [IsEmpty x.RightMoves]
+theorem numeric_of_isEmpty_rightMoves (x : PGame) [IsEmpty x.RightMoves]
(H : ∀ i, Numeric (x.moveLeft i)) : Numeric x :=
Numeric.mk (fun _ => isEmptyElim) H isEmptyElim
-#align pgame.numeric_of_is_empty_right_moves Pgame.numeric_of_isEmpty_rightMoves
+#align pgame.numeric_of_is_empty_right_moves PGame.numeric_of_isEmpty_rightMoves
theorem numeric_zero : Numeric 0 :=
numeric_of_isEmpty 0
-#align pgame.numeric_zero Pgame.numeric_zero
+#align pgame.numeric_zero PGame.numeric_zero
theorem numeric_one : Numeric 1 :=
numeric_of_isEmpty_rightMoves 1 fun _ => numeric_zero
-#align pgame.numeric_one Pgame.numeric_one
+#align pgame.numeric_one PGame.numeric_one
-theorem Numeric.neg : ∀ {x : Pgame} (o : Numeric x), Numeric (-x)
+theorem Numeric.neg : ∀ {x : PGame} (o : Numeric x), Numeric (-x)
| ⟨l, r, L, R⟩, o =>
⟨fun j i => neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i => (o.2.1 i).neg⟩
-#align pgame.numeric.neg Pgame.Numeric.neg
+#align pgame.numeric.neg PGame.Numeric.neg
namespace Numeric
-theorem moveLeft_lt {x : Pgame} (o : Numeric x) (i) : x.moveLeft i < x :=
+theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x :=
(moveLeft_lf i).lt (o.moveLeft i) o
-#align pgame.numeric.move_left_lt Pgame.Numeric.moveLeft_lt
+#align pgame.numeric.move_left_lt PGame.Numeric.moveLeft_lt
-theorem moveLeft_le {x : Pgame} (o : Numeric x) (i) : x.moveLeft i ≤ x :=
+theorem moveLeft_le {x : PGame} (o : Numeric x) (i) : x.moveLeft i ≤ x :=
(o.moveLeft_lt i).le
-#align pgame.numeric.move_left_le Pgame.Numeric.moveLeft_le
+#align pgame.numeric.move_left_le PGame.Numeric.moveLeft_le
-theorem lt_moveRight {x : Pgame} (o : Numeric x) (j) : x < x.moveRight j :=
+theorem lt_moveRight {x : PGame} (o : Numeric x) (j) : x < x.moveRight j :=
(lf_moveRight j).lt o (o.moveRight j)
-#align pgame.numeric.lt_move_right Pgame.Numeric.lt_moveRight
+#align pgame.numeric.lt_move_right PGame.Numeric.lt_moveRight
-theorem le_moveRight {x : Pgame} (o : Numeric x) (j) : x ≤ x.moveRight j :=
+theorem le_moveRight {x : PGame} (o : Numeric x) (j) : x ≤ x.moveRight j :=
(o.lt_moveRight j).le
-#align pgame.numeric.le_move_right Pgame.Numeric.le_moveRight
+#align pgame.numeric.le_move_right PGame.Numeric.le_moveRight
-theorem add : ∀ {x y : Pgame} (ox : Numeric x) (oy : Numeric y), Numeric (x + y)
+theorem add : ∀ {x y : PGame} (ox : Numeric x) (oy : Numeric y), Numeric (x + y)
| ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, ox, oy =>
⟨by
rintro (ix | iy) (jx | jy)
@@ -269,11 +269,11 @@ theorem add : ∀ {x y : Pgame} (ox : Numeric x) (oy : Numeric y), Numeric (x +
· apply (ox.move_right jx).add oy
· apply ox.add (oy.move_right jy)⟩decreasing_by
pgame_wf_tac
-#align pgame.numeric.add Pgame.Numeric.add
+#align pgame.numeric.add PGame.Numeric.add
-theorem sub {x y : Pgame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
+theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
ox.add oy.neg
-#align pgame.numeric.sub Pgame.Numeric.sub
+#align pgame.numeric.sub PGame.Numeric.sub
end Numeric
@@ -281,7 +281,7 @@ end Numeric
theorem numeric_nat : ∀ n : ℕ, Numeric n
| 0 => numeric_zero
| n + 1 => (numeric_nat n).add numeric_one
-#align pgame.numeric_nat Pgame.numeric_nat
+#align pgame.numeric_nat PGame.numeric_nat
/-- Ordinal games are numeric. -/
theorem numeric_toPgame (o : Ordinal) : o.toPgame.Numeric :=
@@ -289,11 +289,11 @@ theorem numeric_toPgame (o : Ordinal) : o.toPgame.Numeric :=
induction' o using Ordinal.induction with o IH
apply numeric_of_is_empty_right_moves
simpa using fun i => IH _ (Ordinal.toLeftMovesToPgame_symm_lt i)
-#align pgame.numeric_to_pgame Pgame.numeric_toPgame
+#align pgame.numeric_to_pgame PGame.numeric_toPgame
-end Pgame
+end PGame
-open Pgame
+open PGame
/-- 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,
@@ -305,7 +305,7 @@ def Surreal :=
namespace Surreal
/-- Construct a surreal number from a numeric pre-game. -/
-def mk (x : Pgame) (h : x.Numeric) : Surreal :=
+def mk (x : PGame) (h : x.Numeric) : Surreal :=
⟦⟨x, h⟩⟧
#align surreal.mk Surreal.mk
@@ -343,7 +343,7 @@ instance : LT Surreal :=
/-- 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 :=
- ⟨Surreal.lift₂ (fun (x y : Pgame) ox oy => ⟦⟨x + y, ox.add oy⟩⟧) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy =>
+ ⟨Surreal.lift₂ (fun (x y : PGame) ox oy => ⟦⟨x + y, ox.add oy⟩⟧) fun x₁ y₁ x₂ y₂ _ _ _ _ hx hy =>
Quotient.sound (add_congr hx hy)⟩
/-- Negation for surreal numbers is inherited from pre-game negation:
@@ -375,26 +375,26 @@ instance : OrderedAddCommGroup Surreal where
lt := (· < ·)
le_refl := by
rintro ⟨_⟩
- apply @le_rfl Pgame
+ apply @le_rfl PGame
le_trans := by
rintro ⟨_⟩ ⟨_⟩ ⟨_⟩
- apply @le_trans Pgame
+ apply @le_trans PGame
lt_iff_le_not_le := by
rintro ⟨_, ox⟩ ⟨_, oy⟩
- apply @lt_iff_le_not_le Pgame
+ apply @lt_iff_le_not_le PGame
le_antisymm := by
rintro ⟨_⟩ ⟨_⟩ h₁ h₂
exact Quotient.sound ⟨h₁, h₂⟩
add_le_add_left := by
rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩
- exact @add_le_add_left Pgame _ _ _ _ _ hx _
+ exact @add_le_add_left PGame _ _ _ _ _ hx _
noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{
Surreal.orderedAddCommGroup with
le_total := by
rintro ⟨⟨x, ox⟩⟩ ⟨⟨y, oy⟩⟩ <;> classical skip <;>
- exact or_iff_not_imp_left.2 fun h => (Pgame.not_le.1 h).le oy ox
+ exact or_iff_not_imp_left.2 fun h => (PGame.not_le.1 h).le oy ox
decidableLe := Classical.decRel _ }
instance : AddMonoidWithOne Surreal :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
The termination checker has been getting more capable, and many of the termination_by
or decreasing_by
clauses in Mathlib are no longer needed.
(Note that termination_by?
will show the automatically derived termination expression, so no information is being lost by removing these.)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -251,7 +251,6 @@ theorem add : ∀ {x y : PGame} (_ : Numeric x) (_ : Numeric y), Numeric (x + y)
· apply (ox.moveRight jx).add oy
· apply ox.add (oy.moveRight jy)⟩
termination_by x y => (x, y) -- Porting note: Added `termination_by`
-decreasing_by all_goals pgame_wf_tac
#align pgame.numeric.add SetTheory.PGame.Numeric.add
theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
Finish forwarding porting https://github.com/leanprover-community/mathlib/pull/15260 after #10566 ported just the changes in PGame.lean
.
We don't port upper_bound_numeric
(or lower_bound_numeric
) because upper_bound
was deleted following review feedback on the previous forward-porting PR #10566.
Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: timotree3 <timorcb@gmail.com>
@@ -6,7 +6,7 @@ Authors: Mario Carneiro, Scott Morrison
import Mathlib.Algebra.Order.Hom.Monoid
import Mathlib.SetTheory.Game.Ordinal
-#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"ee02a30e209a2a77b93eac1254e8c66e76192f54"
+#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
/-!
# Surreal numbers
@@ -322,6 +322,9 @@ instance instLE : LE Surreal :=
⟨lift₂ (fun x y _ _ => x ≤ y) fun _ _ _ _ hx hy => propext (le_congr hx hy)⟩
#align surreal.has_le Surreal.instLE
+@[simp]
+lemma mk_le_mk {x y : PGame.{u}} {hx hy} : mk x hx ≤ mk y hy ↔ x ≤ y := Iff.rfl
+
instance instLT : LT Surreal :=
⟨lift₂ (fun x y _ _ => x < y) fun _ _ _ _ hx hy => propext (lt_congr hx hy)⟩
#align surreal.has_lt Surreal.instLT
@@ -388,6 +391,53 @@ theorem nat_toGame : ∀ n : ℕ, toGame n = n :=
map_natCast' _ one_toGame
#align surreal.nat_to_game Surreal.nat_toGame
+#noalign upper_bound_numeric
+#noalign lower_bound_numeric
+
+/-- A small family of surreals is bounded above. -/
+lemma bddAbove_range_of_small {ι : Type*} [Small.{u} ι] (f : ι → Surreal.{u}) :
+ BddAbove (Set.range f) := by
+ induction' f using Quotient.induction_on_pi with f
+ let g : ι → PGame.{u} := Subtype.val ∘ f
+ have hg (i) : (g i).Numeric := Subtype.prop _
+ conv in (⟦f _⟧) =>
+ change mk (g i) (hg i)
+ clear_value g
+ clear f
+ let x : PGame.{u} := ⟨Σ i, (g <| (equivShrink.{u} ι).symm i).LeftMoves, PEmpty,
+ fun x ↦ moveLeft _ x.2, PEmpty.elim⟩
+ refine ⟨mk x (.mk (by simp [x]) (fun _ ↦ (hg _).moveLeft _) (by simp [x])),
+ Set.forall_mem_range.2 fun i ↦ ?_⟩
+ rw [mk_le_mk, ← (equivShrink ι).symm_apply_apply i, le_iff_forall_lf]
+ simpa [x] using fun j ↦ @moveLeft_lf x ⟨equivShrink ι i, j⟩
+
+/-- A small set of surreals is bounded above. -/
+lemma bddAbove_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddAbove s := by
+ simpa using bddAbove_range_of_small (Subtype.val : s → Surreal.{u})
+#align surreal.bdd_above_of_small Surreal.bddAbove_of_small
+
+/-- A small family of surreals is bounded below. -/
+lemma bddBelow_range_of_small {ι : Type*} [Small.{u} ι] (f : ι → Surreal.{u}) :
+ BddBelow (Set.range f) := by
+ induction' f using Quotient.induction_on_pi with f
+ let g : ι → PGame.{u} := Subtype.val ∘ f
+ have hg (i) : (g i).Numeric := Subtype.prop _
+ conv in (⟦f _⟧) =>
+ change mk (g i) (hg i)
+ clear_value g
+ clear f
+ let x : PGame.{u} := ⟨PEmpty, Σ i, (g <| (equivShrink.{u} ι).symm i).RightMoves,
+ PEmpty.elim, fun x ↦ moveRight _ x.2⟩
+ refine ⟨mk x (.mk (by simp [x]) (by simp [x]) (fun _ ↦ (hg _).moveRight _) ),
+ Set.forall_mem_range.2 fun i ↦ ?_⟩
+ rw [mk_le_mk, ← (equivShrink ι).symm_apply_apply i, le_iff_forall_lf]
+ simpa [x] using fun j ↦ @lf_moveRight x ⟨equivShrink ι i, j⟩
+
+/-- A small set of surreals is bounded below. -/
+lemma bddBelow_of_small (s : Set Surreal.{u}) [Small.{u} s] : BddBelow s := by
+ simpa using bddBelow_range_of_small (Subtype.val : s → Surreal.{u})
+#align surreal.bdd_below_of_small Surreal.bddBelow_of_small
+
end Surreal
open Surreal
nsmul
and zsmul
to default automatically (#6262)
This PR removes the default values for nsmul
and zsmul
, forcing the user to populate them manually.
The previous behavior can be obtained by writing nsmul := nsmulRec
and zsmul := zsmulRec
, which is now in the docstring for these fields.
The motivation here is to make it more obvious when module diamonds are being introduced, or at least where they might be hiding; you can now simply search for nsmulRec
in the source code.
Arguably we should do the same thing for intCast
, natCast
, pow
, and zpow
too, but diamonds are less common in those fields, so I'll leave them to a subsequent PR.
Co-authored-by: Matthew Ballard <matt@mrb.email>
@@ -353,6 +353,8 @@ instance orderedAddCommGroup : OrderedAddCommGroup Surreal where
lt_iff_le_not_le := by rintro ⟨_, ox⟩ ⟨_, oy⟩; apply @lt_iff_le_not_le PGame
le_antisymm := by rintro ⟨_⟩ ⟨_⟩ h₁ h₂; exact Quotient.sound ⟨h₁, h₂⟩
add_le_add_left := by rintro ⟨_⟩ ⟨_⟩ hx ⟨_⟩; exact @add_le_add_left PGame _ _ _ _ _ hx _
+ nsmul := nsmulRec
+ zsmul := zsmulRec
noncomputable instance : LinearOrderedAddCommGroup Surreal :=
{ Surreal.orderedAddCommGroup with
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
@@ -250,8 +250,8 @@ theorem add : ∀ {x y : PGame} (_ : Numeric x) (_ : Numeric y), Numeric (x + y)
· rintro (jx | jy)
· apply (ox.moveRight jx).add oy
· apply ox.add (oy.moveRight jy)⟩
-termination_by _ x y _ _ => (x, y) -- Porting note: Added `termination_by`
-decreasing_by pgame_wf_tac
+termination_by x y => (x, y) -- Porting note: Added `termination_by`
+decreasing_by all_goals pgame_wf_tac
#align pgame.numeric.add SetTheory.PGame.Numeric.add
theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
@@ -135,15 +135,15 @@ theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) :
not_lf.1 (lf_asymm ox oy h)
#align pgame.le_of_lf SetTheory.PGame.le_of_lf
-alias Lf.le := le_of_lf
-#align pgame.lf.le SetTheory.PGame.Lf.le
+alias LF.le := le_of_lf
+#align pgame.lf.le SetTheory.PGame.LF.le
theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
(lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
#align pgame.lt_of_lf SetTheory.PGame.lt_of_lf
-alias Lf.lt := lt_of_lf
-#align pgame.lf.lt SetTheory.PGame.Lf.lt
+alias LF.lt := lt_of_lf
+#align pgame.lf.lt SetTheory.PGame.LF.lt
theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
⟨fun h => h.lt ox oy, lf_of_lt⟩
Game
to SetTheory.Game
(#6365)
move Game
and PGame
into namespace SetTheory
as _root_.Game
might collide with other definitions (e.g. in projects depending on mathlib)
@@ -56,6 +56,8 @@ The branch `surreal_mul` contains some progress on this proof.
universe u
+namespace SetTheory
+
open scoped PGame
namespace PGame
@@ -64,33 +66,33 @@ namespace PGame
and all the elements of L and R are also numeric. -/
def Numeric : PGame → Prop
| ⟨_, _, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, Numeric (L i)) ∧ ∀ j, Numeric (R j)
-#align pgame.numeric PGame.Numeric
+#align pgame.numeric SetTheory.PGame.Numeric
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) := by
cases x; rfl
-#align pgame.numeric_def PGame.numeric_def
+#align pgame.numeric_def SetTheory.PGame.numeric_def
namespace Numeric
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 :=
numeric_def.2 ⟨h₁, h₂, h₃⟩
-#align pgame.numeric.mk PGame.Numeric.mk
+#align pgame.numeric.mk SetTheory.PGame.Numeric.mk
theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
x.moveLeft i < x.moveRight j := by cases x; exact o.1 i j
-#align pgame.numeric.left_lt_right PGame.Numeric.left_lt_right
+#align pgame.numeric.left_lt_right SetTheory.PGame.Numeric.left_lt_right
theorem moveLeft {x : PGame} (o : Numeric x) (i : x.LeftMoves) : Numeric (x.moveLeft i) := by
cases x; exact o.2.1 i
-#align pgame.numeric.move_left PGame.Numeric.moveLeft
+#align pgame.numeric.move_left SetTheory.PGame.Numeric.moveLeft
theorem moveRight {x : PGame} (o : Numeric x) (j : x.RightMoves) : Numeric (x.moveRight j) := by
cases x; exact o.2.2 j
-#align pgame.numeric.move_right PGame.Numeric.moveRight
+#align pgame.numeric.move_right SetTheory.PGame.Numeric.moveRight
end Numeric
@@ -102,7 +104,7 @@ theorem numeric_rec {C : PGame → Prop}
∀ x, Numeric x → C x
| ⟨_, _, _, _⟩, ⟨h, hl, hr⟩ =>
H _ _ _ _ h hl hr (fun i => numeric_rec H _ (hl i)) fun i => numeric_rec H _ (hr i)
-#align pgame.numeric_rec PGame.numeric_rec
+#align pgame.numeric_rec SetTheory.PGame.numeric_rec
theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) : Numeric y := by
induction' x using PGame.moveRecOn with x IHl IHr generalizing y
@@ -111,12 +113,12 @@ theorem Relabelling.numeric_imp {x y : PGame} (r : x ≡r y) (ox : Numeric x) :
apply ox.left_lt_right
· exact IHl _ (r.moveLeftSymm i) (ox.moveLeft _)
· exact IHr _ (r.moveRightSymm j) (ox.moveRight _)
-#align pgame.relabelling.numeric_imp PGame.Relabelling.numeric_imp
+#align pgame.relabelling.numeric_imp SetTheory.PGame.Relabelling.numeric_imp
/-- Relabellings preserve being numeric. -/
theorem Relabelling.numeric_congr {x y : PGame} (r : x ≡r y) : Numeric x ↔ Numeric y :=
⟨r.numeric_imp, r.symm.numeric_imp⟩
-#align pgame.relabelling.numeric_congr PGame.Relabelling.numeric_congr
+#align pgame.relabelling.numeric_congr SetTheory.PGame.Relabelling.numeric_congr
theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y → ¬y ⧏ x := by
refine' numeric_rec (C := fun x => ∀ z (_oz : Numeric z), x ⧏ z → ¬z ⧏ x)
@@ -127,25 +129,25 @@ theorem lf_asymm {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y →
· exact (le_trans h₂ h₁).not_gf (lf_of_lt (hy _ _))
· exact (le_trans h₁ h₂).not_gf (lf_of_lt (hx _ _))
· exact IHxr _ _ (oyr _) (h₁.lf_moveRight _) (h₂.lf_moveRight _)
-#align pgame.lf_asymm PGame.lf_asymm
+#align pgame.lf_asymm SetTheory.PGame.lf_asymm
theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x ≤ y :=
not_lf.1 (lf_asymm ox oy h)
-#align pgame.le_of_lf PGame.le_of_lf
+#align pgame.le_of_lf SetTheory.PGame.le_of_lf
alias Lf.le := le_of_lf
-#align pgame.lf.le PGame.Lf.le
+#align pgame.lf.le SetTheory.PGame.Lf.le
theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
(lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
-#align pgame.lt_of_lf PGame.lt_of_lf
+#align pgame.lt_of_lf SetTheory.PGame.lt_of_lf
alias Lf.lt := lt_of_lf
-#align pgame.lf.lt PGame.Lf.lt
+#align pgame.lf.lt SetTheory.PGame.Lf.lt
theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
⟨fun h => h.lt ox oy, lf_of_lt⟩
-#align pgame.lf_iff_lt PGame.lf_iff_lt
+#align pgame.lf_iff_lt SetTheory.PGame.lf_iff_lt
/-- 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) :
@@ -153,18 +155,18 @@ theorem le_iff_forall_lt {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
refine' le_iff_forall_lf.trans (and_congr _ _) <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [Numeric.moveLeft, Numeric.moveRight]
-#align pgame.le_iff_forall_lt PGame.le_iff_forall_lt
+#align pgame.le_iff_forall_lt SetTheory.PGame.le_iff_forall_lt
/-- 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 := by
rw [← lf_iff_lt ox oy, lf_iff_exists_le]
-#align pgame.lt_iff_exists_le PGame.lt_iff_exists_le
+#align pgame.lt_iff_exists_le SetTheory.PGame.lt_iff_exists_le
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 :=
(lt_iff_exists_le ox oy).2
-#align pgame.lt_of_exists_le PGame.lt_of_exists_le
+#align pgame.lt_of_exists_le SetTheory.PGame.lt_of_exists_le
/-- 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) :
@@ -175,61 +177,61 @@ theorem lt_def {x y : PGame} (ox : x.Numeric) (oy : y.Numeric) :
refine' or_congr _ _ <;> refine' exists_congr fun x_1 => _ <;> refine' and_congr _ _ <;>
refine' forall_congr' fun i => lf_iff_lt _ _ <;>
apply_rules [Numeric.moveLeft, Numeric.moveRight]
-#align pgame.lt_def PGame.lt_def
+#align pgame.lt_def SetTheory.PGame.lt_def
theorem not_fuzzy {x y : PGame} (ox : Numeric x) (oy : Numeric y) : ¬Fuzzy x y :=
fun h => not_lf.2 ((lf_of_fuzzy h).le ox oy) h.2
-#align pgame.not_fuzzy PGame.not_fuzzy
+#align pgame.not_fuzzy SetTheory.PGame.not_fuzzy
theorem lt_or_equiv_or_gt {x y : PGame} (ox : Numeric x) (oy : Numeric y) :
x < y ∨ (x ≈ y) ∨ y < x :=
((lf_or_equiv_or_gf x y).imp fun h => h.lt ox oy) <| Or.imp_right fun h => h.lt oy ox
-#align pgame.lt_or_equiv_or_gt PGame.lt_or_equiv_or_gt
+#align pgame.lt_or_equiv_or_gt SetTheory.PGame.lt_or_equiv_or_gt
theorem numeric_of_isEmpty (x : PGame) [IsEmpty x.LeftMoves] [IsEmpty x.RightMoves] : Numeric x :=
Numeric.mk isEmptyElim isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty PGame.numeric_of_isEmpty
+#align pgame.numeric_of_is_empty SetTheory.PGame.numeric_of_isEmpty
theorem numeric_of_isEmpty_leftMoves (x : PGame) [IsEmpty x.LeftMoves] :
(∀ j, Numeric (x.moveRight j)) → Numeric x :=
Numeric.mk isEmptyElim isEmptyElim
-#align pgame.numeric_of_is_empty_left_moves PGame.numeric_of_isEmpty_leftMoves
+#align pgame.numeric_of_is_empty_left_moves SetTheory.PGame.numeric_of_isEmpty_leftMoves
theorem numeric_of_isEmpty_rightMoves (x : PGame) [IsEmpty x.RightMoves]
(H : ∀ i, Numeric (x.moveLeft i)) : Numeric x :=
Numeric.mk (fun _ => isEmptyElim) H isEmptyElim
-#align pgame.numeric_of_is_empty_right_moves PGame.numeric_of_isEmpty_rightMoves
+#align pgame.numeric_of_is_empty_right_moves SetTheory.PGame.numeric_of_isEmpty_rightMoves
theorem numeric_zero : Numeric 0 :=
numeric_of_isEmpty 0
-#align pgame.numeric_zero PGame.numeric_zero
+#align pgame.numeric_zero SetTheory.PGame.numeric_zero
theorem numeric_one : Numeric 1 :=
numeric_of_isEmpty_rightMoves 1 fun _ => numeric_zero
-#align pgame.numeric_one PGame.numeric_one
+#align pgame.numeric_one SetTheory.PGame.numeric_one
theorem Numeric.neg : ∀ {x : PGame} (_ : Numeric x), Numeric (-x)
| ⟨_, _, _, _⟩, o =>
⟨fun j i => neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i => (o.2.1 i).neg⟩
-#align pgame.numeric.neg PGame.Numeric.neg
+#align pgame.numeric.neg SetTheory.PGame.Numeric.neg
namespace Numeric
theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x :=
(moveLeft_lf i).lt (o.moveLeft i) o
-#align pgame.numeric.move_left_lt PGame.Numeric.moveLeft_lt
+#align pgame.numeric.move_left_lt SetTheory.PGame.Numeric.moveLeft_lt
theorem moveLeft_le {x : PGame} (o : Numeric x) (i) : x.moveLeft i ≤ x :=
(o.moveLeft_lt i).le
-#align pgame.numeric.move_left_le PGame.Numeric.moveLeft_le
+#align pgame.numeric.move_left_le SetTheory.PGame.Numeric.moveLeft_le
theorem lt_moveRight {x : PGame} (o : Numeric x) (j) : x < x.moveRight j :=
(lf_moveRight j).lt o (o.moveRight j)
-#align pgame.numeric.lt_move_right PGame.Numeric.lt_moveRight
+#align pgame.numeric.lt_move_right SetTheory.PGame.Numeric.lt_moveRight
theorem le_moveRight {x : PGame} (o : Numeric x) (j) : x ≤ x.moveRight j :=
(o.lt_moveRight j).le
-#align pgame.numeric.le_move_right PGame.Numeric.le_moveRight
+#align pgame.numeric.le_move_right SetTheory.PGame.Numeric.le_moveRight
theorem add : ∀ {x y : PGame} (_ : Numeric x) (_ : Numeric y), Numeric (x + y)
| ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, ox, oy =>
@@ -250,11 +252,11 @@ theorem add : ∀ {x y : PGame} (_ : Numeric x) (_ : Numeric y), Numeric (x + y)
· apply ox.add (oy.moveRight jy)⟩
termination_by _ x y _ _ => (x, y) -- Porting note: Added `termination_by`
decreasing_by pgame_wf_tac
-#align pgame.numeric.add PGame.Numeric.add
+#align pgame.numeric.add SetTheory.PGame.Numeric.add
theorem sub {x y : PGame} (ox : Numeric x) (oy : Numeric y) : Numeric (x - y) :=
ox.add oy.neg
-#align pgame.numeric.sub PGame.Numeric.sub
+#align pgame.numeric.sub SetTheory.PGame.Numeric.sub
end Numeric
@@ -262,18 +264,20 @@ end Numeric
theorem numeric_nat : ∀ n : ℕ, Numeric n
| 0 => numeric_zero
| n + 1 => (numeric_nat n).add numeric_one
-#align pgame.numeric_nat PGame.numeric_nat
+#align pgame.numeric_nat SetTheory.PGame.numeric_nat
/-- Ordinal games are numeric. -/
theorem numeric_toPGame (o : Ordinal) : o.toPGame.Numeric := by
induction' o using Ordinal.induction with o IH
apply numeric_of_isEmpty_rightMoves
simpa using fun i => IH _ (Ordinal.toLeftMovesToPGame_symm_lt i)
-#align pgame.numeric_to_pgame PGame.numeric_toPGame
+#align pgame.numeric_to_pgame SetTheory.PGame.numeric_toPGame
end PGame
-open PGame
+end SetTheory
+
+open SetTheory PGame
/-- 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,
@@ -133,14 +133,14 @@ theorem le_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) :
not_lf.1 (lf_asymm ox oy h)
#align pgame.le_of_lf PGame.le_of_lf
-alias le_of_lf ← Lf.le
+alias Lf.le := le_of_lf
#align pgame.lf.le PGame.Lf.le
theorem lt_of_lf {x y : PGame} (h : x ⧏ y) (ox : Numeric x) (oy : Numeric y) : x < y :=
(lt_or_fuzzy_of_lf h).resolve_right (not_fuzzy_of_le (h.le ox oy))
#align pgame.lt_of_lf PGame.lt_of_lf
-alias lt_of_lf ← Lf.lt
+alias Lf.lt := lt_of_lf
#align pgame.lf.lt PGame.Lf.lt
theorem lf_iff_lt {x y : PGame} (ox : Numeric x) (oy : Numeric y) : x ⧏ y ↔ x < y :=
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -279,7 +279,7 @@ open PGame
by the equivalence relation `x ≈ y ↔ x ≤ y ∧ y ≤ x`. In the quotient,
the order becomes a total order. -/
def Surreal :=
- Quotient (Subtype.instSetoidSubtype Numeric)
+ Quotient (inferInstanceAs <| Setoid (Subtype Numeric))
#align surreal Surreal
namespace Surreal
@@ -2,15 +2,12 @@
Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison
-
-! This file was ported from Lean 3 source module set_theory.surreal.basic
-! leanprover-community/mathlib commit ee02a30e209a2a77b93eac1254e8c66e76192f54
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.Order.Hom.Monoid
import Mathlib.SetTheory.Game.Ordinal
+#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"ee02a30e209a2a77b93eac1254e8c66e76192f54"
+
/-!
# Surreal numbers
The unported dependencies are