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

Commit ac76745

Browse files
feat(data/finsupp/basic): add finsupp.prod_congr and sum_congr (#10568)
These are the counterparts for `finsupp` of a simpler form of `finset.prod_congr`
1 parent 42d3cbc commit ac76745

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/data/finsupp/basic.lean

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,11 @@ lemma _root_.submonoid.finsupp_prod_mem (S : submonoid N) (f : α →₀ M) (g :
770770
(h : ∀ c, f c ≠ 0 → g c (f c) ∈ S) : f.prod g ∈ S :=
771771
S.prod_mem $ λ i hi, h _ (finsupp.mem_support_iff.mp hi)
772772

773+
@[to_additive]
774+
lemma prod_congr {f : α →₀ M} {g1 g2 : α → M → N}
775+
(h : ∀ x ∈ f.support, g1 x (f x) = g2 x (f x)) : f.prod g1 = f.prod g2 :=
776+
finset.prod_congr rfl h
777+
773778
end sum_prod
774779

775780
/-!
@@ -1438,7 +1443,7 @@ begin
14381443
refine ((sum_sum_index _ _).trans _).symm,
14391444
{ intros, exact single_zero },
14401445
{ intros, exact single_add },
1441-
refine sum_congr rfl (λ _ _, sum_single_index _),
1446+
refine sum_congr (λ _ _, sum_single_index _),
14421447
{ exact single_zero }
14431448
end
14441449

@@ -1497,7 +1502,7 @@ finset.subset.trans support_sum $
14971502
lemma prod_map_domain_index [comm_monoid N] {f : α → β} {s : α →₀ M}
14981503
{h : β → M → N} (h_zero : ∀b, h b 0 = 1) (h_add : ∀b m₁ m₂, h b (m₁ + m₂) = h b m₁ * h b m₂) :
14991504
(map_domain f s).prod h = s.prod (λa m, h (f a) m) :=
1500-
(prod_sum_index h_zero h_add).trans $ prod_congr rfl $ λ _ _, prod_single_index (h_zero _)
1505+
(prod_sum_index h_zero h_add).trans $ prod_congr $ λ _ _, prod_single_index (h_zero _)
15011506

15021507
/--
15031508
A version of `sum_map_domain_index` that takes a bundled `add_monoid_hom`,

0 commit comments

Comments
 (0)