@@ -38,8 +38,7 @@ variable [CommMonoid β]
38
38
open Classical
39
39
40
40
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
41
- ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x :=
42
- by
41
+ ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x := by
43
42
apply Finset.induction
44
43
· simp
45
44
· intro a s has H
@@ -61,8 +60,8 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
61
60
#align finset.mul_sum Finset.mul_sum
62
61
63
62
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
64
- (f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p. 1 * f₂ p. 2 :=
65
- by
63
+ (f₂ : ι₂ → β) :
64
+ ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p. 1 * f₂ p. 2 := by
66
65
rw [sum_product, sum_mul, sum_congr rfl]
67
66
intros
68
67
rw [mul_sum]
@@ -96,13 +95,12 @@ variable [CommSemiring β]
96
95
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
97
96
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
98
97
{t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
99
- (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2 ) :=
100
- by
98
+ (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2 ) := by
101
99
induction' s using Finset.induction with a s ha ih
102
100
· rw [pi_empty, sum_singleton]
103
101
rfl
104
- · have h₁ : ∀ x ∈ t a,∀ y ∈ t a,
105
- x ≠ y → Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
102
+ · have h₁ : ∀ x ∈ t a, ∀ y ∈ t a, x ≠ y →
103
+ Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
106
104
intro x _ y _ h
107
105
simp only [disjoint_iff_ne, mem_image]
108
106
rintro _ ⟨p₂, _, eq₂⟩ _ ⟨p₃, _, eq₃⟩ eq
@@ -166,8 +164,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
166
164
∏ i in s, (f i + g i) =
167
165
(∏ i in s, f i) +
168
166
∑ i in s,
169
- g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j :=
170
- by
167
+ g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j := by
171
168
refine' Finset.induction_on_max s (by simp) _
172
169
clear s
173
170
intro a s ha ihs
@@ -191,8 +188,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
191
188
∏ i in s, (f i - g i) =
192
189
(∏ i in s, f i) -
193
190
∑ i in s,
194
- g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j :=
195
- by
191
+ g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j := by
196
192
simp only [sub_eq_add_neg]
197
193
convert prod_add_ordered s f fun i => -g i
198
194
simp
@@ -201,17 +197,15 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
201
197
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
202
198
a partition of unity from a collection of “bump” functions. -/
203
199
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
204
- (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) :=
205
- by
200
+ (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
206
201
rw [prod_sub_ordered]
207
202
simp
208
203
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
209
204
210
205
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
211
206
gives `(a + b)^s.card`.-/
212
207
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
213
- (∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card :=
214
- by
208
+ (∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
215
209
rw [← prod_const, prod_add]
216
210
refine' Finset.sum_congr rfl fun t ht => _
217
211
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
@@ -222,9 +216,9 @@ theorem dvd_sum {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣
222
216
#align finset.dvd_sum Finset.dvd_sum
223
217
224
218
@[norm_cast]
225
- theorem prod_nat_cast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
219
+ theorem prod_natCast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
226
220
(Nat.castRingHom β).map_prod f s
227
- #align finset.prod_nat_cast Finset.prod_nat_cast
221
+ #align finset.prod_nat_cast Finset.prod_natCast
228
222
229
223
end CommSemiring
230
224
@@ -235,7 +229,7 @@ variable {R : Type _} [CommRing R]
235
229
theorem prod_range_cast_nat_sub (n k : ℕ) :
236
230
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
237
231
by
238
- rw [prod_nat_cast ]
232
+ rw [prod_natCast ]
239
233
cases' le_or_lt k n with hkn hnk
240
234
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
241
235
· rw [← mem_range] at hnk
@@ -252,8 +246,7 @@ of `s`, and over all subsets of `s` to which one adds `x`. -/
252
246
theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x : α} (h : x ∉ s)
253
247
(f : Finset α → β) :
254
248
(∏ a in (insert x s).powerset, f a) =
255
- (∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) :=
256
- by
249
+ (∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) := by
257
250
rw [powerset_insert, Finset.prod_union, Finset.prod_image]
258
251
· intro t₁ h₁ t₂ h₂ heq
259
252
rw [← Finset.erase_insert (not_mem_of_mem_powerset_of_not_mem h₁ h), ←
@@ -279,8 +272,8 @@ theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k :
279
272
((∑ i in range (n + 1 ), f i) * ∑ i in range (k + 1 ), g i) =
280
273
(((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
281
274
(∑ i in range n, f i) * g k +
282
- f n * g k :=
283
- by simp only [add_mul, mul_add, add_assoc, sum_range_succ]
275
+ f n * g k := by
276
+ simp only [add_mul, mul_add, add_assoc, sum_range_succ]
284
277
#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
285
278
286
279
end Finset
0 commit comments