Skip to content

Commit

Permalink
chore: generalize CauchySeq to Preorder (#8339)
Browse files Browse the repository at this point in the history
  • Loading branch information
alreadydone committed Nov 11, 2023
1 parent ea682fb commit 5f066e7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
9 changes: 5 additions & 4 deletions Mathlib/Analysis/Normed/Group/InfiniteSum.lean
Expand Up @@ -31,7 +31,7 @@ infinite series, absolute convergence, normed group
-/


open Classical BigOperators Topology NNReal
open BigOperators Topology NNReal

open Finset Filter Metric

Expand All @@ -55,6 +55,7 @@ theorem cauchySeq_finset_of_norm_bounded_eventually {f : ι → E} {g : ι →
(h : ∀ᶠ i in cofinite, ‖f i‖ ≤ g i) : CauchySeq fun s => ∑ i in s, f i := by
refine' cauchySeq_finset_iff_vanishing_norm.2 fun ε hε => _
rcases summable_iff_vanishing_norm.1 hg ε hε with ⟨s, hs⟩
classical
refine' ⟨s ∪ h.toFinset, fun t ht => _⟩
have : ∀ i ∈ t, ‖f i‖ ≤ g i := by
intro i hi
Expand Down Expand Up @@ -116,8 +117,8 @@ theorem summable_of_norm_bounded [CompleteSpace E] {f : ι → E} (g : ι →
#align summable_of_norm_bounded summable_of_norm_bounded

theorem HasSum.norm_le_of_bounded {f : ι → E} {g : ι → ℝ} {a : E} {b : ℝ} (hf : HasSum f a)
(hg : HasSum g b) (h : ∀ i, ‖f i‖ ≤ g i) : ‖a‖ ≤ b :=
le_of_tendsto_of_tendsto' hf.norm hg fun _s => norm_sum_le_of_le _ fun i _hi => h i
(hg : HasSum g b) (h : ∀ i, ‖f i‖ ≤ g i) : ‖a‖ ≤ b := by
classical exact le_of_tendsto_of_tendsto' hf.norm hg fun _s norm_sum_le_of_le _ fun i _hi h i
#align has_sum.norm_le_of_bounded HasSum.norm_le_of_bounded

/-- Quantitative result associated to the direct comparison test for series: If `∑' i, g i` is
Expand All @@ -128,7 +129,7 @@ theorem tsum_of_norm_bounded {f : ι → E} {g : ι → ℝ} {a : ℝ} (hg : Has
by_cases hf : Summable f
· exact hf.hasSum.norm_le_of_bounded hg h
· rw [tsum_eq_zero_of_not_summable hf, norm_zero]
exact ge_of_tendsto' hg fun s => sum_nonneg fun i _hi => (norm_nonneg _).trans (h i)
classical exact ge_of_tendsto' hg fun s => sum_nonneg fun i _hi => (norm_nonneg _).trans (h i)
#align tsum_of_norm_bounded tsum_of_norm_bounded

/-- If `∑' i, ‖f i‖` is summable, then `‖∑' i, f i‖ ≤ (∑' i, ‖f i‖)`. Note that we do not assume
Expand Down
16 changes: 8 additions & 8 deletions Mathlib/Topology/Algebra/InfiniteSum/Basic.lean
Expand Up @@ -1096,16 +1096,17 @@ section UniformGroup
variable [AddCommGroup α] [UniformSpace α]

/-- The **Cauchy criterion** for infinite sums, also known as the **Cauchy convergence test** -/
theorem summable_iff_cauchySeq_finset [CompleteSpace α] [DecidableEq β] {f : β → α} :
Summable f ↔ CauchySeq fun s : Finset β ↦ ∑ b in s, f b :=
cauchy_map_iff_exists_tendsto.symm
theorem summable_iff_cauchySeq_finset [CompleteSpace α] {f : β → α} :
Summable f ↔ CauchySeq fun s : Finset β ↦ ∑ b in s, f b := by
classical exact cauchy_map_iff_exists_tendsto.symm
#align summable_iff_cauchy_seq_finset summable_iff_cauchySeq_finset

variable [UniformAddGroup α] {f g : β → α} {a a₁ a₂ : α}

theorem cauchySeq_finset_iff_vanishing [DecidableEq β] :
theorem cauchySeq_finset_iff_vanishing :
(CauchySeq fun s : Finset β ↦ ∑ b in s, f b) ↔
∀ e ∈ 𝓝 (0 : α), ∃ s : Finset β, ∀ t, Disjoint t s → (∑ b in t, f b) ∈ e := by
classical
simp_rw [CauchySeq, cauchy_map_iff, and_iff_right atTop_neBot, prod_atTop_atTop_eq,
uniformity_eq_comap_nhds_zero α, tendsto_comap_iff, (· ∘ ·), tendsto_atTop']
constructor
Expand All @@ -1126,7 +1127,7 @@ theorem cauchySeq_finset_iff_vanishing [DecidableEq β] :
exact hde _ (h _ Finset.sdiff_disjoint) _ (h _ Finset.sdiff_disjoint)
#align cauchy_seq_finset_iff_vanishing cauchySeq_finset_iff_vanishing

theorem cauchySeq_finset_iff_tsum_vanishing [DecidableEq β] :
theorem cauchySeq_finset_iff_tsum_vanishing :
(CauchySeq fun s : Finset β ↦ ∑ b in s, f b) ↔
∀ e ∈ 𝓝 (0 : α), ∃ s : Finset β, ∀ t : Set β, Disjoint t s → (∑' b : t, f b) ∈ e := by
simp_rw [cauchySeq_finset_iff_vanishing, Set.disjoint_left, disjoint_left]
Expand All @@ -1135,7 +1136,8 @@ theorem cauchySeq_finset_iff_tsum_vanishing [DecidableEq β] :
obtain ⟨s, hs⟩ := vanish o ho
refine ⟨s, fun t hts ↦ oe ?_⟩
by_cases ht : Summable fun a : t ↦ f a
· refine o_closed.mem_of_tendsto ht.hasSum (eventually_of_forall fun t' ↦ ?_)
· classical
refine o_closed.mem_of_tendsto ht.hasSum (eventually_of_forall fun t' ↦ ?_)
rw [← sum_subtype_map_embedding fun _ _ ↦ by rfl]
apply hs
simp_rw [Finset.mem_map]
Expand All @@ -1162,13 +1164,11 @@ variable [CompleteSpace α]

theorem summable_iff_vanishing :
Summable f ↔ ∀ e ∈ 𝓝 (0 : α), ∃ s : Finset β, ∀ t, Disjoint t s → (∑ b in t, f b) ∈ e := by
classical
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing]
#align summable_iff_vanishing summable_iff_vanishing

theorem summable_iff_tsum_vanishing : Summable f ↔
∀ e ∈ 𝓝 (0 : α), ∃ s : Finset β, ∀ t : Set β, Disjoint t s → (∑' b : t, f b) ∈ e := by
classical
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_tsum_vanishing]

theorem summable_iff_nat_tsum_vanishing {f : ℕ → α} : Summable f ↔
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Topology/Algebra/UniformGroup.lean
Expand Up @@ -431,28 +431,28 @@ theorem uniformContinuous_monoidHom_of_continuous {hom : Type*} [UniformSpace β
#align uniform_continuous_add_monoid_hom_of_continuous uniformContinuous_addMonoidHom_of_continuous

@[to_additive]
theorem CauchySeq.mul {ι : Type*} [SemilatticeSup ι] {u v : ι → α} (hu : CauchySeq u)
theorem CauchySeq.mul {ι : Type*} [Preorder ι] {u v : ι → α} (hu : CauchySeq u)
(hv : CauchySeq v) : CauchySeq (u * v) :=
uniformContinuous_mul.comp_cauchySeq (hu.prod hv)
#align cauchy_seq.mul CauchySeq.mul
#align cauchy_seq.add CauchySeq.add

@[to_additive]
theorem CauchySeq.mul_const {ι : Type*} [SemilatticeSup ι] {u : ι → α} {x : α} (hu : CauchySeq u) :
theorem CauchySeq.mul_const {ι : Type*} [Preorder ι] {u : ι → α} {x : α} (hu : CauchySeq u) :
CauchySeq fun n => u n * x :=
(uniformContinuous_id.mul uniformContinuous_const).comp_cauchySeq hu
#align cauchy_seq.mul_const CauchySeq.mul_const
#align cauchy_seq.add_const CauchySeq.add_const

@[to_additive]
theorem CauchySeq.const_mul {ι : Type*} [SemilatticeSup ι] {u : ι → α} {x : α} (hu : CauchySeq u) :
theorem CauchySeq.const_mul {ι : Type*} [Preorder ι] {u : ι → α} {x : α} (hu : CauchySeq u) :
CauchySeq fun n => x * u n :=
(uniformContinuous_const.mul uniformContinuous_id).comp_cauchySeq hu
#align cauchy_seq.const_mul CauchySeq.const_mul
#align cauchy_seq.const_add CauchySeq.const_add

@[to_additive]
theorem CauchySeq.inv {ι : Type*} [SemilatticeSup ι] {u : ι → α} (h : CauchySeq u) :
theorem CauchySeq.inv {ι : Type*} [Preorder ι] {u : ι → α} (h : CauchySeq u) :
CauchySeq u⁻¹ :=
uniformContinuous_inv.comp_cauchySeq h
#align cauchy_seq.inv CauchySeq.inv
Expand Down
26 changes: 13 additions & 13 deletions Mathlib/Topology/UniformSpace/Cauchy.lean
Expand Up @@ -193,16 +193,16 @@ theorem Cauchy.comap' [UniformSpace β] {f : Filter β} {m : α → β} (hf : Ca
/-- Cauchy sequences. Usually defined on ℕ, but often it is also useful to say that a function
defined on ℝ is Cauchy at +∞ to deduce convergence. Therefore, we define it in a type class that
is general enough to cover both ℕ and ℝ, which are the main motivating examples. -/
def CauchySeq [SemilatticeSup β] (u : β → α) :=
def CauchySeq [Preorder β] (u : β → α) :=
Cauchy (atTop.map u)
#align cauchy_seq CauchySeq

theorem CauchySeq.tendsto_uniformity [SemilatticeSup β] {u : β → α} (h : CauchySeq u) :
theorem CauchySeq.tendsto_uniformity [Preorder β] {u : β → α} (h : CauchySeq u) :
Tendsto (Prod.map u u) atTop (𝓤 α) := by
simpa only [Tendsto, prod_map_map_eq', prod_atTop_atTop_eq] using h.right
#align cauchy_seq.tendsto_uniformity CauchySeq.tendsto_uniformity

theorem CauchySeq.nonempty [SemilatticeSup β] {u : β → α} (hu : CauchySeq u) : Nonempty β :=
theorem CauchySeq.nonempty [Preorder β] {u : β → α} (hu : CauchySeq u) : Nonempty β :=
@nonempty_of_neBot _ _ <| (map_neBot_iff _).1 hu.1
#align cauchy_seq.nonempty CauchySeq.nonempty

Expand All @@ -227,9 +227,9 @@ theorem cauchySeq_iff_tendsto [Nonempty β] [SemilatticeSup β] {u : β → α}
cauchy_map_iff'.trans <| by simp only [prod_atTop_atTop_eq, Prod.map_def]
#align cauchy_seq_iff_tendsto cauchySeq_iff_tendsto

theorem CauchySeq.comp_tendsto {γ} [SemilatticeSup β] [SemilatticeSup γ] [Nonempty γ] {f : β → α}
theorem CauchySeq.comp_tendsto {γ} [Preorder β] [SemilatticeSup γ] [Nonempty γ] {f : β → α}
(hf : CauchySeq f) {g : γ → β} (hg : Tendsto g atTop atTop) : CauchySeq (f ∘ g) :=
cauchySeq_iff_tendsto.2 <| hf.tendsto_uniformity.comp (hg.prod_atTop hg)
⟨inferInstance, le_trans (prod_le_prod.mpr ⟨Tendsto.comp le_rfl hg, Tendsto.comp le_rfl hg⟩) hf.2
#align cauchy_seq.comp_tendsto CauchySeq.comp_tendsto

theorem CauchySeq.comp_injective [SemilatticeSup β] [NoMaxOrder β] [Nonempty β] {u : ℕ → α}
Expand Down Expand Up @@ -262,14 +262,14 @@ theorem cauchySeq_iff {u : ℕ → α} :
simp only [cauchySeq_iff', Filter.eventually_atTop_prod_self', mem_preimage, Prod_map]
#align cauchy_seq_iff cauchySeq_iff

theorem CauchySeq.prod_map {γ δ} [UniformSpace β] [SemilatticeSup γ] [SemilatticeSup δ] {u : γ → α}
theorem CauchySeq.prod_map {γ δ} [UniformSpace β] [Preorder γ] [Preorder δ] {u : γ → α}
{v : δ → β} (hu : CauchySeq u) (hv : CauchySeq v) : CauchySeq (Prod.map u v) := by
simpa only [CauchySeq, prod_map_map_eq', prod_atTop_atTop_eq] using hu.prod hv
#align cauchy_seq.prod_map CauchySeq.prod_map

theorem CauchySeq.prod {γ} [UniformSpace β] [SemilatticeSup γ] {u : γ → α} {v : γ → β}
theorem CauchySeq.prod {γ} [UniformSpace β] [Preorder γ] {u : γ → α} {v : γ → β}
(hu : CauchySeq u) (hv : CauchySeq v) : CauchySeq fun x => (u x, v x) :=
haveI := hu.nonempty
haveI := hu.1.of_map
(Cauchy.prod hu hv).mono (Tendsto.prod_mk le_rfl le_rfl)
#align cauchy_seq.prod CauchySeq.prod

Expand All @@ -278,7 +278,7 @@ theorem CauchySeq.eventually_eventually [SemilatticeSup β] {u : β → α} (hu
eventually_atTop_curry <| hu.tendsto_uniformity hV
#align cauchy_seq.eventually_eventually CauchySeq.eventually_eventually

theorem UniformContinuous.comp_cauchySeq {γ} [UniformSpace β] [SemilatticeSup γ] {f : α → β}
theorem UniformContinuous.comp_cauchySeq {γ} [UniformSpace β] [Preorder γ] {f : α → β}
(hf : UniformContinuous f) {u : γ → α} (hu : CauchySeq u) : CauchySeq (f ∘ u) :=
hu.map hf
#align uniform_continuous.comp_cauchy_seq UniformContinuous.comp_cauchySeq
Expand All @@ -304,7 +304,7 @@ theorem Filter.Tendsto.subseq_mem_entourage {V : ℕ → Set (α × α)} (hV :
#align filter.tendsto.subseq_mem_entourage Filter.Tendsto.subseq_mem_entourage

/-- If a Cauchy sequence has a convergent subsequence, then it converges. -/
theorem tendsto_nhds_of_cauchySeq_of_subseq [SemilatticeSup β] {u : β → α} (hu : CauchySeq u)
theorem tendsto_nhds_of_cauchySeq_of_subseq [Preorder β] {u : β → α} (hu : CauchySeq u)
{ι : Type*} {f : ι → β} {p : Filter ι} [NeBot p] (hf : Tendsto f p atTop) {a : α}
(ha : Tendsto (u ∘ f) p (𝓝 a)) : Tendsto u atTop (𝓝 a) :=
le_nhds_of_cauchy_adhp hu (mapClusterPt_of_comp hf ha)
Expand Down Expand Up @@ -465,13 +465,13 @@ theorem cauchy_map_iff_exists_tendsto [CompleteSpace α] {l : Filter β} {f : β
#align cauchy_map_iff_exists_tendsto cauchy_map_iff_exists_tendsto

/-- A Cauchy sequence in a complete space converges -/
theorem cauchySeq_tendsto_of_complete [SemilatticeSup β] [CompleteSpace α] {u : β → α}
theorem cauchySeq_tendsto_of_complete [Preorder β] [CompleteSpace α] {u : β → α}
(H : CauchySeq u) : ∃ x, Tendsto u atTop (𝓝 x) :=
CompleteSpace.complete H
#align cauchy_seq_tendsto_of_complete cauchySeq_tendsto_of_complete

/-- If `K` is a complete subset, then any cauchy sequence in `K` converges to a point in `K` -/
theorem cauchySeq_tendsto_of_isComplete [SemilatticeSup β] {K : Set α} (h₁ : IsComplete K)
theorem cauchySeq_tendsto_of_isComplete [Preorder β] {K : Set α} (h₁ : IsComplete K)
{u : β → α} (h₂ : ∀ n, u n ∈ K) (h₃ : CauchySeq u) : ∃ v ∈ K, Tendsto u atTop (𝓝 v) :=
h₁ _ h₃ <| le_principal_iff.2 <| mem_map_iff_exists_image.2
⟨univ, univ_mem, by rwa [image_univ, range_subset_iff]⟩
Expand All @@ -483,7 +483,7 @@ theorem Cauchy.le_nhds_lim [CompleteSpace α] [Nonempty α] {f : Filter α} (hf
set_option linter.uppercaseLean3 false in
#align cauchy.le_nhds_Lim Cauchy.le_nhds_lim

theorem CauchySeq.tendsto_limUnder [SemilatticeSup β] [CompleteSpace α] [Nonempty α] {u : β → α}
theorem CauchySeq.tendsto_limUnder [Preorder β] [CompleteSpace α] [Nonempty α] {u : β → α}
(h : CauchySeq u) : Tendsto u atTop (𝓝 <| limUnder atTop u) :=
h.le_nhds_lim
#align cauchy_seq.tendsto_lim CauchySeq.tendsto_limUnder
Expand Down

0 comments on commit 5f066e7

Please sign in to comment.