Skip to content

Commit c315f04

Browse files
committed
chore(Data/Finsupp): make support_single simp (leanprover-community#38860)
... for throth `Finsupp`, `DFinsupp` and `SkewMonoidAlgebra`, and rename the first two from `support_single_ne_zero`.
1 parent ba83d54 commit c315f04

26 files changed

Lines changed: 54 additions & 58 deletions

File tree

Mathlib/Algebra/DirectSum/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ theorem support_zero [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] : (0 : ⨁ i
154154
@[simp]
155155
theorem support_of [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] (i : ι) (x : β i) (h : x ≠ 0) :
156156
(of _ i x).support = {i} :=
157-
DFinsupp.support_single_ne_zero h
157+
DFinsupp.support_single h
158158

159159
theorem support_of_subset [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] {i : ι} {b : β i} :
160160
(of _ i b).support ⊆ {i} :=

Mathlib/Algebra/FreeAbelianGroup/Finsupp.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ theorem support_zero : support (0 : FreeAbelianGroup X) = ∅ := by
118118

119119
@[simp]
120120
theorem support_of (x : X) : support (of x) = {x} := by
121-
rw [support, toFinsupp_of, Finsupp.support_single_ne_zero _ one_ne_zero]
121+
rw [support, toFinsupp_of, Finsupp.support_single _ one_ne_zero]
122122

123123
@[simp]
124124
theorem support_neg (a : FreeAbelianGroup X) : support (-a) = support a := by

Mathlib/Algebra/Group/Finsupp.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,23 @@ lemma single_add_apply (a : ι) (m₁ m₂ : M) (b : ι) :
138138
lemma support_single_add {a : ι} {b : M} {f : ι →₀ M} (ha : a ∉ f.support) (hb : b ≠ 0) :
139139
support (single a b + f) = cons a f.support ha := by
140140
classical
141-
have H := support_single_ne_zero a hb
141+
have H := support_single a hb
142142
rw [support_add_eq, H, cons_eq_insert, insert_eq]
143143
rwa [H, disjoint_singleton_left]
144144

145145
lemma support_add_single {a : ι} {b : M} {f : ι →₀ M} (ha : a ∉ f.support) (hb : b ≠ 0) :
146146
support (f + single a b) = cons a f.support ha := by
147147
classical
148-
have H := support_single_ne_zero a hb
148+
have H := support_single a hb
149149
rw [support_add_eq, H, union_comm, cons_eq_insert, insert_eq]
150150
rwa [H, disjoint_singleton_right]
151151

152152
lemma support_single_add_single [DecidableEq ι] {f₁ f₂ : ι} {g₁ g₂ : M}
153153
(H : f₁ ≠ f₂) (hg₁ : g₁ ≠ 0) (hg₂ : g₂ ≠ 0) :
154154
(single f₁ g₁ + single f₂ g₂).support = {f₁, f₂} := by
155-
rw [support_add_eq, support_single_ne_zero _ hg₁, support_single_ne_zero _ hg₂]
155+
rw [support_add_eq, support_single _ hg₁, support_single _ hg₂]
156156
· simp
157-
· simp [support_single_ne_zero, *]
157+
· simp [support_single, *]
158158

159159
lemma support_single_add_single_subset [DecidableEq ι] {f₁ f₂ : ι} {g₁ g₂ : M} :
160160
(single f₁ g₁ + single f₂ g₂).support ⊆ {f₁, f₂} := by
@@ -257,7 +257,7 @@ lemma induction₂ {motive : (ι →₀ M) → Prop} (f : ι →₀ M) (zero : m
257257
refine f.induction zero ?_
258258
convert add_single using 7
259259
apply (addCommute_of_disjoint _).eq
260-
simp_all [disjoint_iff_inter_eq_empty, eq_empty_iff_forall_notMem, single_apply]
260+
simp_all
261261

262262
@[elab_as_elim]
263263
lemma induction_linear {motive : (ι →₀ M) → Prop} (f : ι →₀ M) (zero : motive 0)
@@ -304,7 +304,7 @@ lemma induction_on_max₂ (f : ι →₀ M) (zero : motive 0)
304304
convert add_single using 7 with _ _ _ H
305305
have := fun c hc ↦ (H c hc).ne
306306
apply (addCommute_of_disjoint _).eq
307-
simp_all [disjoint_iff_inter_eq_empty, eq_empty_iff_forall_notMem, single_apply, not_imp_not]
307+
simp_all [not_imp_not]
308308

309309
/-- A finitely supported function can be built by adding up `single a b` for decreasing `a`.
310310

Mathlib/Algebra/Module/LinearMap/Polynomial.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ lemma toMvPolynomial_isHomogeneous (M : Matrix m n R) (i : m) :
9797
apply MvPolynomial.IsHomogeneous.sum
9898
rintro j -
9999
apply MvPolynomial.isHomogeneous_monomial _ _
100-
simp [Finsupp.degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton,
101-
Finsupp.single_eq_same]
100+
simp
102101

103102
lemma toMvPolynomial_totalDegree_le (M : Matrix m n R) (i : m) :
104103
(M.toMvPolynomial i).totalDegree ≤ 1 := by

Mathlib/Algebra/MonoidAlgebra/Degree.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ theorem supDegree_sum_le {ι} {s : Finset ι} {f : ι → R[A]} :
254254

255255
theorem supDegree_single_ne_zero (a : A) {r : R} (hr : r ≠ 0) :
256256
(single a r).supDegree D = D a := by
257-
rw [supDegree, Finsupp.support_single_ne_zero a hr, Finset.sup_singleton]
257+
rw [supDegree, Finsupp.support_single a hr, Finset.sup_singleton]
258258

259259
open Classical in
260260
theorem supDegree_single (a : A) (r : R) :

Mathlib/Algebra/MonoidAlgebra/Grading.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ theorem decomposeAux_coe {i : ι} (x : gradeBy R f i) :
154154
exact map_zero _
155155
· intro m b y hmy hb ih hmby
156156
have : Disjoint (Finsupp.single m b).support y.support := by
157-
simpa only [Finsupp.support_single_ne_zero _ hb, Finset.disjoint_singleton_left]
157+
simpa only [Finsupp.support_single _ hb, Finset.disjoint_singleton_left]
158158
rw [mem_gradeBy_iff, Finsupp.support_add_eq this, Finset.coe_union, Set.union_subset_iff]
159159
at hmby
160160
obtain ⟨h1, h2⟩ := hmby
161161
have : f m = i := by
162-
rwa [Finsupp.support_single_ne_zero _ hb, Finset.coe_singleton, Set.singleton_subset_iff]
162+
rwa [Finsupp.support_single _ hb, Finset.coe_singleton, Set.singleton_subset_iff]
163163
at h1
164164
subst this
165165
simp only [map_add, decomposeAux_single f m]

Mathlib/Algebra/MonoidAlgebra/Support.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ lemma support_one_subset [One G] : (1 : k[G]).support ⊆ 1 :=
9191

9292
@[to_additive (dont_translate := k) (attr := simp) support_one]
9393
lemma support_one [One G] [NeZero (1 : k)] : (1 : k[G]).support = 1 :=
94-
Finsupp.support_single_ne_zero _ one_ne_zero
94+
Finsupp.support_single _ one_ne_zero
9595

9696
section Span
9797

Mathlib/Algebra/MvPolynomial/Variables.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
8888

8989
@[simp]
9090
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
91-
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
91+
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single _ (one_ne_zero' ℕ)]
9292

9393
theorem mem_vars_iff_mem_support (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
9494
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff]
@@ -218,7 +218,7 @@ theorem vars_map_of_injective (hf : Injective f) : (map f p).vars = p.vars := by
218218

219219
theorem vars_monomial_single (i : σ) {e : ℕ} {r : R} (he : e ≠ 0) (hr : r ≠ 0) :
220220
(monomial (Finsupp.single i e) r).vars = {i} := by
221-
rw [vars_monomial hr, Finsupp.support_single_ne_zero _ he]
221+
rw [vars_monomial hr, Finsupp.support_single _ he]
222222

223223
theorem vars_eq_support_biUnion_support [DecidableEq σ] :
224224
p.vars = p.support.biUnion Finsupp.support := by

Mathlib/Algebra/Polynomial/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ theorem eq_zero_of_eq_zero (h : (0 : R) = (1 : R)) (p : R[X]) : p = 0 := by
748748
section Fewnomials
749749

750750
theorem support_monomial (n) {a : R} (H : a ≠ 0) : (monomial n a).support = singleton n := by
751-
rw [← ofFinsupp_single, support]; exact Finsupp.support_single_ne_zero _ H
751+
rw [← ofFinsupp_single, support]; exact Finsupp.support_single _ H
752752

753753
theorem support_monomial' (n) (a : R) : (monomial n a).support ⊆ singleton n := by
754754
rw [← ofFinsupp_single, support]

Mathlib/Algebra/Polynomial/Laurent.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ set_option backward.isDefEq.respectTransparency false in
388388
theorem support_C_mul_T_of_ne_zero {a : R} (a0 : a ≠ 0) (n : ℤ) :
389389
Finsupp.support (C a * T n) = {n} := by
390390
rw [← single_eq_C_mul_T]
391-
exact support_single_ne_zero _ a0
391+
exact support_single _ a0
392392

393393
set_option backward.isDefEq.respectTransparency false in
394394
/-- The support of a polynomial `f` is a finset in `ℕ`. The lemma `toLaurent_support f`

0 commit comments

Comments
 (0)