The areas / V03. Sets, finite structures and big operators
Mathlib.Algebra.BigOperators.Group.Finset.Basic
283 declarations. Mathlib docs · Source
Big operators
In this file we prove theorems about products and sums indexed by a Finset.
theorem Finset.sum_eq_fold E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (f : ι → M),
∑ i ∈ s, f i = Finset.fold (fun x1 x2 ↦ x1 + x2) 0 f s
theorem Finset.prod_eq_fold E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (f : ι → M),
∏ i ∈ s, f i = Finset.fold (fun x1 x2 ↦ x1 * x2) 1 f s
theorem Finset.sum_cons E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] {f : ι → M} (h : a ∉ s),
∑ x ∈ Finset.cons a s h, f x = f a + ∑ x ∈ s, f x
theorem Finset.prod_cons E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] {f : ι → M} (h : a ∉ s),
∏ x ∈ Finset.cons a s h, f x = f a * ∏ x ∈ s, f x
theorem Finset.prod_cons' E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] (h : a ∉ s),
(Finset.cons a s h).prod = fun f ↦ f a * ∏ x ∈ s, f x
Variant of prod_cons not applied to a function.
theorem Finset.sum_cons' E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] (h : a ∉ s),
(Finset.cons a s h).sum = fun f ↦ f a + ∑ x ∈ s, f x
theorem Finset.prod_insert E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
a ∉ s → ∏ x ∈ insert a s, f x = f a * ∏ x ∈ s, f x
theorem Finset.sum_insert E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
a ∉ s → ∑ x ∈ insert a s, f x = f a + ∑ x ∈ s, f x
theorem Finset.prod_insert' E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] [inst_1 : DecidableEq ι],
a ∉ s → (insert a s).prod = fun f ↦ f a * ∏ x ∈ s, f x
Variant of prod_insert not applied to a function.
theorem Finset.sum_insert' E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι],
a ∉ s → (insert a s).sum = fun f ↦ f a + ∑ x ∈ s, f x
theorem Finset.prod_insert_of_eq_one_if_notMem E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(a ∉ s → f a = 1) → ∏ x ∈ insert a s, f x = ∏ x ∈ s, f x
The product of f over insert a s is the same as
the product over s, as long as a is in s or f a = 1.
theorem Finset.sum_insert_of_eq_zero_if_notMem E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(a ∉ s → f a = 0) → ∑ x ∈ insert a s, f x = ∑ x ∈ s, f x
The sum of f over insert a s is the same as
the sum over s, as long as a is in s or f a = 0.
theorem Finset.prod_insert_one E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
f a = 1 → ∏ x ∈ insert a s, f x = ∏ x ∈ s, f x
The product of f over insert a s is the same as
the product over s, as long as f a = 1.
theorem Finset.sum_insert_zero E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} {a : ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
f a = 0 → ∑ x ∈ insert a s, f x = ∑ x ∈ s, f x
The sum of f over insert a s is the same as
the sum over s, as long as f a = 0.
theorem Finset.prod_singleton E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (f : ι → M) (a : ι), ∏ x ∈ {a}, f x = f a
theorem Finset.sum_singleton E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (f : ι → M) (a : ι), ∑ x ∈ {a}, f x = f a
theorem Finset.prod_singleton' E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (a : ι), {a}.prod = fun f ↦ f a
Variant of prod_singleton not applied to a function.
theorem Finset.sum_singleton' E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (a : ι), {a}.sum = fun f ↦ f a
theorem Finset.sum_pair E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {a b : ι},
a ≠ b → ∑ x ∈ {a, b}, f x = f a + f b
theorem Finset.prod_pair E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {a b : ι},
a ≠ b → ∏ x ∈ {a, b}, f x = f a * f b
theorem Finset.prod_image E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {s : Finset κ}
{g : κ → ι}, Set.InjOn g ↑s → ∏ x ∈ Finset.image g s, f x = ∏ x ∈ s, f (g x)
If a function is injective on a finset, products over the original finset or its image coincide.
See also prod_image_of_pairwise_eq_one for a version with weaker assumptions.
theorem Finset.sum_image E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι]
{s : Finset κ} {g : κ → ι}, Set.InjOn g ↑s → ∑ x ∈ Finset.image g s, f x = ∑ x ∈ s, f (g x)
If a function is injective on a finset, sums over the original
finset or its image coincide.
See also sum_image_of_pairwise_eq_zero for a version with weaker assumptions.
theorem Finset.sum_attach E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (f : ι → M), ∑ x ∈ s.attach, f ↑x = ∑ x ∈ s, f x
theorem Finset.prod_attach E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (f : ι → M), ∏ x ∈ s.attach, f ↑x = ∏ x ∈ s, f x
theorem Finset.prod_attach_index E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} (f : ι → κ) {h : ι → κ → M},
∏ x ∈ s.attach, h (↑x) (f ↑x) = ∏ x ∈ s, h x (f x)
This is a specialization of prod_attach which simp is better at unifying.
theorem Finset.sum_attach_index E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} (f : ι → κ) {h : ι → κ → M},
∑ x ∈ s.attach, h (↑x) (f ↑x) = ∑ x ∈ s, h x (f x)
theorem Finset.prod_congr E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f g : ι → M},
s₁ = s₂ → (∀ x ∈ s₂, f x = g x) → s₁.prod f = s₂.prod g
theorem Finset.sum_congr E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f g : ι → M},
s₁ = s₂ → (∀ x ∈ s₂, f x = g x) → s₁.sum f = s₂.sum g
theorem Finset.prod_eq_one E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M}, (∀ x ∈ s, f x = 1) → ∏ x ∈ s, f x = 1
theorem Finset.sum_eq_zero E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M},
(∀ x ∈ s, f x = 0) → ∑ x ∈ s, f x = 0
theorem Finset.prod_eq_one_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} [Subsingleton Mˣ],
∏ i ∈ s, f i = 1 ↔ ∀ i ∈ s, f i = 1
In a monoid whose only unit is 1, a product is equal to 1 iff all factors are 1.
theorem Finset.sum_eq_zero_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [Subsingleton (AddUnits M)],
∑ i ∈ s, f i = 0 ↔ ∀ i ∈ s, f i = 0
In an additive monoid whose only unit is 0, a sum is equal to 0 iff all terms are 0.
theorem Finset.sum_disjUnion E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (h : Disjoint s₁ s₂),
∑ x ∈ s₁.disjUnion s₂ h, f x = ∑ x ∈ s₁, f x + ∑ x ∈ s₂, f x
theorem Finset.prod_disjUnion E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} (h : Disjoint s₁ s₂),
∏ x ∈ s₁.disjUnion s₂ h, f x = (∏ x ∈ s₁, f x) * ∏ x ∈ s₂, f x
theorem Finset.prod_disjiUnion E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} (s : Finset κ) (t : κ → Finset ι)
(h : (↑s).PairwiseDisjoint t), ∏ x ∈ s.disjiUnion t h, f x = ∏ i ∈ s, ∏ x ∈ t i, f x
theorem Finset.sum_disjiUnion E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} (s : Finset κ) (t : κ → Finset ι)
(h : (↑s).PairwiseDisjoint t), ∑ x ∈ s.disjiUnion t h, f x = ∑ i ∈ s, ∑ x ∈ t i, f x
theorem Finset.sum_union_inter E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
∑ x ∈ s₁ ∪ s₂, f x + ∑ x ∈ s₁ ∩ s₂, f x = ∑ x ∈ s₁, f x + ∑ x ∈ s₂, f x
theorem Finset.prod_union_inter E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(∏ x ∈ s₁ ∪ s₂, f x) * ∏ x ∈ s₁ ∩ s₂, f x = (∏ x ∈ s₁, f x) * ∏ x ∈ s₂, f x
theorem Finset.prod_union E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
Disjoint s₁ s₂ → ∏ x ∈ s₁ ∪ s₂, f x = (∏ x ∈ s₁, f x) * ∏ x ∈ s₂, f x
theorem Finset.sum_union E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
Disjoint s₁ s₂ → ∑ x ∈ s₁ ∪ s₂, f x = ∑ x ∈ s₁, f x + ∑ x ∈ s₂, f x
theorem Finset.sum_filter_add_sum_filter_not E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (p : ι → Prop) [inst_1 : DecidablePred p]
[inst_2 : (x : ι) → Decidable ¬p x] (f : ι → M), ∑ x ∈ s with p x, f x + ∑ x ∈ s with ¬p x, f x = ∑ x ∈ s, f x
theorem Finset.prod_filter_mul_prod_filter_not E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (p : ι → Prop) [inst_1 : DecidablePred p]
[inst_2 : (x : ι) → Decidable ¬p x] (f : ι → M), (∏ x ∈ s with p x, f x) * ∏ x ∈ s with ¬p x, f x = ∏ x ∈ s, f x
theorem Finset.sum_filter_not_add_sum_filter E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (p : ι → Prop) [inst_1 : DecidablePred p]
[inst_2 : (x : ι) → Decidable ¬p x] (f : ι → M), ∑ x ∈ s with ¬p x, f x + ∑ x ∈ s with p x, f x = ∑ x ∈ s, f x
theorem Finset.prod_filter_not_mul_prod_filter E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (p : ι → Prop) [inst_1 : DecidablePred p]
[inst_2 : (x : ι) → Decidable ¬p x] (f : ι → M), (∏ x ∈ s with ¬p x, f x) * ∏ x ∈ s with p x, f x = ∏ x ∈ s, f x
theorem Finset.prod_eq_of_subset E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s₁ s₂ : Finset ι},
s₁ ⊆ s₂ → ∀ (f : ι → M), (∀ i ∈ s₂, i ∉ s₁ → f i = 1) → ∏ i ∈ s₁, f i = ∏ i ∈ s₂, f i
theorem Finset.sum_eq_of_subset E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s₁ s₂ : Finset ι},
s₁ ⊆ s₂ → ∀ (f : ι → M), (∀ i ∈ s₂, i ∉ s₁ → f i = 0) → ∑ i ∈ s₁, f i = ∑ i ∈ s₂, f i
theorem Finset.prod_filter_xor E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (p q : ι → Prop)
[inst_1 : DecidablePred p] [inst_2 : DecidablePred q],
∏ x ∈ s with Xor (p x) (q x), f x = (∏ x ∈ s with p x ∧ ¬q x, f x) * ∏ x ∈ s with q x ∧ ¬p x, f x
theorem Finset.sum_filter_xor E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (p q : ι → Prop)
[inst_1 : DecidablePred p] [inst_2 : DecidablePred q],
∑ x ∈ s with Xor (p x) (q x), f x = ∑ x ∈ s with p x ∧ ¬q x, f x + ∑ x ∈ s with q x ∧ ¬p x, f x
theorem IsCompl.sum_add_sum E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] {s t : Finset ι},
IsCompl s t → ∀ (f : ι → M), ∑ i ∈ s, f i + ∑ i ∈ t, f i = ∑ i, f i
theorem IsCompl.prod_mul_prod E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] {s t : Finset ι},
IsCompl s t → ∀ (f : ι → M), (∏ i ∈ s, f i) * ∏ i ∈ t, f i = ∏ i, f i
theorem Finset.prod_mul_prod_compl E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] [inst_2 : DecidableEq ι] (s : Finset ι)
(f : ι → M), (∏ i ∈ s, f i) * ∏ i ∈ sᶜ, f i = ∏ i, f i
Multiplying the products of a function over s and over sᶜ gives the whole product.
For a version expressed with subtypes, see Fintype.prod_subtype_mul_prod_subtype.
theorem Finset.sum_add_sum_compl E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] [inst_2 : DecidableEq ι] (s : Finset ι)
(f : ι → M), ∑ i ∈ s, f i + ∑ i ∈ sᶜ, f i = ∑ i, f i
Adding the sums of a function over s and over sᶜ gives the whole sum.
For a version expressed with subtypes, see Fintype.sum_subtype_add_sum_subtype.
theorem Finset.sum_compl_add_sum E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] [inst_2 : DecidableEq ι] (s : Finset ι)
(f : ι → M), ∑ i ∈ sᶜ, f i + ∑ i ∈ s, f i = ∑ i, f i
theorem Finset.prod_compl_mul_prod E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] [inst_2 : DecidableEq ι] (s : Finset ι)
(f : ι → M), (∏ i ∈ sᶜ, f i) * ∏ i ∈ s, f i = ∏ i, f i
theorem Finset.prod_sdiff E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
s₁ ⊆ s₂ → (∏ x ∈ s₂ \ s₁, f x) * ∏ x ∈ s₁, f x = ∏ x ∈ s₂, f x
theorem Finset.sum_sdiff E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
s₁ ⊆ s₂ → ∑ x ∈ s₂ \ s₁, f x + ∑ x ∈ s₁, f x = ∑ x ∈ s₂, f x
theorem Finset.prod_subset_one_on_sdiff E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f g : ι → M} [inst_1 : DecidableEq ι],
s₁ ⊆ s₂ → (∀ x ∈ s₂ \ s₁, g x = 1) → (∀ x ∈ s₁, f x = g x) → ∏ i ∈ s₁, f i = ∏ i ∈ s₂, g i
theorem Finset.sum_subset_zero_on_sdiff E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f g : ι → M} [inst_1 : DecidableEq ι],
s₁ ⊆ s₂ → (∀ x ∈ s₂ \ s₁, g x = 0) → (∀ x ∈ s₁, f x = g x) → ∑ i ∈ s₁, f i = ∑ i ∈ s₂, g i
theorem Finset.prod_subset E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M},
s₁ ⊆ s₂ → (∀ x ∈ s₂, x ∉ s₁ → f x = 1) → ∏ x ∈ s₁, f x = ∏ x ∈ s₂, f x
theorem Finset.sum_subset E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M},
s₁ ⊆ s₂ → (∀ x ∈ s₂, x ∉ s₁ → f x = 0) → ∑ x ∈ s₁, f x = ∑ x ∈ s₂, f x
theorem Finset.sum_disjSum E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (t : Finset κ) (f : ι ⊕ κ → M),
∑ x ∈ s.disjSum t, f x = ∑ x ∈ s, f (Sum.inl x) + ∑ x ∈ t, f (Sum.inr x)
theorem Finset.prod_disjSum E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (t : Finset κ) (f : ι ⊕ κ → M),
∏ x ∈ s.disjSum t, f x = (∏ x ∈ s, f (Sum.inl x)) * ∏ x ∈ t, f (Sum.inr x)
theorem Finset.prod_sum_eq_prod_toLeft_mul_prod_toRight E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] (s : Finset (ι ⊕ κ)) (f : ι ⊕ κ → M),
∏ x ∈ s, f x = (∏ x ∈ s.toLeft, f (Sum.inl x)) * ∏ x ∈ s.toRight, f (Sum.inr x)
theorem Finset.sum_sum_eq_sum_toLeft_add_sum_toRight E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset (ι ⊕ κ)) (f : ι ⊕ κ → M),
∑ x ∈ s, f x = ∑ x ∈ s.toLeft, f (Sum.inl x) + ∑ x ∈ s.toRight, f (Sum.inr x)
theorem Finset.sum_sumElim E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (t : Finset κ) (f : ι → M)
(g : κ → M), ∑ x ∈ s.disjSum t, Sum.elim f g x = ∑ x ∈ s, f x + ∑ x ∈ t, g x
theorem Finset.prod_sumElim E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (t : Finset κ) (f : ι → M)
(g : κ → M), ∏ x ∈ s.disjSum t, Sum.elim f g x = (∏ x ∈ s, f x) * ∏ x ∈ t, g x
theorem Finset.prod_biUnion E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {s : Finset κ}
{t : κ → Finset ι}, (↑s).PairwiseDisjoint t → ∏ x ∈ s.biUnion t, f x = ∏ x ∈ s, ∏ i ∈ t x, f i
Given a finite family of pairwise disjoint finsets, the product over their union is the product
of the products over the sets.
See also prod_biUnion_of_pairwise_eq_one for a version with weaker assumptions.
theorem Finset.sum_biUnion E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι]
{s : Finset κ} {t : κ → Finset ι}, (↑s).PairwiseDisjoint t → ∑ x ∈ s.biUnion t, f x = ∑ x ∈ s, ∑ i ∈ t x, f i
Given a finite family of pairwise disjoint finsets, the sum over their union is
the sum of the sums over the sets.
See also sum_biUnion_of_pairwise_eq_zero for a version with weaker assumptions.
theorem Finset.sum_of_injOn E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {t : Finset κ} {f : ι → M}
{g : κ → M} (e : ι → κ),
Set.InjOn e ↑s →
Set.MapsTo e ↑s ↑t → (∀ i ∈ t, i ∉ e '' ↑s → g i = 0) → (∀ i ∈ s, f i = g (e i)) → ∑ i ∈ s, f i = ∑ j ∈ t, g j
theorem Finset.prod_of_injOn E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {t : Finset κ} {f : ι → M}
{g : κ → M} (e : ι → κ),
Set.InjOn e ↑s →
Set.MapsTo e ↑s ↑t → (∀ i ∈ t, i ∉ e '' ↑s → g i = 1) → (∀ i ∈ s, f i = g (e i)) → ∏ i ∈ s, f i = ∏ j ∈ t, g j
theorem Finset.sum_fiberwise_eq_sum_filter E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ] (s : Finset ι)
(t : Finset κ) (g : ι → κ) (f : ι → M), ∑ j ∈ t, ∑ i ∈ s with g i = j, f i = ∑ i ∈ s with g i ∈ t, f i
theorem Finset.prod_fiberwise_eq_prod_filter E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq κ] (s : Finset ι)
(t : Finset κ) (g : ι → κ) (f : ι → M), ∏ j ∈ t, ∏ i ∈ s with g i = j, f i = ∏ i ∈ s with g i ∈ t, f i
theorem Finset.prod_fiberwise_eq_prod_filter' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq κ] (s : Finset ι)
(t : Finset κ) (g : ι → κ) (f : κ → M), ∏ j ∈ t, ∏ i ∈ s with g i = j, f j = ∏ i ∈ s with g i ∈ t, f (g i)
theorem Finset.sum_fiberwise_eq_sum_filter' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ] (s : Finset ι)
(t : Finset κ) (g : ι → κ) (f : κ → M), ∑ j ∈ t, ∑ i ∈ s with g i = j, f j = ∑ i ∈ s with g i ∈ t, f (g i)
theorem Finset.prod_fiberwise_of_maps_to E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {t : Finset κ}
[inst_1 : DecidableEq κ] {g : ι → κ},
(∀ i ∈ s, g i ∈ t) → ∀ (f : ι → M), ∏ j ∈ t, ∏ i ∈ s with g i = j, f i = ∏ i ∈ s, f i
theorem Finset.sum_fiberwise_of_maps_to E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {t : Finset κ}
[inst_1 : DecidableEq κ] {g : ι → κ},
(∀ i ∈ s, g i ∈ t) → ∀ (f : ι → M), ∑ j ∈ t, ∑ i ∈ s with g i = j, f i = ∑ i ∈ s, f i
theorem Finset.prod_fiberwise_of_maps_to' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {t : Finset κ}
[inst_1 : DecidableEq κ] {g : ι → κ},
(∀ i ∈ s, g i ∈ t) → ∀ (f : κ → M), ∏ j ∈ t, ∏ i ∈ s with g i = j, f j = ∏ i ∈ s, f (g i)
theorem Finset.sum_fiberwise_of_maps_to' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {t : Finset κ}
[inst_1 : DecidableEq κ] {g : ι → κ},
(∀ i ∈ s, g i ∈ t) → ∀ (f : κ → M), ∑ j ∈ t, ∑ i ∈ s with g i = j, f j = ∑ i ∈ s, f (g i)
theorem Finset.prod_fiberwise E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq κ] [inst_2 : Fintype κ]
(s : Finset ι) (g : ι → κ) (f : ι → M), ∏ j, ∏ i ∈ s with g i = j, f i = ∏ i ∈ s, f i
theorem Finset.sum_fiberwise E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ] [inst_2 : Fintype κ]
(s : Finset ι) (g : ι → κ) (f : ι → M), ∑ j, ∑ i ∈ s with g i = j, f i = ∑ i ∈ s, f i
theorem Finset.sum_fiberwise' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ] [inst_2 : Fintype κ]
(s : Finset ι) (g : ι → κ) (f : κ → M), ∑ j, ∑ i ∈ s with g i = j, f j = ∑ i ∈ s, f (g i)
theorem Finset.prod_fiberwise' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq κ] [inst_2 : Fintype κ]
(s : Finset ι) (g : ι → κ) (f : κ → M), ∏ j, ∏ i ∈ s with g i = j, f j = ∏ i ∈ s, f (g i)
theorem Finset.prod_diag E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (f : ι × ι → M),
∏ i ∈ s.diag, f i = ∏ i ∈ s, f (i, i)
theorem Finset.sum_diag E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (f : ι × ι → M),
∑ i ∈ s.diag, f i = ∑ i ∈ s, f (i, i)
theorem Finset.prod_image' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {s : Finset κ}
{g : κ → ι} (h : κ → M), (∀ i ∈ s, f (g i) = ∏ j ∈ s with g j = g i, h j) → ∏ a ∈ Finset.image g s, f a = ∏ i ∈ s, h i
theorem Finset.sum_image' E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι]
{s : Finset κ} {g : κ → ι} (h : κ → M),
(∀ i ∈ s, f (g i) = ∑ j ∈ s with g j = g i, h j) → ∑ a ∈ Finset.image g s, f a = ∑ i ∈ s, h i
theorem Finset.prod_mul_distrib E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f g : ι → M},
∏ x ∈ s, f x * g x = (∏ x ∈ s, f x) * ∏ x ∈ s, g x
theorem Finset.sum_add_distrib E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f g : ι → M},
∑ x ∈ s, (f x + g x) = ∑ x ∈ s, f x + ∑ x ∈ s, g x
theorem Finset.prod_mul_prod_comm E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (f g h i : ι → M),
(∏ a ∈ s, f a * g a) * ∏ a ∈ s, h a * i a = (∏ a ∈ s, f a * h a) * ∏ a ∈ s, g a * i a
theorem Finset.sum_add_sum_comm E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (f g h i : ι → M),
∑ a ∈ s, (f a + g a) + ∑ a ∈ s, (h a + i a) = ∑ a ∈ s, (f a + h a) + ∑ a ∈ s, (g a + i a)
theorem Finset.prod_filter_of_ne E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} {p : ι → Prop}
[inst_1 : DecidablePred p], (∀ x ∈ s, f x ≠ 1 → p x) → ∏ x ∈ s with p x, f x = ∏ x ∈ s, f x
theorem Finset.sum_filter_of_ne E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} {p : ι → Prop}
[inst_1 : DecidablePred p], (∀ x ∈ s, f x ≠ 0 → p x) → ∑ x ∈ s with p x, f x = ∑ x ∈ s, f x
theorem Finset.prod_filter_ne_one E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} (s : Finset ι)
[inst_1 : (x : ι) → Decidable (f x ≠ 1)], ∏ x ∈ s with f x ≠ 1, f x = ∏ x ∈ s, f x
theorem Finset.sum_filter_ne_zero E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} (s : Finset ι)
[inst_1 : (x : ι) → Decidable (f x ≠ 0)], ∑ x ∈ s with f x ≠ 0, f x = ∑ x ∈ s, f x
theorem Finset.prod_filter E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (p : ι → Prop) [inst_1 : DecidablePred p]
(f : ι → M), ∏ a ∈ s with p a, f a = ∏ a ∈ s, if p a then f a else 1
theorem Finset.sum_filter E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (p : ι → Prop) [inst_1 : DecidablePred p]
(f : ι → M), ∑ a ∈ s with p a, f a = ∑ a ∈ s, if p a then f a else 0
theorem Finset.sum_eq_single_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {f : ι → M},
∀ a ∈ s, (∀ b ∈ s, b ≠ a → f b = 0) → ∑ x ∈ s, f x = f a
theorem Finset.prod_eq_single_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {f : ι → M},
∀ a ∈ s, (∀ b ∈ s, b ≠ a → f b = 1) → ∏ x ∈ s, f x = f a
theorem Finset.sum_eq_single E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {f : ι → M} (a : ι),
(∀ b ∈ s, b ≠ a → f b = 0) → (a ∉ s → f a = 0) → ∑ x ∈ s, f x = f a
theorem Finset.prod_eq_single E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {f : ι → M} (a : ι),
(∀ b ∈ s, b ≠ a → f b = 1) → (a ∉ s → f a = 1) → ∏ x ∈ s, f x = f a
theorem Finset.sum_ite_mem_eq E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] (s : Finset ι) (f : ι → M)
[inst_2 : DecidablePred fun x ↦ x ∈ s], (∑ i, if i ∈ s then f i else 0) = ∑ i ∈ s, f i
theorem Finset.prod_ite_mem_eq E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] (s : Finset ι) (f : ι → M)
[inst_2 : DecidablePred fun x ↦ x ∈ s], (∏ i, if i ∈ s then f i else 1) = ∏ i ∈ s, f i
theorem Finset.prod_eq_ite E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] {s : Finset ι} {f : ι → M} (a : ι),
(∀ b ∈ s, b ≠ a → f b = 1) → ∏ x ∈ s, f x = if a ∈ s then f a else 1
theorem Finset.sum_eq_ite E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] {s : Finset ι} {f : ι → M} (a : ι),
(∀ b ∈ s, b ≠ a → f b = 0) → ∑ x ∈ s, f x = if a ∈ s then f a else 0
theorem Finset.prod_union_eq_left E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(∀ a ∈ s₂, a ∉ s₁ → f a = 1) → ∏ a ∈ s₁ ∪ s₂, f a = ∏ a ∈ s₁, f a
theorem Finset.sum_union_eq_left E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(∀ a ∈ s₂, a ∉ s₁ → f a = 0) → ∑ a ∈ s₁ ∪ s₂, f a = ∑ a ∈ s₁, f a
theorem Finset.prod_union_eq_right E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(∀ a ∈ s₁, a ∉ s₂ → f a = 1) → ∏ a ∈ s₁ ∪ s₂, f a = ∏ a ∈ s₂, f a
theorem Finset.sum_union_eq_right E1 #
∀ {ι : Type u_1} {M : Type u_4} {s₁ s₂ : Finset ι} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι],
(∀ a ∈ s₁, a ∉ s₂ → f a = 0) → ∑ a ∈ s₁ ∪ s₂, f a = ∑ a ∈ s₂, f a
theorem Finset.prod_congr_of_eq_on_inter E1 #
∀ {ι : Type u_5} {M : Type u_6} {s₁ s₂ : Finset ι} {f g : ι → M} [inst : CommMonoid M],
(∀ a ∈ s₁, a ∉ s₂ → f a = 1) →
(∀ a ∈ s₂, a ∉ s₁ → g a = 1) → (∀ a ∈ s₁, a ∈ s₂ → f a = g a) → ∏ a ∈ s₁, f a = ∏ a ∈ s₂, g a
The products of two functions f g : ι → M over finite sets s₁ s₂ : Finset ι
are equal if the functions agree on s₁ ∩ s₂, f = 1 and g = 1 on the respective
set differences.
theorem Finset.sum_congr_of_eq_on_inter E1 #
∀ {ι : Type u_5} {M : Type u_6} {s₁ s₂ : Finset ι} {f g : ι → M} [inst : AddCommMonoid M],
(∀ a ∈ s₁, a ∉ s₂ → f a = 0) →
(∀ a ∈ s₂, a ∉ s₁ → g a = 0) → (∀ a ∈ s₁, a ∈ s₂ → f a = g a) → ∑ a ∈ s₁, f a = ∑ a ∈ s₂, g a
The sum of two functions f g : ι → M over finite sets s₁ s₂ : Finset ι
are equal if the functions agree on s₁ ∩ s₂, f = 0 and g = 0 on the respective
set differences.
theorem Finset.sum_eq_add_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {f : ι → M} (a b : ι),
a ∈ s → b ∈ s → a ≠ b → (∀ c ∈ s, c ≠ a ∧ c ≠ b → f c = 0) → ∑ x ∈ s, f x = f a + f b
theorem Finset.prod_eq_mul_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {f : ι → M} (a b : ι),
a ∈ s → b ∈ s → a ≠ b → (∀ c ∈ s, c ≠ a ∧ c ≠ b → f c = 1) → ∏ x ∈ s, f x = f a * f b
theorem Finset.prod_eq_mul E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {f : ι → M} (a b : ι),
a ≠ b → (∀ c ∈ s, c ≠ a ∧ c ≠ b → f c = 1) → (a ∉ s → f a = 1) → (b ∉ s → f b = 1) → ∏ x ∈ s, f x = f a * f b
theorem Finset.sum_eq_add E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {f : ι → M} (a b : ι),
a ≠ b → (∀ c ∈ s, c ≠ a ∧ c ≠ b → f c = 0) → (a ∉ s → f a = 0) → (b ∉ s → f b = 0) → ∑ x ∈ s, f x = f a + f b
theorem Finset.prod_subtype_eq_prod_filter E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (f : ι → M) {p : ι → Prop}
[inst_1 : DecidablePred p], ∏ x ∈ Finset.subtype p s, f ↑x = ∏ x ∈ s with p x, f x
A product over s.subtype p equals one over {x ∈ s | p x}.
theorem Finset.sum_subtype_eq_sum_filter E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (f : ι → M) {p : ι → Prop}
[inst_1 : DecidablePred p], ∑ x ∈ Finset.subtype p s, f ↑x = ∑ x ∈ s with p x, f x
A sum over s.subtype p equals one over {x ∈ s | p x}.
theorem Finset.prod_subtype_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (f : ι → M) {p : ι → Prop}
[inst_1 : DecidablePred p], (∀ x ∈ s, p x) → ∏ x ∈ Finset.subtype p s, f ↑x = ∏ x ∈ s, f x
If all elements of a Finset satisfy the predicate p, a product
over s.subtype p equals that product over s.
theorem Finset.sum_subtype_of_mem E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (f : ι → M) {p : ι → Prop}
[inst_1 : DecidablePred p], (∀ x ∈ s, p x) → ∑ x ∈ Finset.subtype p s, f ↑x = ∑ x ∈ s, f x
If all elements of a Finset satisfy the predicate p, a sum
over s.subtype p equals that sum over s.
theorem Finset.prod_subtype_map_embedding E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {p : ι → Prop} {s : Finset { x // p x }} {f : { x // p x } → M}
{g : ι → M}, (∀ x ∈ s, g ↑x = f x) → ∏ x ∈ Finset.map (Function.Embedding.subtype fun x ↦ p x) s, g x = ∏ x ∈ s, f x
A product of a function over a Finset in a subtype equals a
product in the main type of a function that agrees with the first
function on that Finset.
theorem Finset.sum_subtype_map_embedding E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {p : ι → Prop} {s : Finset { x // p x }} {f : { x // p x } → M}
{g : ι → M}, (∀ x ∈ s, g ↑x = f x) → ∑ x ∈ Finset.map (Function.Embedding.subtype fun x ↦ p x) s, g x = ∑ x ∈ s, f x
A sum of a function over a Finset in a subtype equals a
sum in the main type of a function that agrees with the first
function on that Finset.
theorem Finset.prod_coe_sort E1 #
∀ {ι : Type u_1} {M : Type u_4} (s : Finset ι) [inst : CommMonoid M] (f : ι → M), ∏ i, f ↑i = ∏ i ∈ s, f i
theorem Finset.sum_coe_sort E1 #
∀ {ι : Type u_1} {M : Type u_4} (s : Finset ι) [inst : AddCommMonoid M] (f : ι → M), ∑ i, f ↑i = ∑ i ∈ s, f i
theorem Finset.prod_finset_coe E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (f : ι → M) (s : Finset ι), ∏ i, f ↑i = ∏ i ∈ s, f i
theorem Finset.sum_finset_coe E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (f : ι → M) (s : Finset ι), ∑ i, f ↑i = ∑ i ∈ s, f i
theorem Finset.sum_subtype E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {p : ι → Prop} {F : Fintype (Subtype p)} (s : Finset ι),
(∀ (x : ι), x ∈ s ↔ p x) → ∀ (f : ι → M), ∑ a ∈ s, f a = ∑ a, f ↑a
theorem Finset.prod_subtype E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {p : ι → Prop} {F : Fintype (Subtype p)} (s : Finset ι),
(∀ (x : ι), x ∈ s ↔ p x) → ∀ (f : ι → M), ∏ a ∈ s, f a = ∏ a, f ↑a
theorem Finset.prod_set_coe E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} (s : Set ι) [inst_1 : Fintype ↑s],
∏ i, f ↑i = ∏ i ∈ s.toFinset, f i
theorem Finset.sum_set_coe E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} (s : Set ι) [inst_1 : Fintype ↑s],
∑ i, f ↑i = ∑ i ∈ s.toFinset, f i
theorem Finset.prod_congr_set E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] (s : Set ι)
[inst_2 : DecidablePred fun x ↦ x ∈ s] (f : ι → M) (g : ↑s → M),
(∀ (x : ι) (hx : x ∈ s), f x = g ⟨x, hx⟩) → (∀ x ∉ s, f x = 1) → ∏ i, f i = ∏ i, g i
The product of a function g defined only on a set s is equal to
the product of a function f defined everywhere,
as long as f and g agree on s, and f = 1 off s.
theorem Finset.sum_congr_set E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] (s : Set ι)
[inst_2 : DecidablePred fun x ↦ x ∈ s] (f : ι → M) (g : ↑s → M),
(∀ (x : ι) (hx : x ∈ s), f x = g ⟨x, hx⟩) → (∀ x ∉ s, f x = 0) → ∑ i, f i = ∑ i, g i
The sum of a function g defined only on a set s is equal to
the sum of a function f defined everywhere,
as long as f and g agree on s, and f = 0 off s.
theorem Finset.prod_extend_by_one E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M),
(∏ i ∈ s, if i ∈ s then f i else 1) = ∏ i ∈ s, f i
theorem Finset.sum_extend_by_zero E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M),
(∑ i ∈ s, if i ∈ s then f i else 0) = ∑ i ∈ s, f i
theorem Finset.sum_extend E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ]
{t : Finset κ} {f : ι → κ} {g : ι → M} (j : κ → M),
Function.FactorsThrough g f →
Set.BijOn f (↑s) (↑t ∩ Set.range f) →
∑ i ∈ t, Function.extend f g j i = ∑ i ∈ t \ Finset.image f s, j i + ∑ i ∈ s, g i
theorem Finset.prod_extend E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] [inst_1 : DecidableEq κ]
{t : Finset κ} {f : ι → κ} {g : ι → M} (j : κ → M),
Function.FactorsThrough g f →
Set.BijOn f (↑s) (↑t ∩ Set.range f) →
∏ i ∈ t, Function.extend f g j i = (∏ i ∈ t \ Finset.image f s, j i) * ∏ i ∈ s, g i
theorem Finset.sum_extend_zero E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {t : Finset κ} {f : ι → κ}
{g : ι → M},
Function.FactorsThrough g f → Set.BijOn f (↑s) (↑t ∩ Set.range f) → ∑ i ∈ t, Function.extend f g 0 i = ∑ i ∈ s, g i
theorem Finset.prod_extend_one E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {t : Finset κ} {f : ι → κ}
{g : ι → M},
Function.FactorsThrough g f → Set.BijOn f (↑s) (↑t ∩ Set.range f) → ∏ i ∈ t, Function.extend f g 1 i = ∏ i ∈ s, g i
theorem Finset.sum_extend_zero_of_injective E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype ι] {t : Finset κ} {f : ι → κ}
(g : ι → M), Function.Injective f → (∀ (i : ι), f i ∈ t) → ∑ i ∈ t, Function.extend f g 0 i = ∑ i, g i
theorem Finset.prod_extend_one_of_injective E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype ι] {t : Finset κ} {f : ι → κ}
(g : ι → M), Function.Injective f → (∀ (i : ι), f i ∈ t) → ∏ i ∈ t, Function.extend f g 1 i = ∏ i, g i
theorem Finset.prod_eq_prod_extend E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (f : ↥s → M),
∏ x, f x = ∏ x ∈ s, Function.extend Subtype.val f 1 x
Also see Finset.prod_ite_mem_eq
theorem Finset.sum_eq_sum_extend E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (f : ↥s → M),
∑ x, f x = ∑ x ∈ s, Function.extend Subtype.val f 0 x
Also see Finset.sum_ite_mem_eq
theorem Finset.sum_bij_ne_zero E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {t : Finset κ} {f : ι → M}
{g : κ → M} (i : (a : ι) → a ∈ s → f a ≠ 0 → κ),
(∀ (a : ι) (h₁ : a ∈ s) (h₂ : f a ≠ 0), i a h₁ h₂ ∈ t) →
(∀ (a₁ : ι) (h₁₁ : a₁ ∈ s) (h₁₂ : f a₁ ≠ 0) (a₂ : ι) (h₂₁ : a₂ ∈ s) (h₂₂ : f a₂ ≠ 0),
i a₁ h₁₁ h₁₂ = i a₂ h₂₁ h₂₂ → a₁ = a₂) →
(∀ b ∈ t, g b ≠ 0 → ∃ a, ∃ (h₁ : a ∈ s) (h₂ : f a ≠ 0), i a h₁ h₂ = b) →
(∀ (a : ι) (h₁ : a ∈ s) (h₂ : f a ≠ 0), f a = g (i a h₁ h₂)) → ∑ x ∈ s, f x = ∑ x ∈ t, g x
theorem Finset.prod_bij_ne_one E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {t : Finset κ} {f : ι → M}
{g : κ → M} (i : (a : ι) → a ∈ s → f a ≠ 1 → κ),
(∀ (a : ι) (h₁ : a ∈ s) (h₂ : f a ≠ 1), i a h₁ h₂ ∈ t) →
(∀ (a₁ : ι) (h₁₁ : a₁ ∈ s) (h₁₂ : f a₁ ≠ 1) (a₂ : ι) (h₂₁ : a₂ ∈ s) (h₂₂ : f a₂ ≠ 1),
i a₁ h₁₁ h₁₂ = i a₂ h₂₁ h₂₂ → a₁ = a₂) →
(∀ b ∈ t, g b ≠ 1 → ∃ a, ∃ (h₁ : a ∈ s) (h₂ : f a ≠ 1), i a h₁ h₂ = b) →
(∀ (a : ι) (h₁ : a ∈ s) (h₂ : f a ≠ 1), f a = g (i a h₁ h₂)) → ∏ x ∈ s, f x = ∏ x ∈ t, g x
theorem Finset.exists_ne_zero_of_sum_ne_zero E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M}, ∑ x ∈ s, f x ≠ 0 → ∃ a ∈ s, f a ≠ 0
theorem Finset.exists_ne_one_of_prod_ne_one E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M}, ∏ x ∈ s, f x ≠ 1 → ∃ a ∈ s, f a ≠ 1
theorem Finset.sum_range_succ_comm E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : ℕ → M) (n : ℕ),
∑ x ∈ Finset.range (n + 1), f x = f n + ∑ x ∈ Finset.range n, f x
theorem Finset.prod_range_succ_comm E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : ℕ → M) (n : ℕ),
∏ x ∈ Finset.range (n + 1), f x = f n * ∏ x ∈ Finset.range n, f x
theorem Finset.prod_range_succ E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : ℕ → M) (n : ℕ),
∏ x ∈ Finset.range (n + 1), f x = (∏ x ∈ Finset.range n, f x) * f n
theorem Finset.sum_range_succ E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : ℕ → M) (n : ℕ),
∑ x ∈ Finset.range (n + 1), f x = ∑ x ∈ Finset.range n, f x + f n
theorem Finset.prod_range_succ' E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : ℕ → M) (n : ℕ),
∏ k ∈ Finset.range (n + 1), f k = (∏ k ∈ Finset.range n, f (k + 1)) * f 0
theorem Finset.sum_range_succ' E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : ℕ → M) (n : ℕ),
∑ k ∈ Finset.range (n + 1), f k = ∑ k ∈ Finset.range n, f (k + 1) + f 0
theorem Finset.eventually_constant_sum E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] {u : ℕ → M} {N : ℕ},
(∀ n ≥ N, u n = 0) → ∀ {n : ℕ}, N ≤ n → ∑ k ∈ Finset.range n, u k = ∑ k ∈ Finset.range N, u k
theorem Finset.eventually_constant_prod E1 #
∀ {M : Type u_4} [inst : CommMonoid M] {u : ℕ → M} {N : ℕ},
(∀ n ≥ N, u n = 1) → ∀ {n : ℕ}, N ≤ n → ∏ k ∈ Finset.range n, u k = ∏ k ∈ Finset.range N, u k
theorem Finset.prod_range_add E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : ℕ → M) (n m : ℕ),
∏ x ∈ Finset.range (n + m), f x = (∏ x ∈ Finset.range n, f x) * ∏ x ∈ Finset.range m, f (n + x)
theorem Finset.sum_range_add E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : ℕ → M) (n m : ℕ),
∑ x ∈ Finset.range (n + m), f x = ∑ x ∈ Finset.range n, f x + ∑ x ∈ Finset.range m, f (n + x)
theorem Finset.prod_range_one E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : ℕ → M), ∏ k ∈ Finset.range 1, f k = f 0
theorem Finset.sum_range_one E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : ℕ → M), ∑ k ∈ Finset.range 1, f k = f 0
theorem Finset.prod_list_map_count E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] (l : List ι) (f : ι → M),
(List.map f l).prod = ∏ m ∈ l.toFinset, f m ^ List.count m l
theorem Finset.sum_list_map_count E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] (l : List ι) (f : ι → M),
(List.map f l).sum = ∑ m ∈ l.toFinset, List.count m l • f m
theorem Finset.sum_list_count E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq M] (s : List M),
s.sum = ∑ m ∈ s.toFinset, List.count m s • m
theorem Finset.prod_list_count E1 #
∀ {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq M] (s : List M),
s.prod = ∏ m ∈ s.toFinset, m ^ List.count m s
theorem Finset.sum_list_count_of_subset E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq M] (m : List M) (s : Finset M),
m.toFinset ⊆ s → m.sum = ∑ i ∈ s, List.count i m • i
theorem Finset.prod_list_count_of_subset E1 #
∀ {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq M] (m : List M) (s : Finset M),
m.toFinset ⊆ s → m.prod = ∏ i ∈ s, i ^ List.count i m
theorem Finset.prod_multiset_map_count E1 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (s : Multiset ι) {M : Type u_5} [inst_1 : CommMonoid M] (f : ι → M),
(Multiset.map f s).prod = ∏ m ∈ s.toFinset, f m ^ Multiset.count m s
theorem Finset.sum_multiset_map_count E1 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (s : Multiset ι) {M : Type u_5} [inst_1 : AddCommMonoid M] (f : ι → M),
(Multiset.map f s).sum = ∑ m ∈ s.toFinset, Multiset.count m s • f m
theorem Finset.prod_multiset_count E1 #
∀ {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq M] (s : Multiset M),
s.prod = ∏ m ∈ s.toFinset, m ^ Multiset.count m s
theorem Finset.sum_multiset_count E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq M] (s : Multiset M),
s.sum = ∑ m ∈ s.toFinset, Multiset.count m s • m
theorem Finset.prod_multiset_count_of_subset E1 #
∀ {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq M] (m : Multiset M) (s : Finset M),
m.toFinset ⊆ s → m.prod = ∏ i ∈ s, i ^ Multiset.count i m
theorem Finset.sum_multiset_count_of_subset E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq M] (m : Multiset M) (s : Finset M),
m.toFinset ⊆ s → m.sum = ∑ i ∈ s, Multiset.count i m • i
theorem Finset.prod_range_induction E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f s : ℕ → M),
s 0 = 1 → ∀ (n : ℕ), (∀ k < n, s (k + 1) = s k * f k) → ∏ k ∈ Finset.range n, f k = s n
For any product along {0, ..., n - 1} of a commutative-monoid-valued function, we can verify
that it's equal to a different function just by checking ratios of adjacent terms up to n.
This is a multiplicative discrete analogue of the fundamental theorem of calculus.
theorem Finset.sum_range_induction E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f s : ℕ → M),
s 0 = 0 → ∀ (n : ℕ), (∀ k < n, s (k + 1) = s k + f k) → ∑ k ∈ Finset.range n, f k = s n
For any sum along {0, ..., n - 1} of a commutative-monoid-valued function, we
can verify that it's equal to a different function just by checking differences of adjacent terms
up to n.
This is a discrete analogue of the fundamental theorem of calculus.
theorem Finset.prod_const E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (b : M), ∏ _x ∈ s, b = b ^ s.card
theorem Finset.sum_const E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] (b : M), ∑ _x ∈ s, b = s.card • b
theorem Finset.prod_eq_pow_card E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} {b : M},
(∀ a ∈ s, f a = b) → ∏ a ∈ s, f a = b ^ s.card
theorem Finset.sum_eq_card_nsmul E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} {b : M},
(∀ a ∈ s, f a = b) → ∑ a ∈ s, f a = s.card • b
theorem Finset.card_nsmul_add_sum E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} {b : M},
s.card • b + ∑ a ∈ s, f a = ∑ a ∈ s, (b + f a)
theorem Finset.pow_card_mul_prod E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} {b : M},
b ^ s.card * ∏ a ∈ s, f a = ∏ a ∈ s, b * f a
theorem Finset.prod_mul_pow_card E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} {b : M},
(∏ a ∈ s, f a) * b ^ s.card = ∏ a ∈ s, f a * b
theorem Finset.sum_add_card_nsmul E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} {b : M},
∑ a ∈ s, f a + s.card • b = ∑ a ∈ s, (f a + b)
theorem Finset.nsmul_eq_sum_const E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (b : M) (n : ℕ), n • b = ∑ _k ∈ Finset.range n, b
theorem Finset.pow_eq_prod_const E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (b : M) (n : ℕ), b ^ n = ∏ _k ∈ Finset.range n, b
theorem Finset.prod_pow_eq_pow_sum E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] (s : Finset ι) (f : ι → ℕ) (a : M),
∏ i ∈ s, a ^ f i = a ^ ∑ i ∈ s, f i
theorem Finset.sum_nsmul_assoc E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] (s : Finset ι) (f : ι → ℕ) (a : M),
∑ i ∈ s, f i • a = (∑ i ∈ s, f i) • a
theorem Finset.sum_flip E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] {n : ℕ} (f : ℕ → M),
∑ r ∈ Finset.range (n + 1), f (n - r) = ∑ k ∈ Finset.range (n + 1), f k
theorem Finset.prod_flip E1 #
∀ {M : Type u_4} [inst : CommMonoid M] {n : ℕ} (f : ℕ → M),
∏ r ∈ Finset.range (n + 1), f (n - r) = ∏ k ∈ Finset.range (n + 1), f k
theorem Finset.prod_involution E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (g : (a : ι) → a ∈ s → ι),
(∀ (a : ι) (ha : a ∈ s), f a * f (g a ha) = 1) →
(∀ (a : ι) (ha : a ∈ s), f a ≠ 1 → g a ha ≠ a) →
∀ (g_mem : ∀ (a : ι) (ha : a ∈ s), g a ha ∈ s), (∀ (a : ι) (ha : a ∈ s), g (g a ha) ⋯ = a) → ∏ x ∈ s, f x = 1
The difference with Finset.prod_ninvolution is that the involution is allowed to use
membership of the domain of the product, rather than being a non-dependent function.
theorem Finset.sum_involution E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (g : (a : ι) → a ∈ s → ι),
(∀ (a : ι) (ha : a ∈ s), f a + f (g a ha) = 0) →
(∀ (a : ι) (ha : a ∈ s), f a ≠ 0 → g a ha ≠ a) →
∀ (g_mem : ∀ (a : ι) (ha : a ∈ s), g a ha ∈ s), (∀ (a : ι) (ha : a ∈ s), g (g a ha) ⋯ = a) → ∑ x ∈ s, f x = 0
The difference with Finset.sum_ninvolution is that the involution is allowed to
use membership of the domain of the sum, rather than being a non-dependent function.
theorem Finset.prod_ninvolution E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (g : ι → ι),
(∀ (a : ι), f a * f (g a) = 1) →
(∀ (a : ι), f a ≠ 1 → g a ≠ a) → (∀ (a : ι), g a ∈ s) → (∀ (a : ι), g (g a) = a) → ∏ x ∈ s, f x = 1
The difference with Finset.prod_involution is that the involution is a non-dependent function,
rather than being allowed to use membership of the domain of the product.
theorem Finset.sum_ninvolution E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (g : ι → ι),
(∀ (a : ι), f a + f (g a) = 0) →
(∀ (a : ι), f a ≠ 0 → g a ≠ a) → (∀ (a : ι), g a ∈ s) → (∀ (a : ι), g (g a) = a) → ∑ x ∈ s, f x = 0
The difference with Finset.sum_involution is that the involution is a
non-dependent function, rather than being allowed to use membership of the domain of the sum.
theorem Finset.prod_comp E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] [inst_1 : DecidableEq κ] (f : κ → M)
(g : ι → κ), ∏ a ∈ s, f (g a) = ∏ b ∈ Finset.image g s, f b ^ {a ∈ s | g a = b}.card
The product of the composition of functions f and g, is the product over b ∈ s.image g of
f b to the power of the cardinality of the fibre of b. See also Finset.prod_image.
theorem Finset.sum_comp E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] [inst_1 : DecidableEq κ]
(f : κ → M) (g : ι → κ), ∑ a ∈ s, f (g a) = ∑ b ∈ Finset.image g s, {a ∈ s | g a = b}.card • f b
The sum of the composition of functions f and g, is the sum over
b ∈ s.image g of f b times of the cardinality of the fibre of b. See also
Finset.sum_image.
theorem Finset.prod_partition E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (R : Setoid ι)
[inst_1 : DecidableRel ⇑R], ∏ x ∈ s, f x = ∏ xbar ∈ Finset.image (Quotient.mk R) s, ∏ y ∈ s with ⟦y⟧ = xbar, f y
A product can be partitioned into a product of products, each equivalent under a setoid.
theorem Finset.sum_partition E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (R : Setoid ι)
[inst_1 : DecidableRel ⇑R], ∑ x ∈ s, f x = ∑ xbar ∈ Finset.image (Quotient.mk R) s, ∑ y ∈ s with ⟦y⟧ = xbar, f y
A sum can be partitioned into a sum of sums, each equivalent under a setoid.
theorem Finset.prod_cancels_of_partition_cancels E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (R : Setoid ι)
[inst_1 : DecidableRel ⇑R], (∀ x ∈ s, ∏ a ∈ s with R a x, f a = 1) → ∏ x ∈ s, f x = 1
If we can partition a product into subsets that cancel out, then the whole product cancels.
theorem Finset.sum_cancels_of_partition_cancels E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (R : Setoid ι)
[inst_1 : DecidableRel ⇑R], (∀ x ∈ s, ∑ a ∈ s with R a x, f a = 0) → ∑ x ∈ s, f x = 0
If we can partition a sum into subsets that cancel out, then the whole sum cancels.
theorem Finset.mul_prod_erase E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M) {a : ι},
a ∈ s → f a * ∏ x ∈ s.erase a, f x = ∏ x ∈ s, f x
Taking a product over s : Finset ι is the same as multiplying the value on a single element
f a by the product of s.erase a.
See Multiset.prod_map_erase for the Multiset version.
theorem Finset.add_sum_erase E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M) {a : ι},
a ∈ s → f a + ∑ x ∈ s.erase a, f x = ∑ x ∈ s, f x
Taking a sum over s : Finset ι is the same as adding the value on a single
element f a to the sum over s.erase a.
See Multiset.sum_map_erase for the Multiset version.
theorem Finset.prod_erase_mul E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M) {a : ι},
a ∈ s → (∏ x ∈ s.erase a, f x) * f a = ∏ x ∈ s, f x
A variant of Finset.mul_prod_erase with the multiplication swapped.
theorem Finset.sum_erase_add E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → M) {a : ι},
a ∈ s → ∑ x ∈ s.erase a, f x + f a = ∑ x ∈ s, f x
A variant of Finset.add_sum_erase with the addition swapped.
theorem Finset.prod_erase E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) {f : ι → M} {a : ι},
f a = 1 → ∏ x ∈ s.erase a, f x = ∏ x ∈ s, f x
If a function applied at a point is 1, a product is unchanged by
removing that point, if present, from a Finset.
theorem Finset.sum_erase E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] (s : Finset ι) {f : ι → M} {a : ι},
f a = 0 → ∑ x ∈ s.erase a, f x = ∑ x ∈ s, f x
If a function applied at a point is 0, a sum is unchanged by
removing that point, if present, from a Finset.
theorem Finset.prod_erase_lt_of_one_lt E1 #
∀ {ι : Type u_1} {κ : Type u_5} [inst : DecidableEq ι] [inst_1 : CommMonoid κ] [inst_2 : LT κ] [MulLeftStrictMono κ]
{s : Finset ι} {d : ι}, d ∈ s → ∀ {f : ι → κ}, 1 < f d → ∏ m ∈ s.erase d, f m < ∏ m ∈ s, f m
theorem Finset.sum_erase_lt_of_pos E1 #
∀ {ι : Type u_1} {κ : Type u_5} [inst : DecidableEq ι] [inst_1 : AddCommMonoid κ] [inst_2 : LT κ] [AddLeftStrictMono κ]
{s : Finset ι} {d : ι}, d ∈ s → ∀ {f : ι → κ}, 0 < f d → ∑ m ∈ s.erase d, f m < ∑ m ∈ s, f m
theorem Finset.sum_add_eq_sum_add_of_exists E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] {s : Finset ι} {f : ι → M} {b₁ b₂ : M},
∀ a ∈ s, f a + b₁ = f a + b₂ → ∑ a ∈ s, f a + b₁ = ∑ a ∈ s, f a + b₂
theorem Finset.prod_mul_eq_prod_mul_of_exists E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] {s : Finset ι} {f : ι → M} {b₁ b₂ : M},
∀ a ∈ s, f a * b₁ = f a * b₂ → (∏ a ∈ s, f a) * b₁ = (∏ a ∈ s, f a) * b₂
theorem Finset.prod_biUnion_of_pairwise_eq_one E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι] {s : Finset κ}
{t : κ → Finset ι},
((↑s).Pairwise fun i j ↦ ∀ k ∈ t i ∩ t j, f k = 1) → ∏ x ∈ s.biUnion t, f x = ∏ x ∈ s, ∏ i ∈ t x, f i
theorem Finset.sum_biUnion_of_pairwise_eq_zero E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] {f : ι → M} [inst_1 : DecidableEq ι]
{s : Finset κ} {t : κ → Finset ι},
((↑s).Pairwise fun i j ↦ ∀ k ∈ t i ∩ t j, f k = 0) → ∑ x ∈ s.biUnion t, f x = ∑ x ∈ s, ∑ i ∈ t x, f i
theorem Finset.prod_filter_of_pairwise_eq_one E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] {f : κ → ι} {g : ι → M}
{n : κ} {I : Finset κ},
n ∈ I → ((↑I).Pairwise fun i j ↦ f i = f j → g (f i) = 1) → ∏ j ∈ I with f j = f n, g (f j) = g (f n)
theorem Finset.sum_filter_of_pairwise_eq_zero E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] {f : κ → ι} {g : ι → M}
{n : κ} {I : Finset κ},
n ∈ I → ((↑I).Pairwise fun i j ↦ f i = f j → g (f i) = 0) → ∑ j ∈ I with f j = f n, g (f j) = g (f n)
theorem Finset.prod_image_of_pairwise_eq_one E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] {f : κ → ι} {g : ι → M}
{I : Finset κ}, ((↑I).Pairwise fun i j ↦ f i = f j → g (f i) = 1) → ∏ s ∈ Finset.image f I, g s = ∏ i ∈ I, g (f i)
A version of Finset.prod_map and Finset.prod_image, but we do not assume that f is
injective. Rather, we assume that the image of f on I only overlaps where g (f i) = 1.
The conclusion is the same as in prod_image.
theorem Finset.sum_image_of_pairwise_eq_zero E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι] {f : κ → ι} {g : ι → M}
{I : Finset κ}, ((↑I).Pairwise fun i j ↦ f i = f j → g (f i) = 0) → ∑ s ∈ Finset.image f I, g s = ∑ i ∈ I, g (f i)
A version of Finset.sum_map and Finset.sum_image, but we do not assume that f is
injective. Rather, we assume that the image of f on I only overlaps where g (f i) = 0.
The conclusion is the same as in sum_image.
theorem Finset.prod_image_of_disjoint E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : CommMonoid M] [inst_1 : DecidableEq ι] [inst_2 : PartialOrder ι]
[inst_3 : OrderBot ι] {f : κ → ι} {g : ι → M},
g ⊥ = 1 → ∀ {I : Finset κ}, (↑I).PairwiseDisjoint f → ∏ s ∈ Finset.image f I, g s = ∏ i ∈ I, g (f i)
A version of Finset.prod_map and Finset.prod_image, but we do not assume that f is
injective. Rather, we assume that the images of f are disjoint on I, and g ⊥ = 1. The
conclusion is the same as in prod_image.
theorem Finset.sum_image_of_disjoint E0 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : DecidableEq ι]
[inst_2 : PartialOrder ι] [inst_3 : OrderBot ι] {f : κ → ι} {g : ι → M},
g ⊥ = 0 → ∀ {I : Finset κ}, (↑I).PairwiseDisjoint f → ∑ s ∈ Finset.image f I, g s = ∑ i ∈ I, g (f i)
A version of Finset.sum_map and Finset.sum_image, but we do not assume that f is
injective. Rather, we assume that the images of f are disjoint on I, and g ⊥ = 0. The
conclusion is the same as in sum_image.
theorem Finset.sum_unique_nonempty E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Unique ι] (s : Finset ι) (f : ι → M),
s.Nonempty → ∑ x ∈ s, f x = f default
theorem Finset.prod_unique_nonempty E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Unique ι] (s : Finset ι) (f : ι → M),
s.Nonempty → ∏ x ∈ s, f x = f default
theorem Finset.prod_dvd_prod_of_dvd E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] (f g : ι → M),
(∀ i ∈ s, f i ∣ g i) → ∏ i ∈ s, f i ∣ ∏ i ∈ s, g i
theorem Finset.sum_map_equiv E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M} (e : ι ≃ κ),
(Finset.map e.toEmbedding s).sum (f ∘ ⇑e.symm) = s.sum f
theorem Finset.prod_map_equiv E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M} (e : ι ≃ κ),
(Finset.map e.toEmbedding s).prod (f ∘ ⇑e.symm) = s.prod f
theorem Finset.prod_comp_equiv E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : κ → M} (e : ι ≃ κ),
s.prod (f ∘ ⇑e) = (Finset.map e.toEmbedding s).prod f
theorem Finset.sum_comp_equiv E1 #
∀ {ι : Type u_1} {κ : Type u_2} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : κ → M} (e : ι ≃ κ),
s.sum (f ∘ ⇑e) = (Finset.map e.toEmbedding s).sum f
theorem Finset.sum_sdiff_eq_sum_sdiff_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq ι] [inst_1 : AddCancelCommMonoid M] {s t : Finset ι} {f : ι → M},
∑ i ∈ s \ t, f i = ∑ i ∈ t \ s, f i ↔ ∑ i ∈ s, f i = ∑ i ∈ t, f i
theorem Finset.prod_sdiff_eq_prod_sdiff_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq ι] [inst_1 : CancelCommMonoid M] {s t : Finset ι} {f : ι → M},
∏ i ∈ s \ t, f i = ∏ i ∈ t \ s, f i ↔ ∏ i ∈ s, f i = ∏ i ∈ t, f i
theorem Finset.sum_sdiff_ne_sum_sdiff_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq ι] [inst_1 : AddCancelCommMonoid M] {s t : Finset ι} {f : ι → M},
∑ i ∈ s \ t, f i ≠ ∑ i ∈ t \ s, f i ↔ ∑ i ∈ s, f i ≠ ∑ i ∈ t, f i
theorem Finset.prod_sdiff_ne_prod_sdiff_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq ι] [inst_1 : CancelCommMonoid M] {s t : Finset ι} {f : ι → M},
∏ i ∈ s \ t, f i ≠ ∏ i ∈ t \ s, f i ↔ ∏ i ∈ s, f i ≠ ∏ i ∈ t, f i
theorem Finset.sum_insert_sub E1 #
∀ {ι : Type u_1} {G : Type u_3} {s : Finset ι} {a : ι} [inst : AddCommGroup G] [inst_1 : DecidableEq ι],
a ∉ s → ∀ (f : ι → G), ∑ x ∈ insert a s, f x - f a = ∑ x ∈ s, f x
theorem Finset.prod_insert_div E1 #
∀ {ι : Type u_1} {G : Type u_3} {s : Finset ι} {a : ι} [inst : CommGroup G] [inst_1 : DecidableEq ι],
a ∉ s → ∀ (f : ι → G), (∏ x ∈ insert a s, f x) / f a = ∏ x ∈ s, f x
theorem Finset.sum_erase_eq_sub E0 #
∀ {ι : Type u_1} {G : Type u_3} {s : Finset ι} [inst : AddCommGroup G] [inst_1 : DecidableEq ι] {f : ι → G} {a : ι},
a ∈ s → ∑ x ∈ s.erase a, f x = ∑ x ∈ s, f x - f a
theorem Finset.prod_erase_eq_div E0 #
∀ {ι : Type u_1} {G : Type u_3} {s : Finset ι} [inst : CommGroup G] [inst_1 : DecidableEq ι] {f : ι → G} {a : ι},
a ∈ s → ∏ x ∈ s.erase a, f x = (∏ x ∈ s, f x) / f a
theorem Finset.prod_range_div E1 #
∀ {G : Type u_3} [inst : CommGroup G] (f : ℕ → G) (n : ℕ), ∏ i ∈ Finset.range n, f (i + 1) / f i = f n / f 0
A telescoping product along {0, ..., n - 1} of a commutative-group-valued function reduces to
the ratio of the last and first factors.
theorem Finset.sum_range_sub E1 #
∀ {G : Type u_3} [inst : AddCommGroup G] (f : ℕ → G) (n : ℕ), ∑ i ∈ Finset.range n, (f (i + 1) - f i) = f n - f 0
A telescoping sum along {0, ..., n - 1} of a function valued in a commutative
additive group reduces to the difference of the last and first terms.
theorem Finset.prod_range_div' E1 #
∀ {G : Type u_3} [inst : CommGroup G] (f : ℕ → G) (n : ℕ), ∏ i ∈ Finset.range n, f i / f (i + 1) = f 0 / f n
A reversed telescoping product along {0, ..., n - 1} of a commutative-group-valued function
reduces to the ratio of the first and last factors.
theorem Finset.sum_range_sub' E1 #
∀ {G : Type u_3} [inst : AddCommGroup G] (f : ℕ → G) (n : ℕ), ∑ i ∈ Finset.range n, (f i - f (i + 1)) = f 0 - f n
A reversed telescoping sum along {0, ..., n - 1} of a function valued in a
commutative additive group reduces to the difference of the first and last terms.
theorem Finset.prod_range_add_div_prod_range E1 #
∀ {G : Type u_3} [inst : CommGroup G] (f : ℕ → G) (n m : ℕ),
(∏ k ∈ Finset.range (n + m), f k) / ∏ k ∈ Finset.range n, f k = ∏ k ∈ Finset.range m, f (n + k)
theorem Finset.sum_range_add_sub_sum_range E1 #
∀ {G : Type u_3} [inst : AddCommGroup G] (f : ℕ → G) (n m : ℕ),
∑ k ∈ Finset.range (n + m), f k - ∑ k ∈ Finset.range n, f k = ∑ k ∈ Finset.range m, f (n + k)
theorem Finset.prod_sdiff_eq_div E0 #
∀ {ι : Type u_1} {G : Type u_3} {s₁ s₂ : Finset ι} [inst : CommGroup G] [inst_1 : DecidableEq ι] {f : ι → G},
s₁ ⊆ s₂ → ∏ x ∈ s₂ \ s₁, f x = (∏ x ∈ s₂, f x) / ∏ x ∈ s₁, f x
theorem Finset.sum_sdiff_eq_sub E0 #
∀ {ι : Type u_1} {G : Type u_3} {s₁ s₂ : Finset ι} [inst : AddCommGroup G] [inst_1 : DecidableEq ι] {f : ι → G},
s₁ ⊆ s₂ → ∑ x ∈ s₂ \ s₁, f x = ∑ x ∈ s₂, f x - ∑ x ∈ s₁, f x
theorem Finset.sum_sdiff_sub_sum_sdiff E1 #
∀ {ι : Type u_1} {G : Type u_3} {s₁ s₂ : Finset ι} [inst : AddCommGroup G] [inst_1 : DecidableEq ι] {f : ι → G},
∑ x ∈ s₂ \ s₁, f x - ∑ x ∈ s₁ \ s₂, f x = ∑ x ∈ s₂, f x - ∑ x ∈ s₁, f x
theorem Finset.prod_sdiff_div_prod_sdiff E1 #
∀ {ι : Type u_1} {G : Type u_3} {s₁ s₂ : Finset ι} [inst : CommGroup G] [inst_1 : DecidableEq ι] {f : ι → G},
(∏ x ∈ s₂ \ s₁, f x) / ∏ x ∈ s₁ \ s₂, f x = (∏ x ∈ s₂, f x) / ∏ x ∈ s₁, f x
theorem Finset.sum_range_tsub E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : PartialOrder M] [inst_2 : Sub M] [OrderedSub M] [AddLeftMono M]
[AddLeftReflectLE M] [ExistsAddOfLE M] {f : ℕ → M},
Monotone f → ∀ (n : ℕ), ∑ i ∈ Finset.range n, (f (i + 1) - f i) = f n - f 0
A telescoping sum along {0, ..., n-1} of an ℕ-valued function reduces to the difference of
the last and first terms when the function we are summing is monotone.
theorem Finset.sum_tsub_distrib E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : PartialOrder M] [inst_2 : Sub M] [OrderedSub M]
[AddLeftMono M] [AddLeftReflectLE M] [ExistsAddOfLE M] (s : Finset ι) {f g : ι → M},
(∀ x ∈ s, g x ≤ f x) → ∑ x ∈ s, (f x - g x) = ∑ x ∈ s, f x - ∑ x ∈ s, g x
theorem Finset.card_eq_sum_ones E1 #
∀ {ι : Type u_1} (s : Finset ι), s.card = ∑ x ∈ s, 1
theorem Finset.sum_const_nat E1 #
∀ {ι : Type u_1} {s : Finset ι} {m : ℕ} {f : ι → ℕ}, (∀ x ∈ s, f x = m) → ∑ x ∈ s, f x = s.card * m
theorem Finset.sum_card_fiberwise_eq_card_filter E1 #
∀ {ι : Type u_1} {κ : Type u_5} [inst : DecidableEq κ] (s : Finset ι) (t : Finset κ) (g : ι → κ),
∑ j ∈ t, {i ∈ s | g i = j}.card = {i ∈ s | g i ∈ t}.card
theorem Finset.card_disjiUnion E0 #
∀ {ι : Type u_1} {M : Type u_4} (s : Finset ι) (t : ι → Finset M) (h : (↑s).PairwiseDisjoint t),
(s.disjiUnion t h).card = ∑ a ∈ s, (t a).card
theorem Finset.card_biUnion E1 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : DecidableEq M] {t : ι → Finset M},
(↑s).PairwiseDisjoint t → (s.biUnion t).card = ∑ u ∈ s, (t u).card
theorem Finset.card_biUnion_le E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq M] {s : Finset ι} {t : ι → Finset M},
(s.biUnion t).card ≤ ∑ a ∈ s, (t a).card
theorem Finset.card_eq_sum_card_fiberwise E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq M] {f : ι → M} {s : Finset ι} {t : Finset M},
Set.MapsTo f ↑s ↑t → s.card = ∑ b ∈ t, {a ∈ s | f a = b}.card
theorem Finset.card_eq_sum_card_image E1 #
∀ {ι : Type u_1} {M : Type u_4} [inst : DecidableEq M] (f : ι → M) (s : Finset ι),
s.card = ∑ b ∈ Finset.image f s, {a ∈ s | f a = b}.card
theorem Fintype.prod_of_injective E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : CommMonoid M]
(e : ι → κ),
Function.Injective e →
∀ (f : ι → M) (g : κ → M), (∀ i ∉ Set.range e, g i = 1) → (∀ (i : ι), f i = g (e i)) → ∏ i, f i = ∏ j, g j
theorem Fintype.sum_of_injective E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : AddCommMonoid M]
(e : ι → κ),
Function.Injective e →
∀ (f : ι → M) (g : κ → M), (∀ i ∉ Set.range e, g i = 0) → (∀ (i : ι), f i = g (e i)) → ∑ i, f i = ∑ j, g j
theorem Fintype.sum_fiberwise E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : AddCommMonoid M]
[inst_3 : DecidableEq κ] (g : ι → κ) (f : ι → M), ∑ j, ∑ i, f ↑i = ∑ i, f i
theorem Fintype.prod_fiberwise E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : CommMonoid M]
[inst_3 : DecidableEq κ] (g : ι → κ) (f : ι → M), ∏ j, ∏ i, f ↑i = ∏ i, f i
theorem Fintype.prod_fiberwise' E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : CommMonoid M]
[inst_3 : DecidableEq κ] (g : ι → κ) (f : κ → M), ∏ j, ∏ _i, f j = ∏ i, f (g i)
theorem Fintype.sum_fiberwise' E1 #
∀ {M : Type u_4} {ι : Type u_5} {κ : Type u_6} [inst : Fintype ι] [inst_1 : Fintype κ] [inst_2 : AddCommMonoid M]
[inst_3 : DecidableEq κ] (g : ι → κ) (f : κ → M), ∑ j, ∑ _i, f j = ∑ i, f (g i)
theorem Fintype.sum_unique E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : AddCommMonoid M] [inst_2 : Unique ι] (f : ι → M),
∑ x, f x = f default
theorem Fintype.prod_unique E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : CommMonoid M] [inst_2 : Unique ι] (f : ι → M),
∏ x, f x = f default
theorem Fintype.prod_subsingleton E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : CommMonoid M] [Subsingleton ι] (f : ι → M) (a : ι),
∏ x, f x = f a
theorem Fintype.sum_subsingleton E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : AddCommMonoid M] [Subsingleton ι] (f : ι → M) (a : ι),
∑ x, f x = f a
theorem Fintype.prod_Prop E1 #
∀ {M : Type u_4} [inst : CommMonoid M] (f : Prop → M), ∏ p, f p = f True * f False
theorem Fintype.sum_Prop E1 #
∀ {M : Type u_4} [inst : AddCommMonoid M] (f : Prop → M), ∑ p, f p = f True + f False
theorem Fintype.prod_subtype_mul_prod_subtype E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : CommMonoid M] (p : ι → Prop) (f : ι → M)
[inst_2 : DecidablePred p], (∏ i, f ↑i) * ∏ i, f ↑i = ∏ i, f i
theorem Fintype.sum_subtype_add_sum_subtype E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : AddCommMonoid M] (p : ι → Prop) (f : ι → M)
[inst_2 : DecidablePred p], ∑ i, f ↑i + ∑ i, f ↑i = ∑ i, f i
theorem Fintype.sum_subset E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : AddCommMonoid M] {s : Finset ι} {f : ι → M},
(∀ (i : ι), f i ≠ 0 → i ∈ s) → ∑ i ∈ s, f i = ∑ i, f i
theorem Fintype.prod_subset E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : Fintype ι] [inst_1 : CommMonoid M] {s : Finset ι} {f : ι → M},
(∀ (i : ι), f i ≠ 1 → i ∈ s) → ∏ i ∈ s, f i = ∏ i, f i
theorem List.sum_toFinset E1 #
∀ {ι : Type u_1} {M : Type u_5} [inst : DecidableEq ι] [inst_1 : AddCommMonoid M] (f : ι → M) {l : List ι},
l.Nodup → l.toFinset.sum f = (List.map f l).sum
theorem List.prod_toFinset E1 #
∀ {ι : Type u_1} {M : Type u_5} [inst : DecidableEq ι] [inst_1 : CommMonoid M] (f : ι → M) {l : List ι},
l.Nodup → l.toFinset.prod f = (List.map f l).prod
theorem List.sum_toFinset_count_eq_length E0 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (l : List ι), ∑ a ∈ l.toFinset, List.count a l = l.length
theorem Multiset.mem_sum E0 #
∀ {ι : Type u_1} {M : Type u_4} {a : M} {s : Finset ι} {m : ι → Multiset M}, a ∈ ∑ i ∈ s, m i ↔ ∃ i ∈ s, a ∈ m i
theorem Multiset.prod_map_prod E1 #
∀ {ι : Type u_1} {M : Type u_4} {α : Type u_5} [inst : CommMonoid M] {m : Multiset ι} {s : Finset α} {f : ι → α → M},
(Multiset.map (fun i ↦ ∏ a ∈ s, f i a) m).prod = ∏ a ∈ s, (Multiset.map (fun i ↦ f i a) m).prod
theorem Multiset.sum_map_sum E1 #
∀ {ι : Type u_1} {M : Type u_4} {α : Type u_5} [inst : AddCommMonoid M] {m : Multiset ι} {s : Finset α} {f : ι → α → M},
(Multiset.map (fun i ↦ ∑ a ∈ s, f i a) m).sum = ∑ a ∈ s, (Multiset.map (fun i ↦ f i a) m).sum
theorem Multiset.toFinset_sum_count_eq E0 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (s : Multiset ι), ∑ a ∈ s.toFinset, Multiset.count a s = s.card
theorem Multiset.sum_count_eq_card E0 #
∀ {ι : Type u_1} [inst : DecidableEq ι] {s : Finset ι} {m : Multiset ι},
(∀ a ∈ m, a ∈ s) → ∑ a ∈ s, Multiset.count a m = m.card
theorem Multiset.toFinset_sum_count_nsmul_eq E0 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (s : Multiset ι), ∑ a ∈ s.toFinset, Multiset.count a s • {a} = s
theorem Multiset.exists_smul_of_dvd_count E1 #
∀ {ι : Type u_1} [inst : DecidableEq ι] (s : Multiset ι) {k : ℕ}, (∀ a ∈ s, k ∣ Multiset.count a s) → ∃ u, s = k • u
theorem Multiset.prod_sum E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : CommMonoid M] (f : ι → Multiset M) (s : Finset ι),
(∑ x ∈ s, f x).prod = ∏ x ∈ s, (f x).prod
theorem Multiset.sum_sum E1 #
∀ {M : Type u_4} {ι : Type u_5} [inst : AddCommMonoid M] (f : ι → Multiset M) (s : Finset ι),
(∑ x ∈ s, f x).sum = ∑ x ∈ s, (f x).sum
theorem IsUnit.multisetProd_iff E0 #
∀ {M : Type u_4} [inst : CommMonoid M] {s : Multiset M}, IsUnit s.prod ↔ ∀ a ∈ s, IsUnit a
theorem IsAddUnit.multisetSum_iff E0 #
∀ {M : Type u_4} [inst : AddCommMonoid M] {s : Multiset M}, IsAddUnit s.sum ↔ ∀ a ∈ s, IsAddUnit a
theorem IsAddUnit.sum_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : AddCommMonoid M] {f : ι → M},
IsAddUnit (∑ a ∈ s, f a) ↔ ∀ a ∈ s, IsAddUnit (f a)
theorem IsUnit.prod_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} {s : Finset ι} [inst : CommMonoid M] {f : ι → M},
IsUnit (∏ a ∈ s, f a) ↔ ∀ a ∈ s, IsUnit (f a)
theorem IsAddUnit.sum_univ_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : Fintype ι] [inst_1 : AddCommMonoid M] {f : ι → M},
IsAddUnit (∑ a, f a) ↔ ∀ (a : ι), IsAddUnit (f a)
theorem IsUnit.prod_univ_iff E0 #
∀ {ι : Type u_1} {M : Type u_4} [inst : Fintype ι] [inst_1 : CommMonoid M] {f : ι → M},
IsUnit (∏ a, f a) ↔ ∀ (a : ι), IsUnit (f a)
theorem Int.natAbs_prod E0 #
∀ {ι : Type u_1} (s : Finset ι) (f : ι → ℤ), (∏ i ∈ s, f i).natAbs = ∏ i ∈ s, (f i).natAbs
theorem Int.natAbs_sum_le E1 #
∀ {ι : Type u_1} (s : Finset ι) (f : ι → ℤ), (∑ i ∈ s, f i).natAbs ≤ ∑ i ∈ s, (f i).natAbs