Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 695cb07

Browse files
committed
feat({data,linear_algebra}/{finsupp,dfinsupp}): add {add_submonoid,submodule}.[d]finsupp_sum_mem (#8269)
These lemmas are trivial consequences of the finset lemmas, but having them avoids having to unfold `[d]finsupp.sum`. `dfinsupp_sum_add_hom_mem` is particularly useful because this one has some messy decidability arguments to eliminate.
1 parent 40ffaa5 commit 695cb07

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

src/data/dfinsupp.lean

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors: Johannes Hölzl, Kenny Lau
66
import algebra.module.pi
77
import algebra.big_operators.basic
88
import data.set.finite
9-
import group_theory.submonoid.basic
9+
import group_theory.submonoid.membership
1010

1111
/-!
1212
# Dependent functions with finite support
@@ -877,6 +877,12 @@ calc ∏ i in (f + g).support, h i ((f + g) i) =
877877
by simp [h_add, finset.prod_mul_distrib]
878878
... = _ : by rw [f_eq, g_eq]
879879

880+
@[to_additive]
881+
lemma _root_.submonoid.dfinsupp_prod_mem [Π i, has_zero (β i)] [Π i (x : β i), decidable (x ≠ 0)]
882+
[comm_monoid γ] (S : submonoid γ)
883+
(f : Π₀ i, β i) (g : Π i, β i → γ) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) : f.prod g ∈ S :=
884+
S.prod_mem $ λ i hi, h _ $ (f.mem_support_iff _).mp hi
885+
880886
/--
881887
When summing over an `add_monoid_hom`, the decidability assumption is not needed, and the result is
882888
also an `add_monoid_hom`.
@@ -942,6 +948,16 @@ begin
942948
rw [(not_not.mp h), add_monoid_hom.map_zero],
943949
end
944950

951+
lemma _root_.add_submonoid.dfinsupp_sum_add_hom_mem [Π i, add_zero_class (β i)] [add_comm_monoid γ]
952+
(S : add_submonoid γ) (f : Π₀ i, β i) (g : Π i, β i →+ γ) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) :
953+
dfinsupp.sum_add_hom g f ∈ S :=
954+
begin
955+
classical,
956+
rw dfinsupp.sum_add_hom_apply,
957+
convert S.dfinsupp_sum_mem _ _ _,
958+
exact h
959+
end
960+
945961
omit dec
946962
lemma sum_add_hom_comm {ι₁ ι₂ : Sort*} {β₁ : ι₁ → Type*} {β₂ : ι₂ → Type*} {γ : Type*}
947963
[decidable_eq ι₁] [decidable_eq ι₂] [Π i, add_zero_class (β₁ i)] [Π i, add_zero_class (β₂ i)]

src/data/finsupp/basic.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@ lemma on_finset_prod {s : finset α} {f : α → M} {g : α → M → N}
700700
(on_finset s f hf).prod g = ∏ a in s, g a (f a) :=
701701
finset.prod_subset support_on_finset_subset $ by simp [*] { contextual := tt }
702702

703+
@[to_additive]
704+
lemma _root_.submonoid.finsupp_prod_mem (S : submonoid N) (f : α →₀ M) (g : α → M → N)
705+
(h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) : f.prod g ∈ S :=
706+
S.prod_mem $ λ i hi, h _ (finsupp.mem_support_iff.mp hi)
707+
703708
end sum_prod
704709

705710
/-!

src/linear_algebra/dfinsupp.lean

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ include dec_ι
108108
/-- The `dfinsupp` version of `finsupp.lsum`.
109109
110110
See note [bundled maps over different rings] for why separate `R` and `S` semirings are used. -/
111-
@[simps apply symm_apply]
111+
@[simps]
112112
def lsum [semiring S] [module S N] [smul_comm_class R S N] :
113113
(Π i, M i →ₗ[R] N) ≃ₗ[S] ((Π₀ i, M i) →ₗ[R] N) :=
114114
{ to_fun := λ F, {
@@ -202,3 +202,15 @@ basis.of_repr ((map_range.linear_equiv (λ i, (b i).repr)).trans
202202
end basis
203203

204204
end dfinsupp
205+
206+
include dec_ι
207+
208+
lemma submodule.dfinsupp_sum_mem {β : ι → Type*} [Π i, has_zero (β i)]
209+
[Π i (x : β i), decidable (x ≠ 0)] (S : submodule R N)
210+
(f : Π₀ i, β i) (g : Π i, β i → N) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) : f.sum g ∈ S :=
211+
S.to_add_submonoid.dfinsupp_sum_mem f g h
212+
213+
lemma submodule.dfinsupp_sum_add_hom_mem {β : ι → Type*} [Π i, add_zero_class (β i)]
214+
(S : submodule R N) (f : Π₀ i, β i) (g : Π i, β i →+ N) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) :
215+
dfinsupp.sum_add_hom g f ∈ S :=
216+
S.to_add_submonoid.dfinsupp_sum_add_hom_mem f g h

src/linear_algebra/finsupp.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,10 @@ end finsupp
786786
variables {R : Type*} {M : Type*} {N : Type*}
787787
variables [semiring R] [add_comm_monoid M] [module R M] [add_comm_monoid N] [module R N]
788788

789+
lemma submodule.finsupp_sum_mem {ι β : Type*} [has_zero β] (S : submodule R M) (f : ι →₀ β)
790+
(g : ι → β → M) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) : f.sum g ∈ S :=
791+
S.to_add_submonoid.finsupp_sum_mem f g h
792+
789793
lemma linear_map.map_finsupp_total
790794
(f : M →ₗ[R] N) {ι : Type*} {g : ι → M} (l : ι →₀ R) :
791795
f (finsupp.total ι M R g l) = finsupp.total ι N R (f ∘ g) l :=

0 commit comments

Comments
 (0)