Skip to content

Commit 0c771f3

Browse files
committed
chore: simplify simp/grind patterns as suggested by linter (leanprover-community#34714)
This PR removes redundant `simp`, `simp only`, and `have` statements before `grind` where grind can handle the goal directly, as suggested by the grind linter in the nightly testing run. Addresses 6 of the 14 warnings from https://github.com/leanprover-community/mathlib4/actions/runs/21578471064 Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Weekly.20linting.20log/near/571353143 The remaining warnings involve cases where the preprocessing step (`norm_cast`, `ext`, `convert_to`, etc.) is actually necessary for grind to succeed. 🤖 Prepared with Claude Code
1 parent f8e8a41 commit 0c771f3

6 files changed

Lines changed: 4 additions & 9 deletions

File tree

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

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

Mathlib/Data/Setoid/Partition.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ noncomputable def coarserPartition (hs : IndexedPartition s) {κ : Type*} (g :
510510
simp only [← hd, mem_iUnion] at hb
511511
have : c = d := hs.eq_of_mem ha.2 hb.2
512512
by_contra!
513-
have : c ≠ d := disjoint_iff_forall_ne.mp ((disjoint_singleton.mpr this).preimage g) ha.1 hb.1
514-
grind
513+
grind [disjoint_iff_forall_ne.mp ((disjoint_singleton.mpr this).preimage g) ha.1 hb.1]
515514
some k := hs.some ((singleton_nonempty k).preimage hg).some
516515
some_mem k := by
517516
refine mem_iUnion_of_mem ((singleton_nonempty k).preimage hg).some ?_

Mathlib/MeasureTheory/Measure/AddContent.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ private lemma AddContent.supClosureFun_apply_of_mem (hC : IsSetSemiring C)
255255
rw [hJs i hi]
256256
exact subset_sUnion_of_mem ha
257257
let K : Finset (Set α) := Finset.biUnion I J
258-
have : ⋃₀ ↑I = ⋃₀ (↑K : Set (Set α)) := by
259-
simp [K, sUnion_eq_biUnion] at hJs ⊢; grind
258+
have : ⋃₀ ↑I = ⋃₀ (↑K : Set (Set α)) := by grind
260259
rw [this, m.supClosureFun_apply hC (J := K) (by simpa [K] using hJC) _ rfl]; swap
261260
· simp only [K, coe_biUnion]
262261
refine (h'I.mono_on ?_).biUnion hJdisj

Mathlib/NumberTheory/FactorisationProperties.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ theorem abundancyIndex_le_of_dvd (hn : n ≠ 0) (hd : m ∣ n) :
220220

221221
theorem Abundant.of_dvd (h : Abundant m) (hd : m ∣ n) (hn : n ≠ 0) : Abundant n := by
222222
have := abundancyIndex_le_of_dvd hn hd
223-
have := ne_zero_of_dvd_ne_zero hn hd
224223
grind [abundant_iff_two_lt_abundancyIndex]
225224

226225
theorem Abundant.mul_left (h : Abundant n) (hm : m ≠ 0) : Abundant (m * n) := by

Mathlib/Order/Interval/Finset/Gaps.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ theorem intervalGapsWithin_snd_le {a b : α} (hFab : ∀ ⦃z⦄, z ∈ F → a
138138
by_cases hj : j = k
139139
· simp [hj]
140140
· have := hFab (F.intervalGapsWithin_mapsTo h a b (x := j) (by grind))
141-
simp only [Nat.succ_eq_add_one] at this
142141
grind
143142

144143
theorem intervalGapsWithin_fst_le_snd {a b : α} (hab : a ≤ b)

Mathlib/Topology/Sets/CompactOpenCovered.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ lemma of_isCompact_of_forall_exists_isCompactOpenCovered [TopologicalSpace S] {U
117117
· simp [Opens.forall]
118118
aesop
119119
· simpa using ⟨⟨Us x hx, hUo _ _⟩, ⟨x, by simpa⟩, hUx _ _⟩
120-
· simp [Opens.forall]
121-
grind
120+
· grind
122121

123122
lemma image {i : ι} (V : Opens (X i)) (hV : IsCompact (X := X i) V) :
124123
IsCompactOpenCovered f (f i '' V) := by

0 commit comments

Comments
 (0)