@@ -90,7 +90,7 @@ by { rw nim_def, exact λ i, ⟨_, ⟨ordinal.typein_lt_self i, rfl⟩⟩ }
90
90
lemma exists_move_left_eq {O : ordinal} : ∀ O' < O, ∃ i, (nim O).move_left i = nim O' :=
91
91
by { rw nim_def, exact λ _ h, ⟨(ordinal.principal_seg_out h).top, by simp⟩ }
92
92
93
- lemma zero_first_loses : (nim (0 : ordinal)).first_loses :=
93
+ @[simp] lemma zero_first_loses : (nim (0 : ordinal)).first_loses :=
94
94
begin
95
95
rw [impartial.first_loses_symm, nim_def, le_def_lt],
96
96
exact ⟨@is_empty_elim (0 : ordinal).out.α _ _, @is_empty_elim pempty _ _⟩
@@ -103,7 +103,7 @@ begin
103
103
exact or.inr ⟨(ordinal.principal_seg_out hO).top, by simpa using zero_first_loses.1 ⟩
104
104
end
105
105
106
- lemma sum_first_loses_iff_eq (O₁ O₂ : ordinal) : (nim O₁ + nim O₂).first_loses ↔ O₁ = O₂ :=
106
+ @[simp] lemma sum_first_loses_iff_eq (O₁ O₂ : ordinal) : (nim O₁ + nim O₂).first_loses ↔ O₁ = O₂ :=
107
107
begin
108
108
split,
109
109
{ contrapose,
@@ -121,10 +121,10 @@ begin
121
121
exact impartial.add_self (nim O₁) }
122
122
end
123
123
124
- lemma sum_first_wins_iff_neq (O₁ O₂ : ordinal) : (nim O₁ + nim O₂).first_wins ↔ O₁ ≠ O₂ :=
124
+ @[simp] lemma sum_first_wins_iff_neq (O₁ O₂ : ordinal) : (nim O₁ + nim O₂).first_wins ↔ O₁ ≠ O₂ :=
125
125
by rw [iff_not_comm, impartial.not_first_wins, sum_first_loses_iff_eq]
126
126
127
- lemma equiv_iff_eq (O₁ O₂ : ordinal) : nim O₁ ≈ nim O₂ ↔ O₁ = O₂ :=
127
+ @[simp] lemma equiv_iff_eq (O₁ O₂ : ordinal) : nim O₁ ≈ nim O₂ ↔ O₁ = O₂ :=
128
128
⟨λ h, (sum_first_loses_iff_eq _ _).1 $
129
129
by rw [first_loses_of_equiv_iff (add_congr h (equiv_refl _)), sum_first_loses_iff_eq],
130
130
by { rintro rfl, refl }⟩
@@ -133,17 +133,17 @@ end nim
133
133
134
134
/-- The Grundy value of an impartial game, the ordinal which corresponds to the game of nim that the
135
135
game is equivalent to -/
136
- noncomputable def grundy_value : Π (G : pgame.{u}) [G.impartial] , ordinal.{u}
137
- | G := λ hG, by exactI ordinal.mex.{u u} (λ i, grundy_value (G.move_left i))
136
+ noncomputable def grundy_value : Π (G : pgame.{u}), ordinal.{u}
137
+ | G := ordinal.mex.{u u} (λ i, grundy_value (G.move_left i))
138
138
using_well_founded { dec_tac := pgame_wf_tac }
139
139
140
- lemma grundy_value_def (G : pgame) [G.impartial] :
140
+ lemma grundy_value_def (G : pgame) :
141
141
grundy_value G = ordinal.mex.{u u} (λ i, grundy_value (G.move_left i)) :=
142
142
by rw grundy_value
143
143
144
144
/-- The Sprague-Grundy theorem which states that every impartial game is equivalent to a game of
145
145
nim, namely the game of nim corresponding to the games Grundy value -/
146
- theorem equiv_nim_grundy_value : ∀ (G : pgame.{u}) [G.impartial], by exactI G ≈ nim (grundy_value G)
146
+ theorem equiv_nim_grundy_value : ∀ (G : pgame.{u}) [G.impartial], G ≈ nim (grundy_value G)
147
147
| G :=
148
148
begin
149
149
introI hG,
@@ -182,25 +182,26 @@ begin
182
182
end
183
183
using_well_founded { dec_tac := pgame_wf_tac }
184
184
185
- lemma equiv_nim_iff_grundy_value_eq (G : pgame) [G.impartial] (O : ordinal) :
186
- G ≈ nim O ↔ grundy_value G = O :=
187
- ⟨by { intro h, rw ←nim.equiv_iff_eq, exact equiv_trans (equiv_symm ( equiv_nim_grundy_value G)) h },
188
- by { rintro rfl, exact equiv_nim_grundy_value G }⟩
185
+ @[simp] lemma grundy_value_eq_iff_equiv_nim (G : pgame) [G.impartial] (O : ordinal) :
186
+ grundy_value G = O ↔ G ≈ nim O :=
187
+ ⟨by { rintro rfl, exact equiv_nim_grundy_value G },
188
+ by { intro h, rw ←nim.equiv_iff_eq, exact equiv_trans (equiv_symm ( equiv_nim_grundy_value G)) h }⟩
189
189
190
190
lemma nim.grundy_value (O : ordinal.{u}) : grundy_value (nim O) = O :=
191
- by rw ←equiv_nim_iff_grundy_value_eq
191
+ by simp
192
192
193
- lemma equiv_iff_grundy_value_eq (G H : pgame) [G.impartial] [H.impartial] :
194
- G ≈ H ↔ grundy_value G = grundy_value H :=
195
- (equiv_congr_left.1 (equiv_nim_grundy_value H) _).trans $ equiv_nim_iff_grundy_value_eq _ _
193
+ @[simp] lemma grundy_value_eq_iff_equiv (G H : pgame) [G.impartial] [H.impartial] :
194
+ grundy_value G = grundy_value H ↔ G ≈ H :=
195
+ (grundy_value_eq_iff_equiv_nim _ _).trans ( equiv_congr_left.1 (equiv_nim_grundy_value H) _).symm
196
196
197
- lemma grundy_value_zero : grundy_value 0 = 0 :=
198
- by rw [(equiv_iff_grundy_value_eq 0 (nim 0 )).1 (equiv_symm nim.zero_first_loses), nim.grundy_value]
197
+ @[simp] lemma grundy_value_zero : grundy_value 0 = 0 :=
198
+ by rw [(grundy_value_eq_iff_equiv 0 (nim 0 )).2 (equiv_symm nim.zero_first_loses), nim.grundy_value]
199
199
200
- lemma equiv_zero_iff_grundy_value (G : pgame) [G.impartial] : G ≈ 0 ↔ grundy_value G = 0 :=
201
- by rw [equiv_iff_grundy_value_eq , grundy_value_zero]
200
+ @[simp] lemma grundy_value_iff_equiv_zero (G : pgame) [G.impartial] : grundy_value G = 0 ↔ G ≈ 0 :=
201
+ by rw [←grundy_value_eq_iff_equiv , grundy_value_zero]
202
202
203
- lemma grundy_value_nim_add_nim (n m : ℕ) : grundy_value (nim.{u} n + nim.{u} m) = nat.lxor n m :=
203
+ @[simp] lemma grundy_value_nim_add_nim (n m : ℕ) :
204
+ grundy_value (nim.{u} n + nim.{u} m) = nat.lxor n m :=
204
205
begin
205
206
induction n using nat.strong_induction_on with n hn generalizing m,
206
207
induction m using nat.strong_induction_on with m hm,
@@ -271,12 +272,12 @@ begin
271
272
end
272
273
273
274
lemma nim_add_nim_equiv {n m : ℕ} : nim n + nim m ≈ nim (nat.lxor n m) :=
274
- by rw [equiv_nim_iff_grundy_value_eq , grundy_value_nim_add_nim]
275
+ by rw [←grundy_value_eq_iff_equiv_nim , grundy_value_nim_add_nim]
275
276
276
277
lemma grundy_value_add (G H : pgame) [G.impartial] [H.impartial] {n m : ℕ} (hG : grundy_value G = n)
277
278
(hH : grundy_value H = m) : grundy_value (G + H) = nat.lxor n m :=
278
279
begin
279
- rw [←nim.grundy_value (nat.lxor n m), ←equiv_iff_grundy_value_eq ],
280
+ rw [←nim.grundy_value (nat.lxor n m), grundy_value_eq_iff_equiv ],
280
281
refine equiv_trans _ nim_add_nim_equiv,
281
282
convert add_congr (equiv_nim_grundy_value G) (equiv_nim_grundy_value H);
282
283
simp only [hG, hH]
0 commit comments