l3lab/ntp-mathlib huggingface dataset:
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; 

Proof state:
case h.e'_2.h.h.e'_2.h.a
r : ℝ
hr : Irrational r
x✝¹ x✝ : ℤ
⊢ x✝ > 0 ∧ ⌈↑x✝ * r⌉ - 1 = x✝¹ ↔ x✝ > 0 ∧ ⌊↑x✝ * r⌋ = x✝¹

Next tactic:
rename_i k
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; 

Proof state:
case h.e'_2.h.h.e'_2.h.a
r : ℝ
hr : Irrational r
x✝ k : ℤ
⊢ k > 0 ∧ ⌈↑k * r⌉ - 1 = x✝ ↔ k > 0 ∧ ⌊↑k * r⌋ = x✝

Next tactic:
rw [and_congr_right_iff]
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; rw [and_congr_right_iff]; 

Proof state:
case h.e'_2.h.h.e'_2.h.a
r : ℝ
hr : Irrational r
x✝ k : ℤ
⊢ k > 0 → (⌈↑k * r⌉ - 1 = x✝ ↔ ⌊↑k * r⌋ = x✝)

Next tactic:
intro hk
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; rw [and_congr_right_iff]; intro hk; 

Proof state:
case h.e'_2.h.h.e'_2.h.a
r : ℝ
hr : Irrational r
x✝ k : ℤ
hk : k > 0
⊢ ⌈↑k * r⌉ - 1 = x✝ ↔ ⌊↑k * r⌋ = x✝

Next tactic:
congr!
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; rw [and_congr_right_iff]; intro hk; congr!
  

Proof state:
case h.e'_2.h.h.e'_2.h.a.a.h.e'_2
r : ℝ
hr : Irrational r
x✝ k : ℤ
hk : k > 0
⊢ ⌈↑k * r⌉ - 1 = ⌊↑k * r⌋

Next tactic:
rw [sub_eq_iff_eq_add, Int.ceil_eq_iff, Int.cast_add, Int.cast_one, add_sub_cancel]
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; rw [and_congr_right_iff]; intro hk; congr!
  rw [sub_eq_iff_eq_add, Int.ceil_eq_iff, Int.cast_add, Int.cast_one, add_sub_cancel]
  

Proof state:
case h.e'_2.h.h.e'_2.h.a.a.h.e'_2
r : ℝ
hr : Irrational r
x✝ k : ℤ
hk : k > 0
⊢ ↑⌊↑k * r⌋ < ↑k * r ∧ ↑k * r ≤ ↑⌊↑k * r⌋ + 1

Next tactic:
refine ⟨(Int.floor_le _).lt_of_ne fun h ↦ ?_, (Int.lt_floor_add_one _).le⟩
/-- Let `r` be an irrational number. Then `B⁺_r` and `B⁺'_r` are equal. -/
theorem Irrational.beattySeq'_pos_eq {r : ℝ} (hr : Irrational r) :
    {beattySeq' r k | k > 0} = {beattySeq r k | k > 0} := by
  dsimp only [beattySeq, beattySeq']
  congr! 4; rename_i k; rw [and_congr_right_iff]; intro hk; congr!
  rw [sub_eq_iff_eq_add, Int.ceil_eq_iff, Int.cast_add, Int.cast_one, add_sub_cancel]
  refine ⟨(Int.floor_le _).lt_of_ne fun h ↦ ?_, (Int.lt_floor_add_one _).le⟩
  

Proof state:
case h.e'_2.h.h.e'_2.h.a.a.h.e'_2
r : ℝ
hr : Irrational r
x✝ k : ℤ
hk : k > 0
h : ↑⌊↑k * r⌋ = ↑k * r
⊢ False

Next tactic:
exact (hr.int_mul hk.ne').ne_int ⌊k * r⌋ h.symm
/-- **Rayleigh's theorem** on Beatty sequences. Let `r` be an irrational number greater than 1, and
`1/r + 1/s = 1`. Then `B⁺_r` and `B⁺_s` partition the positive integers. -/
theorem Irrational.beattySeq_symmDiff_beattySeq_pos {r s : ℝ}
    (hrs : r.IsConjugateExponent s) (hr : Irrational r) :
    {beattySeq r k | k > 0} ∆ {beattySeq s k | k > 0} = {n | 0 < n} := by
  

Proof state:
r s : ℝ
hrs : Real.IsConjugateExponent r s
hr : Irrational r
⊢ {x | ∃ k > 0, beattySeq r k = x} ∆ {x | ∃ k > 0, beattySeq s k = x} = {n | 0 < n}

Next tactic:
rw [← hr.beattySeq'_pos_eq, beattySeq'_symmDiff_beattySeq_pos hrs]
theorem wf_isOption : WellFounded IsOption :=
  ⟨fun x =>
    moveRecOn x fun x IHl IHr =>
      Acc.intro x fun y h => by
        

Proof state:
x✝ x : PGame
IHl : ∀ (i : LeftMoves x), Acc IsOption (moveLeft x i)
IHr : ∀ (j : RightMoves x), Acc IsOption (moveRight x j)
y : PGame
h : IsOption y x
⊢ Acc IsOption y

Next tactic:
induction' h with _ i _ j
theorem wf_isOption : WellFounded IsOption :=
  ⟨fun x =>
    moveRecOn x fun x IHl IHr =>
      Acc.intro x fun y h => by
        induction' h with _ i _ j
        · 

Proof state:
case moveLeft
x✝¹ x y x✝ : PGame
i : LeftMoves x✝
IHl : ∀ (i : LeftMoves x✝), Acc IsOption (moveLeft x✝ i)
IHr : ∀ (j : RightMoves x✝), Acc IsOption (moveRight x✝ j)
⊢ Acc IsOption (moveLeft x✝ i)

Next tactic:
exact IHl i
theorem wf_isOption : WellFounded IsOption :=
  ⟨fun x =>
    moveRecOn x fun x IHl IHr =>
      Acc.intro x fun y h => by
        induction' h with _ i _ j
        · exact IHl i
        · 

Proof state:
case moveRight
x✝¹ x y x✝ : PGame
j : RightMoves x✝
IHl : ∀ (i : LeftMoves x✝), Acc IsOption (moveLeft x✝ i)
IHr : ∀ (j : RightMoves x✝), Acc IsOption (moveRight x✝ j)
⊢ Acc IsOption (moveRight x✝ j)

Next tactic:
exact IHr j
@[simp]
theorem Subsequent.mk_right' (xL : xl → PGame) (xR : xr → PGame) (j : RightMoves (mk xl xr xL xR)) :
    Subsequent (xR j) (mk xl xr xL xR) := by
  

Proof state:
xl xr : Type u_1
xL : xl → PGame
xR : xr → PGame
j : RightMoves (mk xl xr xL xR)
⊢ Subsequent (xR j) (mk xl xr xL xR)

Next tactic:
pgame_wf_tac
@[simp] theorem Subsequent.moveRight_mk_left (xL : xl → PGame) (j) :
    Subsequent ((xL i).moveRight j) (mk xl xr xL xR) := by
  

Proof state:
xl : Type u_1
i : xl
xr : Type u_1
xR : xr → PGame
xL : xl → PGame
j : RightMoves (xL i)
⊢ Subsequent (PGame.moveRight (xL i) j) (mk xl xr xL xR)

Next tactic:
pgame_wf_tac
@[simp] theorem Subsequent.moveRight_mk_right (xR : xr → PGame) (j) :
    Subsequent ((xR i).moveRight j) (mk xl xr xL xR) := by
  

Proof state:
xr : Type u_1
i : xr
xl : Type u_1
xL : xl → PGame
xR : xr → PGame
j : RightMoves (xR i)
⊢ Subsequent (PGame.moveRight (xR i) j) (mk xl xr xL xR)

Next tactic:
pgame_wf_tac
@[simp] theorem Subsequent.moveLeft_mk_left (xL : xl → PGame) (j) :
    Subsequent ((xL i).moveLeft j) (mk xl xr xL xR) := by
  

Proof state:
xl : Type u_1
i : xl
xr : Type u_1
xR : xr → PGame
xL : xl → PGame
j : LeftMoves (xL i)
⊢ Subsequent (PGame.moveLeft (xL i) j) (mk xl xr xL xR)

Next tactic:
pgame_wf_tac
@[simp] theorem Subsequent.moveLeft_mk_right (xR : xr → PGame) (j) :
    Subsequent ((xR i).moveLeft j) (mk xl xr xL xR) := by
  

Proof state:
xr : Type u_1
i : xr
xl : Type u_1
xL : xl → PGame
xR : xr → PGame
j : LeftMoves (xR i)
⊢ Subsequent (PGame.moveLeft (xR i) j) (mk xl xr xL xR)

Next tactic:
pgame_wf_tac
/-- Definition of `x ≤ y` on pre-games, in terms of `⧏`.

The ordering here is chosen so that `And.left` refer to moves by Left, and `And.right` refer to
moves by Right. -/
theorem le_iff_forall_lf {x y : PGame} :
    x ≤ y ↔ (∀ i, x.moveLeft i ⧏ y) ∧ ∀ j, x ⧏ y.moveRight j := by
  

Proof state:
x y : PGame
⊢ x ≤ y ↔ (∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j

Next tactic:
unfold LE.le le
/-- Definition of `x ≤ y` on pre-games, in terms of `⧏`.

The ordering here is chosen so that `And.left` refer to moves by Left, and `And.right` refer to
moves by Right. -/
theorem le_iff_forall_lf {x y : PGame} :
    x ≤ y ↔ (∀ i, x.moveLeft i ⧏ y) ∧ ∀ j, x ⧏ y.moveRight j := by
  unfold LE.le le
  

Proof state:
x y : PGame
⊢ {
          le :=
            Sym2.GameAdd.fix wf_isOption fun x y le =>
              (∀ (i : LeftMoves x), ¬le y (moveLeft x i) (_ : Sym2.GameAdd IsOption ⟦(y, moveLeft x i)⟧ ⟦(x, y)⟧)) ∧
                ∀ (j : RightMoves y),
                  ¬le (moveRight y j) x (_ : Sym2.GameAdd IsOption ⟦(moveRight y j, x)⟧ ⟦(x, y)⟧) }.1
      x y ↔
    (∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j

Next tactic:
simp only
/-- Definition of `x ≤ y` on pre-games, in terms of `⧏`.

The ordering here is chosen so that `And.left` refer to moves by Left, and `And.right` refer to
moves by Right. -/
theorem le_iff_forall_lf {x y : PGame} :
    x ≤ y ↔ (∀ i, x.moveLeft i ⧏ y) ∧ ∀ j, x ⧏ y.moveRight j := by
  unfold LE.le le
  simp only
  

Proof state:
x y : PGame
⊢ Sym2.GameAdd.fix wf_isOption
      (fun x y le =>
        (∀ (i : LeftMoves x), ¬le y (moveLeft x i) (_ : Sym2.GameAdd IsOption ⟦(y, moveLeft x i)⟧ ⟦(x, y)⟧)) ∧
          ∀ (j : RightMoves y), ¬le (moveRight y j) x (_ : Sym2.GameAdd IsOption ⟦(moveRight y j, x)⟧ ⟦(x, y)⟧))
      x y ↔
    (∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j

Next tactic:
rw [Sym2.GameAdd.fix_eq]
/-- Definition of `x ≤ y` on pre-games, in terms of `⧏`.

The ordering here is chosen so that `And.left` refer to moves by Left, and `And.right` refer to
moves by Right. -/
theorem le_iff_forall_lf {x y : PGame} :
    x ≤ y ↔ (∀ i, x.moveLeft i ⧏ y) ∧ ∀ j, x ⧏ y.moveRight j := by
  unfold LE.le le
  simp only
  rw [Sym2.GameAdd.fix_eq]
  

Proof state:
x y : PGame
⊢ ((∀ (i : LeftMoves x),
        ¬(fun a' b' x =>
              Sym2.GameAdd.fix wf_isOption
                (fun x y le =>
                  (∀ (i : LeftMoves x), ¬le y (moveLeft x i) (_ : Sym2.GameAdd IsOption ⟦(y, moveLeft x i)⟧ ⟦(x, y)⟧)) ∧
                    ∀ (j : RightMoves y),
                      ¬le (moveRight y j) x (_ : Sym2.GameAdd IsOption ⟦(moveRight y j, x)⟧ ⟦(x, y)⟧))
                a' b')
            y (moveLeft x i) (_ : Sym2.GameAdd IsOption ⟦(y, moveLeft x i)⟧ ⟦(x, y)⟧)) ∧
      ∀ (j : RightMoves y),
        ¬(fun a' b' x =>
              Sym2.GameAdd.fix wf_isOption
                (fun x y le =>
                  (∀ (i : LeftMoves x), ¬le y (moveLeft x i) (_ : Sym2.GameAdd IsOption ⟦(y, moveLeft x i)⟧ ⟦(x, y)⟧)) ∧
                    ∀ (j : RightMoves y),
                      ¬le (moveRight y j) x (_ : Sym2.GameAdd IsOption ⟦(moveRight y j, x)⟧ ⟦(x, y)⟧))
                a' b')
            (moveRight y j) x (_ : Sym2.GameAdd IsOption ⟦(moveRight y j, x)⟧ ⟦(x, y)⟧)) ↔
    (∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j

Next tactic:
rfl
/-- Definition of `x ⧏ y` on pre-games, in terms of `≤`.

The ordering here is chosen so that `or.inl` refer to moves by Left, and `or.inr` refer to
moves by Right. -/
theorem lf_iff_exists_le {x y : PGame} :
    x ⧏ y ↔ (∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y := by
  

Proof state:
x y : PGame
⊢ x ⧏ y ↔ (∃ i, x ≤ moveLeft y i) ∨ ∃ j, moveRight x j ≤ y

Next tactic:
rw [LF, le_iff_forall_lf, not_and_or]
/-- Definition of `x ⧏ y` on pre-games, in terms of `≤`.

The ordering here is chosen so that `or.inl` refer to moves by Left, and `or.inr` refer to
moves by Right. -/
theorem lf_iff_exists_le {x y : PGame} :
    x ⧏ y ↔ (∃ i, x ≤ y.moveLeft i) ∨ ∃ j, x.moveRight j ≤ y := by
  rw [LF, le_iff_forall_lf, not_and_or]
  

Proof state:
x y : PGame
⊢ ((¬∀ (i : LeftMoves y), moveLeft y i ⧏ x) ∨ ¬∀ (j : RightMoves x), y ⧏ moveRight x j) ↔
    (∃ i, x ≤ moveLeft y i) ∨ ∃ j, moveRight x j ≤ y

Next tactic:
simp
theorem le_or_gf (x y : PGame) : x ≤ y ∨ y ⧏ x := by
  

Proof state:
x y : PGame
⊢ x ≤ y ∨ y ⧏ x

Next tactic:
rw [← PGame.not_le]
theorem le_or_gf (x y : PGame) : x ≤ y ∨ y ⧏ x := by
  rw [← PGame.not_le]
  

Proof state:
x y : PGame
⊢ x ≤ y ∨ ¬x ≤ y

Next tactic:
apply em
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      

Proof state:
src✝ : LE PGame := le
x : PGame
⊢ x ≤ x

Next tactic:
induction' x with _ _ _ _ IHl IHr
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      

Proof state:
case mk
src✝ : LE PGame := le
α✝ β✝ : Type ?u.34798
a✝¹ : α✝ → PGame
a✝ : β✝ → PGame
IHl : ∀ (a : α✝), a✝¹ a ≤ a✝¹ a
IHr : ∀ (a : β✝), a✝ a ≤ a✝ a
⊢ mk α✝ β✝ a✝¹ a✝ ≤ mk α✝ β✝ a✝¹ a✝

Next tactic:
exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      

Proof state:
src✝ : LE PGame := le
⊢ ∀ (a b c : PGame), a ≤ b → b ≤ c → a ≤ c

Next tactic:
suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
      

Proof state:
src✝ : LE PGame := le
⊢ ∀ {x y z : PGame}, (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y)

Next tactic:
intro x y z
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
      intro x y z
      

Proof state:
src✝ : LE PGame := le
x y z : PGame
⊢ (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y)

Next tactic:
induction' x with xl xr xL xR IHxl IHxr generalizing y z
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
      intro x y z
      induction' x with xl xr xL xR IHxl IHxr generalizing y z
      

Proof state:
case mk
src✝ : LE PGame := le
xl xr : Type ?u.35200
xL : xl → PGame
xR : xr → PGame
IHxl :
  ∀ (a : xl) {y z : PGame},
    (xL a ≤ y → y ≤ z → xL a ≤ z) ∧ (y ≤ z → z ≤ xL a → y ≤ xL a) ∧ (z ≤ xL a → xL a ≤ y → z ≤ y)
IHxr :
  ∀ (a : xr) {y z : PGame},
    (xR a ≤ y → y ≤ z → xR a ≤ z) ∧ (y ≤ z → z ≤ xR a → y ≤ xR a) ∧ (z ≤ xR a → xR a ≤ y → z ≤ y)
y z : PGame
⊢ (mk xl xr xL xR ≤ y → y ≤ z → mk xl xr xL xR ≤ z) ∧
    (y ≤ z → z ≤ mk xl xr xL xR → y ≤ mk xl xr xL xR) ∧ (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ y → z ≤ y)

Next tactic:
induction' y with yl yr yL yR IHyl IHyr generalizing z
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
      intro x y z
      induction' x with xl xr xL xR IHxl IHxr generalizing y z
      induction' y with yl yr yL yR IHyl IHyr generalizing z
      

Proof state:
case mk.mk
src✝ : LE PGame := le
xl xr : Type ?u.35242
xL : xl → PGame
xR : xr → PGame
IHxl :
  ∀ (a : xl) {y z : PGame},
    (xL a ≤ y → y ≤ z → xL a ≤ z) ∧ (y ≤ z → z ≤ xL a → y ≤ xL a) ∧ (z ≤ xL a → xL a ≤ y → z ≤ y)
IHxr :
  ∀ (a : xr) {y z : PGame},
    (xR a ≤ y → y ≤ z → xR a ≤ z) ∧ (y ≤ z → z ≤ xR a → y ≤ xR a) ∧ (z ≤ xR a → xR a ≤ y → z ≤ y)
yl yr : Type ?u.35242
yL : yl → PGame
yR : yr → PGame
IHyl :
  ∀ (a : yl) {z : PGame},
    (mk xl xr xL xR ≤ yL a → yL a ≤ z → mk xl xr xL xR ≤ z) ∧
      (yL a ≤ z → z ≤ mk xl xr xL xR → yL a ≤ mk xl xr xL xR) ∧ (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ yL a → z ≤ yL a)
IHyr :
  ∀ (a : yr) {z : PGame},
    (mk xl xr xL xR ≤ yR a → yR a ≤ z → mk xl xr xL xR ≤ z) ∧
      (yR a ≤ z → z ≤ mk xl xr xL xR → yR a ≤ mk xl xr xL xR) ∧ (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ yR a → z ≤ yR a)
z : PGame
⊢ (mk xl xr xL xR ≤ mk yl yr yL yR → mk yl yr yL yR ≤ z → mk xl xr xL xR ≤ z) ∧
    (mk yl yr yL yR ≤ z → z ≤ mk xl xr xL xR → mk yl yr yL yR ≤ mk xl xr xL xR) ∧
      (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ mk yl yr yL yR → z ≤ mk yl yr yL yR)

Next tactic:
induction' z with zl zr zL zR IHzl IHzr
instance : Preorder PGame :=
  { PGame.le with
    le_refl := fun x => by
      induction' x with _ _ _ _ IHl IHr
      exact
        le_of_forall_lf (fun i => lf_of_le_moveLeft (IHl i)) fun i => lf_of_moveRight_le (IHr i)
    le_trans := by
      suffices
        ∀ {x y z : PGame},
          (x ≤ y → y ≤ z → x ≤ z) ∧ (y ≤ z → z ≤ x → y ≤ x) ∧ (z ≤ x → x ≤ y → z ≤ y) from
        fun x y z => this.1
      intro x y z
      induction' x with xl xr xL xR IHxl IHxr generalizing y z
      induction' y with yl yr yL yR IHyl IHyr generalizing z
      induction' z with zl zr zL zR IHzl IHzr
      

Proof state:
case mk.mk.mk
src✝ : LE PGame := le
xl xr : Type ?u.35279
xL : xl → PGame
xR : xr → PGame
IHxl :
  ∀ (a : xl) {y z : PGame},
    (xL a ≤ y → y ≤ z → xL a ≤ z) ∧ (y ≤ z → z ≤ xL a → y ≤ xL a) ∧ (z ≤ xL a → xL a ≤ y → z ≤ y)
IHxr :
  ∀ (a : xr) {y z : PGame},
    (xR a ≤ y → y ≤ z → xR a ≤ z) ∧ (y ≤ z → z ≤ xR a → y ≤ xR a) ∧ (z ≤ xR a → xR a ≤ y → z ≤ y)
yl yr : Type ?u.35279
yL : yl → PGame
yR : yr → PGame
IHyl :
  ∀ (a : yl) {z : PGame},
    (mk xl xr xL xR ≤ yL a → yL a ≤ z → mk xl xr xL xR ≤ z) ∧
      (yL a ≤ z → z ≤ mk xl xr xL xR → yL a ≤ mk xl xr xL xR) ∧ (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ yL a → z ≤ yL a)
IHyr :
  ∀ (a : yr) {z : PGame},
    (mk xl xr xL xR ≤ yR a → yR a ≤ z → mk xl xr xL xR ≤ z) ∧
      (yR a ≤ z → z ≤ mk xl xr xL xR → yR a ≤ mk xl xr xL xR) ∧ (z ≤ mk xl xr xL xR → mk xl xr xL xR ≤ yR a → z ≤ yR a)
zl zr : Type ?u.35279
zL : zl → PGame
zR : zr → PGame
IHzl :
  ∀ (a : zl),
    (mk xl xr xL xR ≤ mk yl yr yL yR → mk yl yr yL yR ≤ zL a → mk xl xr xL xR ≤ zL a) ∧
      (mk yl yr yL yR ≤ zL a → zL a ≤ mk xl xr xL xR → mk yl yr yL yR ≤ mk xl xr xL xR) ∧
        (zL a ≤ mk xl xr xL xR → mk xl xr xL xR ≤ mk yl yr yL yR → zL a ≤ mk yl yr yL yR)
IHzr :
  ∀ (a : zr),
    (mk xl xr xL xR ≤ mk yl yr yL yR → mk yl yr yL yR ≤ zR a → mk xl xr xL xR ≤ zR a) ∧
      (mk yl yr yL yR ≤ zR a → zR a ≤ mk xl xr xL xR → mk yl yr yL yR ≤ mk xl xr xL xR) ∧
        (zR a ≤ mk xl xr xL xR → mk xl xr xL xR ≤ mk yl yr yL yR → zR a ≤ mk yl yr yL yR)
⊢ (mk xl xr xL xR ≤ mk yl yr yL yR → mk yl yr yL yR ≤ mk zl zr zL zR → mk xl xr xL xR ≤ mk zl zr zL zR) ∧
    (mk yl yr yL yR ≤ mk zl zr zL zR → mk zl zr zL zR ≤ mk xl xr xL xR → mk yl yr yL yR ≤ mk xl xr xL xR) ∧
      (mk zl zr zL zR ≤ mk xl xr xL xR → mk xl xr xL xR ≤ mk yl yr yL yR → mk zl zr zL zR ≤ mk yl yr yL yR)

Next tactic:
exact
        ⟨le_trans_aux (fun {i} => (IHxl i).2.1) fun {j} => (IHzr j).2.2,
          le_trans_aux (fun {i} => (IHyl i).2.2) fun {j} => (IHxr j).1,
          le_trans_aux (fun {i} => (IHzl i).1) fun {j} => (IHyr j).2.1⟩
@[trans]
theorem lf_of_le_of_lf {x y z : PGame} (h₁ : x ≤ y) (h₂ : y ⧏ z) : x ⧏ z := by
  

Proof state:
x y z : PGame
h₁ : x ≤ y
h₂ : y ⧏ z
⊢ x ⧏ z

Next tactic:
rw [← PGame.not_le] at h₂ ⊢
@[trans]
theorem lf_of_le_of_lf {x y z : PGame} (h₁ : x ≤ y) (h₂ : y ⧏ z) : x ⧏ z := by
  rw [← PGame.not_le] at h₂ ⊢
  

Proof state:
x y z : PGame
h₁ : x ≤ y
h₂ : ¬z ≤ y
⊢ ¬z ≤ x

Next tactic:
exact fun h₃ => h₂ (h₃.trans h₁)
@[trans]
theorem lf_of_lf_of_le {x y z : PGame} (h₁ : x ⧏ y) (h₂ : y ≤ z) : x ⧏ z := by
  

Proof state:
x y z : PGame
h₁ : x ⧏ y
h₂ : y ≤ z
⊢ x ⧏ z

Next tactic:
rw [← PGame.not_le] at h₁ ⊢
@[trans]
theorem lf_of_lf_of_le {x y z : PGame} (h₁ : x ⧏ y) (h₂ : y ≤ z) : x ⧏ z := by
  rw [← PGame.not_le] at h₁ ⊢
  

Proof state:
x y z : PGame
h₁ : ¬y ≤ x
h₂ : y ≤ z
⊢ ¬z ≤ x

Next tactic:
exact fun h₃ => h₁ (h₂.trans h₃)
/-- The definition of `x ≤ y` on pre-games, in terms of `≤` two moves later. -/
theorem le_def {x y : PGame} :
    x ≤ y ↔
      (∀ i, (∃ i', x.moveLeft i ≤ y.moveLeft i') ∨ ∃ j, (x.moveLeft i).moveRight j ≤ y) ∧
        ∀ j, (∃ i, x ≤ (y.moveRight j).moveLeft i) ∨ ∃ j', x.moveRight j' ≤ y.moveRight j := by
  

Proof state:
x y : PGame
⊢ x ≤ y ↔
    (∀ (i : LeftMoves x), (∃ i', moveLeft x i ≤ moveLeft y i') ∨ ∃ j, moveRight (moveLeft x i) j ≤ y) ∧
      ∀ (j : RightMoves y), (∃ i, x ≤ moveLeft (moveRight y j) i) ∨ ∃ j', moveRight x j' ≤ moveRight y j

Next tactic:
rw [le_iff_forall_lf]
/-- The definition of `x ≤ y` on pre-games, in terms of `≤` two moves later. -/
theorem le_def {x y : PGame} :
    x ≤ y ↔
      (∀ i, (∃ i', x.moveLeft i ≤ y.moveLeft i') ∨ ∃ j, (x.moveLeft i).moveRight j ≤ y) ∧
        ∀ j, (∃ i, x ≤ (y.moveRight j).moveLeft i) ∨ ∃ j', x.moveRight j' ≤ y.moveRight j := by
  rw [le_iff_forall_lf]
  

Proof state:
x y : PGame
⊢ ((∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j) ↔
    (∀ (i : LeftMoves x), (∃ i', moveLeft x i ≤ moveLeft y i') ∨ ∃ j, moveRight (moveLeft x i) j ≤ y) ∧
      ∀ (j : RightMoves y), (∃ i, x ≤ moveLeft (moveRight y j) i) ∨ ∃ j', moveRight x j' ≤ moveRight y j

Next tactic:
conv =>
    lhs
    simp only [lf_iff_exists_le]
/-- The definition of `x ≤ y` on pre-games, in terms of `≤` two moves later. -/
theorem le_def {x y : PGame} :
    x ≤ y ↔
      (∀ i, (∃ i', x.moveLeft i ≤ y.moveLeft i') ∨ ∃ j, (x.moveLeft i).moveRight j ≤ y) ∧
        ∀ j, (∃ i, x ≤ (y.moveRight j).moveLeft i) ∨ ∃ j', x.moveRight j' ≤ y.moveRight j := by
  rw [le_iff_forall_lf]
  conv =>
    

Proof state:
x y : PGame
| ((∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j) ↔
    (∀ (i : LeftMoves x), (∃ i', moveLeft x i ≤ moveLeft y i') ∨ ∃ j, moveRight (moveLeft x i) j ≤ y) ∧
      ∀ (j : RightMoves y), (∃ i, x ≤ moveLeft (moveRight y j) i) ∨ ∃ j', moveRight x j' ≤ moveRight y j

Next tactic:
lhs
    simp only [lf_iff_exists_le]
/-- The definition of `x ≤ y` on pre-games, in terms of `≤` two moves later. -/
theorem le_def {x y : PGame} :
    x ≤ y ↔
      (∀ i, (∃ i', x.moveLeft i ≤ y.moveLeft i') ∨ ∃ j, (x.moveLeft i).moveRight j ≤ y) ∧
        ∀ j, (∃ i, x ≤ (y.moveRight j).moveLeft i) ∨ ∃ j', x.moveRight j' ≤ y.moveRight j := by
  rw [le_iff_forall_lf]
  conv =>
    

Proof state:
x y : PGame
| ((∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j) ↔
    (∀ (i : LeftMoves x), (∃ i', moveLeft x i ≤ moveLeft y i') ∨ ∃ j, moveRight (moveLeft x i) j ≤ y) ∧
      ∀ (j : RightMoves y), (∃ i, x ≤ moveLeft (moveRight y j) i) ∨ ∃ j', moveRight x j' ≤ moveRight y j

Next tactic:
lhs
/-- The definition of `x ≤ y` on pre-games, in terms of `≤` two moves later. -/
theorem le_def {x y : PGame} :
    x ≤ y ↔
      (∀ i, (∃ i', x.moveLeft i ≤ y.moveLeft i') ∨ ∃ j, (x.moveLeft i).moveRight j ≤ y) ∧
        ∀ j, (∃ i, x ≤ (y.moveRight j).moveLeft i) ∨ ∃ j', x.moveRight j' ≤ y.moveRight j := by
  rw [le_iff_forall_lf]
  conv =>
    lhs
    

Proof state:
x y : PGame
| (∀ (i : LeftMoves x), moveLeft x i ⧏ y) ∧ ∀ (j : RightMoves y), x ⧏ moveRight y j

Next tactic:
simp only [lf_iff_exists_le]
/-- The definition of `x ⧏ y` on pre-games, in terms of `⧏` two moves later. -/
theorem lf_def {x y : PGame} :
    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' := by
  

Proof state:
x y : PGame
⊢ x ⧏ y ↔
    (∃ i,
        (∀ (i' : LeftMoves x), moveLeft x i' ⧏ moveLeft y i) ∧
          ∀ (j : RightMoves (moveLeft y i)), x ⧏ moveRight (moveLeft y i) j) ∨
      ∃ j,
        (∀ (i : LeftMoves (moveRight x j)), moveLeft (moveRight x j) i ⧏ y) ∧
          ∀ (j' : RightMoves y), moveRight x j ⧏ moveRight y j'

Next tactic:
rw [lf_iff_exists_le]