Skip to content

Commit 64f3560

Browse files
committed
chore: address and delete many porting notes across the library (#19685)
1 parent 6c84ec3 commit 64f3560

File tree

28 files changed

+31
-189
lines changed

28 files changed

+31
-189
lines changed

Archive/Imo/Imo1972Q5.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ This is a more concise version of the proof proposed by Ruben Van de Velde.
8080
-/
8181
theorem imo1972_q5' (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y) = 2 * f x * g y)
8282
(hf2 : BddAbove (Set.range fun x => ‖f x‖)) (hf3 : ∃ x, f x ≠ 0) (y : ℝ) : ‖g y‖ ≤ 1 := by
83-
-- Porting note: moved `by_contra!` up to avoid a bug
84-
by_contra! H
8583
obtain ⟨x, hx⟩ := hf3
8684
set k := ⨆ x, ‖f x‖
8785
have h : ∀ x, ‖f x‖ ≤ k := le_ciSup hf2
86+
by_contra! H
8887
have hgy : 0 < ‖g y‖ := by linarith
8988
have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x)
9089
have : k / ‖g y‖ < k := (div_lt_iff₀ hgy).mpr (lt_mul_of_one_lt_right k_pos H)

Archive/Imo/Imo2013Q1.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ We prove a slightly more general version where k does not need to be strictly po
2727

2828
namespace Imo2013Q1
2929

30-
-- Porting note: simplified proof using `positivity`
3130
theorem arith_lemma (k n : ℕ) : 0 < 2 * n + 2 ^ k.succ := by positivity
3231

3332
theorem prod_lemma (m : ℕ → ℕ+) (k : ℕ) (nm : ℕ+) :

Archive/MiuLanguage/DecisionNec.lean

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ theorem goodm_of_rule3 (as bs : Miustr) (h₁ : Derivable (as ++ ↑[I, I, I] ++
154154
exact mhead
155155
· contrapose! nmtail
156156
rcases exists_cons_of_ne_nil k with ⟨x, xs, rfl⟩
157-
-- Porting note: `simp_rw [cons_append]` didn't work
158-
rw [cons_append] at nmtail; rw [cons_append, cons_append]
159-
dsimp only [tail] at nmtail ⊢
157+
simp_rw [cons_append] at nmtail ⊢
160158
simpa using nmtail
161159

162160
/-!
@@ -174,9 +172,7 @@ theorem goodm_of_rule4 (as bs : Miustr) (h₁ : Derivable (as ++ ↑[U, U] ++ bs
174172
exact mhead
175173
· contrapose! nmtail
176174
rcases exists_cons_of_ne_nil k with ⟨x, xs, rfl⟩
177-
-- Porting note: `simp_rw [cons_append]` didn't work
178-
rw [cons_append] at nmtail; rw [cons_append, cons_append]
179-
dsimp only [tail] at nmtail ⊢
175+
simp_rw [cons_append] at nmtail ⊢
180176
simpa using nmtail
181177

182178
/-- Any derivable string must begin with `M` and have no `M` in its tail.

Archive/MiuLanguage/DecisionSuf.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,8 @@ theorem ind_hyp_suf (k : ℕ) (ys : Miustr) (hu : count U ys = succ k) (hdec : D
308308
rcases eq_append_cons_U_of_count_U_pos hu with ⟨as, bs, rfl⟩
309309
use as, bs
310310
refine ⟨rfl, ?_, ?_, ?_⟩
311-
· -- Porting note: `simp_rw [count_append]` didn't work
312-
rw [count_append] at hu
313-
simp_rw [count_cons, beq_self_eq_true, if_true, add_succ, beq_iff_eq, reduceCtorEq, reduceIte,
314-
add_zero, succ_inj'] at hu
311+
· simp_rw [count_append, count_cons, beq_self_eq_true, if_true, add_succ, beq_iff_eq,
312+
reduceCtorEq, reduceIte, add_zero, succ_inj'] at hu
315313
rwa [count_append, count_append]
316314
· apply And.intro rfl
317315
rw [cons_append, cons_append]

Mathlib/Algebra/AddTorsor.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ theorem vadd_vsub (g : G) (p : P) : (g +ᵥ p) -ᵥ p = g :=
8787
/-- If the same point added to two group elements produces equal
8888
results, those group elements are equal. -/
8989
theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by
90-
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
9190
rw [← vadd_vsub g₁ p, h, vadd_vsub]
9291

9392
@[simp]
@@ -364,8 +363,6 @@ def constVAddHom : Multiplicative G →* Equiv.Perm P where
364363

365364
variable {P}
366365

367-
-- Porting note: Previous code was:
368-
-- open _Root_.Function
369366
open Function
370367

371368
/-- Point reflection in `x` as a permutation. -/
@@ -412,7 +409,6 @@ theorem pointReflection_fixed_iff_of_injective_two_nsmul {x y : P} (h : Injectiv
412409
@[deprecated (since := "2024-11-18")] alias pointReflection_fixed_iff_of_injective_bit0 :=
413410
pointReflection_fixed_iff_of_injective_two_nsmul
414411

415-
-- Porting note: need this to calm down CI
416412
theorem injective_pointReflection_left_of_injective_two_nsmul {G P : Type*} [AddCommGroup G]
417413
[AddTorsor G P] (h : Injective (2 • · : G → G)) (y : P) :
418414
Injective fun x : P => pointReflection x y :=

Mathlib/Algebra/BigOperators/Finsupp.lean

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,10 @@ theorem sum_apply [Zero M] [AddCommMonoid N] {f : α →₀ M} {g : α → M →
242242
(f.sum g) a₂ = f.sum fun a₁ b => g a₁ b a₂ :=
243243
finset_sum_apply _ _ _
244244

245-
-- Porting note: inserted ⇑ on the rhs
246245
@[simp, norm_cast] theorem coe_finset_sum [AddCommMonoid N] (S : Finset ι) (f : ι → α →₀ N) :
247246
⇑(∑ i ∈ S, f i) = ∑ i ∈ S, ⇑(f i) :=
248247
map_sum (coeFnAddHom : (α →₀ N) →+ _) _ _
249248

250-
-- Porting note: inserted ⇑ on the rhs
251249
@[simp, norm_cast] theorem coe_sum [Zero M] [AddCommMonoid N] (f : α →₀ M) (g : α → M → β →₀ N) :
252250
⇑(f.sum g) = f.sum fun a₁ b => ⇑(g a₁ b) :=
253251
coe_finset_sum _ _
@@ -381,14 +379,12 @@ theorem univ_sum_single [Fintype α] [AddCommMonoid M] (f : α →₀ M) :
381379
@[simp]
382380
theorem univ_sum_single_apply [AddCommMonoid M] [Fintype α] (i : α) (m : M) :
383381
∑ j : α, single i m j = m := by
384-
-- Porting note: rewrite due to leaky classical in lean3
385382
classical rw [single, coe_mk, Finset.sum_pi_single']
386383
simp
387384

388385
@[simp]
389386
theorem univ_sum_single_apply' [AddCommMonoid M] [Fintype α] (i : α) (m : M) :
390387
∑ j : α, single j m i = m := by
391-
-- Porting note: rewrite due to leaky classical in lean3
392388
simp_rw [single, coe_mk]
393389
classical rw [Finset.sum_pi_single]
394390
simp
@@ -454,7 +450,6 @@ theorem support_sum_eq_biUnion {α : Type*} {ι : Type*} {M : Type*} [DecidableE
454450
(h : ∀ i₁ i₂, i₁ ≠ i₂ → Disjoint (g i₁).support (g i₂).support) :
455451
(∑ i ∈ s, g i).support = s.biUnion fun i => (g i).support := by
456452
classical
457-
-- Porting note: apply Finset.induction_on s was not working; refine does.
458453
refine Finset.induction_on s ?_ ?_
459454
· simp
460455
· intro i s hi
@@ -578,7 +573,6 @@ end
578573

579574
namespace Nat
580575

581-
-- Porting note: Needed to replace pow with (· ^ ·)
582576
/-- If `0 : ℕ` is not in the support of `f : ℕ →₀ ℕ` then `0 < ∏ x ∈ f.support, x ^ (f x)`. -/
583577
theorem prod_pow_pos_of_zero_not_mem_support {f : ℕ →₀ ℕ} (nhf : 0 ∉ f.support) :
584578
0 < f.prod (· ^ ·) :=

Mathlib/Algebra/BigOperators/Group/Finset.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,7 @@ lemma prod_mulIndicator_subset_of_eq_one [One α] (f : ι → α) (g : ι → α
12161216
∏ i ∈ t, g i (mulIndicator ↑s f i) = ∏ i ∈ s, g i (f i) := by
12171217
calc
12181218
_ = ∏ i ∈ s, g i (mulIndicator ↑s f i) := by rw [prod_subset h fun i _ hn ↦ by simp [hn, hg]]
1219-
-- Porting note: This did not use to need the implicit argument
1220-
_ = _ := prod_congr rfl fun i hi ↦ congr_arg _ <| mulIndicator_of_mem (α := ι) hi f
1219+
_ = _ := prod_congr rfl fun i hi ↦ congr_arg _ <| mulIndicator_of_mem hi f
12211220

12221221
/-- Taking the product of an indicator function over a possibly larger finset is the same as
12231222
taking the original function over the original finset. -/

Mathlib/Algebra/BigOperators/Group/Multiset.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ theorem prod_induction (p : α → Prop) (s : Multiset α) (p_mul : ∀ a b, p a
187187
@[to_additive]
188188
theorem prod_induction_nonempty (p : α → Prop) (p_mul : ∀ a b, p a → p b → p (a * b)) (hs : s ≠ ∅)
189189
(p_s : ∀ a ∈ s, p a) : p s.prod := by
190-
-- Porting note: used to be `refine' Multiset.induction _ _`
191190
induction s using Multiset.induction_on with
192191
| empty => simp at hs
193192
| cons a s hsa =>
@@ -263,8 +262,7 @@ theorem prod_map_inv' (m : Multiset α) : (m.map Inv.inv).prod = m.prod⁻¹ :=
263262

264263
@[to_additive (attr := simp)]
265264
theorem prod_map_inv : (m.map fun i => (f i)⁻¹).prod = (m.map f).prod⁻¹ := by
266-
-- Porting note: used `convert`
267-
simp_rw [← (m.map f).prod_map_inv', map_map, Function.comp_apply]
265+
rw [← (m.map f).prod_map_inv', map_map, Function.comp_def]
268266

269267
@[to_additive (attr := simp)]
270268
theorem prod_map_div : (m.map fun i => f i / g i).prod = (m.map f).prod / (m.map g).prod :=

Mathlib/Algebra/Category/Grp/Colimits.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ def descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by
209209
def descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where
210210
toFun := descFun F s
211211
map_zero' := rfl
212-
-- Porting note: in `mathlib3`, nothing needs to be done after `induction`
213-
map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl
212+
map_add' x y := Quot.induction_on₂ x y fun _ _ ↦ rfl
214213

215214
/-- Evidence that the proposed colimit is the colimit. -/
216215
def colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where

Mathlib/Algebra/Category/Grp/EquivalenceGroupAddGroup.lean

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ open CategoryTheory
2020

2121
namespace Grp
2222

23-
-- Porting note: Lean cannot find these now
24-
private instance (X : Grp) : MulOneClass X.α := X.str.toMulOneClass
25-
private instance (X : CommGrp) : MulOneClass X.α := X.str.toMulOneClass
26-
private instance (X : AddGrp) : AddZeroClass X.α := X.str.toAddZeroClass
27-
private instance (X : AddCommGrp) : AddZeroClass X.α := X.str.toAddZeroClass
28-
2923
/-- The functor `Grp ⥤ AddGrp` by sending `X ↦ Additive X` and `f ↦ f`.
3024
-/
3125
@[simps]

0 commit comments

Comments
 (0)