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

Commit 3fd0e60

Browse files
committed
refactor(topology/algebra/infinite_sum): Cauchy condition for infinite sums generalized to complete topological groups
1 parent 246c280 commit 3fd0e60

File tree

6 files changed

+212
-148
lines changed

6 files changed

+212
-148
lines changed

src/analysis/normed_space/basic.lean

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ abs_norm_sub_norm_le g h
114114
lemma norm_sub_rev (g h : α) : ∥g - h∥ = ∥h - g∥ :=
115115
by rw ←norm_neg; simp
116116

117+
lemma ball_0_eq (ε : ℝ) : ball (0:α) ε = {x | ∥x∥ < ε} :=
118+
set.ext $ assume a, by simp
119+
117120
section nnnorm
118121

119122
def nnnorm (a : α) : nnreal := ⟨norm a, norm_nonneg a⟩
@@ -178,26 +181,18 @@ end
178181
lemma continuous_nnnorm : continuous (nnnorm : α → nnreal) :=
179182
continuous_subtype_mk _ continuous_norm
180183

181-
instance normed_top_monoid : topological_add_monoid α :=
182-
⟨continuous_iff_continuous_at.2 $ λ ⟨x₁, x₂⟩,
183-
tendsto_iff_norm_tendsto_zero.2
184-
begin
185-
refine squeeze_zero (by simp) _
186-
(by simpa using tendsto_add (lim_norm (x₁, x₂)) (lim_norm (x₁, x₂))),
187-
exact λ ⟨e₁, e₂⟩, calc
188-
∥(e₁ + e₂) - (x₁ + x₂)∥ = ∥(e₁ - x₁) + (e₂ - x₂)∥ : by simp
189-
... ≤ ∥e₁ - x₁∥ + ∥e₂ - x₂∥ : norm_triangle _ _
190-
... ≤ max (∥e₁ - x₁∥) (∥e₂ - x₂∥) + max (∥e₁ - x₁∥) (∥e₂ - x₂∥) :
191-
add_le_add (le_max_left _ _) (le_max_right _ _)
192-
end
193-
194-
instance normed_top_group : topological_add_group α :=
195-
⟨continuous_iff_continuous_at.2 $ λ x,
196-
tendsto_iff_norm_tendsto_zero.2 begin
197-
have : ∀ (e : α), ∥-e - -x∥ = ∥e - x∥,
198-
{ intro, simpa using norm_neg (e - x) },
199-
rw funext this, exact lim_norm x,
200-
end
184+
instance normed_uniform_group : uniform_add_group α :=
185+
begin
186+
refine ⟨metric.uniform_continuous_iff.2 $ assume ε hε, ⟨ε / 2, half_pos hε, assume a b h, _⟩⟩,
187+
rw [prod.dist_eq, max_lt_iff, dist_eq_norm, dist_eq_norm] at h,
188+
calc dist (a.1 - a.2) (b.1 - b.2) = ∥(a.1 - b.1) - (a.2 - b.2)∥ : by simp [dist_eq_norm]
189+
... ≤ ∥a.1 - b.1∥ + ∥a.2 - b.2∥ : norm_triangle_sub
190+
... < ε / 2 + ε / 2 : add_lt_add h.1 h.2
191+
... = ε : add_halves _
192+
end
193+
194+
instance normed_top_monoid : topological_add_monoid α := by apply_instance
195+
instance normed_top_group : topological_add_group α := by apply_instance
201196

202197
end normed_group
203198

@@ -416,3 +411,43 @@ noncomputable def normed_space.of_core (α : Type*) (β : Type*)
416411
}
417412

418413
end normed_space
414+
415+
section has_sum
416+
local attribute [instance] classical.prop_decidable
417+
open finset filter
418+
variables [normed_group α] [complete_space α]
419+
420+
lemma has_sum_iff_vanishing_norm {f : ι → α} :
421+
has_sum f ↔ ∀ε>0, (∃s:finset ι, ∀t, disjoint t s → ∥ t.sum f ∥ < ε) :=
422+
begin
423+
simp only [has_sum_iff_vanishing, metric.mem_nhds_iff, exists_imp_distrib],
424+
split,
425+
{ assume h ε hε, refine h {x | ∥x∥ < ε} ε hε _, rw [ball_0_eq ε] },
426+
{ assume h s ε hε hs,
427+
rcases h ε hε with ⟨t, ht⟩,
428+
refine ⟨t, assume u hu, hs _⟩,
429+
rw [ball_0_eq],
430+
exact ht u hu }
431+
end
432+
433+
lemma has_sum_of_norm_bounded {f : ι → α} (g : ι → ℝ) (hf : has_sum g) (h : ∀i, ∥f i∥ ≤ g i) :
434+
has_sum f :=
435+
has_sum_iff_vanishing_norm.2 $ assume ε hε,
436+
let ⟨s, hs⟩ := has_sum_iff_vanishing_norm.1 hf ε hε in
437+
⟨s, assume t ht,
438+
have ∥t.sum g∥ < ε := hs t ht,
439+
have nn : 0 ≤ t.sum g := finset.zero_le_sum (assume a _, le_trans (norm_nonneg _) (h a)),
440+
lt_of_le_of_lt (norm_triangle_sum t f) $ lt_of_le_of_lt (finset.sum_le_sum $ assume i _, h i) $
441+
by rwa [real.norm_eq_abs, abs_of_nonneg nn] at this
442+
443+
lemma has_sum_of_has_sum_norm {f : ι → α} (hf : has_sum (λa, ∥f a∥)) : has_sum f :=
444+
has_sum_of_norm_bounded _ hf (assume i, le_refl _)
445+
446+
lemma norm_tsum_le_tsum_norm {f : ι → α} (hf : has_sum (λi, ∥f i∥)) : ∥(∑i, f i)∥ ≤ (∑ i, ∥f i∥) :=
447+
have h₁ : tendsto (λs:finset ι, ∥s.sum f∥) at_top (nhds ∥(∑ i, f i)∥) :=
448+
(is_sum_tsum $ has_sum_of_has_sum_norm hf).comp (continuous_norm.tendsto _),
449+
have h₂ : tendsto (λs:finset ι, s.sum (λi, ∥f i∥)) at_top (nhds (∑ i, ∥f i∥)) :=
450+
is_sum_tsum hf,
451+
le_of_tendsto_of_tendsto at_top_ne_bot h₁ h₂ $ univ_mem_sets' $ assume s, norm_triangle_sum _ _
452+
453+
end has_sum

src/analysis/specific_limits.lean

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,6 @@ open classical function lattice filter finset metric
1515

1616
variables {α : Type*} {β : Type*} {ι : Type*}
1717

18-
lemma has_sum_iff_cauchy [normed_group α] [complete_space α] {f : ι → α} :
19-
has_sum f ↔ ∀ε>0, (∃s:finset ι, ∀t, disjoint t s → ∥ t.sum f ∥ < ε) :=
20-
begin
21-
refine iff.trans (cauchy_map_iff_exists_tendsto at_top_ne_bot).symm _,
22-
simp only [cauchy_map_iff, and_iff_right at_top_ne_bot, prod_at_top_at_top_eq, uniformity_dist,
23-
tendsto_infi, tendsto_at_top_principal, set.mem_set_of_eq],
24-
split,
25-
{ assume h ε hε,
26-
rcases h ε hε with ⟨⟨s₁, s₂⟩, h⟩,
27-
use [s₁ ∪ s₂],
28-
assume t ht,
29-
have : (s₁ ∪ s₂) ∩ t = ∅ := finset.disjoint_iff_inter_eq_empty.1 ht.symm,
30-
specialize h (s₁ ∪ s₂, (s₁ ∪ s₂) ∪ t) ⟨le_sup_left, le_sup_left_of_le le_sup_right⟩,
31-
simpa only [finset.sum_union this, dist_eq_norm,
32-
sub_add_eq_sub_sub, sub_self, zero_sub, norm_neg] using h },
33-
{ assume h' ε hε,
34-
rcases h' (ε / 2) (half_pos hε) with ⟨s, h⟩,
35-
use [(s, s)],
36-
rintros ⟨t₁, t₂⟩ ⟨ht₁, ht₂⟩,
37-
dsimp at ht₁ ht₂,
38-
calc dist (t₁.sum f) (t₂.sum f) = ∥sum (t₁ \ s) f - sum (t₂ \ s) f∥ :
39-
by simp only [(finset.sum_sdiff ht₁).symm, (finset.sum_sdiff ht₂).symm,
40-
dist_eq_norm, add_sub_add_right_eq_sub]
41-
... ≤ ∥sum (t₁ \ s) f∥ + ∥ sum (t₂ \ s) f∥ : norm_triangle_sub
42-
... < ε / 2 + ε / 2 : add_lt_add (h _ finset.disjoint_sdiff) (h _ finset.disjoint_sdiff)
43-
... = ε : add_halves _ }
44-
end
45-
46-
lemma has_sum_of_has_sum_norm [normed_group α] [complete_space α] {f : ι → α}
47-
(hf : has_sum (λa, norm (f a))) : has_sum f :=
48-
has_sum_iff_cauchy.2 $ assume ε hε,
49-
let ⟨s, hs⟩ := has_sum_iff_cauchy.1 hf ε hε in
50-
⟨s, assume t ht,
51-
have ∥t.sum (λa, ∥f a∥)∥ < ε := hs t ht,
52-
have nn : 0 ≤ t.sum (λa, ∥f a∥) := finset.zero_le_sum (assume a _, norm_nonneg _),
53-
lt_of_le_of_lt (norm_triangle_sum t f) $ by rwa [real.norm_eq_abs, abs_of_nonneg nn] at this
54-
5518
lemma has_sum_of_absolute_convergence_real {f : ℕ → ℝ} (hf : ∀n, 0 ≤ f n) :
5619
(∃r, tendsto (λn, (range n).sum (λi, abs (f i))) at_top (nhds r)) → has_sum f
5720
| ⟨r, hr⟩ :=
@@ -142,28 +105,11 @@ begin
142105
have hf : is_sum f ε := is_sum_geometric_two _,
143106
have f0 : ∀ n, 0 < f n := λ n, div_pos (half_pos hε) (pow_pos two_pos _),
144107
refine ⟨f ∘ encodable.encode, λ i, f0 _, _⟩,
145-
let g : ℕ → ℝ := λ n, option.cases_on (encodable.decode2 ι n) 0 (f ∘ encodable.encode),
146-
have : ∀ n, g n = 0 ∨ g n = f n,
147-
{ intro n, dsimp [g], cases e : encodable.decode2 ι n with a,
148-
{ exact or.inl rfl },
149-
{ simp [encodable.mem_decode2.1 e] } },
150-
cases has_sum_of_has_sum_of_sub ⟨_, hf⟩ this with c hg,
151-
have cε : c ≤ ε,
152-
{ refine is_sum_le (λ n, _) hg hf,
153-
cases this n; rw h, exact le_of_lt (f0 _) },
154-
have hs : ∀ n, g n ≠ 0 → (encodable.decode2 ι n).is_some,
155-
{ intros n h, dsimp [g] at h,
156-
cases encodable.decode2 ι n,
157-
exact (h rfl).elim, exact rfl },
158-
refine ⟨c, _, cε⟩,
159-
refine is_sum_of_is_sum_ne_zero
160-
(λ n h, option.get (hs n h)) (λ n _, ne_of_gt (f0 _))
161-
(λ i _, encodable.encode i) (λ n h, ne_of_gt _)
162-
(λ n h, _) (λ i _, _) (λ i _, _) hg,
163-
{ dsimp [g], rw encodable.encodek2, exact f0 _ },
164-
{ exact encodable.mem_decode2.1 (option.get_mem _) },
165-
{ exact option.get_of_mem _ (encodable.encodek2 _) },
166-
{ dsimp [g], rw encodable.encodek2 }
108+
rcases has_sum_comp_of_has_sum_of_injective f (has_sum_spec hf) (@encodable.encode_injective ι _)
109+
with ⟨c, hg⟩,
110+
refine ⟨c, hg, is_sum_le_inj _ (@encodable.encode_injective ι _) _ _ hg hf⟩,
111+
{ assume i _, exact le_of_lt (f0 _) },
112+
{ assume n, exact le_refl _ }
167113
end
168114

169115
namespace nnreal

src/measure_theory/probability_mass_function.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ lemma has_sum_coe (p : pmf α) : has_sum p := has_sum_spec p.is_sum_coe_one
2828

2929
def support (p : pmf α) : set α := {a | p.1 a ≠ 0}
3030

31-
def pure (a : α) : pmf α := ⟨λa', if a' = a then 1 else 0, is_sum_ite _ _⟩
31+
def pure (a : α) : pmf α := ⟨λa', if a' = a then 1 else 0, is_sum_ite_eq _ _⟩
3232

3333
@[simp] lemma pure_apply (a a' : α) : pure a a' = (if a' = a then 1 else 0) := rfl
3434

3535
instance [inhabited α] : inhabited (pmf α) := ⟨pure (default α)⟩
3636

3737
lemma coe_le_one (p : pmf α) (a : α) : p a ≤ 1 :=
38-
is_sum_le (by intro b; split_ifs; simp [h]; exact le_refl _) (is_sum_ite a (p a)) p.2
38+
is_sum_le (by intro b; split_ifs; simp [h]; exact le_refl _) (is_sum_ite_eq a (p a)) p.2
3939

4040
protected lemma bind.has_sum (p : pmf α) (f : α → pmf β) (b : β) : has_sum (λa:α, p a * f a b) :=
4141
begin

src/order/filter/basic.lean

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ section map
652652
variables {f f₁ f₂ : filter α} {g g₁ g₂ : filter β} {m : α → β} {m' : β → γ} {s : set α} {t : set β}
653653

654654
@[simp] theorem mem_comap_sets : s ∈ (comap m g).sets ↔ ∃t∈g.sets, m ⁻¹' t ⊆ s := iff.rfl
655+
655656
theorem preimage_mem_comap (ht : t ∈ g.sets) : m ⁻¹' t ∈ (comap m g).sets :=
656657
⟨t, ht, subset.refl _⟩
657658

@@ -1386,10 +1387,14 @@ calc map f (⨅a, principal {a' | a ≤ a'}) = (⨅a, map f $ principal {a' | a
13861387
(by apply_instance)
13871388
... = (⨅a, principal $ f '' {a' | a ≤ a'}) : by simp only [map_principal, eq_self_iff_true]
13881389

1389-
lemma tendsto_at_top {α β} [preorder β] (m : α → β) (f : filter α) :
1390+
lemma tendsto_at_top [preorder β] (m : α → β) (f : filter α) :
13901391
tendsto m f at_top ↔ (∀b, {a | b ≤ m a} ∈ f.sets) :=
13911392
by simp only [at_top, tendsto_infi, tendsto_principal]; refl
13921393

1394+
lemma tendsto_at_top' [nonempty α] [semilattice_sup α] (f : α → β) (l : filter β) :
1395+
tendsto f at_top l ↔ (∀s∈l.sets, ∃a, ∀b≥a, f b ∈ s) :=
1396+
by simp only [tendsto_def, mem_at_top_sets]; refl
1397+
13931398
theorem tendsto_at_top_principal [nonempty β] [semilattice_sup β] {f : β → α} {s : set α} :
13941399
tendsto f at_top (principal s) ↔ ∃N, ∀n≥N, f n ∈ s :=
13951400
by rw [tendsto_iff_comap, comap_principal, le_principal_iff, mem_at_top_sets]; refl

0 commit comments

Comments
 (0)