Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 998a382

Browse files
committed
feat(topology/algebra/infinite_sum): add tsum_even_add_odd (#6620)
Prove `∑' i, f (2 * i) + ∑' i, f (2 * i + 1) = ∑' i, f i` and some supporting lemmas.
1 parent 95a8e95 commit 998a382

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed

src/algebra/ring/basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,17 @@ def even (a : α) : Prop := ∃ k, a = 2*k
171171

172172
lemma even_iff_two_dvd {a : α} : even a ↔ 2 ∣ a := iff.rfl
173173

174+
@[simp] lemma range_two_mul (α : Type*) [semiring α] :
175+
set.range (λ x : α, 2 * x) = {a | even a} :=
176+
by { ext x, simp [even, eq_comm] }
177+
174178
/-- An element `a` of a semiring is odd if there exists `k` such `a = 2*k + 1`. -/
175179
def odd (a : α) : Prop := ∃ k, a = 2*k + 1
176180

181+
@[simp] lemma range_two_mul_add_one (α : Type*) [semiring α] :
182+
set.range (λ x : α, 2 * x + 1) = {a | odd a} :=
183+
by { ext x, simp [odd, eq_comm] }
184+
177185
theorem dvd_add {a b c : α} (h₁ : a ∣ b) (h₂ : a ∣ c) : a ∣ b + c :=
178186
dvd.elim h₁ (λ d hd, dvd.elim h₂ (λ e he, dvd.intro (d + e) (by simp [left_distrib, hd, he])))
179187

src/data/nat/parity.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ by rw [not_odd_iff, even_iff]
3636
@[simp] lemma odd_iff_not_even : odd n ↔ ¬ even n :=
3737
by rw [not_even_iff, odd_iff]
3838

39+
lemma is_compl_even_odd : is_compl {n : ℕ | even n} {n | odd n} :=
40+
by simp [← set.compl_set_of, is_compl_compl]
41+
3942
lemma even_or_odd (n : ℕ) : even n ∨ odd n :=
4043
or.imp_right (odd_iff_not_even.2) (em (even n))
4144

src/topology/algebra/infinite_sum.lean

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import topology.instances.real
88
import topology.algebra.module
99
import data.indicator_function
1010
import data.equiv.encodable.lattice
11+
import data.nat.parity
1112
import order.filter.at_top_bot
1213

1314
/-!
@@ -150,6 +151,10 @@ lemma equiv.has_sum_iff (e : γ ≃ β) :
150151
has_sum (f ∘ e) a ↔ has_sum f a :=
151152
e.injective.has_sum_iff $ by simp
152153

154+
lemma function.injective.has_sum_range_iff {g : γ → β} (hg : injective g) :
155+
has_sum (λ x : set.range g, f x) a ↔ has_sum (f ∘ g) a :=
156+
(equiv.set.range g hg).has_sum_iff.symm
157+
153158
lemma equiv.summable_iff (e : γ ≃ β) :
154159
summable (f ∘ e) ↔ summable f :=
155160
exists_congr $ λ a, e.has_sum_iff
@@ -231,10 +236,25 @@ lemma summable_sum {f : γ → β → α} {s : finset γ} (hf : ∀i∈s, summab
231236
summable (λb, ∑ i in s, f i b) :=
232237
(has_sum_sum $ assume i hi, (hf i hi).has_sum).summable
233238

239+
lemma has_sum.add_disjoint {s t : set β} (hs : disjoint s t)
240+
(ha : has_sum (f ∘ coe : s → α) a) (hb : has_sum (f ∘ coe : t → α) b) :
241+
has_sum (f ∘ coe : s ∪ t → α) (a + b) :=
242+
begin
243+
rw has_sum_subtype_iff_indicator at *,
244+
rw set.indicator_union_of_disjoint hs,
245+
exact ha.add hb
246+
end
247+
248+
lemma has_sum.add_is_compl {s t : set β} (hs : is_compl s t)
249+
(ha : has_sum (f ∘ coe : s → α) a) (hb : has_sum (f ∘ coe : t → α) b) :
250+
has_sum f (a + b) :=
251+
by simpa [← hs.compl_eq]
252+
using (has_sum_subtype_iff_indicator.1 ha).add (has_sum_subtype_iff_indicator.1 hb)
253+
234254
lemma has_sum.add_compl {s : set β} (ha : has_sum (f ∘ coe : s → α) a)
235255
(hb : has_sum (f ∘ coe : sᶜ → α) b) :
236256
has_sum f (a + b) :=
237-
by simpa using (has_sum_subtype_iff_indicator.1 ha).add (has_sum_subtype_iff_indicator.1 hb)
257+
ha.add_is_compl is_compl_compl hb
238258

239259
lemma summable.add_compl {s : set β} (hs : summable (f ∘ coe : s → α))
240260
(hsc : summable (f ∘ coe : sᶜ → α)) :
@@ -244,13 +264,29 @@ lemma summable.add_compl {s : set β} (hs : summable (f ∘ coe : s → α))
244264
lemma has_sum.compl_add {s : set β} (ha : has_sum (f ∘ coe : sᶜ → α) a)
245265
(hb : has_sum (f ∘ coe : s → α) b) :
246266
has_sum f (a + b) :=
247-
by simpa using (has_sum_subtype_iff_indicator.1 ha).add (has_sum_subtype_iff_indicator.1 hb)
267+
ha.add_is_compl is_compl_compl.symm hb
268+
269+
lemma has_sum.even_add_odd {f : ℕ → α} (he : has_sum (λ k, f (2 * k)) a)
270+
(ho : has_sum (λ k, f (2 * k + 1)) b) :
271+
has_sum f (a + b) :=
272+
begin
273+
have := mul_right_injective' (@two_ne_zero ℕ _ _),
274+
replace he := this.has_sum_range_iff.2 he,
275+
replace ho := ((add_left_injective 1).comp this).has_sum_range_iff.2 ho,
276+
refine he.add_is_compl _ ho,
277+
simpa [(∘)] using nat.is_compl_even_odd
278+
end
248279

249280
lemma summable.compl_add {s : set β} (hs : summable (f ∘ coe : sᶜ → α))
250281
(hsc : summable (f ∘ coe : s → α)) :
251282
summable f :=
252283
(hs.has_sum.compl_add hsc.has_sum).summable
253284

285+
lemma summable.even_add_odd {f : ℕ → α} (he : summable (λ k, f (2 * k)))
286+
(ho : summable (λ k, f (2 * k + 1))) :
287+
summable f :=
288+
(he.has_sum.even_add_odd ho.has_sum).summable
289+
254290
lemma has_sum.sigma [regular_space α] {γ : β → Type*} {f : (Σ b:β, γ b) → α} {g : β → α} {a : α}
255291
(ha : has_sum f a) (hf : ∀b, has_sum (λc, f ⟨b, c⟩) (g b)) : has_sum g a :=
256292
begin
@@ -464,6 +500,23 @@ end
464500

465501
end encodable
466502

503+
variables [has_continuous_add α]
504+
505+
lemma tsum_add_tsum_compl {s : set β} (hs : summable (f ∘ coe : s → α))
506+
(hsc : summable (f ∘ coe : sᶜ → α)) :
507+
(∑' x : s, f x) + (∑' x : sᶜ, f x) = ∑' x, f x :=
508+
(hs.has_sum.add_compl hsc.has_sum).tsum_eq.symm
509+
510+
lemma tsum_union_disjoint {s t : set β} (hd : disjoint s t)
511+
(hs : summable (f ∘ coe : s → α)) (ht : summable (f ∘ coe : t → α)) :
512+
(∑' x : s ∪ t, f x) = (∑' x : s, f x) + (∑' x : t, f x) :=
513+
(hs.has_sum.add_disjoint hd ht.has_sum).tsum_eq
514+
515+
lemma tsum_even_add_odd {f : ℕ → α} (he : summable (λ k, f (2 * k)))
516+
(ho : summable (λ k, f (2 * k + 1))) :
517+
(∑' k, f (2 * k)) + (∑' k, f (2 * k + 1)) = ∑' k, f k :=
518+
(he.has_sum.even_add_odd ho.has_sum).tsum_eq.symm
519+
467520
end tsum
468521

469522
section pi
@@ -562,11 +615,6 @@ hf.has_sum.neg.tsum_eq
562615
lemma tsum_sub (hf : summable f) (hg : summable g) : ∑'b, (f b - g b) = ∑'b, f b - ∑'b, g b :=
563616
(hf.has_sum.sub hg.has_sum).tsum_eq
564617

565-
lemma tsum_add_tsum_compl {s : set β} (hs : summable (f ∘ coe : s → α))
566-
(hsc : summable (f ∘ coe : sᶜ → α)) :
567-
(∑' x : s, f x) + (∑' x : sᶜ, f x) = ∑' x, f x :=
568-
(hs.has_sum.add_compl hsc.has_sum).tsum_eq.symm
569-
570618
lemma sum_add_tsum_compl {s : finset β} (hf : summable f) :
571619
(∑ x in s, f x) + (∑' x : (↑s : set β)ᶜ, f x) = ∑' x, f x :=
572620
((s.has_sum f).add_compl (s.summable_compl_iff.2 hf).has_sum).tsum_eq.symm

0 commit comments

Comments
 (0)