# Documentation

Mathlib.Algebra.BigOperators.Finprod

# Finite products and sums over types and sets #

We define products and sums over types and subsets of types, with no finiteness hypotheses. All infinite products and sums are defined to be junk values (i.e. one or zero). This approach is sometimes easier to use than Finset.sum, when issues arise with Finset and Fintype being data.

## Main definitions #

We use the following variables:

• α, β - types with no structure;
• s, t - sets
• M, N - additive or multiplicative commutative monoids
• f, g - functions

Definitions in this file:

• finsum f : M : the sum of f x as x ranges over the support of f, if it's finite. Zero otherwise.

• finprod f : M : the product of f x as x ranges over the multiplicative support of f, if it's finite. One otherwise.

## Notation #

• ∑ᶠ i, f i∑ᶠ i, f i and ∑ᶠ i : α, f i∑ᶠ i : α, f i for finsum f

• ∏ᶠ i, f i∏ᶠ i, f i and ∏ᶠ i : α, f i∏ᶠ i : α, f i for finprod f

This notation works for functions f : p → M→ M, where p : Prop, so the following works:

• ∑ᶠ i ∈ s, f i∑ᶠ i ∈ s, f i∈ s, f i, where f : α → M→ M, s : Set α : sum over the set s;
• ∑ᶠ n < 5, f n∑ᶠ n < 5, f n, where f : ℕ → M→ M : same as f 0 + f 1 + f 2 + f 3 + f 4;
• ∏ᶠ (n >= -2) (hn : n < 3), f n∏ᶠ (n >= -2) (hn : n < 3), f n, where f : ℤ → M→ M : same as f (-2) * f (-1) * f 0 * f 1 * f 2.

## Implementation notes #

Finsum and Finprod is "yet another way of doing finite sums and products in Lean". However experiments in the wild (e.g. with matroids) indicate that it is a helpful approach in settings where the user is not interested in computability and wants to do reasoning without running into typeclass diamonds caused by the constructive finiteness used in definitions such as Finset and Fintype. By sticking solely to Set.finite we avoid these problems. We are aware that there are other solutions but for beginner mathematicians this approach is easier in practice.

Another application is the construction of a partition of unity from a collection of “bump” function. In this case the finite set depends on the point and it's convenient to have a definition that does not mention the set explicitly.

The first arguments in all definitions and lemmas is the codomain of the function of the big operator. This is necessary for the heuristic in @[to_additive]. See the documentation of to_additive.attr for more information.

We did not add IsFinite (X : Type) : Prop, because it is simply Nonempty (Fintype X).

## Tags #

finsum, finprod, finite sum, finite product

### Definition and relation to Finset.sum and Finset.prod#

noncomputable def finsum {M : Type u_1} {α : Sort u_2} [inst : ] (f : αM) :
M

Sum of f x as x ranges over the elements of the support of f, if it's finite. Zero otherwise.

Equations
noncomputable def finprod {M : Type u_1} {α : Sort u_2} [inst : ] (f : αM) :
M

Product of f x as x ranges over the elements of the multiplicative support of f, if it's finite. One otherwise.

Equations

∑ᶠ x, f x∑ᶠ x, f x is notation for finsum f. It is the sum of f x, where x ranges over the the support of f, if it's finite, zero otherwise. Taking the sum over multiple arguments or conditions is possible, e.g. ∏ᶠ (x) (y), f x y∏ᶠ (x) (y), f x y and ∏ᶠ (x) (h: x ∈ s), f x∏ᶠ (x) (h: x ∈ s), f x∈ s), f x

Equations
• One or more equations did not get rendered due to their size.

∏ᶠ x, f x∏ᶠ x, f x is notation for finprod f. It is the sum of f x, where x ranges over the the multiplicative support of f, if it's finite, one otherwise. Taking the product over multiple arguments or conditions is possible, e.g. ∏ᶠ (x) (y), f x y∏ᶠ (x) (y), f x y and ∏ᶠ (x) (h: x ∈ s), f x∏ᶠ (x) (h: x ∈ s), f x∈ s), f x

Equations
• One or more equations did not get rendered due to their size.
theorem finsum_eq_sum_pLift_of_support_toFinset_subset {M : Type u_2} {α : Sort u_1} [inst : ] {f : αM} (hf : Set.Finite (Function.support (f PLift.down))) {s : Finset ()} (hs : ) :
(finsum fun i => f i) = Finset.sum s fun i => f i.down
theorem finprod_eq_prod_pLift_of_mulSupport_toFinset_subset {M : Type u_2} {α : Sort u_1} [inst : ] {f : αM} (hf : Set.Finite (Function.mulSupport (f PLift.down))) {s : Finset ()} (hs : ) :
(finprod fun i => f i) = Finset.prod s fun i => f i.down
theorem finsum_eq_sum_pLift_of_support_subset {M : Type u_2} {α : Sort u_1} [inst : ] {f : αM} {s : Finset ()} (hs : Function.support (f PLift.down) s) :
(finsum fun i => f i) = Finset.sum s fun i => f i.down
theorem finprod_eq_prod_pLift_of_mulSupport_subset {M : Type u_2} {α : Sort u_1} [inst : ] {f : αM} {s : Finset ()} (hs : Function.mulSupport (f PLift.down) s) :
(finprod fun i => f i) = Finset.prod s fun i => f i.down
@[simp]
theorem finsum_zero {M : Type u_1} {α : Sort u_2} [inst : ] :
(finsum fun _i => 0) = 0
@[simp]
theorem finprod_one {M : Type u_1} {α : Sort u_2} [inst : ] :
(finprod fun _i => 1) = 1
theorem finsum_of_isEmpty {M : Type u_2} {α : Sort u_1} [inst : ] [inst : ] (f : αM) :
(finsum fun i => f i) = 0
theorem finprod_of_isEmpty {M : Type u_2} {α : Sort u_1} [inst : ] [inst : ] (f : αM) :
(finprod fun i => f i) = 1
@[simp]
theorem finsum_false {M : Type u_1} [inst : ] (f : FalseM) :
(finsum fun i => f i) = 0
@[simp]
theorem finprod_false {M : Type u_1} [inst : ] (f : FalseM) :
(finprod fun i => f i) = 1
theorem finsum_eq_single {M : Type u_2} {α : Sort u_1} [inst : ] (f : αM) (a : α) (ha : ∀ (x : α), x af x = 0) :
(finsum fun x => f x) = f a
theorem finprod_eq_single {M : Type u_2} {α : Sort u_1} [inst : ] (f : αM) (a : α) (ha : ∀ (x : α), x af x = 1) :
(finprod fun x => f x) = f a
theorem finsum_unique {M : Type u_2} {α : Sort u_1} [inst : ] [inst : ] (f : αM) :
(finsum fun i => f i) = f default
theorem finprod_unique {M : Type u_2} {α : Sort u_1} [inst : ] [inst : ] (f : αM) :
(finprod fun i => f i) = f default
@[simp]
theorem finsum_true {M : Type u_1} [inst : ] (f : TrueM) :
(finsum fun i => f i) =
@[simp]
theorem finprod_true {M : Type u_1} [inst : ] (f : TrueM) :
(finprod fun i => f i) =
theorem finsum_eq_dif {M : Type u_1} [inst : ] {p : Prop} [inst : ] (f : pM) :
(finsum fun i => f i) = if h : p then f h else 0
theorem finprod_eq_dif {M : Type u_1} [inst : ] {p : Prop} [inst : ] (f : pM) :
(finprod fun i => f i) = if h : p then f h else 1
theorem finsum_eq_if {M : Type u_1} [inst : ] {p : Prop} [inst : ] {x : M} :
(finsum fun _i => x) = if p then x else 0
theorem finprod_eq_if {M : Type u_1} [inst : ] {p : Prop} [inst : ] {x : M} :
(finprod fun _i => x) = if p then x else 1
theorem finsum_congr {M : Type u_1} {α : Sort u_2} [inst : ] {f : αM} {g : αM} (h : ∀ (x : α), f x = g x) :
=
theorem finprod_congr {M : Type u_1} {α : Sort u_2} [inst : ] {f : αM} {g : αM} (h : ∀ (x : α), f x = g x) :
=
theorem finsum_congr_Prop {M : Type u_1} [inst : ] {p : Prop} {q : Prop} {f : pM} {g : qM} (hpq : p = q) (hfg : ∀ (h : q), f (Eq.mpr hpq h) = g h) :
=
theorem finprod_congr_Prop {M : Type u_1} [inst : ] {p : Prop} {q : Prop} {f : pM} {g : qM} (hpq : p = q) (hfg : ∀ (h : q), f (Eq.mpr hpq h) = g h) :
=
theorem finsum_induction {M : Type u_1} {α : Sort u_2} [inst : ] {f : αM} (p : MProp) (hp₀ : p 0) (hp₁ : (x y : M) → p xp yp (x + y)) (hp₂ : (i : α) → p (f i)) :
p (finsum fun i => f i)

To prove a property of a finite sum, it suffices to prove that the property is additive and holds on the summands.

theorem finprod_induction {M : Type u_1} {α : Sort u_2} [inst : ] {f : αM} (p : MProp) (hp₀ : p 1) (hp₁ : (x y : M) → p xp yp (x * y)) (hp₂ : (i : α) → p (f i)) :
p (finprod fun i => f i)

To prove a property of a finite product, it suffices to prove that the property is multiplicative and holds on the factors.

theorem finprod_nonneg {α : Sort u_2} {R : Type u_1} [inst : ] {f : αR} (hf : ∀ (x : α), 0 f x) :
0 finprod fun x => f x
theorem finsum_nonneg {α : Sort u_2} {M : Type u_1} [inst : ] {f : αM} (hf : ∀ (i : α), 0 f i) :
0 finsum fun i => f i
theorem one_le_finprod' {α : Sort u_2} {M : Type u_1} [inst : ] {f : αM} (hf : ∀ (i : α), 1 f i) :
1 finprod fun i => f i
theorem AddMonoidHom.map_finsum_pLift {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (f : M →+ N) (g : αM) (h : Set.Finite (Function.support (g PLift.down))) :
f (finsum fun x => g x) = finsum fun x => f (g x)
theorem MonoidHom.map_finprod_pLift {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (f : M →* N) (g : αM) (h : Set.Finite (Function.mulSupport (g PLift.down))) :
f (finprod fun x => g x) = finprod fun x => f (g x)
theorem AddMonoidHom.map_finsum_Prop {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {p : Prop} (f : M →+ N) (g : pM) :
f (finsum fun x => g x) = finsum fun x => f (g x)
theorem MonoidHom.map_finprod_Prop {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {p : Prop} (f : M →* N) (g : pM) :
f (finprod fun x => g x) = finprod fun x => f (g x)
theorem AddMonoidHom.map_finsum_of_preimage_zero {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (f : M →+ N) (hf : ∀ (x : M), f x = 0x = 0) (g : αM) :
f (finsum fun i => g i) = finsum fun i => f (g i)
theorem MonoidHom.map_finprod_of_preimage_one {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (f : M →* N) (hf : ∀ (x : M), f x = 1x = 1) (g : αM) :
f (finprod fun i => g i) = finprod fun i => f (g i)
theorem AddMonoidHom.map_finsum_of_injective {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (g : M →+ N) (hg : ) (f : αM) :
g (finsum fun i => f i) = finsum fun i => g (f i)
theorem MonoidHom.map_finprod_of_injective {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (g : M →* N) (hg : ) (f : αM) :
g (finprod fun i => f i) = finprod fun i => g (f i)
theorem AddEquiv.map_finsum {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (g : M ≃+ N) (f : αM) :
g (finsum fun i => f i) = finsum fun i => g (f i)
theorem MulEquiv.map_finprod {M : Type u_1} {N : Type u_2} {α : Sort u_3} [inst : ] [inst : ] (g : M ≃* N) (f : αM) :
g (finprod fun i => f i) = finprod fun i => g (f i)
theorem finsum_smul {ι : Sort u_3} {R : Type u_1} {M : Type u_2} [inst : Ring R] [inst : ] [inst : Module R M] [inst : ] (f : ιR) (x : M) :
(finsum fun i => f i) x = finsum fun i => f i x
theorem smul_finsum {ι : Sort u_3} {R : Type u_1} {M : Type u_2} [inst : Ring R] [inst : ] [inst : Module R M] [inst : ] (c : R) (f : ιM) :
(c finsum fun i => f i) = finsum fun i => c f i
theorem finsum_neg_distrib {G : Type u_1} {α : Sort u_2} [inst : ] (f : αG) :
(finsum fun x => -f x) = -finsum fun x => f x
theorem finprod_inv_distrib {G : Type u_1} {α : Sort u_2} [inst : ] (f : αG) :
(finprod fun x => (f x)⁻¹) = (finprod fun x => f x)⁻¹
theorem finsum_eq_indicator_apply {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) (f : αM) (a : α) :
(finsum fun _h => f a) =
theorem finprod_eq_mulIndicator_apply {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) (f : αM) (a : α) :
(finprod fun _h => f a) =
@[simp]
theorem finsum_mem_support {α : Type u_2} {M : Type u_1} [inst : ] (f : αM) (a : α) :
(finsum fun _h => f a) = f a
@[simp]
theorem finprod_mem_mulSupport {α : Type u_2} {M : Type u_1} [inst : ] (f : αM) (a : α) :
(finprod fun _h => f a) = f a
theorem finsum_mem_def {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) (f : αM) :
(finsum fun a => finsum fun h => f a) = finsum fun a =>
theorem finprod_mem_def {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) (f : αM) :
(finprod fun a => finprod fun h => f a) = finprod fun a =>
theorem finsum_eq_sum_of_support_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : } (h : ) :
(finsum fun i => f i) = Finset.sum s fun i => f i
theorem finprod_eq_prod_of_mulSupport_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : } (h : ) :
(finprod fun i => f i) = Finset.prod s fun i => f i
theorem finsum_eq_sum_of_support_toFinset_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (hf : ) {s : } (h : ) :
(finsum fun i => f i) = Finset.sum s fun i => f i
theorem finprod_eq_prod_of_mulSupport_toFinset_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (hf : ) {s : } (h : ) :
(finprod fun i => f i) = Finset.prod s fun i => f i
theorem finsum_eq_finset_sum_of_support_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : } (h : ) :
(finsum fun i => f i) = Finset.sum s fun i => f i
theorem finprod_eq_finset_prod_of_mulSupport_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : } (h : ) :
(finprod fun i => f i) = Finset.prod s fun i => f i
theorem finsum_def {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) [inst : ] :
(finsum fun i => f i) = if h : then Finset.sum () fun i => f i else 0
theorem finprod_def {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) [inst : ] :
(finprod fun i => f i) = if h : then Finset.prod () fun i => f i else 1
theorem finsum_of_infinite_support {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (hf : ) :
(finsum fun i => f i) = 0
theorem finprod_of_infinite_mulSupport {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (hf : ) :
(finprod fun i => f i) = 1
theorem finsum_eq_sum {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (hf : ) :
(finsum fun i => f i) = Finset.sum () fun i => f i
theorem finprod_eq_prod {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (hf : ) :
(finprod fun i => f i) = Finset.prod () fun i => f i
theorem finsum_eq_sum_of_fintype {α : Type u_1} {M : Type u_2} [inst : ] [inst : ] (f : αM) :
(finsum fun i => f i) = Finset.sum Finset.univ fun i => f i
theorem finprod_eq_prod_of_fintype {α : Type u_1} {M : Type u_2} [inst : ] [inst : ] (f : αM) :
(finprod fun i => f i) = Finset.prod Finset.univ fun i => f i
theorem finsum_cond_eq_sum_of_cond_iff {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {p : αProp} {t : } (h : ∀ {x : α}, f x 0 → (p x x t)) :
(finsum fun i => finsum fun _hi => f i) = Finset.sum t fun i => f i
theorem finprod_cond_eq_prod_of_cond_iff {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {p : αProp} {t : } (h : ∀ {x : α}, f x 1 → (p x x t)) :
(finprod fun i => finprod fun _hi => f i) = Finset.prod t fun i => f i
theorem finsum_cond_ne {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (a : α) [inst : ] (hf : ) :
(finsum fun i => finsum fun _h => f i) = Finset.sum () fun i => f i
theorem finprod_cond_ne {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (a : α) [inst : ] (hf : ) :
(finprod fun i => finprod fun _h => f i) = Finset.prod () fun i => f i
theorem finsum_mem_eq_sum_of_inter_support_eq {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} {t : } (h : = ) :
(finsum fun i => finsum fun h => f i) = Finset.sum t fun i => f i
theorem finprod_mem_eq_prod_of_inter_mulSupport_eq {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} {t : } (h : = ) :
(finprod fun i => finprod fun h => f i) = Finset.prod t fun i => f i
theorem finsum_mem_eq_sum_of_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} {t : } (h₁ : t) (h₂ : t s) :
(finsum fun i => finsum fun h => f i) = Finset.sum t fun i => f i
theorem finprod_mem_eq_prod_of_subset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} {t : } (h₁ : t) (h₂ : t s) :
(finprod fun i => finprod fun h => f i) = Finset.prod t fun i => f i
theorem finsum_mem_eq_sum {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} (hf : Set.Finite ()) :
(finsum fun i => finsum fun h => f i) = Finset.sum () fun i => f i
theorem finprod_mem_eq_prod {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} (hf : ) :
(finprod fun i => finprod fun h => f i) = Finset.prod () fun i => f i
theorem finsum_mem_eq_sum_filter {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) [inst : DecidablePred fun x => x s] (hf : ) :
(finsum fun i => finsum fun h => f i) = Finset.sum (Finset.filter (fun x => x s) ()) fun i => f i
theorem finprod_mem_eq_prod_filter {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) [inst : DecidablePred fun x => x s] (hf : ) :
(finprod fun i => finprod fun h => f i) = Finset.prod (Finset.filter (fun x => x s) ()) fun i => f i
theorem finsum_mem_eq_toFinset_sum {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) [inst : Fintype s] :
(finsum fun i => finsum fun h => f i) = Finset.sum () fun i => f i
theorem finprod_mem_eq_toFinset_prod {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) [inst : Fintype s] :
(finprod fun i => finprod fun h => f i) = Finset.prod () fun i => f i
theorem finsum_mem_eq_finite_toFinset_sum {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} (hs : ) :
(finsum fun i => finsum fun h => f i) = Finset.sum () fun i => f i
theorem finprod_mem_eq_finite_toFinset_prod {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) {s : Set α} (hs : ) :
(finprod fun i => finprod fun h => f i) = Finset.prod () fun i => f i
theorem finsum_mem_finset_eq_sum {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : ) :
(finsum fun i => finsum fun h => f i) = Finset.sum s fun i => f i
theorem finprod_mem_finset_eq_prod {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : ) :
(finprod fun i => finprod fun h => f i) = Finset.prod s fun i => f i
theorem finsum_mem_coe_finset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : ) :
(finsum fun i => finsum fun h => f i) = Finset.sum s fun i => f i
theorem finprod_mem_coe_finset {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : ) :
(finprod fun i => finprod fun h => f i) = Finset.prod s fun i => f i
theorem finsum_mem_eq_zero_of_infinite {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (hs : ) :
(finsum fun i => finsum fun h => f i) = 0
theorem finprod_mem_eq_one_of_infinite {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (hs : ) :
(finprod fun i => finprod fun h => f i) = 1
theorem finsum_mem_eq_zero_of_forall_eq_zero {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (h : ∀ (x : α), x sf x = 0) :
(finsum fun i => finsum fun h => f i) = 0
theorem finprod_mem_eq_one_of_forall_eq_one {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (h : ∀ (x : α), x sf x = 1) :
(finprod fun i => finprod fun h => f i) = 1
theorem finsum_mem_inter_support {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i
theorem finprod_mem_inter_mulSupport {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i
theorem finsum_mem_inter_support_eq {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) (t : Set α) (h : = ) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i
theorem finprod_mem_inter_mulSupport_eq {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) (t : Set α) (h : ) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i
theorem finsum_mem_inter_support_eq' {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) (t : Set α) (h : ∀ (x : α), → (x s x t)) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i
theorem finprod_mem_inter_mulSupport_eq' {α : Type u_1} {M : Type u_2} [inst : ] (f : αM) (s : Set α) (t : Set α) (h : ∀ (x : α), → (x s x t)) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i
theorem finsum_mem_univ {α : Type u_2} {M : Type u_1} [inst : ] (f : αM) :
(finsum fun i => finsum fun h => f i) = finsum fun i => f i
theorem finprod_mem_univ {α : Type u_2} {M : Type u_1} [inst : ] (f : αM) :
(finprod fun i => finprod fun h => f i) = finprod fun i => f i
theorem finsum_mem_congr {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} {t : Set α} (h₀ : s = t) (h₁ : ∀ (x : α), x tf x = g x) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => g i
theorem finprod_mem_congr {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} {t : Set α} (h₀ : s = t) (h₁ : ∀ (x : α), x tf x = g x) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => g i
theorem finsum_eq_zero_of_forall_eq_zero {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} (h : ∀ (x : α), f x = 0) :
(finsum fun i => f i) = 0
theorem finprod_eq_one_of_forall_eq_one {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} (h : ∀ (x : α), f x = 1) :
(finprod fun i => f i) = 1

### Distributivity w.r.t. addition, subtraction, and (scalar) multiplication #

theorem finsum_add_distrib {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} (hf : ) (hg : ) :
(finsum fun i => f i + g i) = (finsum fun i => f i) + finsum fun i => g i

If the additive supports of f and g are finite, then the sum of f i + g i equals the sum of f i plus the sum of g i.

theorem finprod_mul_distrib {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} (hf : ) (hg : ) :
(finprod fun i => f i * g i) = (finprod fun i => f i) * finprod fun i => g i

If the multiplicative supports of f and g are finite, then the product of f i * g i equals the product of f i multiplied by the product of g i.

theorem finsum_sub_distrib {α : Type u_2} {G : Type u_1} [inst : ] {f : αG} {g : αG} (hf : ) (hg : ) :
(finsum fun i => f i - g i) = (finsum fun i => f i) - finsum fun i => g i

If the additive supports of f and g are finite, then the sum of f i - g i equals the sum of f i minus the sum of g i.

theorem finprod_div_distrib {α : Type u_2} {G : Type u_1} [inst : ] {f : αG} {g : αG} (hf : ) (hg : ) :
(finprod fun i => f i / g i) = (finprod fun i => f i) / finprod fun i => g i

If the multiplicative supports of f and g are finite, then the product of f i / g i equals the product of f i divided by the product of g i.

theorem finsum_mem_add_distrib' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} (hf : Set.Finite ()) (hg : Set.Finite ()) :
(finsum fun i => finsum fun h => f i + g i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => g i

A more general version of finsum_mem_add_distrib that only requires s ∩ support f∩ support f and s ∩ support g∩ support g rather than s to be finite.

theorem finprod_mem_mul_distrib' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} (hf : ) (hg : ) :
(finprod fun i => finprod fun h => f i * g i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => g i

A more general version of finprod_mem_mul_distrib that only requires s ∩ mulSupport f∩ mulSupport f and s ∩ mulSupport g∩ mulSupport g rather than s to be finite.

theorem finsum_mem_zero {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) :
(finsum fun i => finsum fun h => 0) = 0

The product of the constant function 0 over any set equals 0.

theorem finprod_mem_one {α : Type u_1} {M : Type u_2} [inst : ] (s : Set α) :
(finprod fun i => finprod fun h => 1) = 1

The product of the constant function 1 over any set equals 1.

theorem finsum_mem_of_eqOn_zero {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (hf : Set.EqOn f 0 s) :
(finsum fun i => finsum fun h => f i) = 0

If a function f equals 0 on a set s, then the product of f i over i ∈ s∈ s equals 0.

theorem finprod_mem_of_eqOn_one {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (hf : Set.EqOn f 1 s) :
(finprod fun i => finprod fun h => f i) = 1

If a function f equals 1 on a set s, then the product of f i over i ∈ s∈ s equals 1.

theorem exists_ne_zero_of_finsum_mem_ne_zero {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (h : (finsum fun i => finsum fun h => f i) 0) :
x, x s f x 0

If the product of f i over i ∈ s∈ s is not equal to 0, then there is some x ∈ s∈ s such that f x ≠ 0≠ 0.

theorem exists_ne_one_of_finprod_mem_ne_one {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (h : (finprod fun i => finprod fun h => f i) 1) :
x, x s f x 1

If the product of f i over i ∈ s∈ s is not equal to 1, then there is some x ∈ s∈ s such that f x ≠ 1≠ 1.

theorem finsum_mem_add_distrib {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} (hs : ) :
(finsum fun i => finsum fun h => f i + g i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => g i

Given a finite set s, the sum of f i + g i over i ∈ s∈ s equals the sum of f i over i ∈ s∈ s plus the sum of g i over i ∈ s∈ s.

theorem finprod_mem_mul_distrib {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {g : αM} {s : Set α} (hs : ) :
(finprod fun i => finprod fun h => f i * g i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => g i

Given a finite set s, the product of f i * g i over i ∈ s∈ s equals the product of f i over i ∈ s∈ s times the product of g i over i ∈ s∈ s.

theorem AddMonoidHom.map_finsum {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {f : αM} (g : M →+ N) (hf : ) :
g (finsum fun i => f i) = finsum fun i => g (f i)
theorem MonoidHom.map_finprod {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {f : αM} (g : M →* N) (hf : ) :
g (finprod fun i => f i) = finprod fun i => g (f i)
theorem finsum_nsmul {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (hf : ) (n : ) :
(n finsum fun i => f i) = finsum fun i => n f i
theorem finprod_pow {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (hf : ) (n : ) :
(finprod fun i => f i) ^ n = finprod fun i => f i ^ n
theorem AddMonoidHom.map_finsum_mem' {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {s : Set α} {f : αM} (g : M →+ N) (h₀ : Set.Finite ()) :
g (finsum fun j => finsum fun h => f j) = finsum fun i => finsum fun h => g (f i)

A more general version of AddMonoidHom.map_finsum_mem that requires s ∩ support f∩ support f rather than s to be finite.

theorem MonoidHom.map_finprod_mem' {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {s : Set α} {f : αM} (g : M →* N) (h₀ : ) :
g (finprod fun j => finprod fun h => f j) = finprod fun i => finprod fun h => g (f i)

A more general version of MonoidHom.map_finprod_mem that requires s ∩ mulSupport f∩ mulSupport f rather than s to be finite.

theorem AddMonoidHom.map_finsum_mem {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {s : Set α} (f : αM) (g : M →+ N) (hs : ) :
g (finsum fun j => finsum fun h => f j) = finsum fun i => finsum fun h => g (f i)

Given an additive monoid homomorphism g : M →* N→* N and a function f : α → M→ M, the value of g at the sum of f i over i ∈ s∈ s equals the sum of g (f i) over s.

theorem MonoidHom.map_finprod_mem {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] {s : Set α} (f : αM) (g : M →* N) (hs : ) :
g (finprod fun j => finprod fun h => f j) = finprod fun i => finprod fun h => g (f i)

Given a monoid homomorphism g : M →* N→* N and a function f : α → M→ M, the value of g at the product of f i over i ∈ s∈ s equals the product of g (f i) over s.

theorem AddEquiv.map_finsum_mem {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] (g : M ≃+ N) (f : αM) {s : Set α} (hs : ) :
g (finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => g (f i)
theorem MulEquiv.map_finprod_mem {α : Type u_3} {M : Type u_1} {N : Type u_2} [inst : ] [inst : ] (g : M ≃* N) (f : αM) {s : Set α} (hs : ) :
g (finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => g (f i)
theorem finsum_mem_neg_distrib {α : Type u_2} {G : Type u_1} {s : Set α} [inst : ] (f : αG) (hs : ) :
(finsum fun x => finsum fun h => -f x) = -finsum fun x => finsum fun h => f x
theorem finprod_mem_inv_distrib {α : Type u_2} {G : Type u_1} {s : Set α} [inst : ] (f : αG) (hs : ) :
(finprod fun x => finprod fun h => (f x)⁻¹) = (finprod fun x => finprod fun h => f x)⁻¹
theorem finsum_mem_sub_distrib {α : Type u_2} {G : Type u_1} {s : Set α} [inst : ] (f : αG) (g : αG) (hs : ) :
(finsum fun i => finsum fun h => f i - g i) = (finsum fun i => finsum fun h => f i) - finsum fun i => finsum fun h => g i

Given a finite set s, the sum of f i / g i over i ∈ s∈ s equals the sum of f i over i ∈ s∈ s minus the sum of g i over i ∈ s∈ s.

theorem finprod_mem_div_distrib {α : Type u_2} {G : Type u_1} {s : Set α} [inst : ] (f : αG) (g : αG) (hs : ) :
(finprod fun i => finprod fun h => f i / g i) = (finprod fun i => finprod fun h => f i) / finprod fun i => finprod fun h => g i

Given a finite set s, the product of f i / g i over i ∈ s∈ s equals the product of f i over i ∈ s∈ s divided by the product of g i over i ∈ s∈ s.

### ∏ᶠ x ∈ s, f x∏ᶠ x ∈ s, f x∈ s, f x and set operations #

theorem finsum_mem_empty {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} :
(finsum fun i => finsum fun h => f i) = 0

The sum of any function over an empty set is 0.

theorem finprod_mem_empty {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} :
(finprod fun i => finprod fun h => f i) = 1

The product of any function over an empty set is 1.

theorem nonempty_of_finsum_mem_ne_zero {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (h : (finsum fun i => finsum fun h => f i) 0) :

A set s is nonempty if the sum of some function over s is not equal to 0.

theorem nonempty_of_finprod_mem_ne_one {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (h : (finprod fun i => finprod fun h => f i) 1) :

A set s is nonempty if the product of some function over s is not equal to 1.

theorem finsum_mem_union_inter {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hs : ) (ht : ) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i

Given finite sets s and t, the sum of f i over i ∈ s ∪ t∈ s ∪ t∪ t plus the sum of f i over i ∈ s ∩ t∈ s ∩ t∩ t equals the sum of f i over i ∈ s∈ s plus the sum of f i over i ∈ t∈ t.

theorem finprod_mem_union_inter {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hs : ) (ht : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i

Given finite sets s and t, the product of f i over i ∈ s ∪ t∈ s ∪ t∪ t times the product of f i over i ∈ s ∩ t∈ s ∩ t∩ t equals the product of f i over i ∈ s∈ s times the product of f i over i ∈ t∈ t.

theorem finsum_mem_union_inter' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hs : Set.Finite ()) (ht : Set.Finite ()) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i

A more general version of finsum_mem_union_inter that requires s ∩ support f∩ support f and t ∩ support f∩ support f rather than s and t to be finite.

theorem finprod_mem_union_inter' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hs : ) (ht : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i

A more general version of finprod_mem_union_inter that requires s ∩ mulSupport f∩ mulSupport f and t ∩ mulSupport f∩ mulSupport f rather than s and t to be finite.

theorem finsum_mem_union' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : Set.Finite ()) (ht : Set.Finite ()) :
(finsum fun i => finsum fun h => f i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i

A more general version of finsum_mem_union that requires s ∩ support f∩ support f and t ∩ support f∩ support f rather than s and t to be finite.

theorem finprod_mem_union' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : ) (ht : ) :
(finprod fun i => finprod fun h => f i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i

A more general version of finprod_mem_union that requires s ∩ mulSupport f∩ mulSupport f and t ∩ mulSupport f∩ mulSupport f rather than s and t to be finite.

theorem finsum_mem_union {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : ) (ht : ) :
(finsum fun i => finsum fun h => f i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i

Given two finite disjoint sets s and t, the sum of f i over i ∈ s ∪ t∈ s ∪ t∪ t equals the sum of f i over i ∈ s∈ s plus the sum of f i over i ∈ t∈ t.

theorem finprod_mem_union {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : ) (ht : ) :
(finprod fun i => finprod fun h => f i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i

Given two finite disjoint sets s and t, the product of f i over i ∈ s ∪ t∈ s ∪ t∪ t equals the product of f i over i ∈ s∈ s times the product of f i over i ∈ t∈ t.

theorem finsum_mem_union'' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint () ()) (hs : Set.Finite ()) (ht : Set.Finite ()) :
(finsum fun i => finsum fun h => f i) = (finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i

A more general version of finsum_mem_union' that requires s ∩ support f∩ support f and t ∩ support f∩ support f rather than s and t to be disjoint

theorem finprod_mem_union'' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint () ()) (hs : ) (ht : ) :
(finprod fun i => finprod fun h => f i) = (finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i

A more general version of finprod_mem_union' that requires s ∩ mulSupport f∩ mulSupport f and t ∩ mulSupport f∩ mulSupport f rather than s and t to be disjoint

theorem finsum_mem_singleton {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finsum fun i => finsum fun h => f i) = f a

The sum of f i over i ∈ {a}∈ {a} equals f a.

theorem finprod_mem_singleton {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finprod fun i => finprod fun h => f i) = f a

The product of f i over i ∈ {a}∈ {a} equals f a.

@[simp]
theorem finsum_cond_eq_left {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finsum fun i => finsum fun _h => f i) = f a
@[simp]
theorem finprod_cond_eq_left {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finprod fun i => finprod fun _h => f i) = f a
@[simp]
theorem finsum_cond_eq_right {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finsum fun i => finsum fun _hi => f i) = f a
@[simp]
theorem finprod_cond_eq_right {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} :
(finprod fun i => finprod fun _hi => f i) = f a
theorem finsum_mem_insert' {α : Type u_1} {M : Type u_2} [inst : ] {a : α} {s : Set α} (f : αM) (h : ¬a s) (hs : Set.Finite ()) :
(finsum fun i => finsum fun h => f i) = f a + finsum fun i => finsum fun h => f i

A more general version of finsum_mem_insert that requires s ∩ support f∩ support f rather than s to be finite.

theorem finprod_mem_insert' {α : Type u_1} {M : Type u_2} [inst : ] {a : α} {s : Set α} (f : αM) (h : ¬a s) (hs : ) :
(finprod fun i => finprod fun h => f i) = f a * finprod fun i => finprod fun h => f i

A more general version of finprod_mem_insert that requires s ∩ mulSupport f∩ mulSupport f rather than s to be finite.

theorem finsum_mem_insert {α : Type u_1} {M : Type u_2} [inst : ] {a : α} {s : Set α} (f : αM) (h : ¬a s) (hs : ) :
(finsum fun i => finsum fun h => f i) = f a + finsum fun i => finsum fun h => f i

Given a finite set s and an element a ∉ s∉ s, the sum of f i over i ∈ insert a s∈ insert a s equals f a plus the sum of f i over i ∈ s∈ s.

theorem finprod_mem_insert {α : Type u_1} {M : Type u_2} [inst : ] {a : α} {s : Set α} (f : αM) (h : ¬a s) (hs : ) :
(finprod fun i => finprod fun h => f i) = f a * finprod fun i => finprod fun h => f i

Given a finite set s and an element a ∉ s∉ s, the product of f i over i ∈ insert a s∈ insert a s equals f a times the product of f i over i ∈ s∈ s.

theorem finsum_mem_insert_of_eq_zero_if_not_mem {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {a : α} {s : Set α} (h : ¬a sf a = 0) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i

If f a = 0 when a ∉ s∉ s, then the sum of f i over i ∈ insert a s∈ insert a s equals the sum of f i over i ∈ s∈ s.

theorem finprod_mem_insert_of_eq_one_if_not_mem {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {a : α} {s : Set α} (h : ¬a sf a = 1) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i

If f a = 1 when a ∉ s∉ s, then the product of f i over i ∈ insert a s∈ insert a s equals the product of f i over i ∈ s∈ s.

theorem finsum_mem_insert_zero {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} {s : Set α} (h : f a = 0) :
(finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i

If f a = 0, then the sum of f i over i ∈ insert a s∈ insert a s equals the sum of f i over i ∈ s∈ s.

theorem finprod_mem_insert_one {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {a : α} {s : Set α} (h : f a = 1) :
(finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i

If f a = 1, then the product of f i over i ∈ insert a s∈ insert a s equals the product of f i over i ∈ s∈ s.

theorem finprod_mem_dvd {α : Type u_1} {N : Type u_2} [inst : ] {f : αN} (a : α) (hf : ) :
f a

If the multiplicative support of f is finite, then for every x in the domain of f, f x divides finprod f.

theorem finsum_mem_pair {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {a : α} {b : α} (h : a b) :
(finsum fun i => finsum fun h => f i) = f a + f b

The sum of f i over i ∈ {a, b}∈ {a, b}, a ≠ b≠ b, is equal to f a + f b.

theorem finprod_mem_pair {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {a : α} {b : α} (h : a b) :
(finprod fun i => finprod fun h => f i) = f a * f b

The product of f i over i ∈ {a, b}∈ {a, b}, a ≠ b≠ b, is equal to f a * f b.

theorem finsum_mem_image' {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {s : Set β} {g : βα} (hg : Set.InjOn g (s Function.support (f g))) :
(finsum fun i => finsum fun h => f i) = finsum fun j => finsum fun h => f (g j)

The sum of f y over y ∈ g '' s∈ g '' s equals the sum of f (g i) over s provided that g is injective on s ∩ support (f ∘ g)∩ support (f ∘ g)∘ g).

theorem finprod_mem_image' {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {s : Set β} {g : βα} (hg : Set.InjOn g (s Function.mulSupport (f g))) :
(finprod fun i => finprod fun h => f i) = finprod fun j => finprod fun h => f (g j)

The product of f y over y ∈ g '' s∈ g '' s equals the product of f (g i) over s provided that g is injective on s ∩ mulSupport (f ∘ g)∩ mulSupport (f ∘ g)∘ g).

theorem finsum_mem_image {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {s : Set β} {g : βα} (hg : ) :
(finsum fun i => finsum fun h => f i) = finsum fun j => finsum fun h => f (g j)

The sum of f y over y ∈ g '' s∈ g '' s equals the sum of f (g i) over s provided that g is injective on s.

theorem finprod_mem_image {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {s : Set β} {g : βα} (hg : ) :
(finprod fun i => finprod fun h => f i) = finprod fun j => finprod fun h => f (g j)

The product of f y over y ∈ g '' s∈ g '' s equals the product of f (g i) over s provided that g is injective on s.

theorem finsum_mem_range' {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {g : βα} (hg : Set.InjOn g (Function.support (f g))) :
(finsum fun i => finsum fun h => f i) = finsum fun j => f (g j)

The sum of f y over y ∈ Set.range g∈ Set.range g equals the sum of f (g i) over all i provided that g is injective on support (f ∘ g)∘ g).

theorem finprod_mem_range' {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {g : βα} (hg : Set.InjOn g (Function.mulSupport (f g))) :
(finprod fun i => finprod fun h => f i) = finprod fun j => f (g j)

The product of f y over y ∈ set.range g∈ set.range g equals the product of f (g i) over all i provided that g is injective on mulSupport (f ∘ g)∘ g).

theorem finsum_mem_range {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {g : βα} (hg : ) :
(finsum fun i => finsum fun h => f i) = finsum fun j => f (g j)

The sum of f y over y ∈ Set.range g∈ Set.range g equals the sum of f (g i) over all i provided that g is injective.

theorem finprod_mem_range {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] {f : αM} {g : βα} (hg : ) :
(finprod fun i => finprod fun h => f i) = finprod fun j => f (g j)

The product of f y over y ∈ Set.range g∈ Set.range g equals the product of f (g i) over all i provided that g is injective.

theorem finsum_mem_eq_of_bijOn {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {s : Set α} {t : Set β} {f : αM} {g : βM} (e : αβ) (he₀ : Set.BijOn e s t) (he₁ : ∀ (x : α), x sf x = g (e x)) :
(finsum fun i => finsum fun h => f i) = finsum fun j => finsum fun h => g j

See also Finset.sum_bij.

theorem finprod_mem_eq_of_bijOn {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {s : Set α} {t : Set β} {f : αM} {g : βM} (e : αβ) (he₀ : Set.BijOn e s t) (he₁ : ∀ (x : α), x sf x = g (e x)) :
(finprod fun i => finprod fun h => f i) = finprod fun j => finprod fun h => g j

See also Finset.prod_bij.

theorem finsum_eq_of_bijective {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {f : αM} {g : βM} (e : αβ) (he₀ : ) (he₁ : ∀ (x : α), f x = g (e x)) :
(finsum fun i => f i) = finsum fun j => g j

See finsum_comp, Fintype.sum_bijective and Finset.sum_bij.

theorem finprod_eq_of_bijective {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {f : αM} {g : βM} (e : αβ) (he₀ : ) (he₁ : ∀ (x : α), f x = g (e x)) :
(finprod fun i => f i) = finprod fun j => g j

See finprod_comp, Fintype.prod_bijective and Finset.prod_bij.

theorem finsum_comp {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {g : βM} (e : αβ) (he₀ : ) :
(finsum fun i => g (e i)) = finsum fun j => g j

See also finsum_eq_of_bijective, Fintype.sum_bijective and Finset.sum_bij.

theorem finprod_comp {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {g : βM} (e : αβ) (he₀ : ) :
(finprod fun i => g (e i)) = finprod fun j => g j

See also finprod_eq_of_bijective, Fintype.prod_bijective and Finset.prod_bij.

theorem finsum_comp_equiv {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (e : α β) {f : βM} :
(finsum fun i => f (e i)) = finsum fun i' => f i'
theorem finprod_comp_equiv {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (e : α β) {f : βM} :
(finprod fun i => f (e i)) = finprod fun i' => f i'
theorem finsum_set_coe_eq_finsum_mem {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (s : Set α) :
(finsum fun j => f j) = finsum fun i => finsum fun h => f i
theorem finprod_set_coe_eq_finprod_mem {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (s : Set α) :
(finprod fun j => f j) = finprod fun i => finprod fun h => f i
theorem finsum_subtype_eq_finsum_cond {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} (p : αProp) :
(finsum fun j => f j) = finsum fun i => finsum fun _hi => f i
theorem finprod_subtype_eq_finprod_cond {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} (p : αProp) :
(finprod fun j => f j) = finprod fun i => finprod fun _hi => f i
theorem finsum_mem_inter_add_diff' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (t : Set α) (h : Set.Finite ()) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i
theorem finprod_mem_inter_mul_diff' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (t : Set α) (h : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i
theorem finsum_mem_inter_add_diff {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (t : Set α) (h : ) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i
theorem finprod_mem_inter_mul_diff {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} (t : Set α) (h : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i
theorem finsum_mem_add_diff' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : Set.Finite ()) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i

A more general version of finsum_mem_add_diff that requires t ∩ support f∩ support f rather than t to be finite.

theorem finprod_mem_mul_diff' {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i

A more general version of finprod_mem_mul_diff that requires t ∩ mulSupport f∩ mulSupport f rather than t to be finite.

theorem finsum_mem_add_diff {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : ) :
((finsum fun i => finsum fun h => f i) + finsum fun i => finsum fun h => f i) = finsum fun i => finsum fun h => f i

Given a finite set t and a subset s of t, the sum of f i over i ∈ s∈ s plus the sum of f i over t \ s equals the sum of f i over i ∈ t∈ t.

theorem finprod_mem_mul_diff {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : ) :
((finprod fun i => finprod fun h => f i) * finprod fun i => finprod fun h => f i) = finprod fun i => finprod fun h => f i

Given a finite set t and a subset s of t, the product of f i over i ∈ s∈ s times the product of f i over t \ s equals the product of f i over i ∈ t∈ t.

theorem finsum_mem_unionᵢ {α : Type u_2} {ι : Type u_1} {M : Type u_3} [inst : ] {f : αM} [inst : ] {t : ιSet α} (h : Pairwise (Disjoint on t)) (ht : ∀ (i : ι), Set.Finite (t i)) :
(finsum fun a => finsum fun h => f a) = finsum fun i => finsum fun a => finsum fun h => f a

Given a family of pairwise disjoint finite sets t i indexed by a finite type, the sum of f a over the union ⋃ i, t i⋃ i, t i is equal to the sum over all indexes i of the sums of f a over a ∈ t i∈ t i.

theorem finprod_mem_unionᵢ {α : Type u_2} {ι : Type u_1} {M : Type u_3} [inst : ] {f : αM} [inst : ] {t : ιSet α} (h : Pairwise (Disjoint on t)) (ht : ∀ (i : ι), Set.Finite (t i)) :
(finprod fun a => finprod fun h => f a) = finprod fun i => finprod fun a => finprod fun h => f a

Given a family of pairwise disjoint finite sets t i indexed by a finite type, the product of f a over the union ⋃ i, t i⋃ i, t i is equal to the product over all indexes i of the products of f a over a ∈ t i∈ t i.

theorem finsum_mem_bunionᵢ {α : Type u_2} {ι : Type u_1} {M : Type u_3} [inst : ] {f : αM} {I : Set ι} {t : ιSet α} (h : ) (hI : ) (ht : ∀ (i : ι), i ISet.Finite (t i)) :
(finsum fun a => finsum fun h => f a) = finsum fun i => finsum fun h => finsum fun j => finsum fun h => f j

Given a family of sets t : ι → Set α→ Set α, a finite set I in the index type such that all sets t i, i ∈ I∈ I, are finite, if all t i, i ∈ I∈ I, are pairwise disjoint, then the sum of f a over a ∈ ⋃ i ∈ I, t i∈ ⋃ i ∈ I, t i⋃ i ∈ I, t i∈ I, t i is equal to the sum over i ∈ I∈ I of the sums of f a over a ∈ t i∈ t i.

theorem finprod_mem_bunionᵢ {α : Type u_2} {ι : Type u_1} {M : Type u_3} [inst : ] {f : αM} {I : Set ι} {t : ιSet α} (h : ) (hI : ) (ht : ∀ (i : ι), i ISet.Finite (t i)) :
(finprod fun a => finprod fun h => f a) = finprod fun i => finprod fun h => finprod fun j => finprod fun h => f j

Given a family of sets t : ι → Set α→ Set α, a finite set I in the index type such that all sets t i, i ∈ I∈ I, are finite, if all t i, i ∈ I∈ I, are pairwise disjoint, then the product of f a over a ∈ ⋃ i ∈ I, t i∈ ⋃ i ∈ I, t i⋃ i ∈ I, t i∈ I, t i is equal to the product over i ∈ I∈ I of the products of f a over a ∈ t i∈ t i.

theorem finsum_mem_unionₛ {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {t : Set (Set α)} (h : ) (ht₀ : ) (ht₁ : ∀ (x : Set α), x t) :
(finsum fun a => finsum fun h => f a) = finsum fun s => finsum fun h => finsum fun a => finsum fun h => f a

If t is a finite set of pairwise disjoint finite sets, then the sum of f a over a ∈ ⋃₀ t∈ ⋃₀ t⋃₀ t is the sum over s ∈ t∈ t of the sums of f a over a ∈ s∈ s.

theorem finprod_mem_unionₛ {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} {t : Set (Set α)} (h : ) (ht₀ : ) (ht₁ : ∀ (x : Set α), x t) :
(finprod fun a => finprod fun h => f a) = finprod fun s => finprod fun h => finprod fun a => finprod fun h => f a

If t is a finite set of pairwise disjoint finite sets, then the product of f a over a ∈ ⋃₀ t∈ ⋃₀ t⋃₀ t is the product over s ∈ t∈ t of the products of f a over a ∈ s∈ s.

theorem add_finsum_cond_ne {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (a : α) (hf : ) :
(f a + finsum fun i => finsum fun _h => f i) = finsum fun i => f i
theorem mul_finprod_cond_ne {α : Type u_1} {M : Type u_2} [inst : ] {f : αM} (a : α) (hf : ) :
(f a * finprod fun i => finprod fun _h => f i) = finprod fun i => f i
theorem finsum_mem_comm {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {s : Set α} {t : Set β} (f : αβM) (hs : ) (ht : ) :
(finsum fun i => finsum fun h => finsum fun j => finsum fun h => f i j) = finsum fun j => finsum fun h => finsum fun i => finsum fun h => f i j

If s : Set α and t : Set β are finite sets, then summing over s commutes with summing over t.

theorem finprod_mem_comm {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {s : Set α} {t : Set β} (f : αβM) (hs : ) (ht : ) :
(finprod fun i => finprod fun h => finprod fun j => finprod fun h => f i j) = finprod fun j => finprod fun h => finprod fun i => finprod fun h => f i j

If s : Set α and t : Set β are finite sets, then taking the product over s commutes with taking the product over t.

theorem finsum_mem_induction {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (p : MProp) (hp₀ : p 0) (hp₁ : (x y : M) → p xp yp (x + y)) (hp₂ : (x : α) → x sp (f x)) :
p (finsum fun i => finsum fun h => f i)

To prove a property of a finite sum, it suffices to prove that the property is additive and holds on summands.

theorem finprod_mem_induction {α : Type u_2} {M : Type u_1} [inst : ] {f : αM} {s : Set α} (p : MProp) (hp₀ : p 1) (hp₁ : (x y : M) → p xp yp (x * y)) (hp₂ : (x : α) → x sp (f x)) :
p (finprod fun i => finprod fun h => f i)

To prove a property of a finite product, it suffices to prove that the property is multiplicative and holds on factors.

theorem finprod_cond_nonneg {α : Type u_2} {R : Type u_1} [inst : ] {p : αProp} {f : αR} (hf : ∀ (x : α), p x0 f x) :
0 finprod fun x => finprod fun _h => f x
theorem single_le_finsum {α : Type u_2} {M : Type u_1} [inst : ] (i : α) {f : αM} (hf : ) (h : ∀ (j : α), 0 f j) :
f i finsum fun j => f j
theorem single_le_finprod {α : Type u_2} {M : Type u_1} [inst : ] (i : α) {f : αM} (hf : ) (h : ∀ (j : α), 1 f j) :
f i finprod fun j => f j
theorem finprod_eq_zero {α : Type u_2} {M₀ : Type u_1} [inst : ] (f : αM₀) (x : α) (hx : f x = 0) (hf : ) :
(finprod fun x => f x) = 0
theorem finsum_sum_comm {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] (s : ) (f : αβM) (h : ∀ (b : β), b sSet.Finite (Function.support fun a => f a b)) :
(finsum fun a => Finset.sum s fun b => f a b) = Finset.sum s fun b => finsum fun a => f a b
theorem finprod_prod_comm {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] (s : ) (f : αβM) (h : ∀ (b : β), b sSet.Finite (Function.mulSupport fun a => f a b)) :
(finprod fun a => Finset.prod s fun b => f a b) = Finset.prod s fun b => finprod fun a => f a b
theorem sum_finsum_comm {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (s : ) (f : αβM) (h : ∀ (a : α), a sSet.Finite (Function.support (f a))) :
(Finset.sum s fun a => finsum fun b => f a b) = finsum fun b => Finset.sum s fun a => f a b
theorem prod_finprod_comm {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (s : ) (f : αβM) (h : ∀ (a : α), a sSet.Finite (Function.mulSupport (f a))) :
(Finset.prod s fun a => finprod fun b => f a b) = finprod fun b => Finset.prod s fun a => f a b
theorem mul_finsum {α : Type u_2} {R : Type u_1} [inst : ] (f : αR) (r : R) (h : ) :
(r * finsum fun a => f a) = finsum fun a => r * f a
theorem finsum_mul {α : Type u_2} {R : Type u_1} [inst : ] (f : αR) (r : R) (h : ) :
(finsum fun a => f a) * r = finsum fun a => f a * r
theorem Finset.support_of_fiberwise_sum_subset_image {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] [inst : ] (s : ) (f : αM) (g : αβ) :
(Function.support fun b => Finset.sum (Finset.filter (fun a => g a = b) s) f) ↑()
theorem Finset.mulSupport_of_fiberwise_prod_subset_image {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] [inst : ] (s : ) (f : αM) (g : αβ) :
(Function.mulSupport fun b => Finset.prod (Finset.filter (fun a => g a = b) s) f) ↑()
theorem finsum_mem_finset_product' {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] [inst : ] [inst : ] (s : Finset (α × β)) (f : α × βM) :
(finsum fun ab => finsum fun _h => f ab) = finsum fun a => finsum fun b => finsum fun _h => f (a, b)

Note that b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd iff (a, b) ∈ s∈ s so we can simplify the right hand side of this lemma. However the form stated here is more useful for iterating this lemma, e.g., if we have f : α × β × γ → M× β × γ → M× γ → M→ M.

theorem finprod_mem_finset_product' {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] [inst : ] [inst : ] (s : Finset (α × β)) (f : α × βM) :
(finprod fun ab => finprod fun _h => f ab) = finprod fun a => finprod fun b => finprod fun _h => f (a, b)

Note that b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd iff (a, b) ∈ s∈ s so we can simplify the right hand side of this lemma. However the form stated here is more useful for iterating this lemma, e.g., if we have f : α × β × γ → M× β × γ → M× γ → M→ M.

theorem finsum_mem_finset_product {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] (s : Finset (α × β)) (f : α × βM) :
(finsum fun ab => finsum fun _h => f ab) = finsum fun a => finsum fun b => finsum fun _h => f (a, b)

See also finsum_mem_finset_product'.

theorem finprod_mem_finset_product {α : Type u_2} {β : Type u_1} {M : Type u_3} [inst : ] (s : Finset (α × β)) (f : α × βM) :
(finprod fun ab => finprod fun _h => f ab) = finprod fun a => finprod fun b => finprod fun _h => f (a, b)

See also finprod_mem_finset_product'.

theorem finsum_mem_finset_product₃ {α : Type u_3} {β : Type u_2} {M : Type u_4} [inst : ] {γ : Type u_1} (s : Finset (α × β × γ)) (f : α × β × γM) :
(finsum fun abc => finsum fun _h => f abc) = finsum fun a => finsum fun b => finsum fun c => finsum fun _h => f (a, b, c)
theorem finprod_mem_finset_product₃ {α : Type u_3} {β : Type u_2} {M : Type u_4} [inst : ] {γ : Type u_1} (s : Finset (α × β × γ)) (f : α × β × γM) :
(finprod fun abc => finprod fun _h => f abc) = finprod fun a => finprod fun b => finprod fun c => finprod fun _h => f (a, b, c)
theorem finsum_curry {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (f : α × βM) (hf : ) :
(finsum fun ab => f ab) = finsum fun a => finsum fun b => f (a, b)
theorem finprod_curry {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (f : α × βM) (hf : ) :
(finprod fun ab => f ab) = finprod fun a => finprod fun b => f (a, b)
theorem finsum_curry₃ {α : Type u_2} {β : Type u_3} {M : Type u_4} [inst : ] {γ : Type u_1} (f : α × β × γM) (h : ) :
(finsum fun abc => f abc) = finsum fun a => finsum fun b => finsum fun c => f (a, b, c)
theorem finprod_curry₃ {α : Type u_2} {β : Type u_3} {M : Type u_4} [inst : ] {γ : Type u_1} (f : α × β × γM) (h : ) :
(finprod fun abc => f abc) = finprod fun a => finprod fun b => finprod fun c => f (a, b, c)
theorem finsum_dmem {α : Type u_1} {M : Type u_2} [inst : ] {s : Set α} [inst : DecidablePred fun x => x s] (f : (a : α) → a sM) :
(finsum fun a => finsum fun h => f a h) = finsum fun a => finsum fun _h => if h' : a s then f a h' else 0
theorem finprod_dmem {α : Type u_1} {M : Type u_2} [inst : ] {s : Set α} [inst : DecidablePred fun x => x s] (f : (a : α) → a sM) :
(finprod fun a => finprod fun h => f a h) = finprod fun a => finprod fun _h => if h' : a s then f a h' else 1
theorem finsum_emb_domain' {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {f : αβ} (hf : ) [inst : DecidablePred fun x => x ] (g : αM) :
(finsum fun b => if h : b then g () else 0) = finsum fun a => g a
theorem finprod_emb_domain' {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] {f : αβ} (hf : ) [inst : DecidablePred fun x => x ] (g : αM) :
(finprod fun b => if h : b then g () else 1) = finprod fun a => g a
theorem finsum_emb_domain {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (f : α β) [inst : DecidablePred fun x => x ] (g : αM) :
(finsum fun b => if h : b then g () else 0) = finsum fun a => g a
theorem finprod_emb_domain {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : ] (f : α β) [inst : DecidablePred fun x => x ] (g : αM) :
(finprod fun b => if h : b then g () else 1) = finprod fun a => g a