# 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 and ∑ᶠ i : α, f i for finsum f

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

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

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

theorem finsum_def' {M : Type u_7} {α : Sort u_8} [] (f : αM) :
= if h : (Function.support (f PLift.down)).Finite then ih.toFinset, f i.down else 0
@[irreducible]
noncomputable def finsum {M : Type u_7} {α : Sort u_8} [] (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
Instances For
@[irreducible]
noncomputable def finprod {M : Type u_7} {α : Sort u_8} [] (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
Instances For
theorem finprod_def' {M : Type u_7} {α : Sort u_8} [] (f : αM) :
= if h : (Function.mulSupport (f PLift.down)).Finite then ih.toFinset, f i.down else 1

Pretty printer defined by notation3 command.

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

∑ᶠ x, f x is notation for finsum f. It is the sum of f x, where x ranges over 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 and ∏ᶠ (x) (h: x ∈ s), f x

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

∏ᶠ x, f x is notation for finprod f. It is the product of f x, where x ranges over 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 and ∏ᶠ (x) (h: x ∈ s), f x

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

Pretty printer defined by notation3 command.

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem finsum_eq_sum_plift_of_support_toFinset_subset {M : Type u_2} {α : Sort u_4} [] {f : αM} (hf : (Function.support (f PLift.down)).Finite) {s : Finset ()} (hs : hf.toFinset s) :
∑ᶠ (i : α), f i = is, f i.down
theorem finprod_eq_prod_plift_of_mulSupport_toFinset_subset {M : Type u_2} {α : Sort u_4} [] {f : αM} (hf : (Function.mulSupport (f PLift.down)).Finite) {s : Finset ()} (hs : hf.toFinset s) :
∏ᶠ (i : α), f i = is, f i.down
theorem finsum_eq_sum_plift_of_support_subset {M : Type u_2} {α : Sort u_4} [] {f : αM} {s : Finset ()} (hs : Function.support (f PLift.down) s) :
∑ᶠ (i : α), f i = is, f i.down
theorem finprod_eq_prod_plift_of_mulSupport_subset {M : Type u_2} {α : Sort u_4} [] {f : αM} {s : Finset ()} (hs : Function.mulSupport (f PLift.down) s) :
∏ᶠ (i : α), f i = is, f i.down
@[simp]
theorem finsum_zero {M : Type u_2} {α : Sort u_4} [] :
∑ᶠ (x : α), 0 = 0
@[simp]
theorem finprod_one {M : Type u_2} {α : Sort u_4} [] :
∏ᶠ (x : α), 1 = 1
theorem finsum_of_isEmpty {M : Type u_2} {α : Sort u_4} [] [] (f : αM) :
∑ᶠ (i : α), f i = 0
theorem finprod_of_isEmpty {M : Type u_2} {α : Sort u_4} [] [] (f : αM) :
∏ᶠ (i : α), f i = 1
@[simp]
theorem finsum_false {M : Type u_2} [] (f : FalseM) :
∑ᶠ (i : False), f i = 0
@[simp]
theorem finprod_false {M : Type u_2} [] (f : FalseM) :
∏ᶠ (i : False), f i = 1
theorem finsum_eq_single {M : Type u_2} {α : Sort u_4} [] (f : αM) (a : α) (ha : ∀ (x : α), x af x = 0) :
∑ᶠ (x : α), f x = f a
theorem finprod_eq_single {M : Type u_2} {α : Sort u_4} [] (f : αM) (a : α) (ha : ∀ (x : α), x af x = 1) :
∏ᶠ (x : α), f x = f a
theorem finsum_unique {M : Type u_2} {α : Sort u_4} [] [] (f : αM) :
∑ᶠ (i : α), f i = f default
theorem finprod_unique {M : Type u_2} {α : Sort u_4} [] [] (f : αM) :
∏ᶠ (i : α), f i = f default
@[simp]
theorem finsum_true {M : Type u_2} [] (f : TrueM) :
∑ᶠ (i : True), f i =
@[simp]
theorem finprod_true {M : Type u_2} [] (f : TrueM) :
∏ᶠ (i : True), f i =
theorem finsum_eq_dif {M : Type u_2} [] {p : Prop} [] (f : pM) :
∑ᶠ (i : p), f i = if h : p then f h else 0
theorem finprod_eq_dif {M : Type u_2} [] {p : Prop} [] (f : pM) :
∏ᶠ (i : p), f i = if h : p then f h else 1
theorem finsum_eq_if {M : Type u_2} [] {p : Prop} [] {x : M} :
∑ᶠ (_ : p), x = if p then x else 0
theorem finprod_eq_if {M : Type u_2} [] {p : Prop} [] {x : M} :
∏ᶠ (_ : p), x = if p then x else 1
theorem finsum_congr {M : Type u_2} {α : Sort u_4} [] {f : αM} {g : αM} (h : ∀ (x : α), f x = g x) :
=
theorem finprod_congr {M : Type u_2} {α : Sort u_4} [] {f : αM} {g : αM} (h : ∀ (x : α), f x = g x) :
=
theorem finsum_congr_Prop {M : Type u_2} [] {p : Prop} {q : Prop} {f : pM} {g : qM} (hpq : p = q) (hfg : ∀ (h : q), f = g h) :
=
theorem finprod_congr_Prop {M : Type u_2} [] {p : Prop} {q : Prop} {f : pM} {g : qM} (hpq : p = q) (hfg : ∀ (h : q), f = g h) :
=
theorem finsum_induction {M : Type u_2} {α : Sort u_4} [] {f : αM} (p : MProp) (hp₀ : p 0) (hp₁ : ∀ (x y : M), p xp yp (x + y)) (hp₂ : ∀ (i : α), p (f i)) :
p (∑ᶠ (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_2} {α : Sort u_4} [] {f : αM} (p : MProp) (hp₀ : p 1) (hp₁ : ∀ (x y : M), p xp yp (x * y)) (hp₂ : ∀ (i : α), p (f i)) :
p (∏ᶠ (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_4} {R : Type u_7} {f : αR} (hf : ∀ (x : α), 0 f x) :
0 ∏ᶠ (x : α), f x
theorem finsum_nonneg {α : Sort u_4} {M : Type u_7} {f : αM} (hf : ∀ (i : α), 0 f i) :
0 ∑ᶠ (i : α), f i
theorem one_le_finprod' {α : Sort u_4} {M : Type u_7} {f : αM} (hf : ∀ (i : α), 1 f i) :
1 ∏ᶠ (i : α), f i
theorem AddMonoidHom.map_finsum_plift {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (f : M →+ N) (g : αM) (h : (Function.support (g PLift.down)).Finite) :
f (∑ᶠ (x : α), g x) = ∑ᶠ (x : α), f (g x)
theorem MonoidHom.map_finprod_plift {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (f : M →* N) (g : αM) (h : (Function.mulSupport (g PLift.down)).Finite) :
f (∏ᶠ (x : α), g x) = ∏ᶠ (x : α), f (g x)
theorem AddMonoidHom.map_finsum_Prop {M : Type u_2} {N : Type u_3} [] [] {p : Prop} (f : M →+ N) (g : pM) :
f (∑ᶠ (x : p), g x) = ∑ᶠ (x : p), f (g x)
theorem MonoidHom.map_finprod_Prop {M : Type u_2} {N : Type u_3} [] [] {p : Prop} (f : M →* N) (g : pM) :
f (∏ᶠ (x : p), g x) = ∏ᶠ (x : p), f (g x)
theorem AddMonoidHom.map_finsum_of_preimage_zero {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (f : M →+ N) (hf : ∀ (x : M), f x = 0x = 0) (g : αM) :
f (∑ᶠ (i : α), g i) = ∑ᶠ (i : α), f (g i)
theorem MonoidHom.map_finprod_of_preimage_one {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (f : M →* N) (hf : ∀ (x : M), f x = 1x = 1) (g : αM) :
f (∏ᶠ (i : α), g i) = ∏ᶠ (i : α), f (g i)
theorem AddMonoidHom.map_finsum_of_injective {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (g : M →+ N) (hg : ) (f : αM) :
g (∑ᶠ (i : α), f i) = ∑ᶠ (i : α), g (f i)
theorem MonoidHom.map_finprod_of_injective {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (g : M →* N) (hg : ) (f : αM) :
g (∏ᶠ (i : α), f i) = ∏ᶠ (i : α), g (f i)
theorem AddEquiv.map_finsum {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (g : M ≃+ N) (f : αM) :
g (∑ᶠ (i : α), f i) = ∑ᶠ (i : α), g (f i)
theorem MulEquiv.map_finprod {M : Type u_2} {N : Type u_3} {α : Sort u_4} [] [] (g : M ≃* N) (f : αM) :
g (∏ᶠ (i : α), f i) = ∏ᶠ (i : α), g (f i)
theorem finsum_smul {ι : Sort u_6} {R : Type u_7} {M : Type u_8} [Ring R] [] [Module R M] [] (f : ιR) (x : M) :
(∑ᶠ (i : ι), f i) x = ∑ᶠ (i : ι), f i x

The NoZeroSMulDivisors makes sure that the result holds even when the support of f is infinite. For a more usual version assuming (support f).Finite instead, see finsum_smul'.

theorem smul_finsum {ι : Sort u_6} {R : Type u_7} {M : Type u_8} [Ring R] [] [Module R M] [] (c : R) (f : ιM) :
c ∑ᶠ (i : ι), f i = ∑ᶠ (i : ι), c f i

The NoZeroSMulDivisors makes sure that the result holds even when the support of f is infinite. For a more usual version assuming (support f).Finite instead, see smul_finsum'.

theorem finsum_neg_distrib {G : Type u_1} {α : Sort u_4} (f : αG) :
∑ᶠ (x : α), -f x = -∑ᶠ (x : α), f x
theorem finprod_inv_distrib {G : Type u_1} {α : Sort u_4} (f : αG) :
∏ᶠ (x : α), (f x)⁻¹ = (∏ᶠ (x : α), f x)⁻¹
theorem finsum_eq_indicator_apply {α : Type u_1} {M : Type u_5} [] (s : Set α) (f : αM) (a : α) :
∑ᶠ (_ : a s), f a = s.indicator f a
theorem finprod_eq_mulIndicator_apply {α : Type u_1} {M : Type u_5} [] (s : Set α) (f : αM) (a : α) :
∏ᶠ (_ : a s), f a = s.mulIndicator f a
@[simp]
theorem finsum_mem_support {α : Type u_1} {M : Type u_5} [] (f : αM) (a : α) :
∑ᶠ (_ : f a 0), f a = f a
@[simp]
theorem finprod_mem_mulSupport {α : Type u_1} {M : Type u_5} [] (f : αM) (a : α) :
∏ᶠ (_ : f a 1), f a = f a
theorem finsum_mem_def {α : Type u_1} {M : Type u_5} [] (s : Set α) (f : αM) :
∑ᶠ (a : α) (_ : a s), f a = ∑ᶠ (a : α), s.indicator f a
theorem finprod_mem_def {α : Type u_1} {M : Type u_5} [] (s : Set α) (f : αM) :
∏ᶠ (a : α) (_ : a s), f a = ∏ᶠ (a : α), s.mulIndicator f a
theorem finsum_eq_sum_of_support_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : } (h : ) :
∑ᶠ (i : α), f i = is, f i
theorem finprod_eq_prod_of_mulSupport_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : } (h : ) :
∏ᶠ (i : α), f i = is, f i
theorem finsum_eq_sum_of_support_toFinset_subset {α : Type u_1} {M : Type u_5} [] (f : αM) (hf : ().Finite) {s : } (h : hf.toFinset s) :
∑ᶠ (i : α), f i = is, f i
theorem finprod_eq_prod_of_mulSupport_toFinset_subset {α : Type u_1} {M : Type u_5} [] (f : αM) (hf : .Finite) {s : } (h : hf.toFinset s) :
∏ᶠ (i : α), f i = is, f i
theorem finsum_eq_finset_sum_of_support_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : } (h : ) :
∑ᶠ (i : α), f i = is, f i
theorem finprod_eq_finset_prod_of_mulSupport_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : } (h : ) :
∏ᶠ (i : α), f i = is, f i
theorem finsum_def {α : Type u_1} {M : Type u_5} [] (f : αM) [Decidable ().Finite] :
∑ᶠ (i : α), f i = if h : ().Finite then ih.toFinset, f i else 0
theorem finprod_def {α : Type u_1} {M : Type u_5} [] (f : αM) [Decidable .Finite] :
∏ᶠ (i : α), f i = if h : .Finite then ih.toFinset, f i else 1
theorem finsum_of_infinite_support {α : Type u_1} {M : Type u_5} [] {f : αM} (hf : ().Infinite) :
∑ᶠ (i : α), f i = 0
theorem finprod_of_infinite_mulSupport {α : Type u_1} {M : Type u_5} [] {f : αM} (hf : .Infinite) :
∏ᶠ (i : α), f i = 1
theorem finsum_eq_sum {α : Type u_1} {M : Type u_5} [] (f : αM) (hf : ().Finite) :
∑ᶠ (i : α), f i = ihf.toFinset, f i
theorem finprod_eq_prod {α : Type u_1} {M : Type u_5} [] (f : αM) (hf : .Finite) :
∏ᶠ (i : α), f i = ihf.toFinset, f i
theorem finsum_eq_sum_of_fintype {α : Type u_1} {M : Type u_5} [] [] (f : αM) :
∑ᶠ (i : α), f i = i : α, f i
theorem finprod_eq_prod_of_fintype {α : Type u_1} {M : Type u_5} [] [] (f : αM) :
∏ᶠ (i : α), f i = i : α, f i
theorem finsum_cond_eq_sum_of_cond_iff {α : Type u_1} {M : Type u_5} [] (f : αM) {p : αProp} {t : } (h : ∀ {x : α}, f x 0(p x x t)) :
∑ᶠ (i : α) (_ : p i), f i = it, f i
theorem finprod_cond_eq_prod_of_cond_iff {α : Type u_1} {M : Type u_5} [] (f : αM) {p : αProp} {t : } (h : ∀ {x : α}, f x 1(p x x t)) :
∏ᶠ (i : α) (_ : p i), f i = it, f i
theorem finsum_cond_ne {α : Type u_1} {M : Type u_5} [] (f : αM) (a : α) [] (hf : ().Finite) :
∑ᶠ (i : α) (_ : i a), f i = ihf.toFinset.erase a, f i
theorem finprod_cond_ne {α : Type u_1} {M : Type u_5} [] (f : αM) (a : α) [] (hf : .Finite) :
∏ᶠ (i : α) (_ : i a), f i = ihf.toFinset.erase a, f i
theorem finsum_mem_eq_sum_of_inter_support_eq {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} {t : } (h : = ) :
∑ᶠ (i : α) (_ : i s), f i = it, f i
theorem finprod_mem_eq_prod_of_inter_mulSupport_eq {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} {t : } (h : = ) :
∏ᶠ (i : α) (_ : i s), f i = it, f i
theorem finsum_mem_eq_sum_of_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} {t : } (h₁ : t) (h₂ : t s) :
∑ᶠ (i : α) (_ : i s), f i = it, f i
theorem finprod_mem_eq_prod_of_subset {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} {t : } (h₁ : t) (h₂ : t s) :
∏ᶠ (i : α) (_ : i s), f i = it, f i
theorem finsum_mem_eq_sum {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} (hf : ().Finite) :
∑ᶠ (i : α) (_ : i s), f i = ihf.toFinset, f i
theorem finprod_mem_eq_prod {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} (hf : ().Finite) :
∏ᶠ (i : α) (_ : i s), f i = ihf.toFinset, f i
theorem finsum_mem_eq_sum_filter {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) [DecidablePred fun (x : α) => x s] (hf : ().Finite) :
∑ᶠ (i : α) (_ : i s), f i = iFinset.filter (fun (x : α) => x s) hf.toFinset, f i
theorem finprod_mem_eq_prod_filter {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) [DecidablePred fun (x : α) => x s] (hf : .Finite) :
∏ᶠ (i : α) (_ : i s), f i = iFinset.filter (fun (x : α) => x s) hf.toFinset, f i
theorem finsum_mem_eq_toFinset_sum {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) [Fintype s] :
∑ᶠ (i : α) (_ : i s), f i = is.toFinset, f i
theorem finprod_mem_eq_toFinset_prod {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) [Fintype s] :
∏ᶠ (i : α) (_ : i s), f i = is.toFinset, f i
theorem finsum_mem_eq_finite_toFinset_sum {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} (hs : s.Finite) :
∑ᶠ (i : α) (_ : i s), f i = ihs.toFinset, f i
theorem finprod_mem_eq_finite_toFinset_prod {α : Type u_1} {M : Type u_5} [] (f : αM) {s : Set α} (hs : s.Finite) :
∏ᶠ (i : α) (_ : i s), f i = ihs.toFinset, f i
theorem finsum_mem_finset_eq_sum {α : Type u_1} {M : Type u_5} [] (f : αM) (s : ) :
∑ᶠ (i : α) (_ : i s), f i = is, f i
theorem finprod_mem_finset_eq_prod {α : Type u_1} {M : Type u_5} [] (f : αM) (s : ) :
∏ᶠ (i : α) (_ : i s), f i = is, f i
theorem finsum_mem_coe_finset {α : Type u_1} {M : Type u_5} [] (f : αM) (s : ) :
∑ᶠ (i : α) (_ : i s), f i = is, f i
theorem finprod_mem_coe_finset {α : Type u_1} {M : Type u_5} [] (f : αM) (s : ) :
∏ᶠ (i : α) (_ : i s), f i = is, f i
theorem finsum_mem_eq_zero_of_infinite {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (hs : ().Infinite) :
∑ᶠ (i : α) (_ : i s), f i = 0
theorem finprod_mem_eq_one_of_infinite {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (hs : ().Infinite) :
∏ᶠ (i : α) (_ : i s), f i = 1
theorem finsum_mem_eq_zero_of_forall_eq_zero {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : xs, f x = 0) :
∑ᶠ (i : α) (_ : i s), f i = 0
theorem finprod_mem_eq_one_of_forall_eq_one {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : xs, f x = 1) :
∏ᶠ (i : α) (_ : i s), f i = 1
theorem finsum_mem_inter_support {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) :
∑ᶠ (i : α) (_ : i ), f i = ∑ᶠ (i : α) (_ : i s), f i
theorem finprod_mem_inter_mulSupport {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) :
∏ᶠ (i : α) (_ : i ), f i = ∏ᶠ (i : α) (_ : i s), f i
theorem finsum_mem_inter_support_eq {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) (t : Set α) (h : = ) :
∑ᶠ (i : α) (_ : i s), f i = ∑ᶠ (i : α) (_ : i t), f i
theorem finprod_mem_inter_mulSupport_eq {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) (t : Set α) (h : ) :
∏ᶠ (i : α) (_ : i s), f i = ∏ᶠ (i : α) (_ : i t), f i
theorem finsum_mem_inter_support_eq' {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) (t : Set α) (h : x, x s x t) :
∑ᶠ (i : α) (_ : i s), f i = ∑ᶠ (i : α) (_ : i t), f i
theorem finprod_mem_inter_mulSupport_eq' {α : Type u_1} {M : Type u_5} [] (f : αM) (s : Set α) (t : Set α) (h : x, x s x t) :
∏ᶠ (i : α) (_ : i s), f i = ∏ᶠ (i : α) (_ : i t), f i
theorem finsum_mem_univ {α : Type u_1} {M : Type u_5} [] (f : αM) :
∑ᶠ (i : α) (_ : i Set.univ), f i = ∑ᶠ (i : α), f i
theorem finprod_mem_univ {α : Type u_1} {M : Type u_5} [] (f : αM) :
∏ᶠ (i : α) (_ : i Set.univ), f i = ∏ᶠ (i : α), f i
theorem finsum_mem_congr {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} {s : Set α} {t : Set α} (h₀ : s = t) (h₁ : xt, f x = g x) :
∑ᶠ (i : α) (_ : i s), f i = ∑ᶠ (i : α) (_ : i t), g i
theorem finprod_mem_congr {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} {s : Set α} {t : Set α} (h₀ : s = t) (h₁ : xt, f x = g x) :
∏ᶠ (i : α) (_ : i s), f i = ∏ᶠ (i : α) (_ : i t), g i
theorem finsum_eq_zero_of_forall_eq_zero {α : Type u_1} {M : Type u_5} [] {f : αM} (h : ∀ (x : α), f x = 0) :
∑ᶠ (i : α), f i = 0
theorem finprod_eq_one_of_forall_eq_one {α : Type u_1} {M : Type u_5} [] {f : αM} (h : ∀ (x : α), f x = 1) :
∏ᶠ (i : α), f i = 1
theorem finsum_pos' {ι : Type u_3} {M : Type u_7} {f : ιM} (h : ∀ (i : ι), 0 f i) (h' : ∃ (i : ι), 0 < f i) (hf : ().Finite) :
0 < ∑ᶠ (i : ι), f i
theorem one_lt_finprod' {ι : Type u_3} {M : Type u_7} {f : ιM} (h : ∀ (i : ι), 1 f i) (h' : ∃ (i : ι), 1 < f i) (hf : .Finite) :
1 < ∏ᶠ (i : ι), f i

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

theorem finsum_add_distrib {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} (hf : ().Finite) (hg : ().Finite) :
∑ᶠ (i : α), (f i + g i) = ∑ᶠ (i : α), f i + ∑ᶠ (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_5} [] {f : αM} {g : αM} (hf : .Finite) (hg : .Finite) :
∏ᶠ (i : α), f i * g i = (∏ᶠ (i : α), f i) * ∏ᶠ (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_1} {G : Type u_4} {f : αG} {g : αG} (hf : ().Finite) (hg : ().Finite) :
∑ᶠ (i : α), (f i - g i) = ∑ᶠ (i : α), f i - ∑ᶠ (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_1} {G : Type u_4} {f : αG} {g : αG} (hf : .Finite) (hg : .Finite) :
∏ᶠ (i : α), f i / g i = (∏ᶠ (i : α), f i) / ∏ᶠ (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_5} [] {f : αM} {g : αM} {s : Set α} (hf : ().Finite) (hg : ().Finite) :
∑ᶠ (i : α) (_ : i s), (f i + g i) = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i s), g i

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

theorem finprod_mem_mul_distrib' {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} {s : Set α} (hf : ().Finite) (hg : ().Finite) :
∏ᶠ (i : α) (_ : i s), f i * g i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i s), g i

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

theorem finsum_mem_zero {α : Type u_1} {M : Type u_5} [] (s : Set α) :
∑ᶠ (i : α) (_ : i s), 0 = 0

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

theorem finprod_mem_one {α : Type u_1} {M : Type u_5} [] (s : Set α) :
∏ᶠ (i : α) (_ : i s), 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_5} [] {f : αM} {s : Set α} (hf : Set.EqOn f 0 s) :
∑ᶠ (i : α) (_ : i s), f i = 0

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

theorem finprod_mem_of_eqOn_one {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (hf : Set.EqOn f 1 s) :
∏ᶠ (i : α) (_ : i s), f i = 1

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

theorem exists_ne_zero_of_finsum_mem_ne_zero {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : ∑ᶠ (i : α) (_ : i s), f i 0) :
xs, f x 0

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

theorem exists_ne_one_of_finprod_mem_ne_one {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : ∏ᶠ (i : α) (_ : i s), f i 1) :
xs, f x 1

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

theorem finsum_mem_add_distrib {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} {s : Set α} (hs : s.Finite) :
∑ᶠ (i : α) (_ : i s), (f i + g i) = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i s), g i

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

theorem finprod_mem_mul_distrib {α : Type u_1} {M : Type u_5} [] {f : αM} {g : αM} {s : Set α} (hs : s.Finite) :
∏ᶠ (i : α) (_ : i s), f i * g i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i s), g i

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

theorem AddMonoidHom.map_finsum {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {f : αM} (g : M →+ N) (hf : ().Finite) :
g (∑ᶠ (i : α), f i) = ∑ᶠ (i : α), g (f i)
theorem MonoidHom.map_finprod {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {f : αM} (g : M →* N) (hf : .Finite) :
g (∏ᶠ (i : α), f i) = ∏ᶠ (i : α), g (f i)
theorem finsum_nsmul {α : Type u_1} {M : Type u_5} [] {f : αM} (hf : ().Finite) (n : ) :
n ∑ᶠ (i : α), f i = ∑ᶠ (i : α), n f i
theorem finprod_pow {α : Type u_1} {M : Type u_5} [] {f : αM} (hf : .Finite) (n : ) :
(∏ᶠ (i : α), f i) ^ n = ∏ᶠ (i : α), f i ^ n
theorem finsum_smul' {ι : Type u_3} {R : Type u_7} {M : Type u_8} [] [] [Module R M] {f : ιR} (hf : ().Finite) (x : M) :
(∑ᶠ (i : ι), f i) x = ∑ᶠ (i : ι), f i x

See also finsum_smul for a version that works even when the support of f is not finite, but with slightly stronger typeclass requirements.

theorem smul_finsum' {ι : Type u_3} {R : Type u_7} {M : Type u_8} [] [] [Module R M] (c : R) {f : ιM} (hf : ().Finite) :
c ∑ᶠ (i : ι), f i = ∑ᶠ (i : ι), c f i

See also smul_finsum for a version that works even when the support of f is not finite, but with slightly stronger typeclass requirements.

theorem AddMonoidHom.map_finsum_mem' {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {s : Set α} {f : αM} (g : M →+ N) (h₀ : ().Finite) :
g (∑ᶠ (j : α) (_ : j s), f j) = ∑ᶠ (i : α) (_ : i s), g (f i)

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

theorem MonoidHom.map_finprod_mem' {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {s : Set α} {f : αM} (g : M →* N) (h₀ : ().Finite) :
g (∏ᶠ (j : α) (_ : j s), f j) = ∏ᶠ (i : α) (_ : i s), g (f i)

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

theorem AddMonoidHom.map_finsum_mem {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {s : Set α} (f : αM) (g : M →+ N) (hs : s.Finite) :
g (∑ᶠ (j : α) (_ : j s), f j) = ∑ᶠ (i : α) (_ : i s), g (f i)

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

theorem MonoidHom.map_finprod_mem {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] {s : Set α} (f : αM) (g : M →* N) (hs : s.Finite) :
g (∏ᶠ (j : α) (_ : j s), f j) = ∏ᶠ (i : α) (_ : i s), g (f i)

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

theorem AddEquiv.map_finsum_mem {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] (g : M ≃+ N) (f : αM) {s : Set α} (hs : s.Finite) :
g (∑ᶠ (i : α) (_ : i s), f i) = ∑ᶠ (i : α) (_ : i s), g (f i)
theorem MulEquiv.map_finprod_mem {α : Type u_1} {M : Type u_5} {N : Type u_6} [] [] (g : M ≃* N) (f : αM) {s : Set α} (hs : s.Finite) :
g (∏ᶠ (i : α) (_ : i s), f i) = ∏ᶠ (i : α) (_ : i s), g (f i)
theorem finsum_mem_neg_distrib {α : Type u_1} {G : Type u_4} {s : Set α} (f : αG) (hs : s.Finite) :
∑ᶠ (x : α) (_ : x s), -f x = -∑ᶠ (x : α) (_ : x s), f x
theorem finprod_mem_inv_distrib {α : Type u_1} {G : Type u_4} {s : Set α} (f : αG) (hs : s.Finite) :
∏ᶠ (x : α) (_ : x s), (f x)⁻¹ = (∏ᶠ (x : α) (_ : x s), f x)⁻¹
theorem finsum_mem_sub_distrib {α : Type u_1} {G : Type u_4} {s : Set α} (f : αG) (g : αG) (hs : s.Finite) :
∑ᶠ (i : α) (_ : i s), (f i - g i) = ∑ᶠ (i : α) (_ : i s), f i - ∑ᶠ (i : α) (_ : i s), g i

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

theorem finprod_mem_div_distrib {α : Type u_1} {G : Type u_4} {s : Set α} (f : αG) (g : αG) (hs : s.Finite) :
∏ᶠ (i : α) (_ : i s), f i / g i = (∏ᶠ (i : α) (_ : i s), f i) / ∏ᶠ (i : α) (_ : i s), g i

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

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

theorem finsum_mem_empty {α : Type u_1} {M : Type u_5} [] {f : αM} :
∑ᶠ (i : α) (_ : i ), f i = 0

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

theorem finprod_mem_empty {α : Type u_1} {M : Type u_5} [] {f : αM} :
∏ᶠ (i : α) (_ : i ), f i = 1

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

theorem nonempty_of_finsum_mem_ne_zero {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : ∑ᶠ (i : α) (_ : i s), f i 0) :
s.Nonempty

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_1} {M : Type u_5} [] {f : αM} {s : Set α} (h : ∏ᶠ (i : α) (_ : i s), f i 1) :
s.Nonempty

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_5} [] {f : αM} {s : Set α} {t : Set α} (hs : s.Finite) (ht : t.Finite) :
∑ᶠ (i : α) (_ : i s t), f i + ∑ᶠ (i : α) (_ : i s t), f i = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_union_inter {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hs : s.Finite) (ht : t.Finite) :
(∏ᶠ (i : α) (_ : i s t), f i) * ∏ᶠ (i : α) (_ : i s t), f i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_union_inter' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hs : ().Finite) (ht : ().Finite) :
∑ᶠ (i : α) (_ : i s t), f i + ∑ᶠ (i : α) (_ : i s t), f i = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_union_inter' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hs : ().Finite) (ht : ().Finite) :
(∏ᶠ (i : α) (_ : i s t), f i) * ∏ᶠ (i : α) (_ : i s t), f i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_union' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : ().Finite) (ht : ().Finite) :
∑ᶠ (i : α) (_ : i s t), f i = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_union' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : ().Finite) (ht : ().Finite) :
∏ᶠ (i : α) (_ : i s t), f i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_union {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : s.Finite) (ht : t.Finite) :
∑ᶠ (i : α) (_ : i s t), f i = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_union {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint s t) (hs : s.Finite) (ht : t.Finite) :
∏ᶠ (i : α) (_ : i s t), f i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_union'' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint () ()) (hs : ().Finite) (ht : ().Finite) :
∑ᶠ (i : α) (_ : i s t), f i = ∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_union'' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : Disjoint () ()) (hs : ().Finite) (ht : ().Finite) :
∏ᶠ (i : α) (_ : i s t), f i = (∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_singleton {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∑ᶠ (i : α) (_ : i {a}), f i = f a

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

theorem finprod_mem_singleton {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∏ᶠ (i : α) (_ : i {a}), f i = f a

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

@[simp]
theorem finsum_cond_eq_left {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∑ᶠ (i : α) (_ : i = a), f i = f a
@[simp]
theorem finprod_cond_eq_left {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∏ᶠ (i : α) (_ : i = a), f i = f a
@[simp]
theorem finsum_cond_eq_right {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∑ᶠ (i : α) (_ : a = i), f i = f a
@[simp]
theorem finprod_cond_eq_right {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} :
∏ᶠ (i : α) (_ : a = i), f i = f a
theorem finsum_mem_insert' {α : Type u_1} {M : Type u_5} [] {a : α} {s : Set α} (f : αM) (h : as) (hs : ().Finite) :
∑ᶠ (i : α) (_ : i insert a s), f i = f a + ∑ᶠ (i : α) (_ : i s), f i

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

theorem finprod_mem_insert' {α : Type u_1} {M : Type u_5} [] {a : α} {s : Set α} (f : αM) (h : as) (hs : ().Finite) :
∏ᶠ (i : α) (_ : i insert a s), f i = f a * ∏ᶠ (i : α) (_ : i s), f i

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

theorem finsum_mem_insert {α : Type u_1} {M : Type u_5} [] {a : α} {s : Set α} (f : αM) (h : as) (hs : s.Finite) :
∑ᶠ (i : α) (_ : i insert a s), f i = f a + ∑ᶠ (i : α) (_ : i s), f i

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

theorem finprod_mem_insert {α : Type u_1} {M : Type u_5} [] {a : α} {s : Set α} (f : αM) (h : as) (hs : s.Finite) :
∏ᶠ (i : α) (_ : i insert a s), f i = f a * ∏ᶠ (i : α) (_ : i s), f i

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

theorem finsum_mem_insert_of_eq_zero_if_not_mem {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} {s : Set α} (h : asf a = 0) :
∑ᶠ (i : α) (_ : i insert a s), f i = ∑ᶠ (i : α) (_ : i s), f i

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

theorem finprod_mem_insert_of_eq_one_if_not_mem {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} {s : Set α} (h : asf a = 1) :
∏ᶠ (i : α) (_ : i insert a s), f i = ∏ᶠ (i : α) (_ : i s), f i

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

theorem finsum_mem_insert_zero {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} {s : Set α} (h : f a = 0) :
∑ᶠ (i : α) (_ : i insert a s), f i = ∑ᶠ (i : α) (_ : i s), f i

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

theorem finprod_mem_insert_one {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} {s : Set α} (h : f a = 1) :
∏ᶠ (i : α) (_ : i insert a s), f i = ∏ᶠ (i : α) (_ : i s), f i

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

theorem finprod_mem_dvd {α : Type u_1} {N : Type u_6} [] {f : αN} (a : α) (hf : .Finite) :
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_5} [] {f : αM} {a : α} {b : α} (h : a b) :
∑ᶠ (i : α) (_ : i {a, b}), f i = f a + f b

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

theorem finprod_mem_pair {α : Type u_1} {M : Type u_5} [] {f : αM} {a : α} {b : α} (h : a b) :
∏ᶠ (i : α) (_ : i {a, b}), f i = f a * f b

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

theorem finsum_mem_image' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {s : Set β} {g : βα} (hg : Set.InjOn g (s Function.support (f g))) :
∑ᶠ (i : α) (_ : i g '' s), f i = ∑ᶠ (j : β) (_ : j s), f (g j)

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

theorem finprod_mem_image' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {s : Set β} {g : βα} (hg : Set.InjOn g (s Function.mulSupport (f g))) :
∏ᶠ (i : α) (_ : i g '' s), f i = ∏ᶠ (j : β) (_ : j s), f (g j)

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

theorem finsum_mem_image {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {s : Set β} {g : βα} (hg : ) :
∑ᶠ (i : α) (_ : i g '' s), f i = ∑ᶠ (j : β) (_ : j s), f (g j)

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

theorem finprod_mem_image {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {s : Set β} {g : βα} (hg : ) :
∏ᶠ (i : α) (_ : i g '' s), f i = ∏ᶠ (j : β) (_ : j s), f (g j)

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

theorem finsum_mem_range' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {g : βα} (hg : Set.InjOn g (Function.support (f g))) :
∑ᶠ (i : α) (_ : i ), f i = ∑ᶠ (j : β), f (g j)

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

theorem finprod_mem_range' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {g : βα} (hg : Set.InjOn g (Function.mulSupport (f g))) :
∏ᶠ (i : α) (_ : i ), f i = ∏ᶠ (j : β), f (g j)

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

theorem finsum_mem_range {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {g : βα} (hg : ) :
∑ᶠ (i : α) (_ : i ), f i = ∑ᶠ (j : β), f (g j)

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

theorem finprod_mem_range {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {g : βα} (hg : ) :
∏ᶠ (i : α) (_ : i ), f i = ∏ᶠ (j : β), f (g j)

The product of f y over y ∈ 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_5} [] {s : Set α} {t : Set β} {f : αM} {g : βM} (e : αβ) (he₀ : Set.BijOn e s t) (he₁ : xs, f x = g (e x)) :
∑ᶠ (i : α) (_ : i s), f i = ∑ᶠ (j : β) (_ : j t), g j

See also Finset.sum_bij.

theorem finprod_mem_eq_of_bijOn {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {s : Set α} {t : Set β} {f : αM} {g : βM} (e : αβ) (he₀ : Set.BijOn e s t) (he₁ : xs, f x = g (e x)) :
∏ᶠ (i : α) (_ : i s), f i = ∏ᶠ (j : β) (_ : j t), g j

See also Finset.prod_bij.

theorem finsum_eq_of_bijective {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αM} {g : βM} (e : αβ) (he₀ : ) (he₁ : ∀ (x : α), f x = g (e x)) :
∑ᶠ (i : α), f i = ∑ᶠ (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_5} [] {f : αM} {g : βM} (e : αβ) (he₀ : ) (he₁ : ∀ (x : α), f x = g (e x)) :
∏ᶠ (i : α), f i = ∏ᶠ (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_5} [] {g : βM} (e : αβ) (he₀ : ) :
∑ᶠ (i : α), g (e i) = ∑ᶠ (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_5} [] {g : βM} (e : αβ) (he₀ : ) :
∏ᶠ (i : α), g (e i) = ∏ᶠ (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_5} [] (e : α β) {f : βM} :
∑ᶠ (i : α), f (e i) = ∑ᶠ (i' : β), f i'
theorem finprod_comp_equiv {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (e : α β) {f : βM} :
∏ᶠ (i : α), f (e i) = ∏ᶠ (i' : β), f i'
theorem finsum_set_coe_eq_finsum_mem {α : Type u_1} {M : Type u_5} [] {f : αM} (s : Set α) :
∑ᶠ (j : s), f j = ∑ᶠ (i : α) (_ : i s), f i
theorem finprod_set_coe_eq_finprod_mem {α : Type u_1} {M : Type u_5} [] {f : αM} (s : Set α) :
∏ᶠ (j : s), f j = ∏ᶠ (i : α) (_ : i s), f i
theorem finsum_subtype_eq_finsum_cond {α : Type u_1} {M : Type u_5} [] {f : αM} (p : αProp) :
∑ᶠ (j : ), f j = ∑ᶠ (i : α) (_ : p i), f i
theorem finprod_subtype_eq_finprod_cond {α : Type u_1} {M : Type u_5} [] {f : αM} (p : αProp) :
∏ᶠ (j : ), f j = ∏ᶠ (i : α) (_ : p i), f i
theorem finsum_mem_inter_add_diff' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (t : Set α) (h : ().Finite) :
∑ᶠ (i : α) (_ : i s t), f i + ∑ᶠ (i : α) (_ : i s \ t), f i = ∑ᶠ (i : α) (_ : i s), f i
theorem finprod_mem_inter_mul_diff' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (t : Set α) (h : ().Finite) :
(∏ᶠ (i : α) (_ : i s t), f i) * ∏ᶠ (i : α) (_ : i s \ t), f i = ∏ᶠ (i : α) (_ : i s), f i
theorem finsum_mem_inter_add_diff {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (t : Set α) (h : s.Finite) :
∑ᶠ (i : α) (_ : i s t), f i + ∑ᶠ (i : α) (_ : i s \ t), f i = ∑ᶠ (i : α) (_ : i s), f i
theorem finprod_mem_inter_mul_diff {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} (t : Set α) (h : s.Finite) :
(∏ᶠ (i : α) (_ : i s t), f i) * ∏ᶠ (i : α) (_ : i s \ t), f i = ∏ᶠ (i : α) (_ : i s), f i
theorem finsum_mem_add_diff' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : ().Finite) :
∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t \ s), f i = ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_mul_diff' {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : ().Finite) :
(∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t \ s), f i = ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_add_diff {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : t.Finite) :
∑ᶠ (i : α) (_ : i s), f i + ∑ᶠ (i : α) (_ : i t \ s), f i = ∑ᶠ (i : α) (_ : i t), f i

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

theorem finprod_mem_mul_diff {α : Type u_1} {M : Type u_5} [] {f : αM} {s : Set α} {t : Set α} (hst : s t) (ht : t.Finite) :
(∏ᶠ (i : α) (_ : i s), f i) * ∏ᶠ (i : α) (_ : i t \ s), f i = ∏ᶠ (i : α) (_ : i t), f i

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

theorem finsum_mem_iUnion {α : Type u_1} {ι : Type u_3} {M : Type u_5} [] {f : αM} [] {t : ιSet α} (h : Pairwise (Disjoint on t)) (ht : ∀ (i : ι), (t i).Finite) :
∑ᶠ (a : α) (_ : a ⋃ (i : ι), t i), f a = ∑ᶠ (i : ι) (a : α) (_ : a t i), 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 is equal to the sum over all indexes i of the sums of f a over a ∈ t i.

theorem finprod_mem_iUnion {α : Type u_1} {ι : Type u_3} {M : Type u_5} [] {f : αM} [] {t : ιSet α} (h : Pairwise (Disjoint on t)) (ht : ∀ (i : ι), (t i).Finite) :
∏ᶠ (a : α) (_ : a ⋃ (i : ι), t i), f a = ∏ᶠ (i : ι) (a : α) (_ : a t i), 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 is equal to the product over all indexes i of the products of f a over a ∈ t i.

theorem finsum_mem_biUnion {α : Type u_1} {ι : Type u_3} {M : Type u_5} [] {f : αM} {I : Set ι} {t : ιSet α} (h : I.PairwiseDisjoint t) (hI : I.Finite) (ht : iI, (t i).Finite) :
∑ᶠ (a : α) (_ : a xI, t x), f a = ∑ᶠ (i : ι) (_ : i I) (j : α) (_ : j t i), f j

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

theorem finprod_mem_biUnion {α : Type u_1} {ι : Type u_3} {M : Type u_5} [] {f : αM} {I : Set ι} {t : ιSet α} (h : I.PairwiseDisjoint t) (hI : I.Finite) (ht : iI, (t i).Finite) :
∏ᶠ (a : α) (_ : a xI, t x), f a = ∏ᶠ (i : ι) (_ : i I) (j : α) (_ : j t i), f j

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

theorem finsum_mem_sUnion {α : Type u_1} {M : Type u_5} [] {f : αM} {t : Set (Set α)} (h : t.PairwiseDisjoint id) (ht₀ : t.Finite) (ht₁ : xt, x.Finite) :
∑ᶠ (a : α) (_ : a ⋃₀ t), f a = ∑ᶠ (s : Set α) (_ : s t) (a : α) (_ : a s), f a

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

theorem finprod_mem_sUnion {α : Type u_1} {M : Type u_5} [] {f : αM} {t : Set (Set α)} (h : t.PairwiseDisjoint id) (ht₀ : t.Finite) (ht₁ : xt, x.Finite) :
∏ᶠ (a : α) (_ : a ⋃₀ t), f a = ∏ᶠ (s : Set α) (_ : s t) (a : α) (_ : a s), f a

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

theorem add_finsum_cond_ne {α : Type u_1} {M : Type u_5} [] {f : αM} (a : α) (hf : ().Finite) :
f a + ∑ᶠ (i : α) (_ : i a), f i = ∑ᶠ (i : α), f i
theorem mul_finprod_cond_ne {α : Type u_1} {M : Type u_5} [] {f : αM} (a : α) (hf : .Finite) :
f a * ∏ᶠ (i : α) (_ : i a), f i = ∏ᶠ (i : α), f i
theorem finsum_mem_comm {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {s : Set α} {t : Set β} (f : αβM) (hs : s.Finite) (ht : t.Finite) :
∑ᶠ (i : α) (_ : i s) (j : β) (_ : j t), f i j = ∑ᶠ (j : β) (_ : j t) (i : α) (_ : i s), 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_5} [] {s : Set α} {t : Set β} (f : αβM) (hs : s.Finite) (ht : t.Finite) :
∏ᶠ (i : α) (_ : i s) (j : β) (_ : j t), f i j = ∏ᶠ (j : β) (_ : j t) (i : α) (_ : i s), 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_1} {M : Type u_5} [] {f : αM} {s : Set α} (p : MProp) (hp₀ : p 0) (hp₁ : ∀ (x y : M), p xp yp (x + y)) (hp₂ : xs, p (f x)) :
p (∑ᶠ (i : α) (_ : i s), 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_1} {M : Type u_5} [] {f : αM} {s : Set α} (p : MProp) (hp₀ : p 1) (hp₁ : ∀ (x y : M), p xp yp (x * y)) (hp₂ : xs, p (f x)) :
p (∏ᶠ (i : α) (_ : i s), 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_1} {R : Type u_7} {p : αProp} {f : αR} (hf : ∀ (x : α), p x0 f x) :
0 ∏ᶠ (x : α) (_ : p x), f x
theorem single_le_finsum {α : Type u_1} {M : Type u_7} (i : α) {f : αM} (hf : ().Finite) (h : ∀ (j : α), 0 f j) :
f i ∑ᶠ (j : α), f j
theorem single_le_finprod {α : Type u_1} {M : Type u_7} (i : α) {f : αM} (hf : .Finite) (h : ∀ (j : α), 1 f j) :
f i ∏ᶠ (j : α), f j
theorem finprod_eq_zero {α : Type u_1} {M₀ : Type u_7} [] (f : αM₀) (x : α) (hx : f x = 0) (hf : .Finite) :
∏ᶠ (x : α), f x = 0
theorem finsum_sum_comm {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : ) (f : αβM) (h : bs, (Function.support fun (a : α) => f a b).Finite) :
∑ᶠ (a : α), bs, f a b = bs, ∑ᶠ (a : α), f a b
theorem finprod_prod_comm {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : ) (f : αβM) (h : bs, (Function.mulSupport fun (a : α) => f a b).Finite) :
∏ᶠ (a : α), bs, f a b = bs, ∏ᶠ (a : α), f a b
theorem sum_finsum_comm {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : ) (f : αβM) (h : as, (Function.support (f a)).Finite) :
as, ∑ᶠ (b : β), f a b = ∑ᶠ (b : β), as, f a b
theorem prod_finprod_comm {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : ) (f : αβM) (h : as, (Function.mulSupport (f a)).Finite) :
as, ∏ᶠ (b : β), f a b = ∏ᶠ (b : β), as, f a b
theorem mul_finsum {α : Type u_1} {R : Type u_7} [] (f : αR) (r : R) (h : ().Finite) :
r * ∑ᶠ (a : α), f a = ∑ᶠ (a : α), r * f a
theorem finsum_mul {α : Type u_1} {R : Type u_7} [] (f : αR) (r : R) (h : ().Finite) :
(∑ᶠ (a : α), f a) * r = ∑ᶠ (a : α), f a * r
theorem Finset.support_of_fiberwise_sum_subset_image {α : Type u_1} {β : Type u_2} {M : Type u_5} [] [] (s : ) (f : αM) (g : αβ) :
(Function.support fun (b : β) => (Finset.filter (fun (a : α) => g a = b) s).sum f) ()
theorem Finset.mulSupport_of_fiberwise_prod_subset_image {α : Type u_1} {β : Type u_2} {M : Type u_5} [] [] (s : ) (f : αM) (g : αβ) :
(Function.mulSupport fun (b : β) => (Finset.filter (fun (a : α) => g a = b) s).prod f) ()
theorem finsum_mem_finset_product' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] [] [] (s : Finset (α × β)) (f : α × βM) :
∑ᶠ (ab : α × β) (_ : ab s), f ab = ∑ᶠ (a : α) (b : β) (_ : b Finset.image Prod.snd (Finset.filter (fun (ab : α × β) => ab.1 = a) s)), f (a, b)

Note that b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd iff (a, b) ∈ 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.

theorem finprod_mem_finset_product' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] [] [] (s : Finset (α × β)) (f : α × βM) :
∏ᶠ (ab : α × β) (_ : ab s), f ab = ∏ᶠ (a : α) (b : β) (_ : b Finset.image Prod.snd (Finset.filter (fun (ab : α × β) => ab.1 = a) s)), f (a, b)

Note that b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd iff (a, b) ∈ 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.

theorem finsum_mem_finset_product {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : Finset (α × β)) (f : α × βM) :
∑ᶠ (ab : α × β) (_ : ab s), f ab = ∑ᶠ (a : α) (b : β) (_ : (a, b) s), f (a, b)

See also finsum_mem_finset_product'.

theorem finprod_mem_finset_product {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (s : Finset (α × β)) (f : α × βM) :
∏ᶠ (ab : α × β) (_ : ab s), f ab = ∏ᶠ (a : α) (b : β) (_ : (a, b) s), f (a, b)

See also finprod_mem_finset_product'.

theorem finsum_mem_finset_product₃ {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {γ : Type u_7} (s : Finset (α × β × γ)) (f : α × β × γM) :
∑ᶠ (abc : α × β × γ) (_ : abc s), f abc = ∑ᶠ (a : α) (b : β) (c : γ) (_ : (a, b, c) s), f (a, b, c)
theorem finprod_mem_finset_product₃ {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {γ : Type u_7} (s : Finset (α × β × γ)) (f : α × β × γM) :
∏ᶠ (abc : α × β × γ) (_ : abc s), f abc = ∏ᶠ (a : α) (b : β) (c : γ) (_ : (a, b, c) s), f (a, b, c)
theorem finsum_curry {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (f : α × βM) (hf : ().Finite) :
∑ᶠ (ab : α × β), f ab = ∑ᶠ (a : α) (b : β), f (a, b)
theorem finprod_curry {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (f : α × βM) (hf : .Finite) :
∏ᶠ (ab : α × β), f ab = ∏ᶠ (a : α) (b : β), f (a, b)
theorem finsum_curry₃ {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {γ : Type u_7} (f : α × β × γM) (h : ().Finite) :
∑ᶠ (abc : α × β × γ), f abc = ∑ᶠ (a : α) (b : β) (c : γ), f (a, b, c)
theorem finprod_curry₃ {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {γ : Type u_7} (f : α × β × γM) (h : .Finite) :
∏ᶠ (abc : α × β × γ), f abc = ∏ᶠ (a : α) (b : β) (c : γ), f (a, b, c)
theorem finsum_dmem {α : Type u_1} {M : Type u_5} [] {s : Set α} [DecidablePred fun (x : α) => x s] (f : (a : α) → a sM) :
∑ᶠ (a : α) (h : a s), f a h = ∑ᶠ (a : α) (_ : a s), if h' : a s then f a h' else 0
theorem finprod_dmem {α : Type u_1} {M : Type u_5} [] {s : Set α} [DecidablePred fun (x : α) => x s] (f : (a : α) → a sM) :
∏ᶠ (a : α) (h : a s), f a h = ∏ᶠ (a : α) (_ : a s), if h' : a s then f a h' else 1
theorem finsum_emb_domain' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αβ} (hf : ) [DecidablePred fun (x : β) => x ] (g : αM) :
(∑ᶠ (b : β), if h : b then g () else 0) = ∑ᶠ (a : α), g a
theorem finprod_emb_domain' {α : Type u_1} {β : Type u_2} {M : Type u_5} [] {f : αβ} (hf : ) [DecidablePred fun (x : β) => x ] (g : αM) :
(∏ᶠ (b : β), if h : b then g () else 1) = ∏ᶠ (a : α), g a
theorem finsum_emb_domain {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (f : α β) [DecidablePred fun (x : β) => x ] (g : αM) :
(∑ᶠ (b : β), if h : b then g () else 0) = ∑ᶠ (a : α), g a
theorem finprod_emb_domain {α : Type u_1} {β : Type u_2} {M : Type u_5} [] (f : α β) [DecidablePred fun (x : β) => x ] (g : αM) :
(∏ᶠ (b : β), if h : b then g () else 1) = ∏ᶠ (a : α), g a