The areas / V03. Sets, finite structures and big operators
Mathlib.Algebra.BigOperators.Ring.Finset
54 declarations. Mathlib docs · Source
theorem Finset.Pi.empty.congr_simp E1 #
∀ {α : Type u_1} (β : α → Sort u_2) (a : α) (h : a ∈ ∅), Finset.Pi.empty β a h = Finset.Pi.empty β a h
theorem Finset.Pi.cons.congr_simp E1 #
∀ {α : Type u_1} {δ : α → Sort v} {inst : DecidableEq α} [inst_1 : DecidableEq α] (s : Finset α) (a : α) (b b_1 : δ a),
b = b_1 →
∀ (f f_1 : (a : α) → a ∈ s → δ a),
f = f_1 → ∀ (a' : α) (h : a' ∈ insert a s), Finset.Pi.cons s a b f a' h = Finset.Pi.cons s a b_1 f_1 a' ⋯
theorem Finset.prod_neg E1 #
∀ {ι : Type u_1} {M : Type u_3} {s : Finset ι} [inst : CommMonoid M] [inst_1 : HasDistribNeg M] (f : ι → M),
∏ x ∈ s, -f x = (-1) ^ s.card * ∏ x ∈ s, f x
theorem Finset.natCast_card_filter E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : AddCommMonoidWithOne R] (p : ι → Prop) [inst_1 : DecidablePred p]
(s : Finset ι), ↑{x ∈ s | p x}.card = ∑ a ∈ s, if p a then 1 else 0
theorem Finset.sum_boole E0 #
∀ {ι : Type u_1} {R : Type u_4} [inst : AddCommMonoidWithOne R] (p : ι → Prop) [inst_1 : DecidablePred p]
(s : Finset ι), (∑ x ∈ s, if p x then 1 else 0) = ↑{x ∈ s | p x}.card
theorem Finset.card_eq_sum_ite E1 #
∀ {ι : Type u_1} {s t : Finset ι} [inst : DecidablePred fun x ↦ x ∈ s], s ⊆ t → s.card = ∑ i ∈ t, if i ∈ s then 1 else 0
theorem Finset.sum_mul E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (s : Finset ι) (f : ι → R) (a : R),
(∑ i ∈ s, f i) * a = ∑ i ∈ s, f i * a
theorem Finset.mul_sum E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (s : Finset ι) (f : ι → R) (a : R),
a * ∑ i ∈ s, f i = ∑ i ∈ s, a * f i
theorem Finset.sum_mul_sum E1 #
∀ {ι : Type u_1} {κ : Type u_2} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (s : Finset ι) (t : Finset κ)
(f : ι → R) (g : κ → R), (∑ i ∈ s, f i) * ∑ j ∈ t, g j = ∑ i ∈ s, ∑ j ∈ t, f i * g j
theorem Fintype.sum_mul_sum E1 #
∀ {ι : Type u_1} {κ : Type u_2} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] [inst_1 : Fintype ι]
[inst_2 : Fintype κ] (f : ι → R) (g : κ → R), (∑ i, f i) * ∑ j, g j = ∑ i, ∑ j, f i * g j
theorem Commute.sum_right E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (s : Finset ι) (f : ι → R) (b : R),
(∀ i ∈ s, Commute b (f i)) → Commute b (∑ i ∈ s, f i)
theorem Commute.sum_left E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (s : Finset ι) (f : ι → R) (b : R),
(∀ i ∈ s, Commute (f i) b) → Commute (∑ i ∈ s, f i) b
theorem Finset.sum_range_succ_mul_sum_range_succ E1 #
∀ {R : Type u_4} [inst : NonUnitalNonAssocSemiring R] (m n : ℕ) (f g : ℕ → R),
(∑ i ∈ Finset.range (m + 1), f i) * ∑ i ∈ Finset.range (n + 1), g i =
(∑ i ∈ Finset.range m, f i) * ∑ i ∈ Finset.range n, g i + f m * ∑ i ∈ Finset.range n, g i +
(∑ i ∈ Finset.range m, f i) * g n +
f m * g n
theorem Finset.dvd_sum E1 #
∀ {ι : Type u_1} {R : Type u_4} {s : Finset ι} [inst : NonUnitalSemiring R] {f : ι → R} {a : R},
(∀ i ∈ s, a ∣ f i) → a ∣ ∑ i ∈ s, f i
theorem Finset.sum_mul_boole E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonAssocSemiring R] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → R) (i : ι),
(∑ j ∈ s, f j * if i = j then 1 else 0) = if i ∈ s then f i else 0
theorem Finset.sum_boole_mul E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : NonAssocSemiring R] [inst_1 : DecidableEq ι] (s : Finset ι) (f : ι → R) (i : ι),
∑ j ∈ s, (if i = j then 1 else 0) * f j = if i ∈ s then f i else 0
theorem Finset.prod_add_prod_eq E0 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : Finset ι} {i : ι} {f g h : ι → R},
i ∈ s →
g i + h i = f i →
(∀ j ∈ s, j ≠ i → g j = f j) → (∀ j ∈ s, j ≠ i → h j = f j) → ∏ i ∈ s, g i + ∏ i ∈ s, h i = ∏ i ∈ s, f i
If f = g = h everywhere but at i, where f i = g i + h i, then the product of f over s
is the sum of the products of g and h.
theorem Finset.prod_sum E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : DecidableEq ι] {κ : ι → Type u_5} (s : Finset ι)
(t : (i : ι) → Finset (κ i)) (f : (i : ι) → κ i → R),
∏ a ∈ s, ∑ b ∈ t a, f a b = ∑ p ∈ s.pi t, ∏ x ∈ s.attach, f (↑x) (p ↑x ⋯)
The product over a sum can be written as a sum over the product of sets, Finset.Pi.
Finset.prod_univ_sum is an alternative statement when the product is over univ.
theorem Finset.prod_univ_sum E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : DecidableEq ι] {κ : ι → Type u_5} [inst_2 : Fintype ι]
(t : (i : ι) → Finset (κ i)) (f : (i : ι) → κ i → R), ∏ i, ∑ j ∈ t i, f i j = ∑ x ∈ Fintype.piFinset t, ∏ i, f i (x i)
The product over univ of a sum can be written as a sum over the product of sets,
Fintype.piFinset. Finset.prod_sum is an alternative statement when the product is not
over univ.
theorem Finset.sum_prod_piFinset E1 #
∀ {ι : Type u_1} {κ : Type u_2} {R : Type u_4} [inst : CommSemiring R] [inst_1 : DecidableEq ι] [inst_2 : Fintype ι]
(s : Finset κ) (g : ι → κ → R), ∑ f ∈ Fintype.piFinset fun x ↦ s, ∏ i, g i (f i) = ∏ i, ∑ j ∈ s, g i j
theorem Finset.sum_pow' E1 #
∀ {κ : Type u_2} {R : Type u_4} [inst : CommSemiring R] (s : Finset κ) (f : κ → R) (n : ℕ),
(∑ a ∈ s, f a) ^ n = ∑ p ∈ Fintype.piFinset fun _i ↦ s, ∏ i, f (p i)
theorem Finset.prod_add E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : DecidableEq ι] (f g : ι → R) (s : Finset ι),
∏ i ∈ s, (f i + g i) = ∑ t ∈ s.powerset, (∏ i ∈ t, f i) * ∏ i ∈ s \ t, g i
The product of f a + g a over all of s is the sum over the powerset of s of the product of
f over a subset t times the product of g over the complement of t
theorem Finset.prod_one_add E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {f : ι → R} (s : Finset ι),
∏ i ∈ s, (1 + f i) = ∑ t ∈ s.powerset, ∏ i ∈ t, f i
theorem Finset.prod_add_one E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {f : ι → R} (s : Finset ι),
∏ i ∈ s, (f i + 1) = ∑ t ∈ s.powerset, ∏ i ∈ t, f i
theorem Finset.prod_add_ordered E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : LinearOrder ι] (s : Finset ι) (f g : ι → R),
∏ i ∈ s, (f i + g i) = ∏ i ∈ s, f i + ∑ i ∈ s, (g i * ∏ j ∈ s with j < i, (f j + g j)) * ∏ j ∈ s with i < j, f j
∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j).
theorem Finset.prod_add_ordered' E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : LinearOrder ι] (s : Finset ι) (f g : ι → R),
∏ i ∈ s, (f i + g i) = ∏ i ∈ s, f i + ∑ i ∈ s, (g i * ∏ j ∈ s with i < j, (f j + g j)) * ∏ j ∈ s with j < i, f j
theorem Finset.prod_one_add_ordered E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : LinearOrder ι] (s : Finset ι) (f : ι → R),
∏ i ∈ s, (1 + f i) = 1 + ∑ i ∈ s, f i * ∏ j ∈ s with j < i, (1 + f j)
theorem Finset.prod_one_add_ordered' E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] [inst_1 : LinearOrder ι] (s : Finset ι) (f : ι → R),
∏ i ∈ s, (1 + f i) = 1 + ∑ i ∈ s, f i * ∏ j ∈ s with i < j, (1 + f j)
theorem Finset.sum_pow_mul_eq_add_pow E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] (a b : R) (s : Finset ι),
∑ t ∈ s.powerset, a ^ t.card * b ^ (s.card - t.card) = (a + b) ^ s.card
Summing a ^ #t * b ^ (n - #t) over all finite subsets t of a finset s
gives (a + b) ^ #s.
theorem Fintype.sum_pow_mul_eq_add_pow E1 #
∀ {R : Type u_4} [inst : CommSemiring R] (ι : Type u_5) [inst_1 : Fintype ι] (a b : R),
∑ s, a ^ s.card * b ^ (Fintype.card ι - s.card) = (a + b) ^ Fintype.card ι
Summing a^#s * b^(n-#s) over all finite subsets s of a fintype of cardinality n
gives (a + b)^n. The "good" proof involves expanding along all coordinates using the fact that
x^n is multilinear, but multilinear maps are only available now over rings, so we give instead
a proof reducing to the usual binomial theorem to have a result over semirings.
theorem Finset.prod_natCast E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] (s : Finset ι) (f : ι → ℕ), ↑(∏ i ∈ s, f i) = ∏ i ∈ s, ↑(f i)
theorem Finset.prod_sub E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommRing R] [inst_1 : DecidableEq ι] (f g : ι → R) (s : Finset ι),
∏ i ∈ s, (f i - g i) = ∑ t ∈ s.powerset, ((-1) ^ t.card * ∏ i ∈ s \ t, f i) * ∏ i ∈ t, g i
The product of f i - g i over all of s is the sum over the powerset of s of the product of
g over a subset t times the product of f over the complement of t times (-1) ^ #t.
theorem Finset.prod_sub_ordered E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommRing R] [inst_1 : LinearOrder ι] (s : Finset ι) (f g : ι → R),
∏ i ∈ s, (f i - g i) = ∏ i ∈ s, f i - ∑ i ∈ s, (g i * ∏ j ∈ s with j < i, (f j - g j)) * ∏ j ∈ s with i < j, f j
∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j).
theorem Finset.prod_sub_ordered' E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommRing R] [inst_1 : LinearOrder ι] (s : Finset ι) (f g : ι → R),
∏ i ∈ s, (f i - g i) = ∏ i ∈ s, f i - ∑ i ∈ s, (g i * ∏ j ∈ s with i < j, (f j - g j)) * ∏ j ∈ s with j < i, f j
theorem Finset.prod_one_sub_ordered E2 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommRing R] [inst_1 : LinearOrder ι] (s : Finset ι) (f : ι → R),
∏ i ∈ s, (1 - f i) = 1 - ∑ i ∈ s, f i * ∏ j ∈ s with j < i, (1 - f j)
∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j). This formula is useful in construction of
a partition of unity from a collection of “bump” functions.
theorem Finset.prod_one_sub_ordered' E1 #
∀ {ι : Type u_1} {R : Type u_4} [inst : CommRing R] [inst_1 : LinearOrder ι] (s : Finset ι) (f : ι → R),
∏ i ∈ s, (1 - f i) = 1 - ∑ i ∈ s, f i * ∏ j ∈ s with i < j, (1 - f j)
theorem Finset.prod_range_natCast_sub E1 #
∀ {R : Type u_4} [inst : CommRing R] (n k : ℕ), ∏ i ∈ Finset.range k, (↑n - ↑i) = ↑(∏ i ∈ Finset.range k, (n - i))
theorem Fintype.sum_pow E1 #
∀ {ι : Type u_5} {R : Type u_7} [inst : Fintype ι] [inst_1 : CommSemiring R] (f : ι → R) (n : ℕ),
(∑ a, f a) ^ n = ∑ p, ∏ i, f (p i)
theorem Fintype.prod_sum E1 #
∀ {ι : Type u_5} {R : Type u_7} [inst : Fintype ι] [inst_1 : CommSemiring R] [inst_2 : DecidableEq ι] {κ : ι → Type u_8}
[inst_3 : (i : ι) → Fintype (κ i)] (f : (i : ι) → κ i → R), ∏ i, ∑ j, f i j = ∑ x, ∏ i, f i (x i)
A product of sums can be written as a sum of products.
theorem Fintype.prod_add E1 #
∀ {ι : Type u_5} {R : Type u_7} [inst : Fintype ι] [inst_1 : CommSemiring R] [inst_2 : DecidableEq ι] (f g : ι → R),
∏ a, (f a + g a) = ∑ t, (∏ a ∈ t, f a) * ∏ a ∈ tᶜ, g a
theorem Nat.sum_div E1 #
∀ {ι : Type u_5} {s : Finset ι} {f : ι → ℕ} {n : ℕ}, (∀ i ∈ s, n ∣ f i) → (∑ i ∈ s, f i) / n = ∑ i ∈ s, f i / n
theorem Nat.cast_list_sum E0 #
∀ {R : Type u_4} [inst : AddMonoidWithOne R] (s : List ℕ), ↑s.sum = (List.map Nat.cast s).sum
theorem Nat.cast_list_prod E0 #
∀ {R : Type u_4} [inst : Semiring R] (s : List ℕ), ↑s.prod = (List.map Nat.cast s).prod
theorem Nat.cast_multiset_sum E0 #
∀ {R : Type u_4} [inst : AddCommMonoidWithOne R] (s : Multiset ℕ), ↑s.sum = (Multiset.map Nat.cast s).sum
theorem Nat.cast_multiset_prod E0 #
∀ {R : Type u_4} [inst : CommSemiring R] (s : Multiset ℕ), ↑s.prod = (Multiset.map Nat.cast s).prod
theorem Nat.cast_sum E0 #
∀ {R : Type u_4} {ι : Type u_5} [inst : AddCommMonoidWithOne R] (s : Finset ι) (f : ι → ℕ),
↑(∑ x ∈ s, f x) = ∑ x ∈ s, ↑(f x)
theorem Nat.cast_prod E0 #
∀ {R : Type u_4} {ι : Type u_5} [inst : CommSemiring R] (f : ι → ℕ) (s : Finset ι), ↑(∏ i ∈ s, f i) = ∏ i ∈ s, ↑(f i)
theorem Int.sum_div E1 #
∀ {ι : Type u_5} {s : Finset ι} {f : ι → ℤ} {n : ℤ}, (∀ i ∈ s, n ∣ f i) → (∑ i ∈ s, f i) / n = ∑ i ∈ s, f i / n
theorem Int.cast_list_sum E0 #
∀ {R : Type u_4} [inst : AddGroupWithOne R] (s : List ℤ), ↑s.sum = (List.map Int.cast s).sum
theorem Int.cast_list_prod E0 #
∀ {R : Type u_4} [inst : Ring R] (s : List ℤ), ↑s.prod = (List.map Int.cast s).prod
theorem Int.cast_multiset_sum E0 #
∀ {R : Type u_4} [inst : AddCommGroupWithOne R] (s : Multiset ℤ), ↑s.sum = (Multiset.map Int.cast s).sum
theorem Int.cast_multiset_prod E0 #
∀ {R : Type u_6} [inst : CommRing R] (s : Multiset ℤ), ↑s.prod = (Multiset.map Int.cast s).prod
theorem Int.cast_sum E0 #
∀ {R : Type u_4} {ι : Type u_5} [inst : AddCommGroupWithOne R] (s : Finset ι) (f : ι → ℤ),
↑(∑ x ∈ s, f x) = ∑ x ∈ s, ↑(f x)
theorem Int.cast_prod E0 #
∀ {ι : Type u_5} {R : Type u_6} [inst : CommRing R] (f : ι → ℤ) (s : Finset ι), ↑(∏ i ∈ s, f i) = ∏ i ∈ s, ↑(f i)