Skip to content

Commit 95e4d18

Browse files
committed
chore(SetTheory/Game/PGame): deprecate primed lemmas (#18469)
We perform various renames with the intent of doing away with some badly named or dubiously useful lemmas.
1 parent e8b45bf commit 95e4d18

File tree

5 files changed

+42
-27
lines changed

5 files changed

+42
-27
lines changed

Mathlib/SetTheory/Game/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,7 @@ def mulOption (x y : PGame) (i : LeftMoves x) (j : LeftMoves y) : PGame :=
790790
the first kind. -/
791791
lemma mulOption_neg_neg {x} (y) {i j} :
792792
mulOption x y i j = mulOption x (-(-y)) i (toLeftMovesNeg <| toRightMovesNeg j) := by
793-
dsimp only [mulOption]
794-
congr 2
795-
· rw [neg_neg]
796-
iterate 2 rw [moveLeft_neg, moveRight_neg, neg_neg]
793+
simp [mulOption]
797794

798795
/-- The left options of `x * y` agree with that of `y * x` up to equivalence. -/
799796
lemma mulOption_symm (x y) {i j} : ⟦mulOption x y i j⟧ = (⟦mulOption y x j i⟧ : Game) := by

Mathlib/SetTheory/Game/Impartial.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ instance impartial_neg (G : PGame) [G.Impartial] : (-G).Impartial := by
9494
refine ⟨?_, fun i => ?_, fun i => ?_⟩
9595
· rw [neg_neg]
9696
exact Equiv.symm (neg_equiv_self G)
97-
· rw [moveLeft_neg']
97+
· rw [moveLeft_neg]
9898
exact impartial_neg _
99-
· rw [moveRight_neg']
99+
· rw [moveRight_neg]
100100
exact impartial_neg _
101101
termination_by G
102102

Mathlib/SetTheory/Game/Nim.lean

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,26 @@ theorem toRightMovesNim_symm_lt {o : Ordinal} (i : (nim o).RightMoves) :
8484
(toRightMovesNim.symm i).prop
8585

8686
@[simp]
87-
theorem moveLeft_nim' {o : Ordinal} (i) : (nim o).moveLeft i = nim (toLeftMovesNim.symm i).val :=
87+
theorem moveLeft_nim {o : Ordinal} (i) : (nim o).moveLeft i = nim (toLeftMovesNim.symm i).val :=
8888
(congr_heq (moveLeft_nim_hEq o).symm (cast_heq _ i)).symm
8989

90-
theorem moveLeft_nim {o : Ordinal} (i) : (nim o).moveLeft (toLeftMovesNim i) = nim i := by simp
90+
@[deprecated moveLeft_nim (since := "2024-10-30")]
91+
alias moveLeft_nim' := moveLeft_nim
92+
93+
theorem moveLeft_toLeftMovesNim {o : Ordinal} (i) :
94+
(nim o).moveLeft (toLeftMovesNim i) = nim i := by
95+
simp
9196

9297
@[simp]
93-
theorem moveRight_nim' {o : Ordinal} (i) : (nim o).moveRight i = nim (toRightMovesNim.symm i).val :=
98+
theorem moveRight_nim {o : Ordinal} (i) : (nim o).moveRight i = nim (toRightMovesNim.symm i).val :=
9499
(congr_heq (moveRight_nim_hEq o).symm (cast_heq _ i)).symm
95100

96-
theorem moveRight_nim {o : Ordinal} (i) : (nim o).moveRight (toRightMovesNim i) = nim i := by simp
101+
@[deprecated moveRight_nim (since := "2024-10-30")]
102+
alias moveRight_nim' := moveRight_nim
103+
104+
theorem moveRight_toRightMovesNim {o : Ordinal} (i) :
105+
(nim o).moveRight (toRightMovesNim i) = nim i := by
106+
simp
97107

98108
/-- A recursion principle for left moves of a nim game. -/
99109
@[elab_as_elim]
@@ -268,7 +278,7 @@ theorem equiv_nim_grundyValue (G : PGame.{u}) [G.Impartial] :
268278
· rw [add_moveLeft_inr, ← Impartial.exists_left_move_equiv_iff_fuzzy_zero]
269279
obtain ⟨j, hj⟩ := exists_grundyValue_moveLeft_of_lt <| toLeftMovesNim_symm_lt i
270280
use toLeftMovesAdd (Sum.inl j)
271-
rw [add_moveLeft_inl, moveLeft_nim']
281+
rw [add_moveLeft_inl, moveLeft_nim]
272282
exact Equiv.trans (add_congr_left (equiv_nim_grundyValue _)) (hj ▸ Impartial.add_self _)
273283
termination_by G
274284

@@ -329,7 +339,7 @@ theorem exists_grundyValue_moveRight_of_lt {G : PGame} [G.Impartial] {o : Nimber
329339
rw [← grundyValue_neg] at h
330340
obtain ⟨i, hi⟩ := exists_grundyValue_moveLeft_of_lt h
331341
use toLeftMovesNeg.symm i
332-
rwa [← grundyValue_neg, ← moveLeft_neg']
342+
rwa [← grundyValue_neg, ← moveLeft_neg]
333343

334344
theorem grundyValue_le_of_forall_moveRight {G : PGame} [G.Impartial] {o : Nimber}
335345
(h : ∀ i, grundyValue (G.moveRight i) ≠ o) : G.grundyValue ≤ o := by

Mathlib/SetTheory/Game/PGame.lean

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,34 +1310,43 @@ between them. -/
13101310
def toRightMovesNeg {x : PGame} : x.LeftMoves ≃ (-x).RightMoves :=
13111311
Equiv.cast (rightMoves_neg x).symm
13121312

1313-
theorem moveLeft_neg {x : PGame} (i) : (-x).moveLeft (toLeftMovesNeg i) = -x.moveRight i := by
1314-
cases x
1315-
rfl
1316-
13171313
@[simp]
1318-
theorem moveLeft_neg' {x : PGame} (i) : (-x).moveLeft i = -x.moveRight (toLeftMovesNeg.symm i) := by
1314+
theorem moveLeft_neg {x : PGame} (i) :
1315+
(-x).moveLeft i = -x.moveRight (toLeftMovesNeg.symm i) := by
13191316
cases x
13201317
rfl
13211318

1322-
theorem moveRight_neg {x : PGame} (i) : (-x).moveRight (toRightMovesNeg i) = -x.moveLeft i := by
1323-
cases x
1324-
rfl
1319+
@[deprecated moveLeft_neg (since := "2024-10-30")]
1320+
alias moveLeft_neg' := moveLeft_neg
1321+
1322+
theorem moveLeft_neg_toLeftMovesNeg {x : PGame} (i) :
1323+
(-x).moveLeft (toLeftMovesNeg i) = -x.moveRight i := by simp
13251324

13261325
@[simp]
1327-
theorem moveRight_neg' {x : PGame} (i) :
1326+
theorem moveRight_neg {x : PGame} (i) :
13281327
(-x).moveRight i = -x.moveLeft (toRightMovesNeg.symm i) := by
13291328
cases x
13301329
rfl
13311330

1331+
@[deprecated moveRight_neg (since := "2024-10-30")]
1332+
alias moveRight_neg' := moveRight_neg
1333+
1334+
theorem moveRight_neg_toRightMovesNeg {x : PGame} (i) :
1335+
(-x).moveRight (toRightMovesNeg i) = -x.moveLeft i := by simp
1336+
1337+
@[deprecated moveRight_neg (since := "2024-10-30")]
13321338
theorem moveLeft_neg_symm {x : PGame} (i) :
13331339
x.moveLeft (toRightMovesNeg.symm i) = -(-x).moveRight i := by simp
13341340

1341+
@[deprecated moveRight_neg (since := "2024-10-30")]
13351342
theorem moveLeft_neg_symm' {x : PGame} (i) :
13361343
x.moveLeft i = -(-x).moveRight (toRightMovesNeg i) := by simp
13371344

1345+
@[deprecated moveLeft_neg (since := "2024-10-30")]
13381346
theorem moveRight_neg_symm {x : PGame} (i) :
13391347
x.moveRight (toLeftMovesNeg.symm i) = -(-x).moveLeft i := by simp
13401348

1349+
@[deprecated moveLeft_neg (since := "2024-10-30")]
13411350
theorem moveRight_neg_symm' {x : PGame} (i) :
13421351
x.moveRight i = -(-x).moveLeft (toLeftMovesNeg i) := by simp
13431352

Mathlib/SetTheory/Surreal/Multiplication.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ lemma P2_neg_right : P2 x₁ x₂ y ↔ P2 x₁ x₂ (-y) := by
119119
rw [P2, P2, quot_mul_neg, quot_mul_neg, neg_inj]
120120

121121
lemma P4_neg_left : P4 x₁ x₂ y ↔ P4 (-x₂) (-x₁) y := by
122-
simp_rw [P4, PGame.neg_lt_neg_iff, moveLeft_neg', ← P3_neg]
122+
simp_rw [P4, PGame.neg_lt_neg_iff, moveLeft_neg, ← P3_neg]
123123

124124
lemma P4_neg_right : P4 x₁ x₂ y ↔ P4 x₁ x₂ (-y) := by
125125
rw [P4, P4, neg_neg, and_comm]
@@ -230,7 +230,7 @@ lemma ih1_swap (ih : ∀ a, ArgsRel a (Args.P1 x y) → P124 a) : IH1 y x := ih1
230230
lemma P3_of_ih (hy : Numeric y) (ihyx : IH1 y x) (i k l) :
231231
P3 (x.moveLeft i) x (y.moveLeft k) (-(-y).moveLeft l) :=
232232
P3_comm.2 <| ((ihyx (IsOption.moveLeft k) (isOption_neg.1 <| .moveLeft l) <| Or.inl rfl).2
233-
(by rw [← moveRight_neg_symm]; apply hy.left_lt_right)).1 i
233+
(by rw [moveLeft_neg, neg_neg]; apply hy.left_lt_right)).1 i
234234

235235
lemma P24_of_ih (ihxy : IH1 x y) (i j) : P24 (x.moveLeft i) (x.moveLeft j) y :=
236236
ihxy (IsOption.moveLeft i) (IsOption.moveLeft j) (Or.inl rfl)
@@ -413,9 +413,8 @@ theorem P3_of_lt {y₁ y₂} (h : ∀ i, IH3 x₁ (x₂.moveLeft i) x₂ y₁ y
413413
P3 x₁ x₂ y₁ y₂ := by
414414
obtain (⟨i,hi⟩|⟨i,hi⟩) := lf_iff_exists_le.1 (lf_of_lt hl)
415415
· exact P3_of_le_left i (h i) hi
416-
· exact P3_neg.2 <| P3_of_le_left _ (hs _) <| by
417-
rw [moveLeft_neg]
418-
exact neg_le_neg (le_iff_game_le.1 hi)
416+
· apply P3_neg.2 <| P3_of_le_left _ (hs (toLeftMovesNeg i)) _
417+
simpa
419418

420419
/-- The main chunk of Theorem 8 in [Conway2001] / Theorem 3.8 in [SchleicherStoll]. -/
421420
theorem main (a : Args) : a.Numeric → P124 a := by
@@ -488,7 +487,7 @@ theorem P3_of_lt_of_lt (hx₁ : x₁.Numeric) (hx₂ : x₂.Numeric) (hy₁ : y
488487
· have hi := hx₁.neg.moveLeft i
489488
exact ⟨(P24 hx₂.neg hi hy₁).1, (P24 hx₂.neg hi hy₂).1,
490489
P3_comm.2 <| ((P24 hy₁ hy₂ hx₁).2 hy).2 _, by
491-
rw [moveLeft_neg', ← P3_neg, neg_lt_neg_iff]
490+
rw [moveLeft_neg, ← P3_neg, neg_lt_neg_iff]
492491
exact ih _ (fst <| IsOption.moveRight _) (hx₁.moveRight _) hx₂⟩
493492

494493
theorem Numeric.mul_pos (hx₁ : x₁.Numeric) (hx₂ : x₂.Numeric) (hp₁ : 0 < x₁) (hp₂ : 0 < x₂) :

0 commit comments

Comments
 (0)