doc-next-gen

Mathlib.Topology.Instances.ENNReal.Lemmas

Module docstring

{"# Topology on extended non-negative reals "}

ENNReal.isOpen_ne_top theorem
: IsOpen {a : ℝ≥0∞ | a ≠ ∞}
Full source
theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ } := isOpen_ne
Openness of Finite Extended Non-Negative Reals
Informal description
The set $\{a \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid a \neq \infty\}$ is open in the order topology on the extended non-negative real numbers.
ENNReal.isOpen_Ico_zero theorem
: IsOpen (Ico 0 b)
Full source
theorem isOpen_Ico_zero : IsOpen (Ico 0 b) := by
  rw [ENNReal.Ico_eq_Iio]
  exact isOpen_Iio
Openness of the Interval $[0, b)$ in Extended Non-Negative Reals
Informal description
For any extended non-negative real number $b$, the left-closed right-open interval $[0, b)$ is an open set in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.coe_range_mem_nhds theorem
: range ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞)
Full source
theorem coe_range_mem_nhds : rangerange ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞) :=
  IsOpen.mem_nhds isOpenEmbedding_coe.isOpen_range <| mem_range_self _
Neighborhood Property of Canonical Embedding in Extended Non-Negative Reals
Informal description
The range of the canonical embedding from the non-negative real numbers $\mathbb{R}_{\geq 0}$ to the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is a neighborhood of any finite element $r \in \mathbb{R}_{\geq 0}$ in the order topology.
ENNReal.continuous_coe theorem
: Continuous ((↑) : ℝ≥0 → ℝ≥0∞)
Full source
@[fun_prop]
theorem continuous_coe : Continuous ((↑) : ℝ≥0 → ℝ≥0∞) :=
  isEmbedding_coe.continuous
Continuity of the Canonical Embedding from Non-Negative Reals to Extended Non-Negative Reals
Informal description
The canonical embedding from the non-negative real numbers $\mathbb{R}_{\geq 0}$ to the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is continuous with respect to the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tendsto_coe_toNNReal theorem
{a : ℝ≥0∞} (ha : a ≠ ⊤) : Tendsto (↑) (𝓝 a.toNNReal) (𝓝 a)
Full source
lemma tendsto_coe_toNNReal {a : ℝ≥0∞} (ha : a ≠ ⊤) : Tendsto (↑) (𝓝 a.toNNReal) (𝓝 a) := by
  nth_rewrite 2 [← coe_toNNReal ha]
  exact continuous_coe.tendsto _
Continuity of Finite-Valued Embedding from Non-Negative Reals to Extended Non-Negative Reals
Informal description
For any extended non-negative real number $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a \neq \infty$, the canonical embedding from $\mathbb{R}_{\geq 0}$ to $\mathbb{R}_{\geq 0} \cup \{\infty\}$ maps the neighborhood filter of $a$ as a non-negative real number to the neighborhood filter of $a$ in the extended non-negative reals. In other words, the embedding is continuous at $a$ when restricted to finite values.
ENNReal.continuous_coe_iff theorem
{α} [TopologicalSpace α] {f : α → ℝ≥0} : (Continuous fun a => (f a : ℝ≥0∞)) ↔ Continuous f
Full source
theorem continuous_coe_iff {α} [TopologicalSpace α] {f : α → ℝ≥0} :
    (Continuous fun a => (f a : ℝ≥0∞)) ↔ Continuous f :=
  isEmbedding_coe.continuous_iff.symm
Continuity Criterion via Extended Non-Negative Reals
Informal description
For any topological space $\alpha$ and any function $f \colon \alpha \to \mathbb{R}_{\geq 0}$, the function $f$ is continuous if and only if the composition $\alpha \xrightarrow{f} \mathbb{R}_{\geq 0} \xrightarrow{\iota} \mathbb{R}_{\geq 0} \cup \{\infty\}$ is continuous, where $\iota$ is the canonical inclusion map.
ENNReal.nhds_coe theorem
{r : ℝ≥0} : 𝓝 (r : ℝ≥0∞) = (𝓝 r).map (↑)
Full source
theorem nhds_coe {r : ℝ≥0} : 𝓝 (r : ℝ≥0∞) = (𝓝 r).map (↑) :=
  (isOpenEmbedding_coe.map_nhds_eq r).symm
Neighborhood Filter Preservation under Canonical Embedding of Non-Negative Reals
Informal description
For any extended non-negative real number $r \in \mathbb{R}_{\geq 0}$, the neighborhood filter $\mathcal{N}(r)$ in $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is equal to the image under the canonical embedding of the neighborhood filter $\mathcal{N}(r)$ in $\mathbb{R}_{\geq 0}$.
ENNReal.tendsto_nhds_coe_iff theorem
{α : Type*} {l : Filter α} {x : ℝ≥0} {f : ℝ≥0∞ → α} : Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ (↑) : ℝ≥0 → α) (𝓝 x) l
Full source
theorem tendsto_nhds_coe_iff {α : Type*} {l : Filter α} {x : ℝ≥0} {f : ℝ≥0∞ → α} :
    TendstoTendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ (↑) : ℝ≥0 → α) (𝓝 x) l := by
  rw [nhds_coe, tendsto_map'_iff]
Limit Characterization via Extended Non-Negative Reals: $f \to l$ at $x$ iff $f \circ \iota \to l$ at $x$
Informal description
For any type $\alpha$, filter $l$ on $\alpha$, non-negative real number $x \in \mathbb{R}_{\geq 0}$, and function $f \colon \mathbb{R}_{\geq 0} \cup \{\infty\} \to \alpha$, the function $f$ tends to $l$ as its argument approaches $x$ in $\mathbb{R}_{\geq 0} \cup \{\infty\}$ if and only if the composition $f \circ \iota \colon \mathbb{R}_{\geq 0} \to \alpha$ tends to $l$ as its argument approaches $x$ in $\mathbb{R}_{\geq 0}$, where $\iota$ is the canonical inclusion map from $\mathbb{R}_{\geq 0}$ to $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuousAt_coe_iff theorem
{α : Type*} [TopologicalSpace α] {x : ℝ≥0} {f : ℝ≥0∞ → α} : ContinuousAt f ↑x ↔ ContinuousAt (f ∘ (↑) : ℝ≥0 → α) x
Full source
theorem continuousAt_coe_iff {α : Type*} [TopologicalSpace α] {x : ℝ≥0} {f : ℝ≥0∞ → α} :
    ContinuousAtContinuousAt f ↑x ↔ ContinuousAt (f ∘ (↑) : ℝ≥0 → α) x :=
  tendsto_nhds_coe_iff
Continuity at Non-Negative Reals via Extended Non-Negative Reals
Informal description
For any topological space $\alpha$, non-negative real number $x \in \mathbb{R}_{\geq 0}$, and function $f \colon \mathbb{R}_{\geq 0} \cup \{\infty\} \to \alpha$, the function $f$ is continuous at $x$ (considered as an element of $\mathbb{R}_{\geq 0} \cup \{\infty\}$) if and only if the composition $f \circ \iota \colon \mathbb{R}_{\geq 0} \to \alpha$ is continuous at $x$, where $\iota$ is the canonical inclusion map from $\mathbb{R}_{\geq 0}$ to $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuous_ofReal theorem
: Continuous ENNReal.ofReal
Full source
theorem continuous_ofReal : Continuous ENNReal.ofReal :=
  (continuous_coe_iff.2 continuous_id).comp continuous_real_toNNReal
Continuity of the Extended Non-Negative Real Embedding
Informal description
The function $\text{ofReal} \colon \mathbb{R} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, which maps a real number to its corresponding extended non-negative real number, is continuous with respect to the standard topology on $\mathbb{R}$ and the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tendsto_ofReal theorem
{f : Filter α} {m : α → ℝ} {a : ℝ} (h : Tendsto m f (𝓝 a)) : Tendsto (fun a => ENNReal.ofReal (m a)) f (𝓝 (ENNReal.ofReal a))
Full source
theorem tendsto_ofReal {f : Filter α} {m : α → } {a : } (h : Tendsto m f (𝓝 a)) :
    Tendsto (fun a => ENNReal.ofReal (m a)) f (𝓝 (ENNReal.ofReal a)) :=
  (continuous_ofReal.tendsto a).comp h
Limit Preservation of the Extended Non-Negative Real Embedding
Informal description
Let $f$ be a filter on a type $\alpha$, $m \colon \alpha \to \mathbb{R}$ be a function, and $a \in \mathbb{R}$. If $m$ tends to $a$ along $f$ (i.e., $\lim_{x \to f} m(x) = a$), then the composition $\text{ENNReal.ofReal} \circ m$ tends to $\text{ENNReal.ofReal}(a)$ along $f$ (i.e., $\lim_{x \to f} \text{ENNReal.ofReal}(m(x)) = \text{ENNReal.ofReal}(a)$).
ENNReal.tendsto_toNNReal theorem
{a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto ENNReal.toNNReal (𝓝 a) (𝓝 a.toNNReal)
Full source
theorem tendsto_toNNReal {a : ℝ≥0∞} (ha : a ≠ ∞) :
    Tendsto ENNReal.toNNReal (𝓝 a) (𝓝 a.toNNReal) := by
  lift a to ℝ≥0 using ha
  rw [nhds_coe, tendsto_map'_iff]
  exact tendsto_id
Continuity of the Projection from Extended Non-Negative Reals to Non-Negative Reals at Finite Points
Informal description
For any extended non-negative real number $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a \neq \infty$, the function `ENNReal.toNNReal` (which maps $a$ to its finite part in $\mathbb{R}_{\geq 0}$) is continuous at $a$. In other words, the limit of `ENNReal.toNNReal` as $x$ approaches $a$ in the order topology is equal to `a.toNNReal`.
ENNReal.tendsto_toNNReal_iff theorem
{f : α → ℝ≥0∞} {u : Filter α} (ha : a ≠ ∞) (hf : ∀ x, f x ≠ ∞) : Tendsto (ENNReal.toNNReal ∘ f) u (𝓝 (a.toNNReal)) ↔ Tendsto f u (𝓝 a)
Full source
theorem tendsto_toNNReal_iff {f : α → ℝ≥0∞} {u : Filter α} (ha : a ≠ ∞) (hf : ∀ x, f x ≠ ∞) :
    TendstoTendsto (ENNReal.toNNReal ∘ f) u (𝓝 (a.toNNReal)) ↔ Tendsto f u (𝓝 a) := by
  refine ⟨fun h => ?_, fun h => (ENNReal.tendsto_toNNReal ha).comp h⟩
  rw [← coe_comp_toNNReal_comp hf]
  exact (tendsto_coe_toNNReal ha).comp h
Limit Characterization via Projection to Finite Non-Negative Reals
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and a filter $u$ on $\alpha$, if $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ is finite (i.e., $a \neq \infty$) and $f(x)$ is finite for all $x \in \alpha$, then the composition $\text{ENNReal.toNNReal} \circ f$ tends to $a.\text{toNNReal}$ along $u$ if and only if $f$ tends to $a$ along $u$.
ENNReal.tendsto_toNNReal_iff' theorem
{f : α → ℝ≥0∞} {u : Filter α} {a : ℝ≥0} (hf : ∀ x, f x ≠ ∞) : Tendsto (ENNReal.toNNReal ∘ f) u (𝓝 a) ↔ Tendsto f u (𝓝 a)
Full source
theorem tendsto_toNNReal_iff' {f : α → ℝ≥0∞} {u : Filter α} {a : ℝ≥0} (hf : ∀ x, f x ≠ ∞) :
    TendstoTendsto (ENNReal.toNNReal ∘ f) u (𝓝 a) ↔ Tendsto f u (𝓝 a) := by
  rw [← toNNReal_coe a]
  exact tendsto_toNNReal_iff coe_ne_top hf
Limit Characterization via Projection to Finite Non-Negative Reals (Finite Case)
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and a filter $u$ on $\alpha$, if $f(x)$ is finite (i.e., $f(x) \neq \infty$) for all $x \in \alpha$, then the composition $\text{ENNReal.toNNReal} \circ f$ tends to $a \in \mathbb{R}_{\geq 0}$ along $u$ if and only if $f$ tends to $a$ along $u$.
ENNReal.eventuallyEq_of_toReal_eventuallyEq theorem
{l : Filter α} {f g : α → ℝ≥0∞} (hfi : ∀ᶠ x in l, f x ≠ ∞) (hgi : ∀ᶠ x in l, g x ≠ ∞) (hfg : (fun x => (f x).toReal) =ᶠ[l] fun x => (g x).toReal) : f =ᶠ[l] g
Full source
theorem eventuallyEq_of_toReal_eventuallyEq {l : Filter α} {f g : α → ℝ≥0∞}
    (hfi : ∀ᶠ x in l, f x ≠ ∞) (hgi : ∀ᶠ x in l, g x ≠ ∞)
    (hfg : (fun x => (f x).toReal) =ᶠ[l] fun x => (g x).toReal) : f =ᶠ[l] g := by
  filter_upwards [hfi, hgi, hfg] with _ hfx hgx _
  rwa [← ENNReal.toReal_eq_toReal hfx hgx]
Eventual Equality of Extended Non-Negative Real Functions via Real Projection
Informal description
Let $l$ be a filter on a type $\alpha$, and let $f, g : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be extended non-negative real-valued functions. Suppose that for all $x$ in a set eventually in $l$, both $f(x)$ and $g(x)$ are finite (i.e., $f(x) \neq \infty$ and $g(x) \neq \infty$). If the real-valued functions $x \mapsto f(x).\text{toReal}$ and $x \mapsto g(x).\text{toReal}$ are eventually equal in $l$, then $f$ and $g$ are themselves eventually equal in $l$.
ENNReal.continuousOn_toNNReal theorem
: ContinuousOn ENNReal.toNNReal {a | a ≠ ∞}
Full source
theorem continuousOn_toNNReal : ContinuousOn ENNReal.toNNReal { a | a ≠ ∞ } := fun _a ha =>
  ContinuousAt.continuousWithinAt (tendsto_toNNReal ha)
Continuity of Finite Projection on Extended Non-Negative Reals
Informal description
The function `ENNReal.toNNReal`, which maps an extended non-negative real number to its finite part in $\mathbb{R}_{\geq 0}$, is continuous on the set of all extended non-negative real numbers excluding infinity, i.e., $\{a \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid a \neq \infty\}$.
ENNReal.tendsto_toReal theorem
{a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto ENNReal.toReal (𝓝 a) (𝓝 a.toReal)
Full source
theorem tendsto_toReal {a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto ENNReal.toReal (𝓝 a) (𝓝 a.toReal) :=
  NNReal.tendsto_coe.2 <| tendsto_toNNReal ha
Continuity of the Real Projection from Extended Non-Negative Reals at Finite Points
Informal description
For any extended non-negative real number $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a \neq \infty$, the function mapping $x$ to its real part (via `ENNReal.toReal`) is continuous at $a$. That is, $\lim_{x \to a} \text{toReal}(x) = \text{toReal}(a)$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuousOn_toReal theorem
: ContinuousOn ENNReal.toReal {a | a ≠ ∞}
Full source
lemma continuousOn_toReal : ContinuousOn ENNReal.toReal { a | a ≠ ∞ } :=
  NNReal.continuous_coe.comp_continuousOn continuousOn_toNNReal
Continuity of the Real Projection on Finite Extended Non-Negative Reals
Informal description
The function $\text{toReal} : \mathbb{R}_{\geq 0} \cup \{\infty\} \to \mathbb{R}$, which maps an extended non-negative real number to its finite part in $\mathbb{R}$, is continuous on the set $\{a \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid a \neq \infty\}$.
ENNReal.continuousAt_toReal theorem
(hx : x ≠ ∞) : ContinuousAt ENNReal.toReal x
Full source
lemma continuousAt_toReal (hx : x ≠ ∞) : ContinuousAt ENNReal.toReal x :=
  continuousOn_toReal.continuousAt (isOpen_ne_top.mem_nhds_iff.mpr hx)
Continuity of Real Projection at Finite Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $x \neq \infty$, the function $\text{toReal} : \mathbb{R}_{\geq 0} \cup \{\infty\} \to \mathbb{R}$ is continuous at $x$.
ENNReal.neTopHomeomorphNNReal definition
: {a | a ≠ ∞} ≃ₜ ℝ≥0
Full source
/-- The set of finite `ℝ≥0∞` numbers is homeomorphic to `ℝ≥0`. -/
def neTopHomeomorphNNReal : { a | a ≠ ∞ }{ a | a ≠ ∞ } ≃ₜ ℝ≥0 where
  toEquiv := neTopEquivNNReal
  continuous_toFun := continuousOn_iff_continuous_restrict.1 continuousOn_toNNReal
  continuous_invFun := continuous_coe.subtype_mk _
Homeomorphism between finite extended non-negative reals and non-negative reals
Informal description
The set of finite extended non-negative real numbers $\{a \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid a \neq \infty\}$ is homeomorphic to the space of non-negative real numbers $\mathbb{R}_{\geq 0}$. The homeomorphism is given by the natural bijection between these sets, with continuity in both directions ensured by the continuity of the restriction of the projection map and the inclusion map.
ENNReal.ltTopHomeomorphNNReal definition
: {a | a < ∞} ≃ₜ ℝ≥0
Full source
/-- The set of finite `ℝ≥0∞` numbers is homeomorphic to `ℝ≥0`. -/
def ltTopHomeomorphNNReal : { a | a < ∞ }{ a | a < ∞ } ≃ₜ ℝ≥0 := by
  refine (Homeomorph.setCongr ?_).trans neTopHomeomorphNNReal
  simp only [mem_setOf_eq, lt_top_iff_ne_top]
Homeomorphism between finite extended non-negative reals and non-negative reals
Informal description
The set of finite extended non-negative real numbers $\{a \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid a < \infty\}$ is homeomorphic to the space of non-negative real numbers $\mathbb{R}_{\geq 0}$. The homeomorphism is given by the natural bijection between these sets, with continuity in both directions ensured by the continuity of the restriction of the projection map and the inclusion map.
ENNReal.nhds_top theorem
: 𝓝 ∞ = ⨅ (a) (_ : a ≠ ∞), 𝓟 (Ioi a)
Full source
theorem nhds_top : 𝓝  = ⨅ (a) (_ : a ≠ ∞), 𝓟 (Ioi a) :=
  nhds_top_order.trans <| by simp [lt_top_iff_ne_top, Ioi]
Neighborhood Filter at Infinity in Extended Non-Negative Reals
Informal description
The neighborhood filter at infinity in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is equal to the infimum over all $a \neq \infty$ of the principal filter generated by the left-open right-infinite interval $(a, \infty)$.
ENNReal.nhds_top' theorem
: 𝓝 ∞ = ⨅ r : ℝ≥0, 𝓟 (Ioi ↑r)
Full source
theorem nhds_top' : 𝓝  = ⨅ r : ℝ≥0, 𝓟 (Ioi ↑r) :=
  nhds_top.trans <| iInf_ne_top _
Neighborhood Filter at Infinity in Extended Non-Negative Reals via Non-Negative Reals
Informal description
The neighborhood filter at infinity in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is equal to the infimum over all non-negative real numbers $r$ of the principal filter generated by the left-open right-infinite interval $(r, \infty)$.
ENNReal.nhds_top_basis theorem
: (𝓝 ∞).HasBasis (fun a => a < ∞) fun a => Ioi a
Full source
theorem nhds_top_basis : (𝓝 ).HasBasis (fun a => a < ) fun a => Ioi a :=
  _root_.nhds_top_basis
Basis for Neighborhood Filter at Infinity in Extended Non-Negative Reals
Informal description
The neighborhood filter at infinity in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ has a basis consisting of left-open right-infinite intervals $(a, \infty)$, where $a$ ranges over all elements of $\mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a < \infty$.
ENNReal.tendsto_nhds_top_iff_nnreal theorem
{m : α → ℝ≥0∞} {f : Filter α} : Tendsto m f (𝓝 ∞) ↔ ∀ x : ℝ≥0, ∀ᶠ a in f, ↑x < m a
Full source
theorem tendsto_nhds_top_iff_nnreal {m : α → ℝ≥0∞} {f : Filter α} :
    TendstoTendsto m f (𝓝 ∞) ↔ ∀ x : ℝ≥0, ∀ᶠ a in f, ↑x < m a := by
  simp only [nhds_top', tendsto_iInf, tendsto_principal, mem_Ioi]
Characterization of Tendency to Infinity in Extended Non-Negative Reals via Non-Negative Reals
Informal description
For a function $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and a filter $f$ on $\alpha$, the function $m$ tends to $\infty$ along $f$ if and only if for every non-negative real number $x$, the set $\{a \in \alpha \mid x < m(a)\}$ is eventually in $f$.
ENNReal.tendsto_nhds_top_iff_nat theorem
{m : α → ℝ≥0∞} {f : Filter α} : Tendsto m f (𝓝 ∞) ↔ ∀ n : ℕ, ∀ᶠ a in f, ↑n < m a
Full source
theorem tendsto_nhds_top_iff_nat {m : α → ℝ≥0∞} {f : Filter α} :
    TendstoTendsto m f (𝓝 ∞) ↔ ∀ n : ℕ, ∀ᶠ a in f, ↑n < m a :=
  tendsto_nhds_top_iff_nnreal.trans
    ⟨fun h n => by simpa only [ENNReal.coe_natCast] using h n, fun h x =>
      let ⟨n, hn⟩ := exists_nat_gt x
      (h n).mono fun _ => lt_trans <| by rwa [← ENNReal.coe_natCast, coe_lt_coe]⟩
Characterization of Convergence to Infinity in Extended Non-Negative Reals via Natural Numbers
Informal description
For a function $m \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and a filter $f$ on $\alpha$, the function $m$ tends to $\infty$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$ along $f$ if and only if for every natural number $n$, the set $\{a \in \alpha \mid n < m(a)\}$ is eventually in $f$.
ENNReal.tendsto_nhds_top theorem
{m : α → ℝ≥0∞} {f : Filter α} (h : ∀ n : ℕ, ∀ᶠ a in f, ↑n < m a) : Tendsto m f (𝓝 ∞)
Full source
theorem tendsto_nhds_top {m : α → ℝ≥0∞} {f : Filter α} (h : ∀ n : , ∀ᶠ a in f, ↑n < m a) :
    Tendsto m f (𝓝 ) :=
  tendsto_nhds_top_iff_nat.2 h
Sufficient Condition for Tendency to Infinity in Extended Non-Negative Reals
Informal description
For a function $m \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and a filter $f$ on $\alpha$, if for every natural number $n$ the set $\{a \in \alpha \mid n < m(a)\}$ is eventually in $f$, then $m$ tends to $\infty$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$ along $f$.
ENNReal.tendsto_nat_nhds_top theorem
: Tendsto (fun n : ℕ => ↑n) atTop (𝓝 ∞)
Full source
theorem tendsto_nat_nhds_top : Tendsto (fun n :  => ↑n) atTop (𝓝 ) :=
  tendsto_nhds_top fun n =>
    mem_atTop_sets.2 ⟨n + 1, fun _m hm => mem_setOf.2 <| Nat.cast_lt.2 <| Nat.lt_of_succ_le hm⟩
Natural Number Sequence Tends to Infinity in Extended Non-Negative Reals
Informal description
The sequence of extended non-negative real numbers $(n)_{n \in \mathbb{N}}$, where each natural number $n$ is cast to $\mathbb{R}_{\geq 0} \cup \{\infty\}$, tends to $\infty$ in the order topology as $n$ tends to $\infty$ in the natural numbers.
ENNReal.tendsto_coe_nhds_top theorem
{f : α → ℝ≥0} {l : Filter α} : Tendsto (fun x => (f x : ℝ≥0∞)) l (𝓝 ∞) ↔ Tendsto f l atTop
Full source
@[simp, norm_cast]
theorem tendsto_coe_nhds_top {f : α → ℝ≥0} {l : Filter α} :
    TendstoTendsto (fun x => (f x : ℝ≥0∞)) l (𝓝 ∞) ↔ Tendsto f l atTop := by
  rw [tendsto_nhds_top_iff_nnreal, atTop_basis_Ioi.tendsto_right_iff]; simp
Tendency to Infinity in Extended Non-Negative Reals via Non-Negative Reals
Informal description
For a function $f : \alpha \to \mathbb{R}_{\geq 0}$ and a filter $l$ on $\alpha$, the function $x \mapsto (f(x) : \mathbb{R}_{\geq 0} \cup \{\infty\})$ tends to $\infty$ along $l$ if and only if $f$ tends to $\infty$ along $l$.
ENNReal.tendsto_ofReal_nhds_top theorem
{f : α → ℝ} {l : Filter α} : Tendsto (fun x ↦ ENNReal.ofReal (f x)) l (𝓝 ∞) ↔ Tendsto f l atTop
Full source
@[simp]
theorem tendsto_ofReal_nhds_top {f : α → } {l : Filter α} :
    TendstoTendsto (fun x ↦ ENNReal.ofReal (f x)) l (𝓝 ∞) ↔ Tendsto f l atTop :=
  tendsto_coe_nhds_top.trans Real.tendsto_toNNReal_atTop_iff
Tendency to Infinity via Extended Non-Negative Real Embedding
Informal description
For a function $f : \alpha \to \mathbb{R}$ and a filter $l$ on $\alpha$, the function $x \mapsto \text{ENNReal.ofReal}(f(x))$ tends to $\infty$ along $l$ if and only if $f$ tends to $\infty$ along $l$.
ENNReal.tendsto_ofReal_atTop theorem
: Tendsto ENNReal.ofReal atTop (𝓝 ∞)
Full source
theorem tendsto_ofReal_atTop : Tendsto ENNReal.ofReal atTop (𝓝 ) :=
  tendsto_ofReal_nhds_top.2 tendsto_id
Limit of Extended Non-Negative Real Embedding at Infinity is Infinity
Informal description
The function $\text{ENNReal.ofReal} : \mathbb{R} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ tends to $\infty$ as its input tends to $\infty$. In other words, $\lim_{x \to \infty} \text{ENNReal.ofReal}(x) = \infty$.
ENNReal.nhds_zero theorem
: 𝓝 (0 : ℝ≥0∞) = ⨅ (a) (_ : a ≠ 0), 𝓟 (Iio a)
Full source
theorem nhds_zero : 𝓝 (0 : ℝ≥0∞) = ⨅ (a) (_ : a ≠ 0), 𝓟 (Iio a) :=
  nhds_bot_order.trans <| by simp [pos_iff_ne_zero, Iio]
Neighborhood Filter at Zero in Extended Non-Negative Reals
Informal description
The neighborhood filter at $0$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is equal to the infimum of the principal filters generated by the left-infinite right-open intervals $(-\infty, a)$ for all $a \neq 0$, i.e., \[ \mathcal{N}(0) = \biginf_{a \neq 0} \mathcal{P}((-\infty, a)). \]
ENNReal.nhds_zero_basis theorem
: (𝓝 (0 : ℝ≥0∞)).HasBasis (fun a : ℝ≥0∞ => 0 < a) fun a => Iio a
Full source
theorem nhds_zero_basis : (𝓝 (0 : ℝ≥0∞)).HasBasis (fun a : ℝ≥0∞ => 0 < a) fun a => Iio a :=
  nhds_bot_basis
Basis of Neighborhoods at Zero in Extended Non-Negative Reals via Open Intervals
Informal description
The neighborhood filter at $0$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ has a basis consisting of the left-infinite right-open intervals $(-\infty, a)$ for all $a > 0$. That is, \[ \mathcal{N}(0) \text{ has basis } \{ (-\infty, a) \mid a > 0 \}. \]
ENNReal.nhds_zero_basis_Iic theorem
: (𝓝 (0 : ℝ≥0∞)).HasBasis (fun a : ℝ≥0∞ => 0 < a) Iic
Full source
theorem nhds_zero_basis_Iic : (𝓝 (0 : ℝ≥0∞)).HasBasis (fun a : ℝ≥0∞ => 0 < a) Iic :=
  nhds_bot_basis_Iic
Basis of Neighborhoods at Zero in Extended Non-Negative Reals via Closed Intervals
Informal description
The neighborhood filter at $0$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ has a basis consisting of the closed intervals $[0, a]$ for all $a > 0$.
ENNReal.nhdsGT_coe_neBot theorem
{r : ℝ≥0} : (𝓝[>] (r : ℝ≥0∞)).NeBot
Full source
@[instance]
theorem nhdsGT_coe_neBot {r : ℝ≥0} : (𝓝[>] (r : ℝ≥0∞)).NeBot :=
  nhdsGT_neBot_of_exists_gt ⟨∞, ENNReal.coe_lt_top⟩
Non-triviality of Right Neighborhoods for Extended Non-Negative Reals
Informal description
For any extended non-negative real number $r \in \mathbb{R}_{\geq 0}$, the right neighborhood filter $\mathcal{N}_{>}(r)$ (consisting of all sets containing an open interval $(r, r+\epsilon)$ for some $\epsilon > 0$) is non-trivial (i.e., does not contain the empty set).
ENNReal.nhdsGT_zero_neBot theorem
: (𝓝[>] (0 : ℝ≥0∞)).NeBot
Full source
@[instance] theorem nhdsGT_zero_neBot : (𝓝[>] (0 : ℝ≥0∞)).NeBot := nhdsGT_coe_neBot
Non-triviality of Right Neighborhood Filter at Zero in Extended Non-Negative Reals
Informal description
The right neighborhood filter at $0$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is non-trivial, i.e., it does not contain the empty set.
ENNReal.nhdsGT_one_neBot theorem
: (𝓝[>] (1 : ℝ≥0∞)).NeBot
Full source
@[instance] theorem nhdsGT_one_neBot : (𝓝[>] (1 : ℝ≥0∞)).NeBot := nhdsGT_coe_neBot
Non-triviality of Right Neighborhood Filter at 1 in Extended Non-Negative Reals
Informal description
The right neighborhood filter at $1$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is non-trivial, i.e., $\mathcal{N}_{>}(1) \neq \bot$.
ENNReal.nhdsGT_nat_neBot theorem
(n : ℕ) : (𝓝[>] (n : ℝ≥0∞)).NeBot
Full source
@[instance] theorem nhdsGT_nat_neBot (n : ) : (𝓝[>] (n : ℝ≥0∞)).NeBot := nhdsGT_coe_neBot
Non-triviality of Right Neighborhoods at Natural Numbers in Extended Non-Negative Reals
Informal description
For any natural number $n$, the right neighborhood filter $\mathcal{N}_{>}(n)$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is non-trivial, i.e., it does not contain the empty set.
ENNReal.nhdsGT_ofNat_neBot theorem
(n : ℕ) [n.AtLeastTwo] : (𝓝[>] (OfNat.ofNat n : ℝ≥0∞)).NeBot
Full source
@[instance]
theorem nhdsGT_ofNat_neBot (n : ) [n.AtLeastTwo] : (𝓝[>] (OfNat.ofNat n : ℝ≥0∞)).NeBot :=
  nhdsGT_coe_neBot
Non-triviality of Right Neighborhoods at Numeric Literals $\geq 2$ in Extended Non-Negative Reals
Informal description
For any natural number $n \geq 2$, the right neighborhood filter $\mathcal{N}_{>}(n)$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ is non-trivial (i.e., does not contain the empty set).
ENNReal.nhdsLT_neBot theorem
[NeZero x] : (𝓝[<] x).NeBot
Full source
@[instance]
theorem nhdsLT_neBot [NeZero x] : (𝓝[<] x).NeBot :=
  nhdsWithin_Iio_self_neBot' ⟨0, NeZero.pos x⟩
Non-triviality of Left Neighborhoods at Nonzero Extended Non-Negative Reals
Informal description
For any nonzero element $x$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$, the left neighborhood filter $\mathcal{N}_{<}(x)$ is non-trivial (i.e., does not contain the empty set).
ENNReal.hasBasis_nhds_of_ne_top' theorem
(xt : x ≠ ∞) : (𝓝 x).HasBasis (· ≠ 0) (fun ε => Icc (x - ε) (x + ε))
Full source
/-- Closed intervals `Set.Icc (x - ε) (x + ε)`, `ε ≠ 0`, form a basis of neighborhoods of an
extended nonnegative real number `x ≠ ∞`. We use `Set.Icc` instead of `Set.Ioo` because this way the
statement works for `x = 0`.
-/
theorem hasBasis_nhds_of_ne_top' (xt : x ≠ ∞) :
    (𝓝 x).HasBasis (· ≠ 0) (fun ε => Icc (x - ε) (x + ε)) := by
  rcases (zero_le x).eq_or_gt with rfl | x0
  · simp_rw [zero_tsub, zero_add, ← bot_eq_zero, Icc_bot, ← bot_lt_iff_ne_bot]
    exact nhds_bot_basis_Iic
  · refine (nhds_basis_Ioo' ⟨_, x0⟩ ⟨_, xt.lt_top⟩).to_hasBasis ?_ fun ε ε0 => ?_
    · rintro ⟨a, b⟩ ⟨ha, hb⟩
      rcases exists_between (tsub_pos_of_lt ha) with ⟨ε, ε0, hε⟩
      rcases lt_iff_exists_add_pos_lt.1 hb with ⟨δ, δ0, hδ⟩
      refine ⟨min ε δ, (lt_min ε0 (coe_pos.2 δ0)).ne', Icc_subset_Ioo ?_ ?_⟩
      · exact lt_tsub_comm.2 ((min_le_left _ _).trans_lt hε)
      · exact (add_le_add_left (min_le_right _ _) _).trans_lt hδ
    · exact ⟨(x - ε, x + ε), ⟨ENNReal.sub_lt_self xt x0.ne' ε0,
        lt_add_right xt ε0⟩, Ioo_subset_Icc_self⟩
Closed Intervals Form Neighborhood Basis for Finite Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \neq \infty$, the neighborhood filter $\mathcal{N}(x)$ has a basis consisting of closed intervals $[x - \varepsilon, x + \varepsilon]$ for all $\varepsilon \neq 0$.
ENNReal.hasBasis_nhds_of_ne_top theorem
(xt : x ≠ ∞) : (𝓝 x).HasBasis (0 < ·) (fun ε => Icc (x - ε) (x + ε))
Full source
theorem hasBasis_nhds_of_ne_top (xt : x ≠ ∞) :
    (𝓝 x).HasBasis (0 < ·) (fun ε => Icc (x - ε) (x + ε)) := by
  simpa only [pos_iff_ne_zero] using hasBasis_nhds_of_ne_top' xt
Closed Intervals Form a Neighborhood Basis for Finite Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \neq \infty$, the neighborhood filter $\mathcal{N}(x)$ has a basis consisting of closed intervals $[x - \varepsilon, x + \varepsilon]$ for all $\varepsilon > 0$.
ENNReal.Icc_mem_nhds theorem
(xt : x ≠ ∞) (ε0 : ε ≠ 0) : Icc (x - ε) (x + ε) ∈ 𝓝 x
Full source
theorem Icc_mem_nhds (xt : x ≠ ∞) (ε0 : ε ≠ 0) : IccIcc (x - ε) (x + ε) ∈ 𝓝 x :=
  (hasBasis_nhds_of_ne_top' xt).mem_of_mem ε0
Closed Interval is a Neighborhood of Finite Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \neq \infty$ and any $\varepsilon \neq 0$, the closed interval $[x - \varepsilon, x + \varepsilon]$ is a neighborhood of $x$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.nhds_of_ne_top theorem
(xt : x ≠ ∞) : 𝓝 x = ⨅ ε > 0, 𝓟 (Icc (x - ε) (x + ε))
Full source
theorem nhds_of_ne_top (xt : x ≠ ∞) : 𝓝 x = ⨅ ε > 0, 𝓟 (Icc (x - ε) (x + ε)) :=
  (hasBasis_nhds_of_ne_top xt).eq_biInf
Neighborhood Filter Characterization for Finite Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \neq \infty$, the neighborhood filter $\mathcal{N}(x)$ is equal to the infimum over all $\varepsilon > 0$ of the principal filters generated by the closed intervals $[x - \varepsilon, x + \varepsilon]$.
ENNReal.biInf_le_nhds theorem
: ∀ x : ℝ≥0∞, ⨅ ε > 0, 𝓟 (Icc (x - ε) (x + ε)) ≤ 𝓝 x
Full source
theorem biInf_le_nhds : ∀ x : ℝ≥0∞, ⨅ ε > 0, 𝓟 (Icc (x - ε) (x + ε))𝓝 x
  |  => iInf₂_le_of_le 1 one_pos <| by
    simpa only [← coe_one, top_sub_coe, top_add, Icc_self, principal_singleton] using pure_le_nhds _
  | (x : ℝ≥0) => (nhds_of_ne_top coe_ne_top).ge
Infimum of Closed Interval Filters Bounds Neighborhood Filter in Extended Non-Negative Reals
Informal description
For any extended non-negative real number $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the infimum over all $\varepsilon > 0$ of the principal filters generated by the closed intervals $[x - \varepsilon, x + \varepsilon]$ is less than or equal to the neighborhood filter of $x$.
ENNReal.tendsto_nhds_of_Icc theorem
{f : Filter α} {u : α → ℝ≥0∞} {a : ℝ≥0∞} (h : ∀ ε > 0, ∀ᶠ x in f, u x ∈ Icc (a - ε) (a + ε)) : Tendsto u f (𝓝 a)
Full source
protected theorem tendsto_nhds_of_Icc {f : Filter α} {u : α → ℝ≥0∞} {a : ℝ≥0∞}
    (h : ∀ ε > 0, ∀ᶠ x in f, u x ∈ Icc (a - ε) (a + ε)) : Tendsto u f (𝓝 a) := by
  refine Tendsto.mono_right ?_ (biInf_le_nhds _)
  simpa only [tendsto_iInf, tendsto_principal]
Convergence in Extended Non-Negative Reals via Closed Intervals
Informal description
Let $f$ be a filter on a type $\alpha$, $u : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function, and $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$. If for every $\varepsilon > 0$, the set $\{x \in \alpha \mid u(x) \in [a - \varepsilon, a + \varepsilon]\}$ is eventually in $f$, then the limit of $u$ along $f$ is $a$.
ENNReal.tendsto_nhds theorem
{f : Filter α} {u : α → ℝ≥0∞} {a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto u f (𝓝 a) ↔ ∀ ε > 0, ∀ᶠ x in f, u x ∈ Icc (a - ε) (a + ε)
Full source
/-- Characterization of neighborhoods for `ℝ≥0∞` numbers. See also `tendsto_order`
for a version with strict inequalities. -/
protected theorem tendsto_nhds {f : Filter α} {u : α → ℝ≥0∞} {a : ℝ≥0∞} (ha : a ≠ ∞) :
    TendstoTendsto u f (𝓝 a) ↔ ∀ ε > 0, ∀ᶠ x in f, u x ∈ Icc (a - ε) (a + ε) := by
  simp only [nhds_of_ne_top ha, tendsto_iInf, tendsto_principal]
Characterization of Convergence in Extended Non-Negative Reals via Closed Intervals
Informal description
Let $f$ be a filter on a type $\alpha$, $u : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function, and $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a \neq \infty$. Then, the limit of $u$ along $f$ is $a$ if and only if for every $\varepsilon > 0$, the set $\{x \in \alpha \mid u(x) \in [a - \varepsilon, a + \varepsilon]\}$ is eventually in $f$.
ENNReal.tendsto_nhds_zero theorem
{f : Filter α} {u : α → ℝ≥0∞} : Tendsto u f (𝓝 0) ↔ ∀ ε > 0, ∀ᶠ x in f, u x ≤ ε
Full source
protected theorem tendsto_nhds_zero {f : Filter α} {u : α → ℝ≥0∞} :
    TendstoTendsto u f (𝓝 0) ↔ ∀ ε > 0, ∀ᶠ x in f, u x ≤ ε :=
  nhds_zero_basis_Iic.tendsto_right_iff
Characterization of Convergence to Zero in Extended Non-Negative Reals
Informal description
For any filter $f$ on a type $\alpha$ and any function $u : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the limit of $u$ along $f$ is $0$ if and only if for every $\varepsilon > 0$, the set $\{x \in \alpha \mid u(x) \leq \varepsilon\}$ is eventually in $f$.
ENNReal.tendsto_const_sub_nhds_zero_iff theorem
{l : Filter α} {f : α → ℝ≥0∞} {a : ℝ≥0∞} (ha : a ≠ ∞) (hfa : ∀ n, f n ≤ a) : Tendsto (fun n ↦ a - f n) l (𝓝 0) ↔ Tendsto (fun n ↦ f n) l (𝓝 a)
Full source
theorem tendsto_const_sub_nhds_zero_iff {l : Filter α} {f : α → ℝ≥0∞} {a : ℝ≥0∞} (ha : a ≠ ∞)
    (hfa : ∀ n, f n ≤ a) :
    TendstoTendsto (fun n ↦ a - f n) l (𝓝 0) ↔ Tendsto (fun n ↦ f n) l (𝓝 a) := by
  rw [ENNReal.tendsto_nhds_zero, ENNReal.tendsto_nhds ha]
  refine ⟨fun h ε hε ↦ ?_, fun h ε hε ↦ ?_⟩
  · filter_upwards [h ε hε] with n hn
    refine ⟨?_, (hfa n).trans (le_add_right le_rfl)⟩
    rw [tsub_le_iff_right] at hn ⊢
    rwa [add_comm]
  · filter_upwards [h ε hε] with n hn
    have hN_left := hn.1
    rw [tsub_le_iff_right] at hN_left ⊢
    rwa [add_comm]
Convergence of $a - f(x)$ to Zero is Equivalent to Convergence of $f(x)$ to $a$ in Extended Non-Negative Reals
Informal description
Let $l$ be a filter on a type $\alpha$, $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function, and $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $a \neq \infty$. Suppose that $f(x) \leq a$ for all $x \in \alpha$. Then, the function $x \mapsto a - f(x)$ tends to $0$ along $l$ if and only if $f$ tends to $a$ along $l$.
ENNReal.tendsto_atTop theorem
[Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} {a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto f atTop (𝓝 a) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ∈ Icc (a - ε) (a + ε)
Full source
protected theorem tendsto_atTop [Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} {a : ℝ≥0∞}
    (ha : a ≠ ∞) : TendstoTendsto f atTop (𝓝 a) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ∈ Icc (a - ε) (a + ε) :=
  .trans (atTop_basis.tendsto_iff (hasBasis_nhds_of_ne_top ha)) (by simp only [true_and]; rfl)
Characterization of Convergence to Finite Extended Non-Negative Reals via Closed Intervals
Informal description
For a nonempty directed set $\beta$ and a function $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, if $a \in \mathbb{R}_{\geq 0}$ (i.e., $a \neq \infty$), then the limit of $f$ at infinity is $a$ if and only if for every $\varepsilon > 0$, there exists an index $N \in \beta$ such that for all $n \geq N$, $f(n) \in [a - \varepsilon, a + \varepsilon]$.
ENNReal.tendsto_atTop_zero theorem
[Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} : Tendsto f atTop (𝓝 0) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ≤ ε
Full source
protected theorem tendsto_atTop_zero [Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} :
    TendstoTendsto f atTop (𝓝 0) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ≤ ε :=
  .trans (atTop_basis.tendsto_iff nhds_zero_basis_Iic) (by simp only [true_and]; rfl)
Characterization of Convergence to Zero in Extended Non-Negative Reals
Informal description
For a nonempty directed set $\beta$ and a function $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the limit of $f$ at infinity is $0$ if and only if for every $\varepsilon > 0$, there exists an index $N \in \beta$ such that for all $n \geq N$, $f(n) \leq \varepsilon$.
ENNReal.tendsto_atTop_zero_iff_le_of_antitone theorem
{β : Type*} [Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} (hf : Antitone f) : Filter.Tendsto f Filter.atTop (𝓝 0) ↔ ∀ ε, 0 < ε → ∃ n : β, f n ≤ ε
Full source
theorem tendsto_atTop_zero_iff_le_of_antitone {β : Type*} [Nonempty β] [SemilatticeSup β]
    {f : β → ℝ≥0∞} (hf : Antitone f) :
    Filter.TendstoFilter.Tendsto f Filter.atTop (𝓝 0) ↔ ∀ ε, 0 < ε → ∃ n : β, f n ≤ ε := by
  rw [ENNReal.tendsto_atTop_zero]
  refine ⟨fun h ↦ fun ε hε ↦ ?_, fun h ↦ fun ε hε ↦ ?_⟩
  · obtain ⟨n, hn⟩ := h ε hε
    exact ⟨n, hn n le_rfl⟩
  · obtain ⟨n, hn⟩ := h ε hε
    exact ⟨n, fun m hm ↦ (hf hm).trans hn⟩
Convergence to Zero for Antitone Functions in Extended Non-Negative Reals
Informal description
For a nonempty directed set $\beta$ and an antitone function $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the limit of $f$ at infinity is $0$ if and only if for every $\varepsilon > 0$, there exists an index $n \in \beta$ such that $f(n) \leq \varepsilon$.
ENNReal.tendsto_atTop_zero_iff_lt_of_antitone theorem
{β : Type*} [Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} (hf : Antitone f) : Filter.Tendsto f Filter.atTop (𝓝 0) ↔ ∀ ε, 0 < ε → ∃ n : β, f n < ε
Full source
theorem tendsto_atTop_zero_iff_lt_of_antitone {β : Type*} [Nonempty β] [SemilatticeSup β]
    {f : β → ℝ≥0∞} (hf : Antitone f) :
    Filter.TendstoFilter.Tendsto f Filter.atTop (𝓝 0) ↔ ∀ ε, 0 < ε → ∃ n : β, f n < ε := by
  rw [ENNReal.tendsto_atTop_zero_iff_le_of_antitone hf]
  constructor <;> intro h ε hε
  · obtain ⟨n, hn⟩ := h (min 1 (ε / 2))
      (lt_min_iff.mpr ⟨zero_lt_one, (ENNReal.div_pos_iff.mpr ⟨ne_of_gt hε, ENNReal.ofNat_ne_top⟩)⟩)
    · refine ⟨n, hn.trans_lt ?_⟩
      by_cases hε_top : ε = ∞
      · rw [hε_top]
        exact (min_le_left _ _).trans_lt ENNReal.one_lt_top
      refine (min_le_right _ _).trans_lt ?_
      rw [ENNReal.div_lt_iff (Or.inr hε.ne') (Or.inr hε_top)]
      conv_lhs => rw [← mul_one ε]
      rw [ENNReal.mul_lt_mul_left hε.ne' hε_top]
      norm_num
  · obtain ⟨n, hn⟩ := h ε hε
    exact ⟨n, hn.le⟩
Convergence to Zero for Antitone Functions in Extended Non-Negative Reals via Strict Inequality
Informal description
Let $\beta$ be a nonempty directed set and $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be an antitone function. The limit of $f$ at infinity is $0$ if and only if for every $\varepsilon > 0$, there exists an index $n \in \beta$ such that $f(n) < \varepsilon$.
ENNReal.tendsto_sub theorem
: ∀ {a b : ℝ≥0∞}, (a ≠ ∞ ∨ b ≠ ∞) → Tendsto (fun p : ℝ≥0∞ × ℝ≥0∞ => p.1 - p.2) (𝓝 (a, b)) (𝓝 (a - b))
Full source
theorem tendsto_sub : ∀ {a b : ℝ≥0∞}, (a ≠ ∞a ≠ ∞ ∨ b ≠ ∞) →
    Tendsto (fun p : ℝ≥0∞ℝ≥0∞ × ℝ≥0∞ => p.1 - p.2) (𝓝 (a, b)) (𝓝 (a - b))
  | , , h => by simp only [ne_eq, not_true_eq_false, or_self] at h
  | , (b : ℝ≥0), _ => by
    rw [top_sub_coe, tendsto_nhds_top_iff_nnreal]
    refine fun x => ((lt_mem_nhds <| @coe_lt_top (b + 1 + x)).prod_nhds
      (ge_mem_nhds <| coe_lt_coe.2 <| lt_add_one b)).mono fun y hy => ?_
    rw [lt_tsub_iff_left]
    calc y.2 + x ≤ ↑(b + 1) + x := add_le_add_right hy.2 _
    _ < y.1 := hy.1
  | (a : ℝ≥0), , _ => by
    rw [sub_top]
    refine (tendsto_pure.2 ?_).mono_right (pure_le_nhds _)
    exact ((gt_mem_nhds <| coe_lt_coe.2 <| lt_add_one a).prod_nhds
      (lt_mem_nhds <| @coe_lt_top (a + 1))).mono fun x hx =>
        tsub_eq_zero_iff_le.2 (hx.1.trans hx.2).le
  | (a : ℝ≥0), (b : ℝ≥0), _ => by
    simp only [nhds_coe_coe, tendsto_map'_iff, ← ENNReal.coe_sub, Function.comp_def, tendsto_coe]
    exact continuous_sub.tendsto (a, b)
Continuity of Subtraction in Extended Non-Negative Reals
Informal description
For any extended non-negative real numbers $a, b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that at least one of $a$ or $b$ is finite, the subtraction function $(x, y) \mapsto x - y$ is continuous at $(a, b)$. That is, the limit of $x - y$ as $(x, y)$ approaches $(a, b)$ is $a - b$.
ENNReal.Tendsto.sub theorem
{f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞} (hma : Tendsto ma f (𝓝 a)) (hmb : Tendsto mb f (𝓝 b)) (h : a ≠ ∞ ∨ b ≠ ∞) : Tendsto (fun a => ma a - mb a) f (𝓝 (a - b))
Full source
protected theorem Tendsto.sub {f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hma : Tendsto ma f (𝓝 a)) (hmb : Tendsto mb f (𝓝 b)) (h : a ≠ ∞a ≠ ∞ ∨ b ≠ ∞) :
    Tendsto (fun a => ma a - mb a) f (𝓝 (a - b)) :=
  show Tendsto ((fun p : ℝ≥0∞ × ℝ≥0∞ => p.1 - p.2) ∘ fun a => (ma a, mb a)) f (𝓝 (a - b)) from
    Tendsto.comp (ENNReal.tendsto_sub h) (hma.prodMk_nhds hmb)
Convergence of Difference in Extended Non-Negative Reals
Informal description
Let $\alpha$ be a type equipped with a filter $f$, and let $m_a, m_b \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions such that $m_a$ converges to $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ and $m_b$ converges to $b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ under the filter $f$. If at least one of $a$ or $b$ is finite (i.e., $a \neq \infty$ or $b \neq \infty$), then the function $x \mapsto m_a(x) - m_b(x)$ converges to $a - b$ under the filter $f$.
ENNReal.tendsto_mul theorem
(ha : a ≠ 0 ∨ b ≠ ∞) (hb : b ≠ 0 ∨ a ≠ ∞) : Tendsto (fun p : ℝ≥0∞ × ℝ≥0∞ => p.1 * p.2) (𝓝 (a, b)) (𝓝 (a * b))
Full source
protected theorem tendsto_mul (ha : a ≠ 0a ≠ 0 ∨ b ≠ ∞) (hb : b ≠ 0b ≠ 0 ∨ a ≠ ∞) :
    Tendsto (fun p : ℝ≥0∞ℝ≥0∞ × ℝ≥0∞ => p.1 * p.2) (𝓝 (a, b)) (𝓝 (a * b)) := by
  have ht : ∀ b : ℝ≥0∞, b ≠ 0Tendsto (fun p : ℝ≥0∞ℝ≥0∞ × ℝ≥0∞ => p.1 * p.2) (𝓝 (∞, b)) (𝓝 ) := fun b hb => by
    refine tendsto_nhds_top_iff_nnreal.2 fun n => ?_
    rcases lt_iff_exists_nnreal_btwn.1 (pos_iff_ne_zero.2 hb) with ⟨ε, hε, hεb⟩
    have : ∀ᶠ c : ℝ≥0∞ × ℝ≥0∞ in 𝓝 (∞, b), ↑n / ↑ε < c.1 ∧ ↑ε < c.2 :=
      (lt_mem_nhds <| div_lt_top coe_ne_top hε.ne').prod_nhds (lt_mem_nhds hεb)
    refine this.mono fun c hc => ?_
    exact (ENNReal.div_mul_cancel hε.ne' coe_ne_top).symm.trans_lt (mul_lt_mul hc.1 hc.2)
  induction a with
  | top => simp only [ne_eq, or_false, not_true_eq_false] at hb; simp [ht b hb, top_mul hb]
  | coe a =>
    induction b with
    | top =>
      simp only [ne_eq, or_false, not_true_eq_false] at ha
      simpa [Function.comp_def, mul_comm, mul_top ha]
        using (ht a ha).comp (continuous_swap.tendsto (ofNNReal a, ∞))
    | coe b =>
      simp only [nhds_coe_coe, ← coe_mul, tendsto_coe, tendsto_map'_iff, Function.comp_def,
        tendsto_mul]
Continuity of Multiplication in Extended Non-Negative Reals
Informal description
Let $a, b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ be extended non-negative real numbers such that either $a \neq 0$ or $b \neq \infty$, and either $b \neq 0$ or $a \neq \infty$. Then the multiplication function $(x, y) \mapsto x \cdot y$ is continuous at $(a, b)$, meaning that for any neighborhood of $a \cdot b$, there exists a neighborhood of $(a, b)$ whose image under multiplication is contained in the given neighborhood of $a \cdot b$.
ENNReal.Tendsto.mul theorem
{f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞} (hma : Tendsto ma f (𝓝 a)) (ha : a ≠ 0 ∨ b ≠ ∞) (hmb : Tendsto mb f (𝓝 b)) (hb : b ≠ 0 ∨ a ≠ ∞) : Tendsto (fun a => ma a * mb a) f (𝓝 (a * b))
Full source
protected theorem Tendsto.mul {f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hma : Tendsto ma f (𝓝 a)) (ha : a ≠ 0a ≠ 0 ∨ b ≠ ∞) (hmb : Tendsto mb f (𝓝 b))
    (hb : b ≠ 0b ≠ 0 ∨ a ≠ ∞) : Tendsto (fun a => ma a * mb a) f (𝓝 (a * b)) :=
  show Tendsto ((fun p : ℝ≥0∞ × ℝ≥0∞ => p.1 * p.2) ∘ fun a => (ma a, mb a)) f (𝓝 (a * b)) from
    Tendsto.comp (ENNReal.tendsto_mul ha hb) (hma.prodMk_nhds hmb)
Convergence of Product in Extended Non-Negative Reals
Informal description
Let $\alpha$ be a type with a filter $f$, and let $m_a, m_b : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions converging to $a, b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ respectively under the filter $f$. Suppose that either $a \neq 0$ or $b \neq \infty$, and either $b \neq 0$ or $a \neq \infty$. Then the product function $x \mapsto m_a(x) \cdot m_b(x)$ converges to $a \cdot b$ under the filter $f$.
ContinuousOn.ennreal_mul theorem
[TopologicalSpace α] {f g : α → ℝ≥0∞} {s : Set α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (h₁ : ∀ x ∈ s, f x ≠ 0 ∨ g x ≠ ∞) (h₂ : ∀ x ∈ s, g x ≠ 0 ∨ f x ≠ ∞) : ContinuousOn (fun x => f x * g x) s
Full source
theorem _root_.ContinuousOn.ennreal_mul [TopologicalSpace α] {f g : α → ℝ≥0∞} {s : Set α}
    (hf : ContinuousOn f s) (hg : ContinuousOn g s) (h₁ : ∀ x ∈ s, f x ≠ 0 ∨ g x ≠ ∞)
    (h₂ : ∀ x ∈ s, g x ≠ 0 ∨ f x ≠ ∞) : ContinuousOn (fun x => f x * g x) s := fun x hx =>
  ENNReal.Tendsto.mul (hf x hx) (h₁ x hx) (hg x hx) (h₂ x hx)
Continuity of Product on Extended Non-Negative Reals Restricted to a Set
Informal description
Let $\alpha$ be a topological space, $f, g : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions, and $s \subseteq \alpha$ be a subset. If $f$ and $g$ are continuous on $s$, and for every $x \in s$ either $f(x) \neq 0$ or $g(x) \neq \infty$ holds, and either $g(x) \neq 0$ or $f(x) \neq \infty$ holds, then the product function $x \mapsto f(x) \cdot g(x)$ is continuous on $s$.
Continuous.ennreal_mul theorem
[TopologicalSpace α] {f g : α → ℝ≥0∞} (hf : Continuous f) (hg : Continuous g) (h₁ : ∀ x, f x ≠ 0 ∨ g x ≠ ∞) (h₂ : ∀ x, g x ≠ 0 ∨ f x ≠ ∞) : Continuous fun x => f x * g x
Full source
theorem _root_.Continuous.ennreal_mul [TopologicalSpace α] {f g : α → ℝ≥0∞} (hf : Continuous f)
    (hg : Continuous g) (h₁ : ∀ x, f x ≠ 0f x ≠ 0 ∨ g x ≠ ∞) (h₂ : ∀ x, g x ≠ 0g x ≠ 0 ∨ f x ≠ ∞) :
    Continuous fun x => f x * g x :=
  continuous_iff_continuousAt.2 fun x =>
    ENNReal.Tendsto.mul hf.continuousAt (h₁ x) hg.continuousAt (h₂ x)
Continuity of Multiplication of Continuous Extended Non-Negative Real-Valued Functions
Informal description
Let $\alpha$ be a topological space and $f, g : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be continuous functions. Suppose that for every $x \in \alpha$, either $f(x) \neq 0$ or $g(x) \neq \infty$, and either $g(x) \neq 0$ or $f(x) \neq \infty$. Then the product function $x \mapsto f(x) \cdot g(x)$ is continuous.
ENNReal.Tendsto.const_mul theorem
{f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞} (hm : Tendsto m f (𝓝 b)) (hb : b ≠ 0 ∨ a ≠ ∞) : Tendsto (fun b => a * m b) f (𝓝 (a * b))
Full source
protected theorem Tendsto.const_mul {f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hm : Tendsto m f (𝓝 b)) (hb : b ≠ 0b ≠ 0 ∨ a ≠ ∞) : Tendsto (fun b => a * m b) f (𝓝 (a * b)) :=
  by_cases (fun (this : a = 0) => by simp [this, tendsto_const_nhds]) fun ha : a ≠ 0 =>
    ENNReal.Tendsto.mul tendsto_const_nhds (Or.inl ha) hm hb
Convergence of Constant Multiple in Extended Non-Negative Reals
Informal description
Let $\alpha$ be a type with a filter $f$, and let $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function converging to $b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ under the filter $f$. If either $b \neq 0$ or $a \neq \infty$, then the function $x \mapsto a \cdot m(x)$ converges to $a \cdot b$ under the filter $f$.
ENNReal.Tendsto.mul_const theorem
{f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞} (hm : Tendsto m f (𝓝 a)) (ha : a ≠ 0 ∨ b ≠ ∞) : Tendsto (fun x => m x * b) f (𝓝 (a * b))
Full source
protected theorem Tendsto.mul_const {f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hm : Tendsto m f (𝓝 a)) (ha : a ≠ 0a ≠ 0 ∨ b ≠ ∞) : Tendsto (fun x => m x * b) f (𝓝 (a * b)) := by
  simpa only [mul_comm] using ENNReal.Tendsto.const_mul hm ha
Convergence of Multiplication by a Constant in Extended Non-Negative Reals
Informal description
Let $\alpha$ be a type with a filter $f$, and let $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function converging to $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ under the filter $f$. If either $a \neq 0$ or $b \neq \infty$, then the function $x \mapsto m(x) \cdot b$ converges to $a \cdot b$ under the filter $f$.
ENNReal.tendsto_finset_prod_of_ne_top theorem
{ι : Type*} {f : ι → α → ℝ≥0∞} {x : Filter α} {a : ι → ℝ≥0∞} (s : Finset ι) (h : ∀ i ∈ s, Tendsto (f i) x (𝓝 (a i))) (h' : ∀ i ∈ s, a i ≠ ∞) : Tendsto (fun b => ∏ c ∈ s, f c b) x (𝓝 (∏ c ∈ s, a c))
Full source
theorem tendsto_finset_prod_of_ne_top {ι : Type*} {f : ι → α → ℝ≥0∞} {x : Filter α} {a : ι → ℝ≥0∞}
    (s : Finset ι) (h : ∀ i ∈ s, Tendsto (f i) x (𝓝 (a i))) (h' : ∀ i ∈ s, a i ≠ ∞) :
    Tendsto (fun b => ∏ c ∈ s, f c b) x (𝓝 (∏ c ∈ s, a c)) := by
  classical
  induction s using Finset.induction with
  | empty => simp [tendsto_const_nhds]
  | insert _ _ has IH =>
    simp only [Finset.prod_insert has]
    apply Tendsto.mul (h _ (Finset.mem_insert_self _ _))
    · right
      exact prod_ne_top fun i hi => h' _ (Finset.mem_insert_of_mem hi)
    · exact IH (fun i hi => h _ (Finset.mem_insert_of_mem hi)) fun i hi =>
        h' _ (Finset.mem_insert_of_mem hi)
    · exact Or.inr (h' _ (Finset.mem_insert_self _ _))
Convergence of Finite Product in Extended Non-Negative Reals with Finite Limits
Informal description
Let $\{f_i : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}\}_{i \in \iota}$ be a family of functions indexed by a finite set $s \subset \iota$, and let $\{a_i\}_{i \in s}$ be a family of extended non-negative real numbers. Suppose that for each $i \in s$, the function $f_i$ converges to $a_i$ under the filter $x$ on $\alpha$, and that $a_i \neq \infty$ for all $i \in s$. Then the product function $b \mapsto \prod_{c \in s} f_c(b)$ converges to $\prod_{c \in s} a_c$ under the filter $x$.
ENNReal.continuousAt_const_mul theorem
{a b : ℝ≥0∞} (h : a ≠ ∞ ∨ b ≠ 0) : ContinuousAt (a * ·) b
Full source
protected theorem continuousAt_const_mul {a b : ℝ≥0∞} (h : a ≠ ∞a ≠ ∞ ∨ b ≠ 0) :
    ContinuousAt (a * ·) b :=
  Tendsto.const_mul tendsto_id h.symm
Continuity of Constant Multiplication in Extended Non-Negative Reals
Informal description
For any extended non-negative real numbers $a$ and $b$, if either $a \neq \infty$ or $b \neq 0$, then the function $x \mapsto a \cdot x$ is continuous at $b$.
ENNReal.continuousAt_mul_const theorem
{a b : ℝ≥0∞} (h : a ≠ ∞ ∨ b ≠ 0) : ContinuousAt (fun x => x * a) b
Full source
protected theorem continuousAt_mul_const {a b : ℝ≥0∞} (h : a ≠ ∞a ≠ ∞ ∨ b ≠ 0) :
    ContinuousAt (fun x => x * a) b :=
  Tendsto.mul_const tendsto_id h.symm
Continuity of Right Multiplication in Extended Non-Negative Reals
Informal description
For any extended non-negative real numbers $a$ and $b$, if either $a \neq \infty$ or $b \neq 0$, then the function $x \mapsto x \cdot a$ is continuous at $b$.
ENNReal.continuous_const_mul theorem
{a : ℝ≥0∞} (ha : a ≠ ∞) : Continuous (a * ·)
Full source
@[fun_prop]
protected theorem continuous_const_mul {a : ℝ≥0∞} (ha : a ≠ ∞) : Continuous (a * ·) :=
  continuous_iff_continuousAt.2 fun _ => ENNReal.continuousAt_const_mul (Or.inl ha)
Continuity of Left Multiplication by Finite Extended Non-Negative Real
Informal description
For any extended non-negative real number $a \neq \infty$, the function $x \mapsto a \cdot x$ is continuous on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuous_mul_const theorem
{a : ℝ≥0∞} (ha : a ≠ ∞) : Continuous fun x => x * a
Full source
@[fun_prop]
protected theorem continuous_mul_const {a : ℝ≥0∞} (ha : a ≠ ∞) : Continuous fun x => x * a :=
  continuous_iff_continuousAt.2 fun _ => ENNReal.continuousAt_mul_const (Or.inl ha)
Continuity of Right Multiplication by Finite Extended Non-Negative Real
Informal description
For any extended non-negative real number $a \neq \infty$, the function $x \mapsto x \cdot a$ is continuous on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuous_div_const theorem
(c : ℝ≥0∞) (c_ne_zero : c ≠ 0) : Continuous fun x : ℝ≥0∞ => x / c
Full source
@[fun_prop]
protected theorem continuous_div_const (c : ℝ≥0∞) (c_ne_zero : c ≠ 0) :
    Continuous fun x : ℝ≥0∞ => x / c :=
  ENNReal.continuous_mul_const <| ENNReal.inv_ne_top.2 c_ne_zero
Continuity of Division by Nonzero Extended Non-Negative Real
Informal description
For any extended non-negative real number $c \neq 0$, the function $x \mapsto x / c$ is continuous on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuous_pow theorem
(n : ℕ) : Continuous fun a : ℝ≥0∞ => a ^ n
Full source
@[continuity, fun_prop]
protected theorem continuous_pow (n : ) : Continuous fun a : ℝ≥0∞ => a ^ n := by
  induction n with
  | zero => simp [continuous_const]
  | succ n IH =>
    simp_rw [pow_add, pow_one, continuous_iff_continuousAt]
    intro x
    refine ENNReal.Tendsto.mul (IH.tendsto _) ?_ tendsto_id ?_ <;> by_cases H : x = 0
    · simp only [H, zero_ne_top, Ne, or_true, not_false_iff]
    · exact Or.inl fun h => H (pow_eq_zero h)
    · simp only [H, pow_eq_top_iff, zero_ne_top, false_or, eq_self_iff_true, not_true, Ne,
        not_false_iff, false_and]
    · simp only [H, true_or, Ne, not_false_iff]
Continuity of Power Function on Extended Non-Negative Reals
Informal description
For any natural number $n$, the function $a \mapsto a^n$ is continuous on the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuousOn_sub theorem
: ContinuousOn (fun p : ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) {p : ℝ≥0∞ × ℝ≥0∞ | p ≠ ⟨∞, ∞⟩}
Full source
theorem continuousOn_sub :
    ContinuousOn (fun p : ℝ≥0∞ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) { p : ℝ≥0∞ × ℝ≥0∞ | p ≠ ⟨∞, ∞⟩ } := by
  rw [ContinuousOn]
  rintro ⟨x, y⟩ hp
  simp only [Ne, Set.mem_setOf_eq, Prod.mk_inj] at hp
  exact tendsto_nhdsWithin_of_tendsto_nhds (tendsto_sub (not_and_or.mp hp))
Continuity of Subtraction on Extended Non-Negative Reals Away from $(\infty, \infty)$
Informal description
The subtraction function $(x, y) \mapsto x - y$ is continuous on the set of pairs $(x, y) \in \mathbb{R}_{\geq 0} \cup \{\infty\} \times \mathbb{R}_{\geq 0} \cup \{\infty\}$ where $(x, y) \neq (\infty, \infty)$.
ENNReal.continuous_sub_left theorem
{a : ℝ≥0∞} (a_ne_top : a ≠ ∞) : Continuous (a - ·)
Full source
theorem continuous_sub_left {a : ℝ≥0∞} (a_ne_top : a ≠ ∞) : Continuous (a - ·) := by
  change Continuous (Function.uncurryFunction.uncurry Sub.sub ∘ (a, ·))
  refine continuousOn_sub.comp_continuous (.prodMk_right a) fun x => ?_
  simp only [a_ne_top, Ne, mem_setOf_eq, Prod.mk_inj, false_and, not_false_iff]
Continuity of Left Subtraction by Finite Extended Non-Negative Real
Informal description
For any extended non-negative real number $a \neq \infty$, the function $x \mapsto a - x$ is continuous on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuous_nnreal_sub theorem
{a : ℝ≥0} : Continuous fun x : ℝ≥0∞ => (a : ℝ≥0∞) - x
Full source
theorem continuous_nnreal_sub {a : ℝ≥0} : Continuous fun x : ℝ≥0∞ => (a : ℝ≥0∞) - x :=
  continuous_sub_left coe_ne_top
Continuity of Subtraction by Non-Negative Real in Extended Non-Negative Reals
Informal description
For any non-negative real number $a \in \mathbb{R}_{\geq 0}$, the function $x \mapsto a - x$ is continuous on the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.continuousOn_sub_left theorem
(a : ℝ≥0∞) : ContinuousOn (a - ·) {x : ℝ≥0∞ | x ≠ ∞}
Full source
theorem continuousOn_sub_left (a : ℝ≥0∞) : ContinuousOn (a - ·) { x : ℝ≥0∞ | x ≠ ∞ } := by
  rw [show (fun x => a - x) = (fun p : ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) ∘ fun x => ⟨a, x⟩ by rfl]
  apply continuousOn_sub.comp (by fun_prop)
  rintro _ h (_ | _)
  exact h none_eq_top
Continuity of Left Subtraction on Extended Non-Negative Reals Away from Infinity
Informal description
For any extended non-negative real number $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the function $x \mapsto a - x$ is continuous on the set $\{x \in \mathbb{R}_{\geq 0} \cup \{\infty\} \mid x \neq \infty\}$.
ENNReal.continuous_sub_right theorem
(a : ℝ≥0∞) : Continuous fun x : ℝ≥0∞ => x - a
Full source
theorem continuous_sub_right (a : ℝ≥0∞) : Continuous fun x : ℝ≥0∞ => x - a := by
  by_cases a_infty : a = ∞
  · simp [a_infty, continuous_const, tsub_eq_zero_of_le]
  · rw [show (fun x => x - a) = (fun p : ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) ∘ fun x => ⟨x, a⟩ by rfl]
    apply continuousOn_sub.comp_continuous (by fun_prop)
    intro x
    simp only [a_infty, Ne, mem_setOf_eq, Prod.mk_inj, and_false, not_false_iff]
Continuity of Right Subtraction in Extended Non-Negative Reals
Informal description
For any extended non-negative real number $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the function $x \mapsto x - a$ is continuous on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.Tendsto.pow theorem
{f : Filter α} {m : α → ℝ≥0∞} {a : ℝ≥0∞} {n : ℕ} (hm : Tendsto m f (𝓝 a)) : Tendsto (fun x => m x ^ n) f (𝓝 (a ^ n))
Full source
protected theorem Tendsto.pow {f : Filter α} {m : α → ℝ≥0∞} {a : ℝ≥0∞} {n : }
    (hm : Tendsto m f (𝓝 a)) : Tendsto (fun x => m x ^ n) f (𝓝 (a ^ n)) :=
  ((ENNReal.continuous_pow n).tendsto a).comp hm
Limit of Powers in Extended Non-Negative Reals
Informal description
Let $(m_x)_{x \in \alpha}$ be a family of extended non-negative real numbers indexed by a type $\alpha$, and let $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$. If $m_x$ tends to $a$ along a filter $f$ on $\alpha$, then for any natural number $n$, the sequence $(m_x^n)_{x \in \alpha}$ tends to $a^n$ along the same filter $f$.
ENNReal.le_of_forall_lt_one_mul_le theorem
{x y : ℝ≥0∞} (h : ∀ a < 1, a * x ≤ y) : x ≤ y
Full source
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0∞} (h : ∀ a < 1, a * x ≤ y) : x ≤ y := by
  have : Tendsto (· * x) (𝓝[<] 1) (𝓝 (1 * x)) :=
    (ENNReal.continuousAt_mul_const (Or.inr one_ne_zero)).mono_left inf_le_left
  rw [one_mul] at this
  exact le_of_tendsto this (eventually_nhdsWithin_iff.2 <| Eventually.of_forall h)
Inequality via Multiplicative Test in Extended Non-Negative Reals
Informal description
For any extended non-negative real numbers $x$ and $y$, if for all $a < 1$ we have $a \cdot x \leq y$, then $x \leq y$.
ENNReal.inv_limsup theorem
{ι : Sort _} {x : ι → ℝ≥0∞} {l : Filter ι} : (limsup x l)⁻¹ = liminf (fun i => (x i)⁻¹) l
Full source
theorem inv_limsup {ι : Sort _} {x : ι → ℝ≥0∞} {l : Filter ι} :
    (limsup x l)⁻¹ = liminf (fun i => (x i)⁻¹) l :=
  OrderIso.invENNRealOrderIso.invENNReal.limsup_apply
Reciprocal of Limit Superior Equals Limit Inferior of Reciprocals in Extended Non-Negative Reals
Informal description
For any family of extended non-negative real numbers $(x_i)_{i \in \iota}$ and any filter $l$ on $\iota$, the reciprocal of the limit superior of $(x_i)$ is equal to the limit inferior of the reciprocals $(x_i^{-1})$. That is, $$ \left(\limsup_{i \in l} x_i\right)^{-1} = \liminf_{i \in l} \frac{1}{x_i}. $$
ENNReal.inv_liminf theorem
{ι : Sort _} {x : ι → ℝ≥0∞} {l : Filter ι} : (liminf x l)⁻¹ = limsup (fun i => (x i)⁻¹) l
Full source
theorem inv_liminf {ι : Sort _} {x : ι → ℝ≥0∞} {l : Filter ι} :
    (liminf x l)⁻¹ = limsup (fun i => (x i)⁻¹) l :=
  OrderIso.invENNRealOrderIso.invENNReal.liminf_apply
Inverse and Limit Inferior/Superior Relation in Extended Non-Negative Reals
Informal description
For any filter $l$ on an index type $\iota$ and any family of extended non-negative real numbers $(x_i)_{i \in \iota}$, the inverse of the limit inferior of $(x_i)$ equals the limit superior of the inverses $(x_i^{-1})$. That is, $$(\liminf_{l} x_i)^{-1} = \limsup_{l} (x_i^{-1}).$$
ENNReal.continuous_zpow theorem
: ∀ n : ℤ, Continuous (· ^ n : ℝ≥0∞ → ℝ≥0∞)
Full source
@[fun_prop]
protected theorem continuous_zpow : ∀ n : , Continuous (· ^ n : ℝ≥0∞ℝ≥0∞)
  | (n : ℕ) => mod_cast ENNReal.continuous_pow n
  | .negSucc n => by simpa using (ENNReal.continuous_pow _).inv
Continuity of Integer Power Function on Extended Non-Negative Reals
Informal description
For every integer $n$, the power function $x \mapsto x^n$ is continuous on the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tendsto_inv_iff theorem
{f : Filter α} {m : α → ℝ≥0∞} {a : ℝ≥0∞} : Tendsto (fun x => (m x)⁻¹) f (𝓝 a⁻¹) ↔ Tendsto m f (𝓝 a)
Full source
@[simp] -- TODO: generalize to `[InvolutiveInv _] [ContinuousInv _]`
protected theorem tendsto_inv_iff {f : Filter α} {m : α → ℝ≥0∞} {a : ℝ≥0∞} :
    TendstoTendsto (fun x => (m x)⁻¹) f (𝓝 a⁻¹) ↔ Tendsto m f (𝓝 a) :=
  ⟨fun h => by simpa only [inv_inv] using Tendsto.inv h, Tendsto.inv⟩
Inverse Function Limit Characterization in Extended Non-Negative Reals
Informal description
Let $f$ be a filter on a type $\alpha$, and let $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function. For any extended non-negative real number $a$, the function $x \mapsto (m x)^{-1}$ tends to $a^{-1}$ along the filter $f$ if and only if $m$ tends to $a$ along $f$.
ENNReal.Tendsto.div theorem
{f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞} (hma : Tendsto ma f (𝓝 a)) (ha : a ≠ 0 ∨ b ≠ 0) (hmb : Tendsto mb f (𝓝 b)) (hb : b ≠ ∞ ∨ a ≠ ∞) : Tendsto (fun a => ma a / mb a) f (𝓝 (a / b))
Full source
protected theorem Tendsto.div {f : Filter α} {ma : α → ℝ≥0∞} {mb : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hma : Tendsto ma f (𝓝 a)) (ha : a ≠ 0a ≠ 0 ∨ b ≠ 0) (hmb : Tendsto mb f (𝓝 b))
    (hb : b ≠ ∞b ≠ ∞ ∨ a ≠ ∞) : Tendsto (fun a => ma a / mb a) f (𝓝 (a / b)) := by
  apply Tendsto.mul hma _ (ENNReal.tendsto_inv_iff.2 hmb) _ <;> simp [ha, hb]
Convergence of Quotient in Extended Non-Negative Reals
Informal description
Let $f$ be a filter on a type $\alpha$, and let $m_a, m_b : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions converging to $a, b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ respectively under the filter $f$. Suppose that either $a \neq 0$ or $b \neq 0$, and either $b \neq \infty$ or $a \neq \infty$. Then the quotient function $x \mapsto m_a(x) / m_b(x)$ converges to $a / b$ under the filter $f$.
ENNReal.Tendsto.const_div theorem
{f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞} (hm : Tendsto m f (𝓝 b)) (hb : b ≠ ∞ ∨ a ≠ ∞) : Tendsto (fun b => a / m b) f (𝓝 (a / b))
Full source
protected theorem Tendsto.const_div {f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hm : Tendsto m f (𝓝 b)) (hb : b ≠ ∞b ≠ ∞ ∨ a ≠ ∞) : Tendsto (fun b => a / m b) f (𝓝 (a / b)) := by
  apply Tendsto.const_mul (ENNReal.tendsto_inv_iff.2 hm)
  simp [hb]
Convergence of Constant Divided by Function in Extended Non-Negative Reals
Informal description
Let $f$ be a filter on a type $\alpha$, and let $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function converging to $b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ under the filter $f$. If either $b \neq \infty$ or $a \neq \infty$, then the function $x \mapsto a / m(x)$ converges to $a / b$ under the filter $f$.
ENNReal.Tendsto.div_const theorem
{f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞} (hm : Tendsto m f (𝓝 a)) (ha : a ≠ 0 ∨ b ≠ 0) : Tendsto (fun x => m x / b) f (𝓝 (a / b))
Full source
protected theorem Tendsto.div_const {f : Filter α} {m : α → ℝ≥0∞} {a b : ℝ≥0∞}
    (hm : Tendsto m f (𝓝 a)) (ha : a ≠ 0a ≠ 0 ∨ b ≠ 0) : Tendsto (fun x => m x / b) f (𝓝 (a / b)) := by
  apply Tendsto.mul_const hm
  simp [ha]
Convergence of Function Divided by Constant in Extended Non-Negative Reals
Informal description
Let $f$ be a filter on a type $\alpha$, and let $m : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function converging to $a \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ under the filter $f$. If either $a \neq 0$ or $b \neq 0$, then the function $x \mapsto m(x) / b$ converges to $a / b$ under the filter $f$.
ENNReal.tendsto_inv_nat_nhds_zero theorem
: Tendsto (fun n : ℕ => (n : ℝ≥0∞)⁻¹) atTop (𝓝 0)
Full source
protected theorem tendsto_inv_nat_nhds_zero : Tendsto (fun n :  => (n : ℝ≥0∞)⁻¹) atTop (𝓝 0) :=
  ENNReal.inv_topENNReal.tendsto_inv_iff.2 tendsto_nat_nhds_top
Reciprocal Sequence Convergence to Zero in Extended Non-Negative Reals
Informal description
The sequence of reciprocals of natural numbers, viewed as extended non-negative real numbers, converges to $0$ in the order topology. That is, $\lim_{n \to \infty} \frac{1}{n} = 0$ in $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tendsto_coe_sub theorem
{b : ℝ≥0∞} : Tendsto (fun b : ℝ≥0∞ => ↑r - b) (𝓝 b) (𝓝 (↑r - b))
Full source
protected theorem tendsto_coe_sub {b : ℝ≥0∞} :
    Tendsto (fun b : ℝ≥0∞ => ↑r - b) (𝓝 b) (𝓝 (↑r - b)) :=
  continuous_nnreal_sub.tendsto _
Continuity of Subtraction by Non-Negative Real in Extended Non-Negative Reals at Any Point
Informal description
For any extended non-negative real number $b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the function $x \mapsto r - x$ is continuous at $b$, where $r$ is a non-negative real number viewed as an element of $\mathbb{R}_{\geq 0} \cup \{\infty\}$ via the canonical inclusion map.
ENNReal.exists_countable_dense_no_zero_top theorem
: ∃ s : Set ℝ≥0∞, s.Countable ∧ Dense s ∧ 0 ∉ s ∧ ∞ ∉ s
Full source
theorem exists_countable_dense_no_zero_top :
    ∃ s : Set ℝ≥0∞, s.Countable ∧ Dense s ∧ 0 ∉ s ∧ ∞ ∉ s := by
  obtain ⟨s, s_count, s_dense, hs⟩ :
    ∃ s : Set ℝ≥0∞, s.Countable ∧ Dense s ∧ (∀ x, IsBot x → x ∉ s) ∧ ∀ x, IsTop x → x ∉ s :=
    exists_countable_dense_no_bot_top ℝ≥0∞
  exact ⟨s, s_count, s_dense, fun h => hs.1 0 (by simp) h, fun h => hs.2 ∞ (by simp) h⟩
Existence of Countable Dense Subset in Extended Non-Negative Reals Avoiding Zero and Infinity
Informal description
There exists a countable dense subset $s$ of the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $0 \notin s$ and $\infty \notin s$.
ENNReal.exists_frequently_lt_of_liminf_ne_top theorem
{ι : Type*} {l : Filter ι} {x : ι → ℝ} (hx : liminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, x n < R
Full source
theorem exists_frequently_lt_of_liminf_ne_top {ι : Type*} {l : Filter ι} {x : ι → }
    (hx : liminfliminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, x n < R := by
  by_contra h
  simp_rw [not_exists, not_frequently, not_lt] at h
  refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_)
  simp only [eventually_map, ENNReal.coe_le_coe]
  filter_upwards [h r] with i hi using hi.trans (le_abs_self (x i))
Existence of Upper Bound for Frequently Small Terms When Liminf is Finite
Informal description
Let $\{x_n\}_{n \in \iota}$ be a sequence of real numbers indexed by a type $\iota$, and let $l$ be a filter on $\iota$. If the liminf of the sequence $\{\|x_n\|\}_{n \in \iota}$ (viewed in the extended non-negative reals) is not equal to $\infty$, then there exists a real number $R$ such that $x_n < R$ frequently in $l$.
ENNReal.exists_frequently_lt_of_liminf_ne_top' theorem
{ι : Type*} {l : Filter ι} {x : ι → ℝ} (hx : liminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, R < x n
Full source
theorem exists_frequently_lt_of_liminf_ne_top' {ι : Type*} {l : Filter ι} {x : ι → }
    (hx : liminfliminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, R < x n := by
  by_contra h
  simp_rw [not_exists, not_frequently, not_lt] at h
  refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_)
  simp only [eventually_map, ENNReal.coe_le_coe]
  filter_upwards [h (-r)] with i hi using(le_neg.1 hi).trans (neg_le_abs _)
Existence of Lower Bound for Frequently Large Terms When Liminf is Finite
Informal description
Let $\{x_n\}_{n \in \iota}$ be a sequence of real numbers indexed by a type $\iota$, and let $l$ be a filter on $\iota$. If the liminf of the sequence $\{\|x_n\|\}_{n \in \iota}$ (viewed in the extended non-negative reals) is not equal to $\infty$, then there exists a real number $R$ such that $R < x_n$ frequently in $l$.
ENNReal.exists_upcrossings_of_not_bounded_under theorem
{ι : Type*} {l : Filter ι} {x : ι → ℝ} (hf : liminf (fun i => (Real.nnabs (x i) : ℝ≥0∞)) l ≠ ∞) (hbdd : ¬IsBoundedUnder (· ≤ ·) l fun i => |x i|) : ∃ a b : ℚ, a < b ∧ (∃ᶠ i in l, x i < a) ∧ ∃ᶠ i in l, ↑b < x i
Full source
theorem exists_upcrossings_of_not_bounded_under {ι : Type*} {l : Filter ι} {x : ι → }
    (hf : liminfliminf (fun i => (Real.nnabs (x i) : ℝ≥0∞)) l ≠ ∞)
    (hbdd : ¬IsBoundedUnder (· ≤ ·) l fun i => |x i|) :
    ∃ a b : ℚ, a < b ∧ (∃ᶠ i in l, x i < a) ∧ ∃ᶠ i in l, ↑b < x i := by
  rw [isBoundedUnder_le_abs, not_and_or] at hbdd
  obtain hbdd | hbdd := hbdd
  · obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top hf
    obtain ⟨q, hq⟩ := exists_rat_gt R
    refine ⟨q, q + 1, (lt_add_iff_pos_right _).2 zero_lt_one, ?_, ?_⟩
    · refine fun hcon => hR ?_
      filter_upwards [hcon] with x hx using not_lt.2 (lt_of_lt_of_le hq (not_lt.1 hx)).le
    · simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, not_exists,
        not_forall, not_le, exists_prop] at hbdd
      refine fun hcon => hbdd ↑(q + 1) ?_
      filter_upwards [hcon] with x hx using not_lt.1 hx
  · obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top' hf
    obtain ⟨q, hq⟩ := exists_rat_lt R
    refine ⟨q - 1, q, (sub_lt_self_iff _).2 zero_lt_one, ?_, ?_⟩
    · simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, not_exists,
        not_forall, not_le, exists_prop] at hbdd
      refine fun hcon => hbdd ↑(q - 1) ?_
      filter_upwards [hcon] with x hx using not_lt.1 hx
    · refine fun hcon => hR ?_
      filter_upwards [hcon] with x hx using not_lt.2 ((not_lt.1 hx).trans hq.le)
Existence of Upcrossings for Unbounded Sequences with Finite Liminf
Informal description
Let $\{x_i\}_{i \in \iota}$ be a sequence of real numbers indexed by a type $\iota$, and let $l$ be a filter on $\iota$. If the liminf of the sequence $\{\|x_i\|\}_{i \in \iota}$ (viewed in the extended non-negative reals) is not equal to $\infty$, and if the sequence $\{|x_i|\}_{i \in \iota}$ is not bounded under the order relation $\leq$ in the filter $l$, then there exist rational numbers $a$ and $b$ with $a < b$ such that both $x_i < a$ and $b < x_i$ hold frequently in $l$.
ENNReal.hasSum_coe theorem
{f : α → ℝ≥0} {r : ℝ≥0} : HasSum (fun a => (f a : ℝ≥0∞)) ↑r ↔ HasSum f r
Full source
@[norm_cast]
protected theorem hasSum_coe {f : α → ℝ≥0} {r : ℝ≥0} :
    HasSumHasSum (fun a => (f a : ℝ≥0∞)) ↑r ↔ HasSum f r := by
  simp only [HasSum, ← coe_finset_sum, tendsto_coe]
Equivalence of Summability in Non-Negative Reals and Extended Non-Negative Reals
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0}$ and a non-negative real number $r \in \mathbb{R}_{\geq 0}$, the extended non-negative real-valued function $\lambda a, (f a : \mathbb{R}_{\geq 0} \cup \{\infty\})$ has sum $r$ (as an extended non-negative real) if and only if $f$ has sum $r$ (as a non-negative real).
ENNReal.tsum_coe_eq theorem
{f : α → ℝ≥0} (h : HasSum f r) : (∑' a, (f a : ℝ≥0∞)) = r
Full source
protected theorem tsum_coe_eq {f : α → ℝ≥0} (h : HasSum f r) : (∑' a, (f a : ℝ≥0∞)) = r :=
  (ENNReal.hasSum_coe.2 h).tsum_eq
Sum Equivalence between Non-Negative Reals and Extended Non-Negative Reals
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0}$ and a non-negative real number $r \in \mathbb{R}_{\geq 0}$, if $f$ has sum $r$ (i.e., $\sum f = r$), then the extended non-negative real-valued series $\sum' a, (f a : \mathbb{R}_{\geq 0} \cup \{\infty\})$ equals $r$.
ENNReal.coe_tsum theorem
{f : α → ℝ≥0} : Summable f → ↑(tsum f) = ∑' a, (f a : ℝ≥0∞)
Full source
protected theorem coe_tsum {f : α → ℝ≥0} : Summable f → ↑(tsum f) = ∑' a, (f a : ℝ≥0∞)
  | ⟨r, hr⟩ => by rw [hr.tsum_eq, ENNReal.tsum_coe_eq hr]
Embedding of Summable Non-Negative Real Series into Extended Non-Negative Reals
Informal description
For any summable function $f \colon \alpha \to \mathbb{R}_{\geq 0}$, the canonical embedding of its sum in the extended non-negative reals $\mathbb{R}_{\geq 0} \cup \{\infty\}$ equals the sum of the embedded function values, i.e., \[ \left(\sum_{a} f(a)\right) = \sum'_{a} (f(a) : \mathbb{R}_{\geq 0} \cup \{\infty\}). \]
ENNReal.hasSum theorem
: HasSum f (⨆ s : Finset α, ∑ a ∈ s, f a)
Full source
protected theorem hasSum : HasSum f (⨆ s : Finset α, ∑ a ∈ s, f a) :=
  tendsto_atTop_iSup fun _ _ => Finset.sum_le_sum_of_subset
Sum Characterization in Extended Non-Negative Reals via Supremum of Partial Sums
Informal description
A function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ has sum equal to the supremum of its partial sums over all finite subsets of $\alpha$, i.e., \[ \text{HasSum } f \left( \sup_{s \in \text{Finset } \alpha} \sum_{a \in s} f(a) \right). \]
ENNReal.summable theorem
: Summable f
Full source
@[simp]
protected theorem summable : Summable f :=
  ⟨_, ENNReal.hasSum⟩
Summability Criterion for Extended Non-Negative Real-Valued Functions
Informal description
A function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ is summable in the extended non-negative real numbers.
ENNReal.tsum_coe_ne_top_iff_summable theorem
{f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f
Full source
theorem tsum_coe_ne_top_iff_summable {f : β → ℝ≥0} : (∑' b, (f b : ℝ≥0∞)) ≠ ∞(∑' b, (f b : ℝ≥0∞)) ≠ ∞ ↔ Summable f := by
  refine ⟨fun h => ?_, fun h => ENNReal.coe_tsum h ▸ ENNReal.coe_ne_top⟩
  lift ∑' b, (f b : ℝ≥0∞) to ℝ≥0 using h with a ha
  refine ⟨a, ENNReal.hasSum_coe.1 ?_⟩
  rw [ha]
  exact ENNReal.summable.hasSum
Finite Sum in Extended Non-Negative Reals iff Summable in Non-Negative Reals
Informal description
For a function $f \colon \beta \to \mathbb{R}_{\geq 0}$, the sum $\sum_{b} (f(b) : \mathbb{R}_{\geq 0} \cup \{\infty\})$ is finite if and only if $f$ is summable in $\mathbb{R}_{\geq 0}$.
ENNReal.tsum_eq_iSup_sum theorem
: ∑' a, f a = ⨆ s : Finset α, ∑ a ∈ s, f a
Full source
protected theorem tsum_eq_iSup_sum : ∑' a, f a = ⨆ s : Finset α, ∑ a ∈ s, f a :=
  ENNReal.hasSum.tsum_eq
Sum as Supremum of Finite Partial Sums in Extended Non-Negative Reals
Informal description
The sum of a function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ over all elements of $\alpha$ is equal to the supremum of its partial sums over all finite subsets $s \subseteq \alpha$, i.e., \[ \sum_{a \in \alpha} f(a) = \sup_{s \text{ finite}} \sum_{a \in s} f(a). \]
ENNReal.tsum_eq_iSup_sum' theorem
{ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) : ∑' a, f a = ⨆ i, ∑ a ∈ s i, f a
Full source
protected theorem tsum_eq_iSup_sum' {ι : Type*} (s : ι → Finset α) (hs : ∀ t, ∃ i, t ⊆ s i) :
    ∑' a, f a = ⨆ i, ∑ a ∈ s i, f a := by
  rw [ENNReal.tsum_eq_iSup_sum]
  symm
  change ⨆ i : ι, (fun t : Finset α => ∑ a ∈ t, f a) (s i) = ⨆ s : Finset α, ∑ a ∈ s, f a
  exact (Finset.sum_mono_set f).iSup_comp_eq hs
Sum as Supremum of Directed Partial Sums in Extended Non-Negative Reals
Informal description
Let $\alpha$ be a type, $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ a function, and $(s_i)_{i \in \iota}$ a family of finite subsets of $\alpha$ such that every finite subset $t \subseteq \alpha$ is contained in some $s_i$. Then the sum of $f$ over all elements of $\alpha$ equals the supremum of the partial sums over the sets $s_i$, i.e., \[ \sum_{a \in \alpha} f(a) = \sup_{i \in \iota} \sum_{a \in s_i} f(a). \]
ENNReal.tsum_sigma theorem
{β : α → Type*} (f : ∀ a, β a → ℝ≥0∞) : ∑' p : Σ a, β a, f p.1 p.2 = ∑' (a) (b), f a b
Full source
protected theorem tsum_sigma {β : α → Type*} (f : ∀ a, β a → ℝ≥0∞) :
    ∑' p : Σ a, β a, f p.1 p.2 = ∑' (a) (b), f a b :=
  ENNReal.summable.tsum_sigma' fun _ => ENNReal.summable
Double Summation Equality for Dependent Products in Extended Non-Negative Reals
Informal description
For any family of types $\beta$ indexed by $\alpha$ and any function $f$ mapping pairs $(a, b)$ with $a \in \alpha$ and $b \in \beta(a)$ to extended non-negative real numbers, the sum over all dependent pairs $\Sigma a, \beta(a)$ equals the double sum over $\alpha$ and then $\beta(a)$. That is, \[ \sum_{(a,b) \in \Sigma a, \beta(a)} f(a,b) = \sum_{a \in \alpha} \sum_{b \in \beta(a)} f(a,b). \]
ENNReal.tsum_sigma' theorem
{β : α → Type*} (f : (Σ a, β a) → ℝ≥0∞) : ∑' p : Σ a, β a, f p = ∑' (a) (b), f ⟨a, b⟩
Full source
protected theorem tsum_sigma' {β : α → Type*} (f : (Σ a, β a) → ℝ≥0∞) :
    ∑' p : Σ a, β a, f p = ∑' (a) (b), f ⟨a, b⟩ :=
  ENNReal.summable.tsum_sigma' fun _ => ENNReal.summable
Summation over Sigma Type Equals Iterated Summation in Extended Non-Negative Reals
Informal description
For any function $f \colon \Sigma a, \beta a \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ defined on the dependent sum type, the sum over all pairs $(a, b)$ is equal to the sum over all elements of the sigma type, i.e., \[ \sum_{p \in \Sigma a, \beta a} f(p) = \sum_{a} \sum_{b} f(a, b). \]
ENNReal.tsum_prod theorem
{f : α → β → ℝ≥0∞} : ∑' p : α × β, f p.1 p.2 = ∑' (a) (b), f a b
Full source
protected theorem tsum_prod {f : α → β → ℝ≥0∞} : ∑' p : α × β, f p.1 p.2 = ∑' (a) (b), f a b :=
  ENNReal.summable.tsum_prod' fun _ => ENNReal.summable
Double Summation Equality for Extended Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \alpha \times \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the double sum over $\alpha$ and $\beta$ can be expressed as a single sum over the product type $\alpha \times \beta$. Specifically, \[ \sum_{(a,b) \in \alpha \times \beta} f(a,b) = \sum_{a \in \alpha} \sum_{b \in \beta} f(a,b). \]
ENNReal.tsum_prod' theorem
{f : α × β → ℝ≥0∞} : ∑' p : α × β, f p = ∑' (a) (b), f (a, b)
Full source
protected theorem tsum_prod' {f : α × βℝ≥0∞} : ∑' p : α × β, f p = ∑' (a) (b), f (a, b) :=
  ENNReal.summable.tsum_prod' fun _ => ENNReal.summable
Double Summation Equality for Extended Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \alpha \times \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum over all pairs $(a, b) \in \alpha \times \beta$ of $f(a, b)$ is equal to the sum over all pairs $p \in \alpha \times \beta$ of $f(p)$. That is, \[ \sum_{(a, b) \in \alpha \times \beta} f(a, b) = \sum_{p \in \alpha \times \beta} f(p). \]
ENNReal.tsum_comm theorem
{f : α → β → ℝ≥0∞} : ∑' a, ∑' b, f a b = ∑' b, ∑' a, f a b
Full source
protected theorem tsum_comm {f : α → β → ℝ≥0∞} : ∑' a, ∑' b, f a b = ∑' b, ∑' a, f a b :=
  ENNReal.summable.tsum_comm' (fun _ => ENNReal.summable) fun _ => ENNReal.summable
Commutativity of Double Sums in Extended Non-Negative Real Numbers
Informal description
For any function $f \colon \alpha \times \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the double sum $\sum_{a \in \alpha} \sum_{b \in \beta} f(a, b)$ is equal to $\sum_{b \in \beta} \sum_{a \in \alpha} f(a, b)$.
ENNReal.tsum_add theorem
: ∑' a, (f a + g a) = ∑' a, f a + ∑' a, g a
Full source
protected theorem tsum_add : ∑' a, (f a + g a) = ∑' a, f a + ∑' a, g a :=
  ENNReal.summable.tsum_add ENNReal.summable
Additivity of Summation in Extended Non-Negative Real Numbers
Informal description
For any functions $f, g \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum of the series $\sum_{a} (f(a) + g(a))$ is equal to the sum of the series $\sum_{a} f(a) + \sum_{a} g(a)$.
ENNReal.tsum_le_tsum theorem
(h : ∀ a, f a ≤ g a) : ∑' a, f a ≤ ∑' a, g a
Full source
protected theorem tsum_le_tsum (h : ∀ a, f a ≤ g a) : ∑' a, f a∑' a, g a :=
  ENNReal.summable.tsum_le_tsum h ENNReal.summable
Comparison of Sums of Extended Non-Negative Real-Valued Functions
Informal description
For any two functions $f, g \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $f(a) \leq g(a)$ for all $a \in \alpha$, the sum of $f$ is less than or equal to the sum of $g$, i.e., $\sum_{a} f(a) \leq \sum_{a} g(a)$.
GCongr.ennreal_tsum_le_tsum theorem
(h : ∀ a, f a ≤ g a) : tsum f ≤ tsum g
Full source
@[gcongr]
protected theorem _root_.GCongr.ennreal_tsum_le_tsum (h : ∀ a, f a ≤ g a) : tsum f ≤ tsum g :=
  ENNReal.tsum_le_tsum h
Comparison of Infinite Sums in Extended Non-Negative Reals: $\sum' f \leq \sum' g$
Informal description
For any two functions $f, g \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $f(a) \leq g(a)$ for all $a \in \alpha$, the sum of the series $\sum'_{a} f(a)$ is less than or equal to the sum of the series $\sum'_{a} g(a)$.
ENNReal.sum_le_tsum theorem
{f : α → ℝ≥0∞} (s : Finset α) : ∑ x ∈ s, f x ≤ ∑' x, f x
Full source
protected theorem sum_le_tsum {f : α → ℝ≥0∞} (s : Finset α) : ∑ x ∈ s, f x∑' x, f x :=
  ENNReal.summable.sum_le_tsum s (fun _ _ => zero_le _)
Finite Sum is Bounded by Infinite Sum in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any finite subset $s \subset \alpha$, the finite sum $\sum_{x \in s} f(x)$ is less than or equal to the infinite sum $\sum'_{x} f(x)$, where the latter is the supremum of all finite partial sums.
ENNReal.tsum_eq_iSup_nat' theorem
{f : ℕ → ℝ≥0∞} {N : ℕ → ℕ} (hN : Tendsto N atTop atTop) : ∑' i : ℕ, f i = ⨆ i : ℕ, ∑ a ∈ Finset.range (N i), f a
Full source
protected theorem tsum_eq_iSup_nat' {f : ℝ≥0∞} {N : } (hN : Tendsto N atTop atTop) :
    ∑' i : ℕ, f i = ⨆ i : ℕ, ∑ a ∈ Finset.range (N i), f a :=
  ENNReal.tsum_eq_iSup_sum' _ fun t =>
    let ⟨n, hn⟩ := t.exists_nat_subset_range
    let ⟨k, _, hk⟩ := exists_le_of_tendsto_atTop hN 0 n
    ⟨k, Finset.Subset.trans hn (Finset.range_mono hk)⟩
Sum of Extended Non-Negative Real Sequence as Supremum of Directed Partial Sums
Informal description
For any sequence $(f_i)_{i \in \mathbb{N}}$ of extended non-negative real numbers and any sequence $(N_i)_{i \in \mathbb{N}}$ of natural numbers tending to infinity, the sum $\sum_{i=0}^\infty f_i$ is equal to the supremum of the partial sums $\sup_{i \in \mathbb{N}} \sum_{a \in \{0, \dots, N_i - 1\}} f_a$.
ENNReal.tsum_eq_iSup_nat theorem
{f : ℕ → ℝ≥0∞} : ∑' i : ℕ, f i = ⨆ i : ℕ, ∑ a ∈ Finset.range i, f a
Full source
protected theorem tsum_eq_iSup_nat {f : ℝ≥0∞} :
    ∑' i : ℕ, f i = ⨆ i : ℕ, ∑ a ∈ Finset.range i, f a :=
  ENNReal.tsum_eq_iSup_sum' _ Finset.exists_nat_subset_range
Sum as Supremum of Partial Sums in Extended Non-Negative Reals
Informal description
For any sequence $(f_i)_{i \in \mathbb{N}}$ of extended non-negative real numbers, the sum $\sum_{i=0}^\infty f_i$ is equal to the supremum of the partial sums $\sum_{j=0}^{i-1} f_j$ over all $i \in \mathbb{N}$.
ENNReal.tsum_eq_liminf_sum_nat theorem
{f : ℕ → ℝ≥0∞} : ∑' i, f i = liminf (fun n => ∑ i ∈ Finset.range n, f i) atTop
Full source
protected theorem tsum_eq_liminf_sum_nat {f : ℝ≥0∞} :
    ∑' i, f i = liminf (fun n => ∑ i ∈ Finset.range n, f i) atTop :=
  ENNReal.summable.hasSum.tendsto_sum_nat.liminf_eq.symm
Sum of Extended Non-Negative Real Sequence as Limit Inferior of Partial Sums
Informal description
For any sequence $(f_i)_{i \in \mathbb{N}}$ of extended non-negative real numbers, the sum $\sum_{i=0}^\infty f_i$ is equal to the limit inferior of the partial sums $\liminf_{n \to \infty} \sum_{i=0}^{n-1} f_i$.
ENNReal.tsum_eq_limsup_sum_nat theorem
{f : ℕ → ℝ≥0∞} : ∑' i, f i = limsup (fun n => ∑ i ∈ Finset.range n, f i) atTop
Full source
protected theorem tsum_eq_limsup_sum_nat {f : ℝ≥0∞} :
    ∑' i, f i = limsup (fun n => ∑ i ∈ Finset.range n, f i) atTop :=
  ENNReal.summable.hasSum.tendsto_sum_nat.limsup_eq.symm
Sum of Extended Non-Negative Reals as Limit Superior of Partial Sums
Informal description
For any sequence $(f_n)$ of extended non-negative real numbers, the sum $\sum_{i=0}^\infty f_i$ is equal to the limit superior of the partial sums $\sum_{i=0}^{n-1} f_i$ as $n$ tends to infinity.
ENNReal.le_tsum theorem
(a : α) : f a ≤ ∑' a, f a
Full source
protected theorem le_tsum (a : α) : f a ≤ ∑' a, f a :=
  ENNReal.summable.le_tsum' a
Elementwise Inequality for Sums in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any element $a \in \alpha$, the value $f(a)$ is less than or equal to the sum $\sum'_{a \in \alpha} f(a)$.
ENNReal.tsum_eq_zero theorem
: ∑' i, f i = 0 ↔ ∀ i, f i = 0
Full source
@[simp]
protected theorem tsum_eq_zero : ∑' i, f i∑' i, f i = 0 ↔ ∀ i, f i = 0 :=
  ENNReal.summable.tsum_eq_zero_iff
Sum of Extended Non-Negative Reals is Zero if and only if All Terms are Zero
Informal description
For a function $f$ taking values in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum $\sum_{i} f(i)$ equals $0$ if and only if $f(i) = 0$ for all $i$.
ENNReal.tsum_eq_top_of_eq_top theorem
: (∃ a, f a = ∞) → ∑' a, f a = ∞
Full source
protected theorem tsum_eq_top_of_eq_top : (∃ a, f a = ∞) → ∑' a, f a = 
  | ⟨a, ha⟩ => top_unique <| ha ▸ ENNReal.le_tsum a
Sum is Infinite if Any Term is Infinite in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, if there exists an element $a \in \alpha$ such that $f(a) = \infty$, then the sum $\sum'_{a \in \alpha} f(a) = \infty$.
ENNReal.lt_top_of_tsum_ne_top theorem
{a : α → ℝ≥0∞} (tsum_ne_top : ∑' i, a i ≠ ∞) (j : α) : a j < ∞
Full source
protected theorem lt_top_of_tsum_ne_top {a : α → ℝ≥0∞} (tsum_ne_top : ∑' i, a i∑' i, a i ≠ ∞) (j : α) :
    a j <  := by
  contrapose! tsum_ne_top with h
  exact ENNReal.tsum_eq_top_of_eq_top ⟨j, top_unique h⟩
Finite Sum Implies Finite Terms in Extended Non-Negative Reals
Informal description
For any function $a \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum'_{i \in \alpha} a(i) \neq \infty$, and for any index $j \in \alpha$, the value $a(j)$ is strictly less than $\infty$.
ENNReal.tsum_top theorem
[Nonempty α] : ∑' _ : α, ∞ = ∞
Full source
@[simp]
protected theorem tsum_top [Nonempty α] : ∑' _ : α, ∞ =  :=
  let ⟨a⟩ := ‹Nonempty α›
  ENNReal.tsum_eq_top_of_eq_top ⟨a, rfl⟩
Sum of Infinite Terms Equals Infinity in Extended Non-Negative Reals
Informal description
For any nonempty type $\alpha$, the sum $\sum'_{x \in \alpha} \infty$ equals $\infty$ in the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tsum_const_eq_top_of_ne_zero theorem
{α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) : ∑' _ : α, c = ∞
Full source
theorem tsum_const_eq_top_of_ne_zero {α : Type*} [Infinite α] {c : ℝ≥0∞} (hc : c ≠ 0) :
    ∑' _ : α, c =  := by
  have A : Tendsto (fun n :  => (n : ℝ≥0∞) * c) atTop (𝓝 ( * c)) := by
    apply ENNReal.Tendsto.mul_const tendsto_nat_nhds_top
    simp only [true_or, top_ne_zero, Ne, not_false_iff]
  have B : ∀ n : , (n : ℝ≥0∞) * c ≤ ∑' _ : α, c := fun n => by
    rcases Infinite.exists_subset_card_eq α n with ⟨s, hs⟩
    simpa [hs] using @ENNReal.sum_le_tsum α (fun _ => c) s
  simpa [hc] using le_of_tendsto' A B
Infinite Sum of Nonzero Constant in Extended Non-Negative Reals Diverges to Infinity
Informal description
For any infinite type $\alpha$ and any nonzero extended non-negative real number $c \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum $\sum'_{x \in \alpha} c$ equals $\infty$.
ENNReal.ne_top_of_tsum_ne_top theorem
(h : ∑' a, f a ≠ ∞) (a : α) : f a ≠ ∞
Full source
protected theorem ne_top_of_tsum_ne_top (h : ∑' a, f a∑' a, f a ≠ ∞) (a : α) : f a ≠ ∞ := fun ha =>
  h <| ENNReal.tsum_eq_top_of_eq_top ⟨a, ha⟩
Finite Sum Implies Finite Terms in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, if the sum $\sum'_{a \in \alpha} f(a) \neq \infty$, then $f(a) \neq \infty$ for every $a \in \alpha$.
ENNReal.tsum_mul_left theorem
: ∑' i, a * f i = a * ∑' i, f i
Full source
protected theorem tsum_mul_left : ∑' i, a * f i = a * ∑' i, f i := by
  by_cases hf : ∀ i, f i = 0
  · simp [hf]
  · rw [← ENNReal.tsum_eq_zero] at hf
    have : Tendsto (fun s : Finset α => ∑ j ∈ s, a * f j) atTop (𝓝 (a * ∑' i, f i)) := by
      simp only [← Finset.mul_sum]
      exact ENNReal.Tendsto.const_mul ENNReal.summable.hasSum (Or.inl hf)
    exact HasSum.tsum_eq this
Left Distributivity of Summation over Multiplication in Extended Non-Negative Reals
Informal description
For any extended non-negative real number $a$ and any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum $\sum_{i} (a \cdot f(i))$ equals $a$ multiplied by the sum $\sum_{i} f(i)$.
ENNReal.tsum_mul_right theorem
: ∑' i, f i * a = (∑' i, f i) * a
Full source
protected theorem tsum_mul_right : ∑' i, f i * a = (∑' i, f i) * a := by
  simp [mul_comm, ENNReal.tsum_mul_left]
Right Distributivity of Summation over Multiplication in Extended Non-Negative Reals
Informal description
For any extended non-negative real number $a$ and any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum $\sum_{i} (f(i) \cdot a)$ equals the sum $\sum_{i} f(i)$ multiplied by $a$.
ENNReal.tsum_const_smul theorem
{R} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (a : R) : ∑' i, a • f i = a • ∑' i, f i
Full source
protected theorem tsum_const_smul {R} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (a : R) :
    ∑' i, a • f i = a • ∑' i, f i := by
  simpa only [smul_one_mul] using @ENNReal.tsum_mul_left _ (a • (1 : ℝ≥0∞)) _
Scalar Multiplication Commutes with Summation in Extended Non-Negative Reals
Informal description
Let $R$ be a type equipped with a scalar multiplication operation on the extended non-negative real numbers $\mathbb{R}_{\geq 0} \cup \{\infty\}$, and assume this operation satisfies the scalar tower property. Then for any scalar $a \in R$ and any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum $\sum_{i} (a \cdot f(i))$ equals $a$ multiplied by the sum $\sum_{i} f(i)$, where $\cdot$ denotes the scalar multiplication operation.
ENNReal.tsum_iSup_eq theorem
{α : Type*} (a : α) {f : α → ℝ≥0∞} : (∑' b : α, ⨆ _ : a = b, f b) = f a
Full source
@[simp]
theorem tsum_iSup_eq {α : Type*} (a : α) {f : α → ℝ≥0∞} : (∑' b : α, ⨆ _ : a = b, f b) = f a :=
  (tsum_eq_single a fun _ h => by simp [h.symm]).trans <| by simp
Sum of Conditional Suprema Equals Function Value
Informal description
For any type $\alpha$, element $a \in \alpha$, and function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum over $\alpha$ of the supremum of $f(b)$ under the condition that $a = b$ equals $f(a)$. In symbols: \[ \sum_{b \in \alpha} \left( \sup_{a = b} f(b) \right) = f(a). \]
ENNReal.hasSum_iff_tendsto_nat theorem
{f : ℕ → ℝ≥0∞} (r : ℝ≥0∞) : HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r)
Full source
theorem hasSum_iff_tendsto_nat {f : ℝ≥0∞} (r : ℝ≥0∞) :
    HasSumHasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r) := by
  refine ⟨HasSum.tendsto_sum_nat, fun h => ?_⟩
  rw [← iSup_eq_of_tendsto _ h, ← ENNReal.tsum_eq_iSup_nat]
  · exact ENNReal.summable.hasSum
  · exact fun s t hst => Finset.sum_le_sum_of_subset (Finset.range_subset.2 hst)
Summability Criterion via Partial Sums in Extended Non-Negative Reals
Informal description
For any sequence $(f_n)_{n \in \mathbb{N}}$ of extended non-negative real numbers and any $r \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sequence has sum $r$ if and only if the sequence of partial sums $\sum_{i=0}^{n-1} f_i$ converges to $r$ in the order topology as $n \to \infty$.
ENNReal.tendsto_nat_tsum theorem
(f : ℕ → ℝ≥0∞) : Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 (∑' n, f n))
Full source
theorem tendsto_nat_tsum (f : ℝ≥0∞) :
    Tendsto (fun n :  => ∑ i ∈ Finset.range n, f i) atTop (𝓝 (∑' n, f n)) := by
  rw [← hasSum_iff_tendsto_nat]
  exact ENNReal.summable.hasSum
Convergence of Partial Sums to Infinite Sum in Extended Non-Negative Reals
Informal description
For any sequence $(f_n)_{n \in \mathbb{N}}$ of extended non-negative real numbers, the sequence of partial sums $\sum_{i=0}^{n-1} f_i$ converges to the infinite sum $\sum_{n=0}^\infty f_n$ in the order topology as $n \to \infty$.
ENNReal.toNNReal_apply_of_tsum_ne_top theorem
{α : Type*} {f : α → ℝ≥0∞} (hf : ∑' i, f i ≠ ∞) (x : α) : (((ENNReal.toNNReal ∘ f) x : ℝ≥0) : ℝ≥0∞) = f x
Full source
theorem toNNReal_apply_of_tsum_ne_top {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' i, f i∑' i, f i ≠ ∞) (x : α) :
    (((ENNReal.toNNRealENNReal.toNNReal ∘ f) x : ℝ≥0) : ℝ≥0∞) = f x :=
  coe_toNNReal <| ENNReal.ne_top_of_tsum_ne_top hf _
Preservation of Value under `toNNReal` for Summable Functions in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum'_{i \in \alpha} f(i) \neq \infty$, and for any $x \in \alpha$, the extended non-negative real value $f(x)$ is equal to its canonical embedding into $\mathbb{R}_{\geq 0} \cup \{\infty\}$ after applying the `ENNReal.toNNReal` function. That is, $(\text{ENNReal.toNNReal}(f(x)) : \mathbb{R}_{\geq 0}) = f(x)$.
ENNReal.summable_toNNReal_of_tsum_ne_top theorem
{α : Type*} {f : α → ℝ≥0∞} (hf : ∑' i, f i ≠ ∞) : Summable (ENNReal.toNNReal ∘ f)
Full source
theorem summable_toNNReal_of_tsum_ne_top {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' i, f i∑' i, f i ≠ ∞) :
    Summable (ENNReal.toNNRealENNReal.toNNReal ∘ f) := by
  simpa only [← tsum_coe_ne_top_iff_summable, toNNReal_apply_of_tsum_ne_top hf] using hf
Summability of `toNNReal` Composition for Functions with Finite Sum in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum_{i \in \alpha} f(i) \neq \infty$, the composition $\text{ENNReal.toNNReal} \circ f$ is summable in $\mathbb{R}_{\geq 0}$.
ENNReal.tendsto_cofinite_zero_of_tsum_ne_top theorem
{α} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) : Tendsto f cofinite (𝓝 0)
Full source
theorem tendsto_cofinite_zero_of_tsum_ne_top {α} {f : α → ℝ≥0∞} (hf : ∑' x, f x∑' x, f x ≠ ∞) :
    Tendsto f cofinite (𝓝 0) := by
  have f_ne_top : ∀ n, f n ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top hf
  have h_f_coe : f = fun n => ((f n).toNNReal : ENNReal) :=
    funext fun n => (coe_toNNReal (f_ne_top n)).symm
  rw [h_f_coe, ← @coe_zero, tendsto_coe]
  exact NNReal.tendsto_cofinite_zero_of_summable (summable_toNNReal_of_tsum_ne_top hf)
Convergence to Zero Along Cofinite Filter for Summable Extended Non-Negative Real Functions
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum_{x \in \alpha} f(x) \neq \infty$, the function $f$ tends to $0$ along the cofinite filter. That is, for any neighborhood $U$ of $0$ in the order topology, the set $\{x \in \alpha \mid f(x) \notin U\}$ is finite.
ENNReal.tendsto_atTop_zero_of_tsum_ne_top theorem
{f : ℕ → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) : Tendsto f atTop (𝓝 0)
Full source
theorem tendsto_atTop_zero_of_tsum_ne_top {f : ℝ≥0∞} (hf : ∑' x, f x∑' x, f x ≠ ∞) :
    Tendsto f atTop (𝓝 0) := by
  rw [← Nat.cofinite_eq_atTop]
  exact tendsto_cofinite_zero_of_tsum_ne_top hf
Convergence to Zero of Summable Sequences in Extended Non-Negative Reals
Informal description
For any sequence $f \colon \mathbb{N} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum_{x \in \mathbb{N}} f(x) \neq \infty$, the sequence $f$ tends to $0$ as $n \to \infty$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.tendsto_tsum_compl_atTop_zero theorem
{α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) : Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0)
Full source
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
theorem tendsto_tsum_compl_atTop_zero {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x∑' x, f x ≠ ∞) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  convert ENNReal.tendsto_coe.2 (NNReal.tendsto_tsum_compl_atTop_zero f)
  rw [ENNReal.coe_tsum]
  exact NNReal.summable_comp_injective (tsum_coe_ne_top_iff_summable.1 hf) Subtype.coe_injective
Limit of Sum over Complement of Finite Subset Tends to Zero in Extended Non-Negative Reals
Informal description
Let $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function such that $\sum_{x \in \alpha} f(x) \neq \infty$. Then, as the finite subset $s \subseteq \alpha$ grows to cover the entire space, the sum of $f$ over the complement of $s$ tends to $0$, i.e., \[ \lim_{s \to \infty} \sum_{b \notin s} f(b) = 0. \]
ENNReal.tsum_apply theorem
{ι α : Type*} {f : ι → α → ℝ≥0∞} {x : α} : (∑' i, f i) x = ∑' i, f i x
Full source
protected theorem tsum_apply {ι α : Type*} {f : ι → α → ℝ≥0∞} {x : α} :
    (∑' i, f i) x = ∑' i, f i x :=
  tsum_apply <| Pi.summable.mpr fun _ => ENNReal.summable
Pointwise Sum of Extended Non-Negative Real-Valued Functions
Informal description
For any family of functions $f_i \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ indexed by a set $\iota$, and for any $x \in \alpha$, the pointwise sum of the functions evaluated at $x$ equals the sum of the evaluations of each function at $x$, i.e., \[ \left( \sum_{i} f_i \right)(x) = \sum_{i} f_i(x). \]
ENNReal.tsum_sub theorem
{f : ℕ → ℝ≥0∞} {g : ℕ → ℝ≥0∞} (h₁ : ∑' i, g i ≠ ∞) (h₂ : g ≤ f) : ∑' i, (f i - g i) = ∑' i, f i - ∑' i, g i
Full source
theorem tsum_sub {f : ℝ≥0∞} {g : ℝ≥0∞} (h₁ : ∑' i, g i∑' i, g i ≠ ∞) (h₂ : g ≤ f) :
    ∑' i, (f i - g i) = ∑' i, f i - ∑' i, g i :=
  have : ∀ i, f i - g i + g i = f i := fun i => tsub_add_cancel_of_le (h₂ i)
  ENNReal.eq_sub_of_add_eq h₁ <| by simp only [← ENNReal.tsum_add, this]
Subtraction Rule for Sums of Extended Non-Negative Real Sequences
Informal description
Let $f, g : \mathbb{N} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be sequences of extended non-negative real numbers such that the sum $\sum_{i=0}^\infty g(i)$ is finite and $g(i) \leq f(i)$ for all $i \in \mathbb{N}$. Then the sum of the differences satisfies $\sum_{i=0}^\infty (f(i) - g(i)) = \sum_{i=0}^\infty f(i) - \sum_{i=0}^\infty g(i)$.
ENNReal.tsum_comp_le_tsum_of_injective theorem
{f : α → β} (hf : Injective f) (g : β → ℝ≥0∞) : ∑' x, g (f x) ≤ ∑' y, g y
Full source
theorem tsum_comp_le_tsum_of_injective {f : α → β} (hf : Injective f) (g : β → ℝ≥0∞) :
    ∑' x, g (f x)∑' y, g y :=
  ENNReal.summable.tsum_le_tsum_of_inj f hf (fun _ _ => zero_le _) (fun _ => le_rfl)
    ENNReal.summable
Sum Inequality for Injective Functions on Extended Non-Negative Reals
Informal description
For any injective function $f \colon \alpha \to \beta$ and any function $g \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum of $g$ over the image of $f$ is less than or equal to the sum of $g$ over the entire codomain $\beta$, i.e., \[ \sum_{x \in \alpha} g(f(x)) \leq \sum_{y \in \beta} g(y). \]
ENNReal.tsum_le_tsum_comp_of_surjective theorem
{f : α → β} (hf : Surjective f) (g : β → ℝ≥0∞) : ∑' y, g y ≤ ∑' x, g (f x)
Full source
theorem tsum_le_tsum_comp_of_surjective {f : α → β} (hf : Surjective f) (g : β → ℝ≥0∞) :
    ∑' y, g y∑' x, g (f x) :=
  calc ∑' y, g y = ∑' y, g (f (surjInv hf y)) := by simp only [surjInv_eq hf]
  _ ≤ ∑' x, g (f x) := tsum_comp_le_tsum_of_injective (injective_surjInv hf) _
Sum Inequality for Surjective Functions on Extended Non-Negative Reals
Informal description
For any surjective function $f \colon \alpha \to \beta$ and any function $g \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum of $g$ over the codomain $\beta$ is less than or equal to the sum of $g$ over the domain $\alpha$ composed with $f$, i.e., \[ \sum_{y \in \beta} g(y) \leq \sum_{x \in \alpha} g(f(x)). \]
ENNReal.tsum_mono_subtype theorem
(f : α → ℝ≥0∞) {s t : Set α} (h : s ⊆ t) : ∑' x : s, f x ≤ ∑' x : t, f x
Full source
theorem tsum_mono_subtype (f : α → ℝ≥0∞) {s t : Set α} (h : s ⊆ t) :
    ∑' x : s, f x∑' x : t, f x :=
  tsum_comp_le_tsum_of_injective (inclusion_injective h) _
Monotonicity of Sums over Subsets in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any subsets $s \subseteq t$ of $\alpha$, the sum of $f$ over $s$ is less than or equal to the sum of $f$ over $t$, i.e., \[ \sum_{x \in s} f(x) \leq \sum_{x \in t} f(x). \]
ENNReal.tsum_iUnion_le_tsum theorem
{ι : Type*} (f : α → ℝ≥0∞) (t : ι → Set α) : ∑' x : ⋃ i, t i, f x ≤ ∑' i, ∑' x : t i, f x
Full source
theorem tsum_iUnion_le_tsum {ι : Type*} (f : α → ℝ≥0∞) (t : ι → Set α) :
    ∑' x : ⋃ i, t i, f x∑' i, ∑' x : t i, f x :=
  calc ∑' x : ⋃ i, t i, f x∑' x : Σ i, t i, f x.2 :=
    tsum_le_tsum_comp_of_surjective (sigmaToiUnion_surjective t) _
  _ = ∑' i, ∑' x : t i, f x := ENNReal.tsum_sigma' _
Sum over Union is Bounded by Sum of Sums in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any family of sets $(t_i)_{i \in \iota}$ indexed by $\iota$, the sum of $f$ over the union $\bigcup_{i} t_i$ is less than or equal to the sum over all indices $i$ of the sums of $f$ over each $t_i$, i.e., \[ \sum_{x \in \bigcup_i t_i} f(x) \leq \sum_{i} \sum_{x \in t_i} f(x). \]
ENNReal.tsum_biUnion_le_tsum theorem
{ι : Type*} (f : α → ℝ≥0∞) (s : Set ι) (t : ι → Set α) : ∑' x : ⋃ i ∈ s, t i, f x ≤ ∑' i : s, ∑' x : t i, f x
Full source
theorem tsum_biUnion_le_tsum {ι : Type*} (f : α → ℝ≥0∞) (s : Set ι) (t : ι → Set α) :
    ∑' x : ⋃ i ∈ s , t i, f x∑' i : s, ∑' x : t i, f x :=
  calc ∑' x : ⋃ i ∈ s, t i, f x = ∑' x : ⋃ i : s, t i, f x := tsum_congr_set_coe _ <| by simp
  _ ≤ ∑' i : s, ∑' x : t i, f x := tsum_iUnion_le_tsum _ _
Sum over Bounded Union is Bounded by Sum of Sums in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, any index set $s \subseteq \iota$, and any family of sets $(t_i)_{i \in \iota}$, the sum of $f$ over the union $\bigcup_{i \in s} t_i$ is less than or equal to the sum over all indices $i \in s$ of the sums of $f$ over each $t_i$, i.e., \[ \sum_{x \in \bigcup_{i \in s} t_i} f(x) \leq \sum_{i \in s} \sum_{x \in t_i} f(x). \]
ENNReal.tsum_biUnion_le theorem
{ι : Type*} (f : α → ℝ≥0∞) (s : Finset ι) (t : ι → Set α) : ∑' x : ⋃ i ∈ s, t i, f x ≤ ∑ i ∈ s, ∑' x : t i, f x
Full source
theorem tsum_biUnion_le {ι : Type*} (f : α → ℝ≥0∞) (s : Finset ι) (t : ι → Set α) :
    ∑' x : ⋃ i ∈ s, t i, f x∑ i ∈ s, ∑' x : t i, f x :=
  (tsum_biUnion_le_tsum f s.toSet t).trans_eq (Finset.tsum_subtype s fun i => ∑' x : t i, f x)
Sum over Finite Union is Bounded by Sum of Sums in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, any finite set $s \subseteq \iota$, and any family of sets $(t_i)_{i \in \iota}$, the sum of $f$ over the union $\bigcup_{i \in s} t_i$ is less than or equal to the sum over all indices $i \in s$ of the sums of $f$ over each $t_i$, i.e., \[ \sum_{x \in \bigcup_{i \in s} t_i} f(x) \leq \sum_{i \in s} \sum_{x \in t_i} f(x). \]
ENNReal.tsum_iUnion_le theorem
{ι : Type*} [Fintype ι] (f : α → ℝ≥0∞) (t : ι → Set α) : ∑' x : ⋃ i, t i, f x ≤ ∑ i, ∑' x : t i, f x
Full source
theorem tsum_iUnion_le {ι : Type*} [Fintype ι] (f : α → ℝ≥0∞) (t : ι → Set α) :
    ∑' x : ⋃ i, t i, f x∑ i, ∑' x : t i, f x := by
  rw [← tsum_fintype]
  exact tsum_iUnion_le_tsum f t
Sum over Finite Union is Bounded by Sum of Sums in Extended Non-Negative Reals
Informal description
For any finite type $\iota$ and any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, the sum of $f$ over the union $\bigcup_{i \in \iota} t_i$ is less than or equal to the sum over all $i \in \iota$ of the sums of $f$ over each $t_i$, i.e., \[ \sum_{x \in \bigcup_i t_i} f(x) \leq \sum_{i \in \iota} \sum_{x \in t_i} f(x). \]
ENNReal.tsum_union_le theorem
(f : α → ℝ≥0∞) (s t : Set α) : ∑' x : ↑(s ∪ t), f x ≤ ∑' x : s, f x + ∑' x : t, f x
Full source
theorem tsum_union_le (f : α → ℝ≥0∞) (s t : Set α) :
    ∑' x : ↑(s ∪ t), f x∑' x : s, f x + ∑' x : t, f x :=
  calc ∑' x : ↑(s ∪ t), f x = ∑' x : ⋃ b, cond b s t, f x := tsum_congr_set_coe _ union_eq_iUnion
  _ ≤ _ := by simpa using tsum_iUnion_le f (cond · s t)
Sum over Union is Bounded by Sum of Sums in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any sets $s, t \subseteq \alpha$, the sum of $f$ over the union $s \cup t$ is less than or equal to the sum of $f$ over $s$ plus the sum of $f$ over $t$, i.e., \[ \sum_{x \in s \cup t} f(x) \leq \sum_{x \in s} f(x) + \sum_{x \in t} f(x). \]
ENNReal.tsum_eq_add_tsum_ite theorem
{f : β → ℝ≥0∞} (b : β) : ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x)
Full source
theorem tsum_eq_add_tsum_ite {f : β → ℝ≥0∞} (b : β) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  ENNReal.summable.tsum_eq_add_tsum_ite' b
Sum Decomposition for Extended Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any element $b \in \beta$, the sum of $f$ over all elements $x \in \beta$ equals $f(b)$ plus the sum of $f(x)$ over all $x \neq b$. That is, \[ \sum_{x} f(x) = f(b) + \sum_{x \neq b} f(x). \]
ENNReal.tsum_add_one_eq_top theorem
{f : ℕ → ℝ≥0∞} (hf : ∑' n, f n = ∞) (hf0 : f 0 ≠ ∞) : ∑' n, f (n + 1) = ∞
Full source
theorem tsum_add_one_eq_top {f : ℝ≥0∞} (hf : ∑' n, f n = ) (hf0 : f 0 ≠ ∞) :
    ∑' n, f (n + 1) =  := by
  rw [tsum_eq_zero_add' ENNReal.summable, add_eq_top] at hf
  exact hf.resolve_left hf0
Shifted Sum of Divergent Series with Finite First Term is Divergent
Informal description
Let $f \colon \mathbb{N} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a sequence of extended non-negative real numbers such that the total sum $\sum_{n=0}^\infty f(n) = \infty$ and $f(0) \neq \infty$. Then the sum of the sequence shifted by one, $\sum_{n=0}^\infty f(n+1)$, is also $\infty$.
ENNReal.finite_const_le_of_tsum_ne_top theorem
{ι : Type*} {a : ι → ℝ≥0∞} (tsum_ne_top : ∑' i, a i ≠ ∞) {ε : ℝ≥0∞} (ε_ne_zero : ε ≠ 0) : {i : ι | ε ≤ a i}.Finite
Full source
/-- A sum of extended nonnegative reals which is finite can have only finitely many terms
above any positive threshold. -/
theorem finite_const_le_of_tsum_ne_top {ι : Type*} {a : ι → ℝ≥0∞} (tsum_ne_top : ∑' i, a i∑' i, a i ≠ ∞)
    {ε : ℝ≥0∞} (ε_ne_zero : ε ≠ 0) : { i : ι | ε ≤ a i }.Finite := by
  by_contra h
  have := Infinite.to_subtype h
  refine tsum_ne_top (top_unique ?_)
  calc  = ∑' _ : { i | ε ≤ a i }, ε := (tsum_const_eq_top_of_ne_zero ε_ne_zero).symm
  _ ≤ ∑' i, a i := ENNReal.summable.tsum_le_tsum_of_inj (↑)
    Subtype.val_injective (fun _ _ => zero_le _) (fun i => i.2) ENNReal.summable
Finiteness of Terms Above Threshold in Finite Sum of Extended Non-Negative Reals
Informal description
Let $\{a_i\}_{i \in \iota}$ be a family of extended non-negative real numbers such that the sum $\sum_{i \in \iota} a_i$ is finite. Then for any positive threshold $\varepsilon > 0$, the set $\{i \in \iota \mid \varepsilon \leq a_i\}$ is finite.
ENNReal.finset_card_const_le_le_of_tsum_le theorem
{ι : Type*} {a : ι → ℝ≥0∞} {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) (tsum_le_c : ∑' i, a i ≤ c) {ε : ℝ≥0∞} (ε_ne_zero : ε ≠ 0) : ∃ hf : {i : ι | ε ≤ a i}.Finite, #hf.toFinset ≤ c / ε
Full source
/-- Markov's inequality for `Finset.card` and `tsum` in `ℝ≥0∞`. -/
theorem finset_card_const_le_le_of_tsum_le {ι : Type*} {a : ι → ℝ≥0∞} {c : ℝ≥0∞} (c_ne_top : c ≠ ∞)
    (tsum_le_c : ∑' i, a i ≤ c) {ε : ℝ≥0∞} (ε_ne_zero : ε ≠ 0) :
    ∃ hf : { i : ι | ε ≤ a i }.Finite, #hf.toFinset ≤ c / ε := by
  have hf : { i : ι | ε ≤ a i }.Finite :=
    finite_const_le_of_tsum_ne_top (ne_top_of_le_ne_top c_ne_top tsum_le_c) ε_ne_zero
  refine ⟨hf, (ENNReal.le_div_iff_mul_le (.inl ε_ne_zero) (.inr c_ne_top)).2 ?_⟩
  calc #hf.toFinset * ε = ∑ _i ∈ hf.toFinset, ε := by rw [Finset.sum_const, nsmul_eq_mul]
    _ ≤ ∑ i ∈ hf.toFinset, a i := Finset.sum_le_sum fun i => hf.mem_toFinset.1
    _ ≤ ∑' i, a i := ENNReal.sum_le_tsum _
    _ ≤ c := tsum_le_c
Markov's Inequality for Finite Sums in Extended Non-Negative Reals: $\#\{i \mid \varepsilon \leq a_i\} \leq c/\varepsilon$
Informal description
Let $\{a_i\}_{i \in \iota}$ be a family of extended non-negative real numbers such that their sum $\sum_{i \in \iota} a_i \leq c$ for some finite $c \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ (with $c \neq \infty$). Then for any $\varepsilon > 0$ (with $\varepsilon \neq 0$), the set $\{i \in \iota \mid \varepsilon \leq a_i\}$ is finite and its cardinality is at most $c / \varepsilon$.
ENNReal.tsum_fiberwise theorem
(f : β → ℝ≥0∞) (g : β → γ) : ∑' x, ∑' b : g ⁻¹' { x }, f b = ∑' i, f i
Full source
theorem tsum_fiberwise (f : β → ℝ≥0∞) (g : β → γ) :
    ∑' x, ∑' b : g ⁻¹' {x}, f b = ∑' i, f i := by
  apply HasSum.tsum_eq
  let equiv := Equiv.sigmaFiberEquiv g
  apply (equiv.hasSum_iff.mpr ENNReal.summable.hasSum).sigma
  exact fun _ ↦ ENNReal.summable.hasSum_iff.mpr rfl
Fiberwise Summation Equality for Extended Non-Negative Reals
Informal description
For any function $f \colon \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any function $g \colon \beta \to \gamma$, the sum of $f$ over all fibers of $g$ equals the total sum of $f$ over its domain. That is, \[ \sum_{x \in \gamma} \sum_{b \in g^{-1}(\{x\})} f(b) = \sum_{i \in \beta} f(i). \]
ENNReal.tendsto_toReal_iff theorem
{ι} {fi : Filter ι} {f : ι → ℝ≥0∞} (hf : ∀ i, f i ≠ ∞) {x : ℝ≥0∞} (hx : x ≠ ∞) : Tendsto (fun n => (f n).toReal) fi (𝓝 x.toReal) ↔ Tendsto f fi (𝓝 x)
Full source
theorem tendsto_toReal_iff {ι} {fi : Filter ι} {f : ι → ℝ≥0∞} (hf : ∀ i, f i ≠ ∞) {x : ℝ≥0∞}
    (hx : x ≠ ∞) : TendstoTendsto (fun n => (f n).toReal) fi (𝓝 x.toReal) ↔ Tendsto f fi (𝓝 x) := by
  lift f to ι → ℝ≥0 using hf
  lift x to ℝ≥0 using hx
  simp [tendsto_coe]
Convergence of Extended Non-Negative Reals to Finite Limit via Real Parts
Informal description
Let $\{f_i\}_{i \in \iota}$ be a family of extended non-negative real numbers such that $f_i \neq \infty$ for all $i$, and let $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $x \neq \infty$. Then the function sequence $f_i$ converges to $x$ in the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$ if and only if the sequence $(f_i)$'s real parts converge to $x$'s real part in the standard topology on $\mathbb{R}$.
ENNReal.tsum_coe_ne_top_iff_summable_coe theorem
{f : α → ℝ≥0} : (∑' a, (f a : ℝ≥0∞)) ≠ ∞ ↔ Summable fun a => (f a : ℝ)
Full source
theorem tsum_coe_ne_top_iff_summable_coe {f : α → ℝ≥0} :
    (∑' a, (f a : ℝ≥0∞)) ≠ ∞(∑' a, (f a : ℝ≥0∞)) ≠ ∞ ↔ Summable fun a => (f a : ℝ) := by
  rw [NNReal.summable_coe]
  exact tsum_coe_ne_top_iff_summable
Finite Sum in Extended Non-Negative Reals iff Summable in Reals
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0}$, the sum $\sum_{a} (f(a) : \mathbb{R}_{\geq 0} \cup \{\infty\})$ is finite if and only if the function $a \mapsto f(a)$ is summable in $\mathbb{R}$.
ENNReal.tsum_coe_eq_top_iff_not_summable_coe theorem
{f : α → ℝ≥0} : (∑' a, (f a : ℝ≥0∞)) = ∞ ↔ ¬Summable fun a => (f a : ℝ)
Full source
theorem tsum_coe_eq_top_iff_not_summable_coe {f : α → ℝ≥0} :
    (∑' a, (f a : ℝ≥0∞)) = ∞ ↔ ¬Summable fun a => (f a : ℝ) :=
  tsum_coe_ne_top_iff_summable_coe.not_right
Infinite Sum in Extended Non-Negative Reals iff Not Summable in Reals
Informal description
For a function $f \colon \alpha \to \mathbb{R}_{\geq 0}$, the sum $\sum_{a} (f(a) : \mathbb{R}_{\geq 0} \cup \{\infty\})$ equals $\infty$ if and only if the function $a \mapsto f(a)$ is not summable in $\mathbb{R}$.
ENNReal.hasSum_toReal theorem
{f : α → ℝ≥0∞} (hsum : ∑' x, f x ≠ ∞) : HasSum (fun x => (f x).toReal) (∑' x, (f x).toReal)
Full source
theorem hasSum_toReal {f : α → ℝ≥0∞} (hsum : ∑' x, f x∑' x, f x ≠ ∞) :
    HasSum (fun x => (f x).toReal) (∑' x, (f x).toReal) := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hsum
  simp only [coe_toReal, ← NNReal.coe_tsum, NNReal.hasSum_coe]
  exact (tsum_coe_ne_top_iff_summable.1 hsum).hasSum
Summability of Real Parts for Finite Extended Non-Negative Sums
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum'_{x} f(x) \neq \infty$, the function $x \mapsto (f(x)).toReal$ has a sum in $\mathbb{R}$, and this sum is equal to $\sum'_{x} (f(x)).toReal$.
ENNReal.summable_toReal theorem
{f : α → ℝ≥0∞} (hsum : ∑' x, f x ≠ ∞) : Summable fun x => (f x).toReal
Full source
theorem summable_toReal {f : α → ℝ≥0∞} (hsum : ∑' x, f x∑' x, f x ≠ ∞) : Summable fun x => (f x).toReal :=
  (hasSum_toReal hsum).summable
Summability of Real-Valued Projection for Finite Extended Non-Negative Sums
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that the sum $\sum_{x} f(x) \neq \infty$, the function $x \mapsto \text{toReal}(f(x))$ is summable in $\mathbb{R}$.
NNReal.tsum_eq_toNNReal_tsum theorem
{f : β → ℝ≥0} : ∑' b, f b = (∑' b, (f b : ℝ≥0∞)).toNNReal
Full source
theorem tsum_eq_toNNReal_tsum {f : β → ℝ≥0} : ∑' b, f b = (∑' b, (f b : ℝ≥0∞)).toNNReal := by
  by_cases h : Summable f
  · rw [← ENNReal.coe_tsum h, ENNReal.toNNReal_coe]
  · have A := tsum_eq_zero_of_not_summable h
    simp only [← ENNReal.tsum_coe_ne_top_iff_summable, Classical.not_not] at h
    simp only [h, ENNReal.toNNReal_top, A]
Sum of Non-Negative Reals Equals Non-Negative Part of Extended Sum
Informal description
For any function $f \colon \beta \to \mathbb{R}_{\geq 0}$, the sum of $f$ over $\beta$ equals the non-negative real part of the sum of the embedded function values in the extended non-negative reals, i.e., \[ \sum_{b} f(b) = \left(\sum'_{b} (f(b) : \mathbb{R}_{\geq 0} \cup \{\infty\})\right)_{\mathbb{R}_{\geq 0}}. \]
NNReal.exists_le_hasSum_of_le theorem
{f g : β → ℝ≥0} {r : ℝ≥0} (hgf : ∀ b, g b ≤ f b) (hfr : HasSum f r) : ∃ p ≤ r, HasSum g p
Full source
/-- Comparison test of convergence of `ℝ≥0`-valued series. -/
theorem exists_le_hasSum_of_le {f g : β → ℝ≥0} {r : ℝ≥0} (hgf : ∀ b, g b ≤ f b) (hfr : HasSum f r) :
    ∃ p ≤ r, HasSum g p :=
  have : (∑' b, (g b : ℝ≥0∞)) ≤ r := by
    refine hasSum_le (fun b => ?_) ENNReal.summable.hasSum (ENNReal.hasSum_coe.2 hfr)
    exact ENNReal.coe_le_coe.2 (hgf _)
  let ⟨p, Eq, hpr⟩ := ENNReal.le_coe_iff.1 this
  ⟨p, hpr, ENNReal.hasSum_coe.1 <| Eq ▸ ENNReal.summable.hasSum⟩
Comparison Test for Summability of Non-Negative Real-Valued Functions
Informal description
For any functions $f, g \colon \beta \to \mathbb{R}_{\geq 0}$ and any $r \in \mathbb{R}_{\geq 0}$, if $g(b) \leq f(b)$ for all $b \in \beta$ and $f$ has sum $r$, then there exists $p \in \mathbb{R}_{\geq 0}$ with $p \leq r$ such that $g$ has sum $p$.
NNReal.summable_of_le theorem
{f g : β → ℝ≥0} (hgf : ∀ b, g b ≤ f b) : Summable f → Summable g
Full source
/-- Comparison test of convergence of `ℝ≥0`-valued series. -/
theorem summable_of_le {f g : β → ℝ≥0} (hgf : ∀ b, g b ≤ f b) : Summable f → Summable g
  | ⟨_r, hfr⟩ =>
    let ⟨_p, _, hp⟩ := exists_le_hasSum_of_le hgf hfr
    hp.summable
Summability Comparison Test for Non-Negative Real-Valued Functions
Informal description
For any functions $f, g \colon \beta \to \mathbb{R}_{\geq 0}$ such that $g(b) \leq f(b)$ for all $b \in \beta$, if $f$ is summable, then $g$ is also summable.
Summable.countable_support_nnreal theorem
(f : α → ℝ≥0) (h : Summable f) : f.support.Countable
Full source
/-- Summable non-negative functions have countable support -/
theorem _root_.Summable.countable_support_nnreal (f : α → ℝ≥0) (h : Summable f) :
    f.support.Countable := by
  rw [← NNReal.summable_coe] at h
  simpa [support] using h.countable_support
Countable Support of Summable Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0}$, if $f$ is summable, then the support of $f$ (i.e., the set $\{x \in \alpha \mid f(x) \neq 0\}$) is countable.
NNReal.hasSum_iff_tendsto_nat theorem
{f : ℕ → ℝ≥0} {r : ℝ≥0} : HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r)
Full source
/-- A series of non-negative real numbers converges to `r` in the sense of `HasSum` if and only if
the sequence of partial sum converges to `r`. -/
theorem hasSum_iff_tendsto_nat {f : ℝ≥0} {r : ℝ≥0} :
    HasSumHasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r) := by
  rw [← ENNReal.hasSum_coe, ENNReal.hasSum_iff_tendsto_nat]
  simp only [← ENNReal.coe_finset_sum]
  exact ENNReal.tendsto_coe
Summability Criterion via Partial Sums in Non-Negative Reals
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers and a non-negative real number $r \in \mathbb{R}_{\geq 0}$, the sequence has sum $r$ if and only if the sequence of partial sums $\sum_{i=0}^{n-1} f_i$ converges to $r$ as $n \to \infty$.
NNReal.not_summable_iff_tendsto_nat_atTop theorem
{f : ℕ → ℝ≥0} : ¬Summable f ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop
Full source
theorem not_summable_iff_tendsto_nat_atTop {f : ℝ≥0} :
    ¬Summable f¬Summable f ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by
  constructor
  · intro h
    refine ((tendsto_of_monotone ?_).resolve_right h).comp ?_
    exacts [Finset.sum_mono_set _, tendsto_finset_range]
  · rintro hnat ⟨r, hr⟩
    exact not_tendsto_nhds_of_tendsto_atTop hnat _ (hasSum_iff_tendsto_nat.1 hr)
Non-summability Criterion via Divergence of Partial Sums in Non-Negative Reals
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers, the sequence is not summable if and only if the sequence of partial sums $\sum_{i=0}^{n-1} f_i$ tends to infinity as $n \to \infty$.
NNReal.summable_iff_not_tendsto_nat_atTop theorem
{f : ℕ → ℝ≥0} : Summable f ↔ ¬Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop
Full source
theorem summable_iff_not_tendsto_nat_atTop {f : ℝ≥0} :
    SummableSummable f ↔ ¬Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by
  rw [← not_iff_not, Classical.not_not, not_summable_iff_tendsto_nat_atTop]
Summability Criterion via Bounded Partial Sums in Non-Negative Reals
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers, the sequence is summable if and only if the sequence of partial sums $\sum_{i=0}^{n-1} f_i$ does not tend to infinity as $n \to \infty$.
NNReal.summable_of_sum_range_le theorem
{f : ℕ → ℝ≥0} {c : ℝ≥0} (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : Summable f
Full source
theorem summable_of_sum_range_le {f : ℝ≥0} {c : ℝ≥0}
    (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : Summable f := by
  refine summable_iff_not_tendsto_nat_atTop.2 fun H => ?_
  rcases exists_lt_of_tendsto_atTop H 0 c with ⟨n, -, hn⟩
  exact lt_irrefl _ (hn.trans_le (h n))
Bounded Partial Sums Imply Summability for Non-Negative Real Sequences
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers, if there exists a constant $c \in \mathbb{R}_{\geq 0}$ such that for all $n \in \mathbb{N}$, the partial sums $\sum_{i=0}^{n-1} f_i \leq c$, then the sequence $(f_n)$ is summable.
NNReal.tsum_le_of_sum_range_le theorem
{f : ℕ → ℝ≥0} {c : ℝ≥0} (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : ∑' n, f n ≤ c
Full source
theorem tsum_le_of_sum_range_le {f : ℝ≥0} {c : ℝ≥0}
    (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : ∑' n, f n ≤ c :=
  (summable_of_sum_range_le h).tsum_le_of_sum_range_le h
Bounded Partial Sums Imply Bounded Infinite Sum for Non-Negative Reals
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers, if there exists a constant $c \in \mathbb{R}_{\geq 0}$ such that for all $n \in \mathbb{N}$, the partial sums $\sum_{i=0}^{n-1} f_i \leq c$, then the infinite sum $\sum_{n=0}^\infty f_n \leq c$.
NNReal.tsum_comp_le_tsum_of_inj theorem
{β : Type*} {f : α → ℝ≥0} (hf : Summable f) {i : β → α} (hi : Function.Injective i) : (∑' x, f (i x)) ≤ ∑' x, f x
Full source
theorem tsum_comp_le_tsum_of_inj {β : Type*} {f : α → ℝ≥0} (hf : Summable f) {i : β → α}
    (hi : Function.Injective i) : (∑' x, f (i x)) ≤ ∑' x, f x :=
  (summable_comp_injective hf hi).tsum_le_tsum_of_inj i hi (fun _ _ => zero_le _) (fun _ => le_rfl)
    hf
Sum Inequality for Injective Images of Non-Negative Real-Valued Functions
Informal description
Let $f: \alpha \to \mathbb{R}_{\geq 0}$ be a summable function and $i: \beta \to \alpha$ be an injective function. Then the sum of $f$ over the image of $i$ is less than or equal to the total sum of $f$, i.e., \[ \sum_{x} f(i(x)) \leq \sum_{x} f(x). \]
NNReal.summable_sigma theorem
{β : α → Type*} {f : (Σ x, β x) → ℝ≥0} : Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩
Full source
theorem summable_sigma {β : α → Type*} {f : (Σ x, β x) → ℝ≥0} :
    SummableSummable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by
  constructor
  · simp only [← NNReal.summable_coe, NNReal.coe_tsum]
    exact fun h => ⟨h.sigma_factor, h.sigma⟩
  · rintro ⟨h₁, h₂⟩
    simpa only [← ENNReal.tsum_coe_ne_top_iff_summable, ENNReal.tsum_sigma',
      ENNReal.coe_tsum (h₁ _)] using h₂
Summability Criterion for Functions on Dependent Sum Types in Non-Negative Reals
Informal description
For a function $f \colon \Sigma x, \beta x \to \mathbb{R}_{\geq 0}$ defined on a dependent sum type, $f$ is summable if and only if for every $x$, the function $y \mapsto f(x, y)$ is summable, and the function $x \mapsto \sum_{y} f(x, y)$ is summable. In other words, the summability of $f$ is equivalent to the pointwise summability of its sections and the summability of their sums.
NNReal.indicator_summable theorem
{f : α → ℝ≥0} (hf : Summable f) (s : Set α) : Summable (s.indicator f)
Full source
theorem indicator_summable {f : α → ℝ≥0} (hf : Summable f) (s : Set α) :
    Summable (s.indicator f) := by
  classical
  refine NNReal.summable_of_le (fun a => le_trans (le_of_eq (s.indicator_apply f a)) ?_) hf
  split_ifs
  · exact le_refl (f a)
  · exact zero_le_coe
Summability of Indicator Function for Non-Negative Real-Valued Functions
Informal description
For any summable function $f \colon \alpha \to \mathbb{R}_{\geq 0}$ and any subset $s \subseteq \alpha$, the indicator function of $s$ applied to $f$ is summable.
NNReal.tsum_indicator_ne_zero theorem
{f : α → ℝ≥0} (hf : Summable f) {s : Set α} (h : ∃ a ∈ s, f a ≠ 0) : (∑' x, (s.indicator f) x) ≠ 0
Full source
theorem tsum_indicator_ne_zero {f : α → ℝ≥0} (hf : Summable f) {s : Set α} (h : ∃ a ∈ s, f a ≠ 0) :
    (∑' x, (s.indicator f) x) ≠ 0 := fun h' =>
  let ⟨a, ha, hap⟩ := h
  hap ((Set.indicator_apply_eq_self.mpr (absurd ha)).symm.trans
    ((indicator_summable hf s).tsum_eq_zero_iff.1 h' a))
Nonzero Sum of Indicator Function for Non-Negative Real-Valued Functions
Informal description
For any summable function $f \colon \alpha \to \mathbb{R}_{\geq 0}$ and any subset $s \subseteq \alpha$, if there exists an element $a \in s$ such that $f(a) \neq 0$, then the sum $\sum_{x} (s.\text{indicator}\, f)(x)$ is nonzero.
NNReal.tendsto_sum_nat_add theorem
(f : ℕ → ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0)
Full source
/-- For `f : ℕ → ℝ≥0`, then `∑' k, f (k + i)` tends to zero. This does not require a summability
assumption on `f`, as otherwise all sums are zero. -/
theorem tendsto_sum_nat_add (f : ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  rw [← tendsto_coe]
  convert _root_.tendsto_sum_nat_add fun i => (f i : )
  norm_cast
Tail Sum of Non-Negative Sequence Tends to Zero
Informal description
For any sequence of non-negative real numbers $f \colon \mathbb{N} \to \mathbb{R}_{\geq 0}$, the tail sum $\sum_{k=0}^\infty f(k + i)$ tends to zero as $i \to \infty$.
NNReal.hasSum_lt theorem
{f g : α → ℝ≥0} {sf sg : ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg
Full source
nonrec theorem hasSum_lt {f g : α → ℝ≥0} {sf sg : ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a)
    (hi : f i < g i) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  have A : ∀ a : α, (f a : ) ≤ g a := fun a => NNReal.coe_le_coe.2 (h a)
  have : (sf : ) < sg := hasSum_lt A (NNReal.coe_lt_coe.2 hi) (hasSum_coe.2 hf) (hasSum_coe.2 hg)
  exact NNReal.coe_lt_coe.1 this
Strict Inequality of Sums for Non-Negative Functions
Informal description
Let $f, g : \alpha \to \mathbb{R}_{\geq 0}$ be non-negative real-valued functions with sums $sf$ and $sg$ respectively. If $f(a) \leq g(a)$ for all $a \in \alpha$, and there exists an index $i \in \alpha$ such that $f(i) < g(i)$, and both $f$ and $g$ have sums $sf$ and $sg$ respectively, then $sf < sg$.
NNReal.hasSum_strict_mono theorem
{f g : α → ℝ≥0} {sf sg : ℝ≥0} (hf : HasSum f sf) (hg : HasSum g sg) (h : f < g) : sf < sg
Full source
@[mono]
theorem hasSum_strict_mono {f g : α → ℝ≥0} {sf sg : ℝ≥0} (hf : HasSum f sf) (hg : HasSum g sg)
    (h : f < g) : sf < sg :=
  let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h
  hasSum_lt hle hi hf hg
Strict Monotonicity of Sums for Non-Negative Functions
Informal description
Let $f, g : \alpha \to \mathbb{R}_{\geq 0}$ be non-negative real-valued functions with sums $sf$ and $sg$ respectively. If $f$ has sum $sf$, $g$ has sum $sg$, and $f(a) < g(a)$ for all $a \in \alpha$, then $sf < sg$.
NNReal.tsum_lt_tsum theorem
{f g : α → ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i) (hg : Summable g) : ∑' n, f n < ∑' n, g n
Full source
theorem tsum_lt_tsum {f g : α → ℝ≥0} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hg : Summable g) : ∑' n, f n < ∑' n, g n :=
  hasSum_lt h hi (summable_of_le h hg).hasSum hg.hasSum
Strict Sum Inequality for Non-Negative Functions
Informal description
Let $f, g : \alpha \to \mathbb{R}_{\geq 0}$ be non-negative real-valued functions such that $f(a) \leq g(a)$ for all $a \in \alpha$, and there exists an index $i \in \alpha$ with $f(i) < g(i)$. If $g$ is summable, then the sum of $f$ is strictly less than the sum of $g$, i.e., $\sum_{n} f(n) < \sum_{n} g(n)$.
NNReal.tsum_strict_mono theorem
{f g : α → ℝ≥0} (hg : Summable g) (h : f < g) : ∑' n, f n < ∑' n, g n
Full source
@[mono]
theorem tsum_strict_mono {f g : α → ℝ≥0} (hg : Summable g) (h : f < g) : ∑' n, f n < ∑' n, g n :=
  let ⟨hle, _i, hi⟩ := Pi.lt_def.mp h
  tsum_lt_tsum hle hi hg
Strict Monotonicity of Sums for Non-Negative Real-Valued Functions
Informal description
Let $f, g : \alpha \to \mathbb{R}_{\geq 0}$ be non-negative real-valued functions such that $f(a) < g(a)$ for all $a \in \alpha$. If $g$ is summable, then the sum of $f$ is strictly less than the sum of $g$, i.e., $\sum_{n} f(n) < \sum_{n} g(n)$.
NNReal.tsum_pos theorem
{g : α → ℝ≥0} (hg : Summable g) (i : α) (hi : 0 < g i) : 0 < ∑' b, g b
Full source
theorem tsum_pos {g : α → ℝ≥0} (hg : Summable g) (i : α) (hi : 0 < g i) : 0 < ∑' b, g b := by
  rw [← tsum_zero]
  exact tsum_lt_tsum (fun a => zero_le _) hi hg
Positivity of Sum for Non-Negative Real-Valued Functions
Informal description
For any summable function $g \colon \alpha \to \mathbb{R}_{\geq 0}$ and any index $i \in \alpha$ such that $g(i) > 0$, the sum of $g$ over all indices is strictly positive, i.e., $\sum_{b} g(b) > 0$.
NNReal.tsum_eq_add_tsum_ite theorem
{f : α → ℝ≥0} (hf : Summable f) (i : α) : ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x)
Full source
theorem tsum_eq_add_tsum_ite {f : α → ℝ≥0} (hf : Summable f) (i : α) :
    ∑' x, f x = f i + ∑' x, ite (x = i) 0 (f x) := by
  refine (NNReal.summable_of_le (fun i' => ?_) hf).tsum_eq_add_tsum_ite' i
  rw [Function.update_apply]
  split_ifs <;> simp only [zero_le', le_rfl]
Sum Decomposition for Non-Negative Real-Valued Functions
Informal description
For any summable function $f \colon \alpha \to \mathbb{R}_{\geq 0}$ and any index $i \in \alpha$, the sum of $f$ over $\alpha$ can be decomposed as the value at $i$ plus the sum of $f$ over all other indices, i.e., \[ \sum_{x \in \alpha} f(x) = f(i) + \sum_{x \neq i} f(x). \]
ENNReal.tsum_toNNReal_eq theorem
{f : α → ℝ≥0∞} (hf : ∀ a, f a ≠ ∞) : (∑' a, f a).toNNReal = ∑' a, (f a).toNNReal
Full source
theorem tsum_toNNReal_eq {f : α → ℝ≥0∞} (hf : ∀ a, f a ≠ ∞) :
    (∑' a, f a).toNNReal = ∑' a, (f a).toNNReal :=
  (congr_arg ENNReal.toNNReal (tsum_congr fun x => (coe_toNNReal (hf x)).symm)).trans
    NNReal.tsum_eq_toNNReal_tsum.symm
Non-Negative Real Part of Sum Equals Sum of Non-Negative Real Parts
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $f(a) \neq \infty$ for all $a \in \alpha$, the non-negative real part of the sum of $f$ equals the sum of the non-negative real parts of $f$, i.e., \[ \left(\sum_{a} f(a)\right)_{\mathbb{R}_{\geq 0}} = \sum_{a} (f(a))_{\mathbb{R}_{\geq 0}}. \]
ENNReal.tsum_toReal_eq theorem
{f : α → ℝ≥0∞} (hf : ∀ a, f a ≠ ∞) : (∑' a, f a).toReal = ∑' a, (f a).toReal
Full source
theorem tsum_toReal_eq {f : α → ℝ≥0∞} (hf : ∀ a, f a ≠ ∞) :
    (∑' a, f a).toReal = ∑' a, (f a).toReal := by
  simp only [ENNReal.toReal, tsum_toNNReal_eq hf, NNReal.coe_tsum]
Real Part of Sum Equals Sum of Real Parts in Extended Non-Negative Reals
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $f(a) \neq \infty$ for all $a \in \alpha$, the real part of the sum of $f$ equals the sum of the real parts of $f$, i.e., \[ \left(\sum_{a} f(a)\right)_{\mathbb{R}} = \sum_{a} (f(a))_{\mathbb{R}}. \]
ENNReal.tendsto_sum_nat_add theorem
(f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0)
Full source
theorem tendsto_sum_nat_add (f : ℝ≥0∞) (hf : ∑' i, f i∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0) := by
  lift f to ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top hf
  replace hf : Summable f := tsum_coe_ne_top_iff_summable.1 hf
  simp only [← ENNReal.coe_tsum, NNReal.summable_nat_add _ hf, ← ENNReal.coe_zero]
  exact mod_cast NNReal.tendsto_sum_nat_add f
Tail Sum of Finite Extended Non-Negative Series Tends to Zero
Informal description
For any sequence of extended non-negative real numbers $(f_n)_{n \in \mathbb{N}}$ such that the sum $\sum_{i=0}^\infty f_i$ is finite, the tail sum $\sum_{k=0}^\infty f_{k+i}$ tends to $0$ as $i \to \infty$.
ENNReal.tsum_le_of_sum_range_le theorem
{f : ℕ → ℝ≥0∞} {c : ℝ≥0∞} (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : ∑' n, f n ≤ c
Full source
theorem tsum_le_of_sum_range_le {f : ℝ≥0∞} {c : ℝ≥0∞}
    (h : ∀ n, ∑ i ∈ Finset.range n, f i ≤ c) : ∑' n, f n ≤ c :=
  ENNReal.summable.tsum_le_of_sum_range_le h
Comparison of Infinite Sum and Partial Sums in Extended Non-Negative Reals
Informal description
For any sequence $(f_n)_{n \in \mathbb{N}}$ of extended non-negative real numbers and any $c \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, if for every $n \in \mathbb{N}$ the partial sum $\sum_{i=0}^{n-1} f_i \leq c$, then the infinite sum $\sum_{n=0}^\infty f_n \leq c$.
ENNReal.hasSum_lt theorem
{f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i) (hsf : sf ≠ ∞) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg
Full source
theorem hasSum_lt {f g : α → ℝ≥0∞} {sf sg : ℝ≥0∞} {i : α} (h : ∀ a : α, f a ≤ g a) (hi : f i < g i)
    (hsf : sf ≠ ∞) (hf : HasSum f sf) (hg : HasSum g sg) : sf < sg := by
  by_cases hsg : sg = ∞
  · exact hsg.symmlt_of_le_of_ne le_top hsf
  · have hg' : ∀ x, g x ≠ ∞ := ENNReal.ne_top_of_tsum_ne_top (hg.tsum_eq.symm ▸ hsg)
    lift f to α → ℝ≥0 using fun x =>
      ne_of_lt (lt_of_le_of_lt (h x) <| lt_of_le_of_ne le_top (hg' x))
    lift g to α → ℝ≥0 using hg'
    lift sf to ℝ≥0 using hsf
    lift sg to ℝ≥0 using hsg
    simp only [coe_le_coe, coe_lt_coe] at h hi ⊢
    exact NNReal.hasSum_lt h hi (ENNReal.hasSum_coe.1 hf) (ENNReal.hasSum_coe.1 hg)
Strict Inequality of Sums for Extended Non-Negative Functions
Informal description
Let $f, g \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions with sums $sf$ and $sg$ respectively, where $sf \neq \infty$. If $f(a) \leq g(a)$ for all $a \in \alpha$, and there exists $i \in \alpha$ such that $f(i) < g(i)$, then $sf < sg$.
ENNReal.tsum_lt_tsum theorem
{f g : α → ℝ≥0∞} {i : α} (hfi : tsum f ≠ ∞) (h : ∀ a : α, f a ≤ g a) (hi : f i < g i) : ∑' x, f x < ∑' x, g x
Full source
theorem tsum_lt_tsum {f g : α → ℝ≥0∞} {i : α} (hfi : tsumtsum f ≠ ∞) (h : ∀ a : α, f a ≤ g a)
    (hi : f i < g i) : ∑' x, f x < ∑' x, g x :=
  hasSum_lt h hi hfi ENNReal.summable.hasSum ENNReal.summable.hasSum
Strict Inequality for Infinite Sums of Extended Non-Negative Functions
Informal description
Let $f, g \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be functions such that the sum $\sum_{x} f(x)$ is finite, $f(a) \leq g(a)$ for all $a \in \alpha$, and there exists $i \in \alpha$ with $f(i) < g(i)$. Then $\sum_{x} f(x) < \sum_{x} g(x)$.
tsum_comp_le_tsum_of_inj theorem
{β : Type*} {f : α → ℝ} (hf : Summable f) (hn : ∀ a, 0 ≤ f a) {i : β → α} (hi : Function.Injective i) : tsum (f ∘ i) ≤ tsum f
Full source
theorem tsum_comp_le_tsum_of_inj {β : Type*} {f : α → } (hf : Summable f) (hn : ∀ a, 0 ≤ f a)
    {i : β → α} (hi : Function.Injective i) : tsum (f ∘ i) ≤ tsum f := by
  lift f to α → ℝ≥0 using hn
  rw [NNReal.summable_coe] at hf
  simpa only [Function.comp_def, ← NNReal.coe_tsum] using NNReal.tsum_comp_le_tsum_of_inj hf hi
Sum Inequality for Non-Negative Functions under Injective Composition
Informal description
Let $f: \alpha \to \mathbb{R}$ be a summable function with non-negative values, and let $i: \beta \to \alpha$ be an injective function. Then the sum of $f$ composed with $i$ is less than or equal to the total sum of $f$, i.e., \[ \sum_{x} f(i(x)) \leq \sum_{x} f(x). \]
Summable.of_nonneg_of_le theorem
{f g : β → ℝ} (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b) (hf : Summable f) : Summable g
Full source
/-- Comparison test of convergence of series of non-negative real numbers. -/
theorem Summable.of_nonneg_of_le {f g : β → } (hg : ∀ b, 0 ≤ g b) (hgf : ∀ b, g b ≤ f b)
    (hf : Summable f) : Summable g := by
  lift f to β → ℝ≥0 using fun b => (hg b).trans (hgf b)
  lift g to β → ℝ≥0 using hg
  rw [NNReal.summable_coe] at hf ⊢
  exact NNReal.summable_of_le (fun b => NNReal.coe_le_coe.1 (hgf b)) hf
Summability Comparison Test for Non-Negative Real-Valued Functions
Informal description
For any real-valued functions $f, g \colon \beta \to \mathbb{R}$ such that $g(b) \geq 0$ and $g(b) \leq f(b)$ for all $b \in \beta$, if $f$ is summable, then $g$ is also summable.
Summable.toNNReal theorem
{f : α → ℝ} (hf : Summable f) : Summable fun n => (f n).toNNReal
Full source
theorem Summable.toNNReal {f : α → } (hf : Summable f) : Summable fun n => (f n).toNNReal := by
  apply NNReal.summable_coe.1
  refine .of_nonneg_of_le (fun n => NNReal.coe_nonneg _) (fun n => ?_) hf.abs
  simp only [le_abs_self, Real.coe_toNNReal', max_le_iff, abs_nonneg, and_self_iff]
Summability of Non-Negative Part of a Summable Real Function
Informal description
For any summable real-valued function $f \colon \alpha \to \mathbb{R}$, the function obtained by applying the canonical projection $\mathbb{R} \to \mathbb{R}_{\geq 0}$ (mapping each real number to its non-negative part) to $f$ is also summable.
Summable.countable_support_ennreal theorem
{f : α → ℝ≥0∞} (h : ∑' (i : α), f i ≠ ∞) : f.support.Countable
Full source
/-- Finitely summable non-negative functions have countable support -/
theorem _root_.Summable.countable_support_ennreal {f : α → ℝ≥0∞} (h : ∑' (i : α), f i∑' (i : α), f i ≠ ∞) :
    f.support.Countable := by
  lift f to α → ℝ≥0 using ENNReal.ne_top_of_tsum_ne_top h
  simpa [support] using (ENNReal.tsum_coe_ne_top_iff_summable.1 h).countable_support_nnreal
Countable Support of Finitely Summable Extended Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, if the sum $\sum_{i \in \alpha} f(i) \neq \infty$, then the support of $f$ (i.e., the set $\{i \in \alpha \mid f(i) \neq 0\}$) is countable.
hasSum_iff_tendsto_nat_of_nonneg theorem
{f : ℕ → ℝ} (hf : ∀ i, 0 ≤ f i) (r : ℝ) : HasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r)
Full source
/-- A series of non-negative real numbers converges to `r` in the sense of `HasSum` if and only if
the sequence of partial sum converges to `r`. -/
theorem hasSum_iff_tendsto_nat_of_nonneg {f : } (hf : ∀ i, 0 ≤ f i) (r : ) :
    HasSumHasSum f r ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop (𝓝 r) := by
  lift f to ℝ≥0 using hf
  simp only [HasSum, ← NNReal.coe_sum, NNReal.tendsto_coe']
  exact exists_congr fun hr => NNReal.hasSum_iff_tendsto_nat
Convergence of Non-Negative Series via Partial Sums
Informal description
For a sequence $(f_n)_{n \in \mathbb{N}}$ of non-negative real numbers and a real number $r \in \mathbb{R}$, the series $\sum_{n=0}^\infty f_n$ converges to $r$ if and only if the sequence of partial sums $S_n = \sum_{i=0}^{n-1} f_i$ tends to $r$ as $n \to \infty$.
ENNReal.ofReal_tsum_of_nonneg theorem
{f : α → ℝ} (hf_nonneg : ∀ n, 0 ≤ f n) (hf : Summable f) : ENNReal.ofReal (∑' n, f n) = ∑' n, ENNReal.ofReal (f n)
Full source
theorem ENNReal.ofReal_tsum_of_nonneg {f : α → } (hf_nonneg : ∀ n, 0 ≤ f n) (hf : Summable f) :
    ENNReal.ofReal (∑' n, f n) = ∑' n, ENNReal.ofReal (f n) := by
  simp_rw [ENNReal.ofReal, ENNReal.tsum_coe_eq (NNReal.hasSum_real_toNNReal_of_nonneg hf_nonneg hf)]
Equality of Extended Non-Negative Real Sums for Non-Negative Real-Valued Functions
Informal description
For any function $f \colon \alpha \to \mathbb{R}$ such that $f(n) \geq 0$ for all $n$ and $f$ is summable, the extended non-negative real number obtained by applying the `ofReal` function to the sum of $f$ equals the sum of the extended non-negative real numbers obtained by applying `ofReal` to each term of $f$. That is, \[ \text{ENNReal.ofReal}\left(\sum_{n} f(n)\right) = \sum_{n} \text{ENNReal.ofReal}(f(n)). \]
edist_ne_top_of_mem_ball theorem
{a : β} {r : ℝ≥0∞} (x y : ball a r) : edist x.1 y.1 ≠ ∞
Full source
/-- In an emetric ball, the distance between points is everywhere finite -/
theorem edist_ne_top_of_mem_ball {a : β} {r : ℝ≥0∞} (x y : ball a r) : edistedist x.1 y.1 ≠ ∞ :=
  ne_of_lt <|
    calc
      edist x y ≤ edist a x + edist a y := edist_triangle_left x.1 y.1 a
      _ < r + r := by rw [edist_comm a x, edist_comm a y]; exact ENNReal.add_lt_add x.2 y.2
      _ ≤  := le_top
Finite Distance in Extended Non-Negative Real Metric Ball
Informal description
For any points $x$ and $y$ in an extended non-negative real emetric ball centered at $a$ with radius $r$, the extended distance between $x$ and $y$ is finite, i.e., $\text{edist}(x, y) \neq \infty$.
metricSpaceEMetricBall definition
(a : β) (r : ℝ≥0∞) : MetricSpace (ball a r)
Full source
/-- Each ball in an extended metric space gives us a metric space, as the edist
is everywhere finite. -/
def metricSpaceEMetricBall (a : β) (r : ℝ≥0∞) : MetricSpace (ball a r) :=
  EMetricSpace.toMetricSpace edist_ne_top_of_mem_ball
Metric space structure on an extended metric ball
Informal description
For any point $a$ in an extended metric space $\beta$ and any extended non-negative real radius $r$, the open ball $\text{ball}(a, r)$ equipped with the restriction of the extended distance function forms a metric space, since the extended distance between any two points in the ball is finite.
nhds_eq_nhds_emetric_ball theorem
(a x : β) (r : ℝ≥0∞) (h : x ∈ ball a r) : 𝓝 x = map ((↑) : ball a r → β) (𝓝 ⟨x, h⟩)
Full source
theorem nhds_eq_nhds_emetric_ball (a x : β) (r : ℝ≥0∞) (h : x ∈ ball a r) :
    𝓝 x = map ((↑) : ball a r → β) (𝓝 ⟨x, h⟩) :=
  (map_nhds_subtype_coe_eq_nhds _ <| IsOpen.mem_nhds EMetric.isOpen_ball h).symm
Neighborhood Filter Equality in Metric Ball Subspace
Informal description
Let $a$ and $x$ be points in a metric space $\beta$, and let $r$ be an extended non-negative real number. If $x$ belongs to the open ball centered at $a$ with radius $r$, then the neighborhood filter of $x$ in $\beta$ is equal to the image under the inclusion map of the neighborhood filter of $\langle x, h \rangle$ in the subspace topology of the ball.
tendsto_iff_edist_tendsto_0 theorem
{l : Filter β} {f : β → α} {y : α} : Tendsto f l (𝓝 y) ↔ Tendsto (fun x => edist (f x) y) l (𝓝 0)
Full source
theorem tendsto_iff_edist_tendsto_0 {l : Filter β} {f : β → α} {y : α} :
    TendstoTendsto f l (𝓝 y) ↔ Tendsto (fun x => edist (f x) y) l (𝓝 0) := by
  simp only [EMetric.nhds_basis_eball.tendsto_right_iff, EMetric.mem_ball,
    @tendsto_order ℝ≥0∞ β _ _, forall_prop_of_false ENNReal.not_lt_zero, forall_const, true_and]
Convergence Criterion via Extended Distance: $f \to y$ iff $\text{edist}(f(x), y) \to 0$
Informal description
Let $l$ be a filter on a type $\beta$, $f : \beta \to \alpha$ a function, and $y \in \alpha$. Then $f$ tends to $y$ along $l$ if and only if the extended distance $\text{edist}(f(x), y)$ tends to $0$ along $l$.
EMetric.cauchySeq_iff_le_tendsto_0 theorem
[Nonempty β] [SemilatticeSup β] {s : β → α} : CauchySeq s ↔ ∃ b : β → ℝ≥0∞, (∀ n m N : β, N ≤ n → N ≤ m → edist (s n) (s m) ≤ b N) ∧ Tendsto b atTop (𝓝 0)
Full source
/-- Yet another metric characterization of Cauchy sequences on integers. This one is often the
most efficient. -/
theorem EMetric.cauchySeq_iff_le_tendsto_0 [Nonempty β] [SemilatticeSup β] {s : β → α} :
    CauchySeqCauchySeq s ↔ ∃ b : β → ℝ≥0∞, (∀ n m N : β, N ≤ n → N ≤ m → edist (s n) (s m) ≤ b N) ∧
      Tendsto b atTop (𝓝 0) := EMetric.cauchySeq_iff.trans <| by
  constructor
  · intro hs
    /- `s` is Cauchy sequence. Let `b n` be the diameter of the set `s '' Set.Ici n`. -/
    refine ⟨fun N => EMetric.diam (s '' Ici N), fun n m N hn hm => ?_, ?_⟩
    -- Prove that it bounds the distances of points in the Cauchy sequence
    · exact EMetric.edist_le_diam_of_mem (mem_image_of_mem _ hn) (mem_image_of_mem _ hm)
    -- Prove that it tends to `0`, by using the Cauchy property of `s`
    · refine ENNReal.tendsto_nhds_zero.2 fun ε ε0 => ?_
      rcases hs ε ε0 with ⟨N, hN⟩
      refine (eventually_ge_atTop N).mono fun n hn => EMetric.diam_le ?_
      rintro _ ⟨k, hk, rfl⟩ _ ⟨l, hl, rfl⟩
      exact (hN _ (hn.trans hk) _ (hn.trans hl)).le
  · rintro ⟨b, ⟨b_bound, b_lim⟩⟩ ε εpos
    have : ∀ᶠ n in atTop, b n < ε := b_lim.eventually (gt_mem_nhds εpos)
    rcases this.exists with ⟨N, hN⟩
    refine ⟨N, fun m hm n hn => ?_⟩
    calc edist (s m) (s n) ≤ b N := b_bound m n N hm hn
    _ < ε := hN
Cauchy Sequence Characterization via Extended Distance and Convergence to Zero
Informal description
Let $\beta$ be a nonempty directed set and $\alpha$ be an extended metric space. A sequence $s : \beta \to \alpha$ is Cauchy if and only if there exists a sequence $b : \beta \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that: 1. For all $n, m, N \in \beta$, if $N \leq n$ and $N \leq m$, then the extended distance between $s(n)$ and $s(m)$ satisfies $\text{edist}(s(n), s(m)) \leq b(N)$. 2. The sequence $b$ tends to $0$ in the neighborhood filter at infinity.
continuous_of_le_add_edist theorem
{f : α → ℝ≥0∞} (C : ℝ≥0∞) (hC : C ≠ ∞) (h : ∀ x y, f x ≤ f y + C * edist x y) : Continuous f
Full source
theorem continuous_of_le_add_edist {f : α → ℝ≥0∞} (C : ℝ≥0∞) (hC : C ≠ ∞)
    (h : ∀ x y, f x ≤ f y + C * edist x y) : Continuous f := by
  refine continuous_iff_continuousAt.2 fun x => ENNReal.tendsto_nhds_of_Icc fun ε ε0 => ?_
  rcases ENNReal.exists_nnreal_pos_mul_lt hC ε0.ne' with ⟨δ, δ0, hδ⟩
  rw [mul_comm] at hδ
  filter_upwards [EMetric.closedBall_mem_nhds x (ENNReal.coe_pos.2 δ0)] with y hy
  refine ⟨tsub_le_iff_right.2 <| (h x y).trans ?_, (h y x).trans ?_⟩ <;>
    refine add_le_add_left (le_trans (mul_le_mul_left' ?_ _) hδ.le) _
  exacts [EMetric.mem_closedBall'.1 hy, EMetric.mem_closedBall.1 hy]
Continuity Criterion via Lipschitz-like Condition in Extended Non-Negative Reals
Informal description
Let $f : \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function and $C \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $C \neq \infty$. If for all $x, y \in \alpha$, the inequality $f(x) \leq f(y) + C \cdot \text{edist}(x, y)$ holds, then $f$ is continuous.
continuous_edist theorem
: Continuous fun p : α × α => edist p.1 p.2
Full source
theorem continuous_edist : Continuous fun p : α × α => edist p.1 p.2 := by
  apply continuous_of_le_add_edist 2 (by decide)
  rintro ⟨x, y⟩ ⟨x', y'⟩
  calc
    edist x y ≤ edist x x' + edist x' y' + edist y' y := edist_triangle4 _ _ _ _
    _ = edist x' y' + (edist x x' + edist y y') := by simp only [edist_comm]; ac_rfl
    _ ≤ edist x' y' + (edist (x, y) (x', y') + edist (x, y) (x', y')) :=
      (add_le_add_left (add_le_add (le_max_left _ _) (le_max_right _ _)) _)
    _ = edist x' y' + 2 * edist (x, y) (x', y') := by rw [← mul_two, mul_comm]
Continuity of Extended Distance Function
Informal description
The extended distance function $\text{edist} : \alpha \times \alpha \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ is continuous with respect to the product topology on $\alpha \times \alpha$ and the order topology on $\mathbb{R}_{\geq 0} \cup \{\infty\}$.
Continuous.edist theorem
[TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : Continuous fun b => edist (f b) (g b)
Full source
@[continuity, fun_prop]
theorem Continuous.edist [TopologicalSpace β] {f g : β → α} (hf : Continuous f)
    (hg : Continuous g) : Continuous fun b => edist (f b) (g b) :=
  continuous_edist.comp (hf.prodMk hg :)
Continuity of Extended Distance Between Continuous Functions
Informal description
Let $\beta$ be a topological space and $f, g : \beta \to \alpha$ be continuous functions. Then the function $b \mapsto \text{edist}(f(b), g(b))$ is continuous on $\beta$, where $\text{edist}$ denotes the extended distance function on $\alpha$.
Filter.Tendsto.edist theorem
{f g : β → α} {x : Filter β} {a b : α} (hf : Tendsto f x (𝓝 a)) (hg : Tendsto g x (𝓝 b)) : Tendsto (fun x => edist (f x) (g x)) x (𝓝 (edist a b))
Full source
theorem Filter.Tendsto.edist {f g : β → α} {x : Filter β} {a b : α} (hf : Tendsto f x (𝓝 a))
    (hg : Tendsto g x (𝓝 b)) : Tendsto (fun x => edist (f x) (g x)) x (𝓝 (edist a b)) :=
  (continuous_edist.tendsto (a, b)).comp (hf.prodMk_nhds hg)
Continuity of Extended Distance under Filter Convergence
Informal description
Let $f, g : \beta \to \alpha$ be functions and $x$ a filter on $\beta$. If $f$ tends to $a$ and $g$ tends to $b$ along $x$, then the function $x \mapsto \text{edist}(f(x), g(x))$ tends to $\text{edist}(a, b)$ along $x$.
cauchySeq_of_edist_le_of_summable theorem
{f : ℕ → α} (d : ℕ → ℝ≥0) (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) (hd : Summable d) : CauchySeq f
Full source
/-- If the extended distance between consecutive points of a sequence is estimated
by a summable series of `NNReal`s, then the original sequence is a Cauchy sequence. -/
theorem cauchySeq_of_edist_le_of_summable {f :  → α} (d : ℝ≥0)
    (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) (hd : Summable d) : CauchySeq f := by
  refine EMetric.cauchySeq_iff_NNReal.2 fun ε εpos ↦ ?_
  -- Actually we need partial sums of `d` to be a Cauchy sequence.
  replace hd : CauchySeq fun n : ∑ x ∈ Finset.range n, d x :=
    let ⟨_, H⟩ := hd
    H.tendsto_sum_nat.cauchySeq
  -- Now we take the same `N` as in one of the definitions of a Cauchy sequence.
  refine (Metric.cauchySeq_iff'.1 hd ε (NNReal.coe_pos.2 εpos)).imp fun N hN n hn ↦ ?_
  specialize hN n hn
  -- We simplify the known inequality.
  rw [dist_nndist, NNReal.nndist_eq, ← Finset.sum_range_add_sum_Ico _ hn, add_tsub_cancel_left,
    NNReal.coe_lt_coe, max_lt_iff] at hN
  rw [edist_comm]
  -- Then use `hf` to simplify the goal to the same form.
  refine lt_of_le_of_lt (edist_le_Ico_sum_of_edist_le hn fun _ _ ↦ hf _) ?_
  exact mod_cast hN.1
Cauchy Criterion via Summable Distance Bounds
Informal description
Let $\{f(n)\}_{n \in \mathbb{N}}$ be a sequence in a metric space $\alpha$, and let $\{d(n)\}_{n \in \mathbb{N}}$ be a sequence of non-negative real numbers. If for every $n \in \mathbb{N}$, the extended distance between consecutive terms satisfies $\text{edist}(f(n), f(n+1)) \leq d(n)$, and if the series $\sum_{n=0}^\infty d(n)$ is summable, then the sequence $\{f(n)\}$ is a Cauchy sequence.
cauchySeq_of_edist_le_of_tsum_ne_top theorem
{f : ℕ → α} (d : ℕ → ℝ≥0∞) (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) (hd : tsum d ≠ ∞) : CauchySeq f
Full source
theorem cauchySeq_of_edist_le_of_tsum_ne_top {f :  → α} (d : ℝ≥0∞)
    (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) (hd : tsumtsum d ≠ ∞) : CauchySeq f := by
  lift d to NNReal using fun i => ENNReal.ne_top_of_tsum_ne_top hd i
  rw [ENNReal.tsum_coe_ne_top_iff_summable] at hd
  exact cauchySeq_of_edist_le_of_summable d hf hd
Cauchy Criterion via Finite Sum of Extended Distance Bounds
Informal description
Let $\{f(n)\}_{n \in \mathbb{N}}$ be a sequence in an extended metric space $\alpha$, and let $\{d(n)\}_{n \in \mathbb{N}}$ be a sequence of extended non-negative real numbers. If for every $n \in \mathbb{N}$, the extended distance between consecutive terms satisfies $\text{edist}(f(n), f(n+1)) \leq d(n)$, and if the sum $\sum_{n=0}^\infty d(n)$ is finite, then the sequence $\{f(n)\}$ is a Cauchy sequence.
EMetric.isClosed_closedBall theorem
{a : α} {r : ℝ≥0∞} : IsClosed (closedBall a r)
Full source
theorem EMetric.isClosed_closedBall {a : α} {r : ℝ≥0∞} : IsClosed (closedBall a r) :=
  isClosed_le (continuous_id.edist continuous_const) continuous_const
Closed Balls are Closed Sets in Extended Metric Spaces
Informal description
For any point $a$ in an extended metric space $\alpha$ and any extended non-negative real number $r$, the closed ball $\overline{B}(a, r) = \{x \in \alpha \mid \text{edist}(a, x) \leq r\}$ is a closed set in the topology of $\alpha$.
EMetric.diam_closure theorem
(s : Set α) : diam (closure s) = diam s
Full source
@[simp]
theorem EMetric.diam_closure (s : Set α) : diam (closure s) = diam s := by
  refine le_antisymm (diam_le fun x hx y hy => ?_) (diam_mono subset_closure)
  have : edistedist x y ∈ closure (Iic (diam s)) :=
    map_mem_closure₂ continuous_edist hx hy fun x hx y hy => edist_le_diam_of_mem hx hy
  rwa [closure_Iic] at this
Diameter of Closure Equals Diameter of Set in Extended Metric Space
Informal description
For any subset $s$ of an extended metric space $\alpha$, the diameter of the closure of $s$ is equal to the diameter of $s$, i.e., $\text{diam}(\overline{s}) = \text{diam}(s)$.
Metric.diam_closure theorem
{α : Type*} [PseudoMetricSpace α] (s : Set α) : Metric.diam (closure s) = diam s
Full source
@[simp]
theorem Metric.diam_closure {α : Type*} [PseudoMetricSpace α] (s : Set α) :
    Metric.diam (closure s) = diam s := by simp only [Metric.diam, EMetric.diam_closure]
Diameter of Closure Equals Diameter of Set in Pseudometric Space
Informal description
For any subset $s$ of a pseudometric space $\alpha$, the diameter of the closure of $s$ is equal to the diameter of $s$, i.e., $\text{diam}(\overline{s}) = \text{diam}(s)$.
isClosed_setOf_lipschitzOnWith theorem
{α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (s : Set α) : IsClosed {f : α → β | LipschitzOnWith K f s}
Full source
theorem isClosed_setOf_lipschitzOnWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0)
    (s : Set α) : IsClosed { f : α → β | LipschitzOnWith K f s } := by
  simp only [LipschitzOnWith, setOf_forall]
  refine isClosed_biInter fun x _ => isClosed_biInter fun y _ => isClosed_le ?_ ?_
  exacts [.edist (continuous_apply x) (continuous_apply y), continuous_const]
Closedness of Lipschitz Continuous Functions on a Subset with Fixed Constant
Informal description
Let $\alpha$ and $\beta$ be pseudo-extended metric spaces, $K$ a non-negative real number, and $s$ a subset of $\alpha$. Then the set of functions $f \colon \alpha \to \beta$ that are Lipschitz continuous on $s$ with constant $K$ is closed in the space of all functions from $\alpha$ to $\beta$.
isClosed_setOf_lipschitzWith theorem
{α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) : IsClosed {f : α → β | LipschitzWith K f}
Full source
theorem isClosed_setOf_lipschitzWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) :
    IsClosed { f : α → β | LipschitzWith K f } := by
  simp only [← lipschitzOnWith_univ, isClosed_setOf_lipschitzOnWith]
Closedness of Lipschitz Continuous Functions with Fixed Constant
Informal description
For any two pseudo-emetric spaces $\alpha$ and $\beta$, and for any non-negative real number $K$, the set of functions $f \colon \alpha \to \beta$ that are Lipschitz continuous with constant $K$ is a closed subset in the space of all functions from $\alpha$ to $\beta$.
Real.ediam_eq theorem
{s : Set ℝ} (h : Bornology.IsBounded s) : EMetric.diam s = ENNReal.ofReal (sSup s - sInf s)
Full source
/-- For a bounded set `s : Set ℝ`, its `EMetric.diam` is equal to `sSup s - sInf s` reinterpreted as
`ℝ≥0∞`. -/
theorem ediam_eq {s : Set } (h : Bornology.IsBounded s) :
    EMetric.diam s = ENNReal.ofReal (sSup s - sInf s) := by
  rcases eq_empty_or_nonempty s with (rfl | hne)
  · simp
  refine le_antisymm (Metric.ediam_le_of_forall_dist_le fun x hx y hy => ?_) ?_
  · exact Real.dist_le_of_mem_Icc (h.subset_Icc_sInf_sSup hx) (h.subset_Icc_sInf_sSup hy)
  · apply ENNReal.ofReal_le_of_le_toReal
    rw [← Metric.diam, ← Metric.diam_closure]
    calc sSup s - sInf s ≤ dist (sSup s) (sInf s) := le_abs_self _
    _ ≤ Metric.diam (closure s) := dist_le_diam_of_mem h.closure (csSup_mem_closure hne h.bddAbove)
        (csInf_mem_closure hne h.bddBelow)
Extended Diameter of Bounded Real Set Equals Supremum Minus Infimum
Informal description
For any bounded subset $s$ of the real numbers $\mathbb{R}$, the extended metric diameter of $s$ is equal to the extended non-negative real number obtained by applying the `ENNReal.ofReal` function to the difference between the supremum and infimum of $s$, i.e., $\text{diam}(s) = \text{ofReal}(\sup s - \inf s)$.
Real.diam_eq theorem
{s : Set ℝ} (h : Bornology.IsBounded s) : Metric.diam s = sSup s - sInf s
Full source
/-- For a bounded set `s : Set ℝ`, its `Metric.diam` is equal to `sSup s - sInf s`. -/
theorem diam_eq {s : Set } (h : Bornology.IsBounded s) : Metric.diam s = sSup s - sInf s := by
  rw [Metric.diam, Real.ediam_eq h, ENNReal.toReal_ofReal]
  exact sub_nonneg.2 (Real.sInf_le_sSup s h.bddBelow h.bddAbove)
Diameter of Bounded Real Set Equals Supremum Minus Infimum
Informal description
For any bounded subset $s$ of the real numbers $\mathbb{R}$, the metric diameter of $s$ equals the difference between its supremum and infimum, i.e., $\text{diam}(s) = \sup s - \inf s$.
Real.ediam_Ioo theorem
(a b : ℝ) : EMetric.diam (Ioo a b) = ENNReal.ofReal (b - a)
Full source
@[simp]
theorem ediam_Ioo (a b : ) : EMetric.diam (Ioo a b) = ENNReal.ofReal (b - a) := by
  rcases le_or_lt b a with (h | h)
  · simp [h]
  · rw [Real.ediam_eq (isBounded_Ioo _ _), csSup_Ioo h, csInf_Ioo h]
Extended Diameter of Open Interval Equals Length: $\text{diam}((a, b)) = b - a$
Informal description
For any real numbers $a$ and $b$, the extended metric diameter of the open interval $(a, b)$ is equal to the extended non-negative real number obtained from the difference $b - a$, i.e., $\text{diam}((a, b)) = \text{ofReal}(b - a)$.
Real.ediam_Icc theorem
(a b : ℝ) : EMetric.diam (Icc a b) = ENNReal.ofReal (b - a)
Full source
@[simp]
theorem ediam_Icc (a b : ) : EMetric.diam (Icc a b) = ENNReal.ofReal (b - a) := by
  rcases le_or_lt a b with (h | h)
  · rw [Real.ediam_eq (isBounded_Icc _ _), csSup_Icc h, csInf_Icc h]
  · simp [h, h.le]
Extended Diameter of Closed Interval Equals Length
Informal description
For any real numbers $a$ and $b$, the extended metric diameter of the closed interval $[a, b]$ is equal to the extended non-negative real number obtained from the difference $b - a$, i.e., $\text{diam}([a, b]) = \text{ofReal}(b - a)$.
Real.ediam_Ico theorem
(a b : ℝ) : EMetric.diam (Ico a b) = ENNReal.ofReal (b - a)
Full source
@[simp]
theorem ediam_Ico (a b : ) : EMetric.diam (Ico a b) = ENNReal.ofReal (b - a) :=
  le_antisymm (ediam_Icc a b ▸ diam_mono Ico_subset_Icc_self)
    (ediam_Ioo a b ▸ diam_mono Ioo_subset_Ico_self)
Extended Diameter of Left-Closed Right-Open Interval Equals Length: $\text{diam}([a, b)) = b - a$
Informal description
For any real numbers $a$ and $b$, the extended metric diameter of the left-closed right-open interval $[a, b)$ is equal to the extended non-negative real number obtained from the difference $b - a$, i.e., $\text{diam}([a, b)) = \text{ofReal}(b - a)$.
Real.ediam_Ioc theorem
(a b : ℝ) : EMetric.diam (Ioc a b) = ENNReal.ofReal (b - a)
Full source
@[simp]
theorem ediam_Ioc (a b : ) : EMetric.diam (Ioc a b) = ENNReal.ofReal (b - a) :=
  le_antisymm (ediam_Icc a b ▸ diam_mono Ioc_subset_Icc_self)
    (ediam_Ioo a b ▸ diam_mono Ioo_subset_Ioc_self)
Extended Diameter of Left-Open Right-Closed Interval Equals Length: $\text{diam}((a, b]) = b - a$
Informal description
For any real numbers $a$ and $b$, the extended metric diameter of the left-open right-closed interval $(a, b]$ is equal to the extended non-negative real number obtained from the difference $b - a$, i.e., $\text{diam}((a, b]) = \text{ofReal}(b - a)$.
Real.diam_Icc theorem
{a b : ℝ} (h : a ≤ b) : Metric.diam (Icc a b) = b - a
Full source
theorem diam_Icc {a b : } (h : a ≤ b) : Metric.diam (Icc a b) = b - a := by
  simp [Metric.diam, ENNReal.toReal_ofReal (sub_nonneg.2 h)]
Diameter of Closed Interval Equals Length: $\text{diam}([a, b]) = b - a$
Informal description
For any real numbers $a$ and $b$ with $a \leq b$, the metric diameter of the closed interval $[a, b]$ is equal to $b - a$, i.e., $\text{diam}([a, b]) = b - a$.
Real.diam_Ico theorem
{a b : ℝ} (h : a ≤ b) : Metric.diam (Ico a b) = b - a
Full source
theorem diam_Ico {a b : } (h : a ≤ b) : Metric.diam (Ico a b) = b - a := by
  simp [Metric.diam, ENNReal.toReal_ofReal (sub_nonneg.2 h)]
Diameter of Left-Closed Right-Open Interval Equals Length: $\text{diam}([a, b)) = b - a$
Informal description
For any real numbers $a$ and $b$ with $a \leq b$, the metric diameter of the left-closed right-open interval $[a, b)$ is equal to $b - a$, i.e., $\text{diam}([a, b)) = b - a$.
Real.diam_Ioc theorem
{a b : ℝ} (h : a ≤ b) : Metric.diam (Ioc a b) = b - a
Full source
theorem diam_Ioc {a b : } (h : a ≤ b) : Metric.diam (Ioc a b) = b - a := by
  simp [Metric.diam, ENNReal.toReal_ofReal (sub_nonneg.2 h)]
Diameter of Left-Open Right-Closed Interval Equals Length: $\text{diam}((a, b]) = b - a$
Informal description
For any real numbers $a$ and $b$ with $a \leq b$, the metric diameter of the left-open right-closed interval $(a, b]$ is equal to $b - a$, i.e., $\text{diam}((a, b]) = b - a$.
Real.diam_Ioo theorem
{a b : ℝ} (h : a ≤ b) : Metric.diam (Ioo a b) = b - a
Full source
theorem diam_Ioo {a b : } (h : a ≤ b) : Metric.diam (Ioo a b) = b - a := by
  simp [Metric.diam, ENNReal.toReal_ofReal (sub_nonneg.2 h)]
Diameter of Open Interval Equals Length: $\text{diam}((a, b)) = b - a$
Informal description
For any real numbers $a$ and $b$ with $a \leq b$, the metric diameter of the open interval $(a, b)$ is equal to $b - a$, i.e., $\text{diam}((a, b)) = b - a$.
edist_le_tsum_of_edist_le_of_tendsto theorem
{f : ℕ → α} (d : ℕ → ℝ≥0∞) (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) : edist (f n) a ≤ ∑' m, d (n + m)
Full source
/-- If `edist (f n) (f (n+1))` is bounded above by a function `d : ℕ → ℝ≥0∞`,
then the distance from `f n` to the limit is bounded by `∑'_{k=n}^∞ d k`. -/
theorem edist_le_tsum_of_edist_le_of_tendsto {f :  → α} (d : ℝ≥0∞)
    (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ) :
    edist (f n) a ≤ ∑' m, d (n + m) := by
  refine le_of_tendsto (tendsto_const_nhds.edist ha) (mem_atTop_sets.2 ⟨n, fun m hnm => ?_⟩)
  change edist _ _ ≤ _
  refine le_trans (edist_le_Ico_sum_of_edist_le hnm fun _ _ => hf _) ?_
  rw [Finset.sum_Ico_eq_sum_range]
  exact ENNReal.summable.sum_le_tsum _ (fun _ _ => zero_le _)
Tail Sum Bound on Limit Distance for Sequences with Bounded Consecutive Differences
Informal description
Let $(f_n)_{n \in \mathbb{N}}$ be a sequence in a metric space $\alpha$ with extended non-negative real-valued distances, and let $d \colon \mathbb{N} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a sequence of extended non-negative real numbers. Suppose that for each $n \in \mathbb{N}$, the extended distance between consecutive terms satisfies $\text{edist}(f_n, f_{n+1}) \leq d(n)$. If the sequence $(f_n)$ converges to a limit $a \in \alpha$, then for any $n \in \mathbb{N}$, the extended distance from $f_n$ to $a$ is bounded by the tail sum of the sequence $d$ starting from $n$, i.e., \[ \text{edist}(f_n, a) \leq \sum_{m=n}^\infty d(m). \]
edist_le_tsum_of_edist_le_of_tendsto₀ theorem
{f : ℕ → α} (d : ℕ → ℝ≥0∞) (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) {a : α} (ha : Tendsto f atTop (𝓝 a)) : edist (f 0) a ≤ ∑' m, d m
Full source
/-- If `edist (f n) (f (n+1))` is bounded above by a function `d : ℕ → ℝ≥0∞`,
then the distance from `f 0` to the limit is bounded by `∑'_{k=0}^∞ d k`. -/
theorem edist_le_tsum_of_edist_le_of_tendsto₀ {f :  → α} (d : ℝ≥0∞)
    (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) {a : α} (ha : Tendsto f atTop (𝓝 a)) :
    edist (f 0) a ≤ ∑' m, d m := by simpa using edist_le_tsum_of_edist_le_of_tendsto d hf ha 0
Sum Bound on Limit Distance for Sequences with Bounded Consecutive Differences
Informal description
Let $(f_n)_{n \in \mathbb{N}}$ be a sequence in a metric space $\alpha$ with extended non-negative real-valued distances, and let $d \colon \mathbb{N} \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a sequence of extended non-negative real numbers. Suppose that for each $n \in \mathbb{N}$, the extended distance between consecutive terms satisfies $\text{edist}(f_n, f_{n+1}) \leq d(n)$. If the sequence $(f_n)$ converges to a limit $a \in \alpha$, then the extended distance from $f_0$ to $a$ is bounded by the sum of the sequence $d$, i.e., \[ \text{edist}(f_0, a) \leq \sum_{m=0}^\infty d(m). \]
ENNReal.truncateToReal definition
(t x : ℝ≥0∞) : ℝ
Full source
/-- With truncation level `t`, the truncated cast `ℝ≥0∞ → ℝ` is given by `x ↦ (min t x).toReal`.
Unlike `ENNReal.toReal`, this cast is continuous and monotone when `t ≠ ∞`. -/
noncomputable def truncateToReal (t x : ℝ≥0∞) :  := (min t x).toReal
Truncated cast from extended non-negative reals to reals
Informal description
For a truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ and an extended non-negative real $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the truncated cast $\mathbb{R}_{\geq 0} \cup \{\infty\} \to \mathbb{R}$ is defined as $x \mapsto (\min(t, x))_{\text{toReal}}$, where $(\cdot)_{\text{toReal}}$ converts the value to a real number. Unlike the standard `ENNReal.toReal` function, this cast is continuous and monotone when $t \neq \infty$.
ENNReal.truncateToReal_eq_toReal theorem
{t x : ℝ≥0∞} (t_ne_top : t ≠ ∞) (x_le : x ≤ t) : truncateToReal t x = x.toReal
Full source
lemma truncateToReal_eq_toReal {t x : ℝ≥0∞} (t_ne_top : t ≠ ∞) (x_le : x ≤ t) :
    truncateToReal t x = x.toReal := by
  have x_lt_top : x <  := lt_of_le_of_lt x_le t_ne_top.lt_top
  have obs : minmin t x ≠ ∞ := by
    simp_all only [ne_eq, min_eq_top, false_and, not_false_eq_true]
  exact (ENNReal.toReal_eq_toReal obs x_lt_top.ne).mpr (min_eq_right x_le)
Truncated Cast Equals Standard Conversion: $\text{truncateToReal}(t, x) = x_{\text{toReal}}$ when $x \leq t \neq \infty$
Informal description
For any truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $t \neq \infty$ and any extended non-negative real $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ such that $x \leq t$, the truncated cast $\text{truncateToReal}(t, x)$ equals the standard conversion $x_{\text{toReal}}$, i.e., $\text{truncateToReal}(t, x) = x_{\text{toReal}}$.
ENNReal.truncateToReal_le theorem
{t : ℝ≥0∞} (t_ne_top : t ≠ ∞) {x : ℝ≥0∞} : truncateToReal t x ≤ t.toReal
Full source
lemma truncateToReal_le {t : ℝ≥0∞} (t_ne_top : t ≠ ∞) {x : ℝ≥0∞} :
    truncateToReal t x ≤ t.toReal := by
  rw [truncateToReal]
  gcongr
  exacts [t_ne_top, min_le_left t x]
Upper Bound for Truncated Cast: $\text{truncateToReal}(t, x) \leq t_{\text{toReal}}$
Informal description
For any truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $t \neq \infty$ and any extended non-negative real $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the truncated cast value satisfies $\text{truncateToReal}(t, x) \leq t_{\text{toReal}}$, where $t_{\text{toReal}}$ is the standard conversion of $t$ to a real number.
ENNReal.truncateToReal_nonneg theorem
{t x : ℝ≥0∞} : 0 ≤ truncateToReal t x
Full source
lemma truncateToReal_nonneg {t x : ℝ≥0∞} : 0 ≤ truncateToReal t x := toReal_nonneg
Non-negativity of Truncated Cast from Extended Non-negative Reals to Reals
Informal description
For any truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ and any extended non-negative real $x \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the truncated cast $\text{truncateToReal}(t, x)$ is non-negative, i.e., $0 \leq \text{truncateToReal}(t, x)$.
ENNReal.monotone_truncateToReal theorem
{t : ℝ≥0∞} (t_ne_top : t ≠ ∞) : Monotone (truncateToReal t)
Full source
/-- The truncated cast `ENNReal.truncateToReal t : ℝ≥0∞ → ℝ` is monotone when `t ≠ ∞`. -/
lemma monotone_truncateToReal {t : ℝ≥0∞} (t_ne_top : t ≠ ∞) : Monotone (truncateToReal t) := by
  intro x y x_le_y
  simp only [truncateToReal]
  gcongr
  exact ne_top_of_le_ne_top t_ne_top (min_le_left _ _)
Monotonicity of Truncated Cast from Extended Non-Negative Reals to Reals for Finite Truncation Levels
Informal description
For any truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $t \neq \infty$, the truncated cast function $\text{truncateToReal}(t, \cdot) : \mathbb{R}_{\geq 0} \cup \{\infty\} \to \mathbb{R}$ is monotone. That is, for any $x, y \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $x \leq y$, we have $\text{truncateToReal}(t, x) \leq \text{truncateToReal}(t, y)$.
ENNReal.continuous_truncateToReal theorem
{t : ℝ≥0∞} (t_ne_top : t ≠ ∞) : Continuous (truncateToReal t)
Full source
/-- The truncated cast `ENNReal.truncateToReal t : ℝ≥0∞ → ℝ` is continuous when `t ≠ ∞`. -/
@[fun_prop]
lemma continuous_truncateToReal {t : ℝ≥0∞} (t_ne_top : t ≠ ∞) : Continuous (truncateToReal t) := by
  apply continuousOn_toReal.comp_continuous (by fun_prop)
  simp [t_ne_top]
Continuity of Truncated Cast from Extended Non-Negative Reals to Reals for Finite Truncation Levels
Informal description
For any truncation level $t \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $t \neq \infty$, the truncated cast function $\text{truncateToReal}(t, \cdot) : \mathbb{R}_{\geq 0} \cup \{\infty\} \to \mathbb{R}$ is continuous.
ENNReal.limsup_sub_const theorem
(F : Filter ι) (f : ι → ℝ≥0∞) (c : ℝ≥0∞) : Filter.limsup (fun i ↦ f i - c) F = Filter.limsup f F - c
Full source
lemma limsup_sub_const (F : Filter ι) (f : ι → ℝ≥0∞) (c : ℝ≥0∞) :
    Filter.limsup (fun i ↦ f i - c) F = Filter.limsup f F - c := by
  rcases F.eq_or_neBot with rfl | _
  · simp only [limsup_bot, bot_eq_zero', zero_le, tsub_eq_zero_of_le]
  · exact (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : ℝ≥0∞) ↦ x - c)
    (fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt).symm
Limit Superior of Shifted Function in Extended Non-Negative Reals: $\limsup (f - c) = (\limsup f) - c$
Informal description
For any filter $F$ on a type $\iota$, any function $f : \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, and any extended non-negative real number $c \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the limit superior of the function $i \mapsto f(i) - c$ with respect to $F$ equals the limit superior of $f$ minus $c$. That is, \[ \limsup_{F} (f - c) = (\limsup_{F} f) - c. \]
ENNReal.liminf_sub_const theorem
(F : Filter ι) [NeBot F] (f : ι → ℝ≥0∞) (c : ℝ≥0∞) : Filter.liminf (fun i ↦ f i - c) F = Filter.liminf f F - c
Full source
lemma liminf_sub_const (F : Filter ι) [NeBot F] (f : ι → ℝ≥0∞) (c : ℝ≥0∞) :
    Filter.liminf (fun i ↦ f i - c) F = Filter.liminf f F - c :=
  (Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : ℝ≥0∞) ↦ x - c)
    (fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt).symm
Limit Inferior of Shifted Sequence in Extended Non-Negative Reals
Informal description
For any non-trivial filter $F$ on a type $\iota$, any function $f : \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, and any extended non-negative real number $c \in \mathbb{R}_{\geq 0} \cup \{\infty\}$, the limit inferior of the sequence $(f(i) - c)_{i \in \iota}$ with respect to $F$ equals the limit inferior of $f$ minus $c$, i.e., \[ \liminf_{i \in F} (f(i) - c) = (\liminf_{i \in F} f(i)) - c. \]
ENNReal.limsup_const_sub theorem
(F : Filter ι) (f : ι → ℝ≥0∞) {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) : Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F
Full source
lemma limsup_const_sub (F : Filter ι) (f : ι → ℝ≥0∞) {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) :
    Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F := by
  rcases F.eq_or_neBot with rfl | _
  · simp only [limsup_bot, bot_eq_zero', liminf_bot, le_top, tsub_eq_zero_of_le]
  · exact (Antitone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : ℝ≥0∞) ↦ c - x)
    (fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c_ne_top).continuousAt).symm
Limsup of Constant Minus Function in Extended Non-Negative Reals
Informal description
For any filter $F$ on a type $\iota$, any function $f \colon \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, and any extended non-negative real number $c \neq \infty$, the limsup of the function $i \mapsto c - f(i)$ with respect to $F$ equals $c$ minus the liminf of $f$ with respect to $F$, i.e., \[ \limsup_{i \in F} (c - f(i)) = c - \liminf_{i \in F} f(i). \]
ENNReal.liminf_const_sub theorem
(F : Filter ι) [NeBot F] (f : ι → ℝ≥0∞) {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) : Filter.liminf (fun i ↦ c - f i) F = c - Filter.limsup f F
Full source
lemma liminf_const_sub (F : Filter ι) [NeBot F] (f : ι → ℝ≥0∞) {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) :
    Filter.liminf (fun i ↦ c - f i) F = c - Filter.limsup f F :=
  (Antitone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : ℝ≥0∞) ↦ c - x)
    (fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c_ne_top).continuousAt).symm
Liminf of Constant Minus Function in Extended Non-Negative Reals
Informal description
For any filter $F$ on a type $\iota$ that is not the trivial filter, any function $f : \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$, and any extended non-negative real number $c \neq \infty$, the liminf of the function $x \mapsto c - f(x)$ with respect to $F$ is equal to $c$ minus the limsup of $f$ with respect to $F$: \[ \liminf_{i \to F} (c - f(i)) = c - \limsup_{i \to F} f(i). \]
ENNReal.le_limsup_mul theorem
: limsup u f * liminf v f ≤ limsup (u * v) f
Full source
lemma le_limsup_mul : limsup u f * liminf v f ≤ limsup (u * v) f :=
  mul_le_of_forall_lt fun a a_u b b_v ↦ (le_limsup_iff).2 fun c c_ab ↦
    Frequently.mono (Frequently.and_eventually ((frequently_lt_of_lt_limsup) a_u)
    ((eventually_lt_of_lt_liminf) b_v)) fun _ ab_x ↦ c_ab.trans (mul_lt_mul ab_x.1 ab_x.2)
Inequality for limsup and liminf of product in extended non-negative reals
Informal description
For any functions $u$ and $v$ with values in the extended non-negative reals $\mathbb{R}_{\geq 0} \cup \{\infty\}$ and any filter $f$, the product of the limsup of $u$ and the liminf of $v$ is less than or equal to the limsup of their product: \[ (\limsup u) \cdot (\liminf v) \leq \limsup (u \cdot v). \]
ENNReal.limsup_mul_le' theorem
(h : limsup u f ≠ 0 ∨ limsup v f ≠ ∞) (h' : limsup u f ≠ ∞ ∨ limsup v f ≠ 0) : limsup (u * v) f ≤ limsup u f * limsup v f
Full source
/-- See also `ENNReal.limsup_mul_le`. -/
lemma limsup_mul_le' (h : limsuplimsup u f ≠ 0limsup u f ≠ 0 ∨ limsup v f ≠ ∞) (h' : limsuplimsup u f ≠ ∞limsup u f ≠ ∞ ∨ limsup v f ≠ 0) :
    limsup (u * v) f ≤ limsup u f * limsup v f := by
  refine le_mul_of_forall_lt h h' fun a a_u b b_v ↦ (limsup_le_iff).2 fun c c_ab ↦ ?_
  filter_upwards [eventually_lt_of_limsup_lt a_u, eventually_lt_of_limsup_lt b_v] with x a_x b_x
  exact (mul_lt_mul a_x b_x).trans c_ab
Inequality for limsup of product in extended non-negative reals
Informal description
Let $u$ and $v$ be functions with values in the extended non-negative reals $\mathbb{R}_{\geq 0} \cup \{\infty\}$, and let $f$ be a filter. If either: 1. The limsup of $u$ is nonzero or the limsup of $v$ is finite, and 2. The limsup of $u$ is finite or the limsup of $v$ is nonzero, then the limsup of the product $u \cdot v$ satisfies: \[ \limsup (u \cdot v) \leq (\limsup u) \cdot (\limsup v). \]
ENNReal.le_liminf_mul theorem
: liminf u f * liminf v f ≤ liminf (u * v) f
Full source
lemma le_liminf_mul : liminf u f * liminf v f ≤ liminf (u * v) f := by
  refine mul_le_of_forall_lt fun a a_u b b_v ↦ (le_liminf_iff).2 fun c c_ab ↦ ?_
  filter_upwards [eventually_lt_of_lt_liminf a_u, eventually_lt_of_lt_liminf b_v] with x a_x b_x
  exact c_ab.trans (mul_lt_mul a_x b_x)
Inequality for liminf of product in extended non-negative reals
Informal description
For any functions $u$ and $v$ with values in the extended non-negative reals $\mathbb{R}_{\geq 0} \cup \{\infty\}$ and any filter $f$, the product of the liminfs of $u$ and $v$ is less than or equal to the liminf of their product: \[ (\liminf u) \cdot (\liminf v) \leq \liminf (u \cdot v). \]
ENNReal.liminf_mul_le theorem
(h : limsup u f ≠ 0 ∨ liminf v f ≠ ∞) (h' : limsup u f ≠ ∞ ∨ liminf v f ≠ 0) : liminf (u * v) f ≤ limsup u f * liminf v f
Full source
lemma liminf_mul_le (h : limsuplimsup u f ≠ 0limsup u f ≠ 0 ∨ liminf v f ≠ ∞) (h' : limsuplimsup u f ≠ ∞limsup u f ≠ ∞ ∨ liminf v f ≠ 0) :
    liminf (u * v) f ≤ limsup u f * liminf v f :=
  le_mul_of_forall_lt h h' fun a a_u b b_v ↦ (liminf_le_iff).2 fun c c_ab ↦
    Frequently.mono (((frequently_lt_of_liminf_lt) b_v).and_eventually
    ((eventually_lt_of_limsup_lt) a_u)) fun _ ab_x ↦ (mul_lt_mul ab_x.2 ab_x.1).trans c_ab
Inequality for liminf of product in extended non-negative reals
Informal description
Let $u$ and $v$ be functions with values in the extended non-negative reals $\mathbb{R}_{\geq 0} \cup \{\infty\}$, and let $f$ be a filter. If either: 1. The limsup of $u$ is nonzero or the liminf of $v$ is finite, and 2. The limsup of $u$ is finite or the liminf of $v$ is nonzero, then the liminf of the product $u \cdot v$ satisfies: \[ \liminf (u \cdot v) \leq (\limsup u) \cdot (\liminf v) \]
ENNReal.liminf_toReal_eq theorem
[NeBot f] {b : ℝ≥0∞} (b_ne_top : b ≠ ∞) (le_b : ∀ᶠ i in f, u i ≤ b) : f.liminf (fun i ↦ (u i).toReal) = (f.liminf u).toReal
Full source
/-- If `u : ι → ℝ≥0∞` is bounded, then we have `liminf (toReal ∘ u) = toReal (liminf u)`. -/
lemma liminf_toReal_eq [NeBot f] {b : ℝ≥0∞} (b_ne_top : b ≠ ∞) (le_b : ∀ᶠ i in f, u i ≤ b) :
    f.liminf (fun i ↦ (u i).toReal) = (f.liminf u).toReal := by
  have liminf_le : f.liminf u ≤ b := by
    apply liminf_le_of_le ⟨0, by simp⟩
    intro y h
    obtain ⟨i, hi⟩ := (Eventually.and h le_b).exists
    exact hi.1.trans hi.2
  have aux : ∀ᶠ i in f, (u i).toReal = ENNReal.truncateToReal b (u i) := by
    filter_upwards [le_b] with i i_le_b
    simp only [truncateToReal_eq_toReal b_ne_top i_le_b, implies_true]
  have aux' : (f.liminf u).toReal = ENNReal.truncateToReal b (f.liminf u) := by
    rw [truncateToReal_eq_toReal b_ne_top liminf_le]
  simp_rw [liminf_congr aux, aux']
  have key := Monotone.map_liminf_of_continuousAt (F := f) (monotone_truncateToReal b_ne_top) u
          (continuous_truncateToReal b_ne_top).continuousAt
          (IsBoundedUnder.isCoboundedUnder_ge ⟨b, by simpa only [eventually_map] using le_b⟩)
          ⟨0, Eventually.of_forall (by simp)⟩
  rw [key]
  rfl
Limit Inferior Commutes with Standard Conversion: $\liminf (u_{\text{toReal}}) = (\liminf u)_{\text{toReal}}$ for Bounded $u$
Informal description
Let $f$ be a non-trivial filter on a type $\iota$, and let $u \colon \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function such that there exists an extended non-negative real number $b \neq \infty$ with $u(i) \leq b$ for all $i$ in $f$. Then the limit inferior of the composition of $u$ with the standard conversion to real numbers equals the standard conversion of the limit inferior of $u$: \[ \liminf_{i \in f} (u(i))_{\text{toReal}} = (\liminf_{i \in f} u(i))_{\text{toReal}}. \]
ENNReal.limsup_toReal_eq theorem
[NeBot f] {b : ℝ≥0∞} (b_ne_top : b ≠ ∞) (le_b : ∀ᶠ i in f, u i ≤ b) : f.limsup (fun i ↦ (u i).toReal) = (f.limsup u).toReal
Full source
/-- If `u : ι → ℝ≥0∞` is bounded, then we have `liminf (toReal ∘ u) = toReal (liminf u)`. -/
lemma limsup_toReal_eq [NeBot f] {b : ℝ≥0∞} (b_ne_top : b ≠ ∞) (le_b : ∀ᶠ i in f, u i ≤ b) :
    f.limsup (fun i ↦ (u i).toReal) = (f.limsup u).toReal := by
  have aux : ∀ᶠ i in f, (u i).toReal = ENNReal.truncateToReal b (u i) := by
    filter_upwards [le_b] with i i_le_b
    simp only [truncateToReal_eq_toReal b_ne_top i_le_b, implies_true]
  have aux' : (f.limsup u).toReal = ENNReal.truncateToReal b (f.limsup u) := by
    rw [truncateToReal_eq_toReal b_ne_top (limsup_le_of_le ⟨0, by simp⟩ le_b)]
  simp_rw [limsup_congr aux, aux']
  have key := Monotone.map_limsup_of_continuousAt (F := f) (monotone_truncateToReal b_ne_top) u
          (continuous_truncateToReal b_ne_top).continuousAt
          ⟨b, by simpa only [eventually_map] using le_b⟩
          (IsBoundedUnder.isCoboundedUnder_le ⟨0, Eventually.of_forall (by simp)⟩)
  rw [key]
  rfl
Limit Superior Commutes with Standard Conversion: $\limsup (\text{toReal} \circ u) = (\limsup u)_{\text{toReal}}$ for Bounded $u$
Informal description
Let $f$ be a non-trivial filter on $\iota$, and let $u \colon \iota \to \mathbb{R}_{\geq 0} \cup \{\infty\}$ be a function such that there exists $b \in \mathbb{R}_{\geq 0} \cup \{\infty\}$ with $b \neq \infty$ and $u(i) \leq b$ for all $i$ in a set belonging to $f$. Then the limit superior of the composition $\text{toReal} \circ u$ with respect to $f$ equals the standard conversion of the limit superior of $u$ with respect to $f$, i.e., \[ \limsup_{i \in f} (u(i))_{\text{toReal}} = (\limsup_{i \in f} u(i))_{\text{toReal}}. \]
ENNReal.ofNNReal_limsup theorem
{u : ι → ℝ≥0} (hf : f.IsBoundedUnder (· ≤ ·) u) : limsup u f = limsup (fun i ↦ (u i : ℝ≥0∞)) f
Full source
@[simp, norm_cast]
lemma ofNNReal_limsup {u : ι → ℝ≥0} (hf : f.IsBoundedUnder (· ≤ ·) u) :
    limsup u f = limsup (fun i ↦ (u i : ℝ≥0∞)) f := by
  refine eq_of_forall_nnreal_iff fun r ↦ ?_
  rw [coe_le_coe, le_limsup_iff, le_limsup_iff]
  simp [forall_ennreal]
Limit Superior Preservation under Non-Negative Real to Extended Non-Negative Real Embedding
Informal description
For a function $u \colon \iota \to \mathbb{R}_{\geq 0}$ and a filter $f$ on $\iota$, if $u$ is bounded above under $f$ (i.e., there exists an upper bound for $u$ along $f$), then the limit superior of $u$ with respect to $f$ is equal to the limit superior of the composition of $u$ with the canonical embedding $\mathbb{R}_{\geq 0} \hookrightarrow \mathbb{R}_{\geq 0} \cup \{\infty\}$.
ENNReal.ofNNReal_liminf theorem
{u : ι → ℝ≥0} (hf : f.IsCoboundedUnder (· ≥ ·) u) : liminf u f = liminf (fun i ↦ (u i : ℝ≥0∞)) f
Full source
@[simp, norm_cast]
lemma ofNNReal_liminf {u : ι → ℝ≥0} (hf : f.IsCoboundedUnder (· ≥ ·) u) :
    liminf u f = liminf (fun i ↦ (u i : ℝ≥0∞)) f := by
  refine eq_of_forall_nnreal_iff fun r ↦ ?_
  rw [coe_le_coe, le_liminf_iff, le_liminf_iff]
  simp [forall_ennreal]
Limit Inferior Preservation under Non-Negative Real to Extended Non-Negative Real Embedding
Informal description
For a function $u \colon \iota \to \mathbb{R}_{\geq 0}$ and a filter $f$ on $\iota$, if $u$ is cobounded below under $f$ (i.e., there exists a lower bound for $u$ along $f$), then the limit inferior of $u$ with respect to $f$ is equal to the limit inferior of the composition of $u$ with the canonical embedding $\mathbb{R}_{\geq 0} \hookrightarrow \mathbb{R}_{\geq 0} \cup \{\infty\}$.