/-
Copyright (c) 2022 Peter Nelson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Peter Nelson
-/
module
public import Mathlib.Data.ENat.Monoid
public import Mathlib.Topology.Algebra.Ring.Basic
public import Mathlib.Topology.Instances.Discrete
set_option doc.verso true
set_option doc.verso.suggestions false
/-!
# Topology on extended natural numbers
-/
public section
open Filter Set Topology
namespace ENat
/--
Topology on `ℕ∞`.
Note: this is different from the `EMetricSpace` topology. The `EMetricSpace` topology has
`IsOpen {∞}`, but all neighborhoods of `∞` in `ℕ∞` contain infinite intervals.
-/
instance : TopologicalSpace ℕ∞ := Preorder.topology ℕ∞
instance : OrderTopology ℕ∞ := ⟨rfl⟩
@[simp] theorem range_natCast : range ((↑) : ℕ → ℕ∞) = Iio ⊤ :=
WithTop.range_coe
theorem isEmbedding_natCast : IsEmbedding ((↑) : ℕ → ℕ∞) :=
Nat.strictMono_cast.isEmbedding_of_ordConnected <| range_natCast ▸ ordConnected_Iio
theorem isOpenEmbedding_natCast : IsOpenEmbedding ((↑) : ℕ → ℕ∞) :=
⟨isEmbedding_natCast, range_natCast ▸ isOpen_Iio⟩
theorem nhds_natCast (n : ℕ) : (n : ℕ∞) = pure (n : ℕ∞) := by
simp [← isOpenEmbedding_natCast.map_nhds_eq]
@[simp]
protected theorem nhds_eq_pure {n : ℕ∞} (h : n ≠ ⊤) : n = pure n := by
lift n to ℕ using h
simp [nhds_natCast]
theorem isOpen_singleton {x : ℕ∞} (hx : x ≠ ⊤) : IsOpen {x} := by
rw [isOpen_singleton_iff_nhds_eq_pure, ENat.nhds_eq_pure hx]
theorem mem_nhds_iff {x : ℕ∞} {s : Set ℕ∞} (hx : x ≠ ⊤) : s ∈ x ↔ x ∈ s := by
simp [hx]
theorem mem_nhds_natCast_iff (n : ℕ) {s : Set ℕ∞} : s ∈ (n : ℕ∞) ↔ (n : ℕ∞) ∈ s :=
mem_nhds_iff (natCast_ne_top _)
theorem tendsto_nhds_top_iff_natCast_lt {α : Type*} {l : Filter α} {f : α → ℕ∞} :
Tendsto f l ( ⊤) ↔ ∀ n : ℕ, ∀ᶠ a in l, n < f a := by
simp_rw [nhds_top_order, lt_top_iff_ne_top, tendsto_iInf, tendsto_principal, ENat.forall_ne_top,
mem_Ioi]
theorem tendsto_natCast_nhds_top : Tendsto Nat.cast atTop ( (⊤ : ℕ∞)) := by
rw [tendsto_nhds_top_iff_natCast_lt]
intro n
filter_upwards [eventually_ge_atTop (n + 1)] with a ha using by simpa
instance : ContinuousAdd ℕ∞ := by
refine ⟨continuous_iff_continuousAt.mpr fun (a, b) ↦ ?_⟩
match a, b with
| ⊤, _ => exact tendsto_nhds_top_mono' continuousAt_fst fun p ↦ le_add_right le_rfl
| (a : ℕ), ⊤ => exact tendsto_nhds_top_mono' continuousAt_snd fun p ↦ le_add_left le_rfl
| (a : ℕ), (b : ℕ) => simp [ContinuousAt, nhds_prod_eq]
instance : ContinuousMul ℕ∞ where
continuous_mul :=
have key (a : ℕ∞) : ContinuousAt (· * ·).uncurry (a, ⊤) := by
rcases eq_zero_or_pos a with rfl | ha
· simp [ContinuousAt, nhds_prod_eq]
· simp only [ContinuousAt, Function.uncurry, mul_top ha.ne']
refine tendsto_nhds_top_mono continuousAt_snd ?_
filter_upwards [continuousAt_fst (lt_mem_nhds ha)] with (x, y) (hx : 0 < x)
exact ENat.self_le_mul_left _ hx.ne'
continuous_iff_continuousAt.2 <| Prod.forall.2 fun
| (a : ℕ∞), ⊤ => key a
| ⊤, (b : ℕ∞) =>
((key b).comp_of_eq (continuous_swap.tendsto (⊤, b)) rfl).congr <|
.of_forall fun _ ↦ mul_comm ..
| (a : ℕ), (b : ℕ) => by
simp [ContinuousAt, nhds_prod_eq, tendsto_pure_nhds]
instance : IsTopologicalSemiring ℕ∞ where
toContinuousAdd := inferInstance
toContinuousMul := inferInstance
protected theorem continuousAt_sub {a b : ℕ∞} (h : a ≠ ⊤ ∨ b ≠ ⊤) :
ContinuousAt (· - ·).uncurry (a, b) := by
match a, b, h with
| (a : ℕ), (b : ℕ), _ => simp [ContinuousAt, nhds_prod_eq]
| (a : ℕ), ⊤, _ =>
suffices ∀ᶠ b in ⊤, (a - b : ℕ∞) = 0 by
simpa [ContinuousAt, nhds_prod_eq, tsub_eq_zero_of_le]
filter_upwards [le_mem_nhds (WithTop.coe_lt_top a)] with b using tsub_eq_zero_of_le
| ⊤, (b : ℕ), _ =>
suffices ∀ n : ℕ, ∀ᶠ a : ℕ∞ in ⊤, b + n < a by
simpa [ContinuousAt, nhds_prod_eq, (· ∘ ·), lt_tsub_iff_left, tendsto_nhds_top_iff_natCast_lt]
exact fun n ↦ lt_mem_nhds <| WithTop.coe_lt_top (b + n)
end ENat
theorem Filter.Tendsto.enatSub {α : Type*} {l : Filter α} {f g : α → ℕ∞} {a b : ℕ∞}
(hf : Tendsto f l ( a)) (hg : Tendsto g l ( b)) (h : a ≠ ⊤ ∨ b ≠ ⊤) :
Tendsto (fun x ↦ f x - g x) l ( (a - b)) :=
(ENat.continuousAt_sub h).tendsto.comp (hf.prodMk_nhds hg)
variable {X : Type*} [TopologicalSpace X] {f g : X → ℕ∞} {s : Set X} {x : X}
nonrec theorem ContinuousWithinAt.enatSub
(hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : f x ≠ ⊤ ∨ g x ≠ ⊤) :
ContinuousWithinAt (fun x ↦ f x - g x) s x :=
hf.enatSub hg h
nonrec theorem ContinuousAt.enatSub
(hf : ContinuousAt f x) (hg : ContinuousAt g x) (h : f x ≠ ⊤ ∨ g x ≠ ⊤) :
ContinuousAt (fun x ↦ f x - g x) x :=
hf.enatSub hg h
nonrec theorem ContinuousOn.enatSub
(hf : ContinuousOn f s) (hg : ContinuousOn g s) (h : ∀ x ∈ s, f x ≠ ⊤ ∨ g x ≠ ⊤) :
ContinuousOn (fun x ↦ f x - g x) s := fun x hx ↦
(hf x hx).enatSub (hg x hx) (h x hx)
nonrec theorem Continuous.enatSub
(hf : Continuous f) (hg : Continuous g) (h : ∀ x, f x ≠ ⊤ ∨ g x ≠ ⊤) :
Continuous (fun x ↦ f x - g x) :=
continuous_iff_continuousAt.2 fun x ↦ hf.continuousAt.enatSub hg.continuousAt (h x)
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland