Skip to content

Commit 0c5ce99

Browse files
committed
chore: weekly lints for 2026-02-16 (leanprover-community#35490)
Changes suggested by the `mergeWithGrind` linter, from the weekly job posted at [#mathlib4 > Weekly linting log @ 💬](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Weekly.20linting.20log/near/574041907). As suggested by @Vierkantor, I have used the `linter.tacticAnalysis.mergeWithGrind` option to turn off the linter in two theorems: one where there was a comment about not making this change for performance reasons and another that appears to be a bug with the linter. Now that there is a precedent for using the `grind` interactive mode in Mathlib, I have used this in one proof where it results in fewer calls to `grind` and a clearer proof.
1 parent 965b967 commit 0c5ce99

12 files changed

Lines changed: 34 additions & 23 deletions

File tree

Mathlib/Algebra/BigOperators/Associated.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ theorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :
5757
fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>
5858
⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩
5959

60+
-- TODO: this seems to trigger a bug in the mergeWithGrind linter
61+
set_option linter.tacticAnalysis.mergeWithGrind false in
6062
theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)
6163
(g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i ∈ s, f i) ~ᵤ (∏ i ∈ s, g i) := by
6264
induction s using Finset.induction with

Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ theorem prod_biUnion_of_pairwise_eq_one [DecidableEq ι] {s : Finset κ} {t : κ
798798
∏ x ∈ s.biUnion t, f x = ∏ x ∈ s, ∏ i ∈ t x, f i := by
799799
classical
800800
let t' k := (t k).filter (fun i ↦ f i ≠ 1)
801-
have : s.biUnion t' = (s.biUnion t).filter (fun i ↦ f i ≠ 1) := by ext; grind
801+
have : s.biUnion t' = (s.biUnion t).filter (fun i ↦ f i ≠ 1) := by grind
802802
rw [← prod_filter_ne_one, ← this, prod_biUnion]
803803
swap
804804
· intro i hi j hj hij a hai haj k hk

Mathlib/Analysis/SpecialFunctions/Pow/NthRootLemmas.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ private theorem nthRoot.lt_pow_go_succ_aux0 (hb : b ≠ 0) :
6666
Nat.le_div_iff_mul_le (by positivity)]
6767
have := (Commute.all (b : ℤ) (a - b)).pow_add_mul_le_add_pow_of_sq_nonneg
6868
(by positivity) (sq_nonneg _) (sq_nonneg _) (by grind) (n + 1)
69-
-- `grind` should solve this, but: https://github.com/leanprover/lean4/issues/11539
70-
simp [mul_sub, ← add_sub_assoc] at this
71-
norm_cast at this
7269
grind
7370

7471
private theorem nthRoot.always_exists (n a : ℕ) :

Mathlib/Data/DFinsupp/Defs.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,6 @@ theorem support_zipWith {f : ∀ i, β₁ i → β₂ i → β i} {hf : ∀ i, f
945945
end MapRangeAndZipWith
946946

947947
theorem erase_def (i : ι) (f : Π₀ i, β i) : f.erase i = mk (f.support.erase i) fun j => f j.1 := by
948-
ext
949948
grind
950949

951950
@[simp]

Mathlib/Data/Setoid/Partition.lean

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,15 @@ some of the sets to obtain a coarser partition. -/
505505
noncomputable def coarserPartition (hs : IndexedPartition s) {κ : Type*} (g : ι → κ)
506506
(hg : g.Surjective) :
507507
IndexedPartition (fun k : κ => ⋃ i ∈ g ⁻¹' {k}, s i) where
508-
eq_of_mem {_x _i _j} hxi hxj := by
508+
eq_of_mem {x _i _j} hxi hxj := by
509509
obtain ⟨a, ⟨c, hc⟩, ha⟩ := hxi
510510
obtain ⟨b, ⟨d, hd⟩, hb⟩ := hxj
511-
simp only [← hc, mem_iUnion] at ha
512-
simp only [← hd, mem_iUnion] at hb
513-
have : c = d := hs.eq_of_mem ha.2 hb.2
514-
by_contra!
515-
grind [disjoint_iff_forall_ne.mp ((disjoint_singleton.mpr this).preimage g) ha.1 hb.1]
511+
grind =>
512+
instantiate [mem_iUnion]
513+
have hb : x ∈ s d
514+
have ha : x ∈ s c
515+
have : c = d := hs.eq_of_mem ha hb
516+
finish
516517
some k := hs.some ((singleton_nonempty k).preimage hg).some
517518
some_mem k := by
518519
refine mem_iUnion_of_mem ((singleton_nonempty k).preimage hg).some ?_

Mathlib/Geometry/Euclidean/Angle/Bisector.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,7 @@ lemma two_zsmul_oangle_eq_of_dist_orthogonalProjection_line_eq {p p₁ p₂ p₃
296296
convert (ha.inf_affineSpan_eq_affineSpan_inter {0, 1} {0, 2})
297297
· simp [Set.image_insert_eq]
298298
· simp [Set.image_insert_eq]
299-
· suffices {p₁} = ![p₁, p₂, p₃] '' {0} by
300-
convert this
301-
grind
299+
· suffices {p₁} = ![p₁, p₂, p₃] '' {0} by grind
302300
simp
303301
have hsup : line[ℝ, p₁, p₂] ⊔ line[ℝ, p₁, p₃] = ⊤ := by
304302
rw [← AffineSubspace.span_union]

Mathlib/MeasureTheory/Integral/IntervalIntegral/AbsolutelyContinuousFun.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ lemma exists_dist_slope_lt_pairwiseDisjoint_hasSum {f f' : ℝ → F} {d b η :
9797
apply_fun fun x ↦ x.toReal at vol_sum
9898
rw [ENNReal.tsum_toReal_eq (by simp), ENNReal.toReal_ofReal (by linarith),
9999
← Summable.hasSum_iff (by grind [tsum_def])] at vol_sum
100-
convert vol_sum with z
101100
grind [ENNReal.toReal_ofReal]
102101

103102
/-- If `f` is absolutely continuous on `[d, b]` and there is a collection of pairwise disjoint

Mathlib/MeasureTheory/MeasurableSpace/Pi.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ theorem IsCountablySpanning.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsCoun
6161
(surjective_decode_getD (ι → ℕ) default).iUnion_comp fun x => Set.pi univ fun i => s i (x i),
6262
iUnion_univ_pi s, h2s, pi_univ]
6363

64+
-- `grind` can close the goal from the point marked by the comment below, but is slow
65+
set_option linter.tacticAnalysis.mergeWithGrind false in
6466
/-- The product of generated σ-algebras is the one generated by boxes, if both generating sets
6567
are countably spanning. -/
6668
theorem generateFrom_pi_eq {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsCountablySpanning (C i)) :

Mathlib/MeasureTheory/SetSemiring.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ protected lemma Ioc [LinearOrder α] [Nonempty α] :
546546
rcases Ioc_mem_setOf_Ioc_le u (min u' v) with ⟨u'', v'', h'', heq⟩
547547
rw [this, heq]
548548
exact ⟨{Set.Ioc u'' v''}, by grind, by simp, by simp⟩
549-
rw [show Set.Ioc u v \ Set.Ioc u' v' = Set.Ioc u u' ∪ Set.Ioc v' v by ext; simp; grind]
549+
rw [show Set.Ioc u v \ Set.Ioc u' v' = Set.Ioc u u' ∪ Set.Ioc v' v by grind]
550550
refine ⟨{Set.Ioc u u', Set.Ioc v' v}, by grind, ?_, by simp⟩
551551
intro a ha b hb hab
552552
simp [Function.onFun]

Mathlib/RingTheory/Polynomial/Morse.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ theorem Splits.toPermHom_apply_eq_one_or_isSwap_of_ncard_le_of_mem_inertia
7474
(by simp [hπ]) (by simp [hπ]) (by simpa [← rootSet.coe_smul]) (by simpa [← rootSet.coe_smul])
7575
grind [rootSet.coe_smul]
7676
· simp [hz']
77-
· have key := hp (g • z) (g • z).2 z z.2 (g • x) (g • x).2 x x.2 (by simp [hπ]) (by simp [hπ])
78-
grind [rootSet.coe_smul, SetLike.coe_eq_coe]
77+
· grind [rootSet.coe_smul, SetLike.coe_eq_coe]
7978

8079
/-- If the roots of `f` in `S` have at most one collision modulo each maximal ideal `m`, and if a
8180
group `G` acting transitively on the roots in `S` is generated by inertia subgroups, then `G`

0 commit comments

Comments
 (0)