state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b c : α H : b ∈ Ico a c ⊢ Ioo b c ⊆ Ioo a c
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio];
exact Ioo_subset_Ioo_left H.1
theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio];
Mathlib.Topology.Order.Basic.408_0.Npdof1X5b8sCkZ2
theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h]
@[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
Mathlib.Topology.Order.Basic.454_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h]
@[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
Mathlib.Topology.Order.Basic.460_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b c : α H : b ∈ Ioc a c ⊢ Ioo a c ∈ 𝓝[<] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by
simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm)
theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by
Mathlib.Topology.Order.Basic.470_0.Npdof1X5b8sCkZ2
theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α h : a < b ⊢ 𝓝[Ico a b] b = 𝓝[<] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by
simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual
@[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by
Mathlib.Topology.Order.Basic.505_0.Npdof1X5b8sCkZ2
@[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α h : a < b ⊢ 𝓝[Ioo a b] b = 𝓝[<] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by
simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual
@[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by
Mathlib.Topology.Order.Basic.510_0.Npdof1X5b8sCkZ2
@[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α f : α → γ h : a < b ⊢ ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h]
@[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by
Mathlib.Topology.Order.Basic.515_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α f : α → γ h : a < b ⊢ ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h]
@[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by
Mathlib.Topology.Order.Basic.521_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b c : α H : b ∈ Ico a c ⊢ Iio c ∩ Ici b ⊆ Ico a c
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by
simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]
theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by
Mathlib.Topology.Order.Basic.539_0.Npdof1X5b8sCkZ2
theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h]
@[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by
Mathlib.Topology.Order.Basic.564_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h]
@[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by
Mathlib.Topology.Order.Basic.570_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b c : α H : b ∈ Ioc a c ⊢ Ioc a c ∈ 𝓝[≤] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by
simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm)
theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by
Mathlib.Topology.Order.Basic.589_0.Npdof1X5b8sCkZ2
theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α h : a < b ⊢ 𝓝[Icc a b] b = 𝓝[≤] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by
simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual
@[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by
Mathlib.Topology.Order.Basic.604_0.Npdof1X5b8sCkZ2
@[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α a✝ b✝ : α inst✝ : TopologicalSpace γ a b : α h : a < b ⊢ 𝓝[Ioc a b] b = 𝓝[≤] b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by
simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual
@[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by
Mathlib.Topology.Order.Basic.609_0.Npdof1X5b8sCkZ2
@[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h]
@[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
Mathlib.Topology.Order.Basic.614_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁴ : TopologicalSpace α inst✝³ : LinearOrder α inst✝² : OrderClosedTopology α a✝ b✝ : α inst✝¹ : TopologicalSpace γ inst✝ : TopologicalSpace β a b : α f : α → β h : a < b ⊢ ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h]
@[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
Mathlib.Topology.Order.Basic.620_0.Npdof1X5b8sCkZ2
@[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g ⊢ frontier {b | f b ≤ g b} ⊆ {b | f b = g b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by
rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg]
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g ⊢ {b | f b ≤ g b} ∩ closure {b | f b ≤ g b}ᶜ ⊆ {b | f b = g b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg]
rintro b ⟨hb₁, hb₂⟩
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg]
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
case intro α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g b : β hb₁ : b ∈ {b | f b ≤ g b} hb₂ : b ∈ closure {b | f b ≤ g b}ᶜ ⊢ b ∈ {b | f b = g b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩
refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _)
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
case intro α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g b : β hb₁ : b ∈ {b | f b ≤ g b} hb₂ : b ∈ closure {b | f b ≤ g b}ᶜ ⊢ b ∈ closure {b | g b < f b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _)
convert hb₂ using 2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _)
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
case h.e'_5.h.e'_3 α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g b : β hb₁ : b ∈ {b | f b ≤ g b} hb₂ : b ∈ closure {b | f b ≤ g b}ᶜ ⊢ {b | g b < f b} = {b | f b ≤ g b}ᶜ
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2;
simp only [not_le.symm]
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2;
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
case h.e'_5.h.e'_3 α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g b : β hb₁ : b ∈ {b | f b ≤ g b} hb₂ : b ∈ closure {b | f b ≤ g b}ᶜ ⊢ {b | ¬f b ≤ g b} = {b | f b ≤ g b}ᶜ
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm];
rfl
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm];
Mathlib.Topology.Order.Basic.641_0.Npdof1X5b8sCkZ2
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g ⊢ frontier {b | f b < g b} ⊆ {b | f b = g b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by
simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf
theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by
Mathlib.Topology.Order.Basic.657_0.Npdof1X5b8sCkZ2
theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b }
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝⁵ : TopologicalSpace α inst✝⁴ : LinearOrder α inst✝³ : OrderClosedTopology α f g : β → α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : (x : β) → Decidable (f x ≤ g x) f' g' : β → γ hf : Continuous f hg : Continuous g hf' : ContinuousOn f' {x | f x ≤ g x} hg' : ContinuousOn g' {x | g x ≤ f x} hfg : ∀ (x : β), f x = g x → f' x = g' x ⊢ Continuous fun x => if f x ≤ g x then f' x else g' x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by
refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _)
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by
Mathlib.Topology.Order.Basic.662_0.Npdof1X5b8sCkZ2
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x
Mathlib_Topology_Order_Basic
case refine'_1 α : Type u β : Type v γ : Type w inst✝⁵ : TopologicalSpace α inst✝⁴ : LinearOrder α inst✝³ : OrderClosedTopology α f g : β → α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : (x : β) → Decidable (f x ≤ g x) f' g' : β → γ hf : Continuous f hg : Continuous g hf' : ContinuousOn f' {x | f x ≤ g x} hg' : ContinuousOn g' {x | g x ≤ f x} hfg : ∀ (x : β), f x = g x → f' x = g' x ⊢ ContinuousOn (fun x => f' x) (closure {x | f x ≤ g x})
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) ·
rwa [(isClosed_le hf hg).closure_eq]
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) ·
Mathlib.Topology.Order.Basic.662_0.Npdof1X5b8sCkZ2
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x
Mathlib_Topology_Order_Basic
case refine'_2 α : Type u β : Type v γ : Type w inst✝⁵ : TopologicalSpace α inst✝⁴ : LinearOrder α inst✝³ : OrderClosedTopology α f g : β → α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : (x : β) → Decidable (f x ≤ g x) f' g' : β → γ hf : Continuous f hg : Continuous g hf' : ContinuousOn f' {x | f x ≤ g x} hg' : ContinuousOn g' {x | g x ≤ f x} hfg : ∀ (x : β), f x = g x → f' x = g' x ⊢ closure {x | ¬f x ≤ g x} ⊆ {x | g x ≤ f x}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] ·
simp only [not_le]
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] ·
Mathlib.Topology.Order.Basic.662_0.Npdof1X5b8sCkZ2
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x
Mathlib_Topology_Order_Basic
case refine'_2 α : Type u β : Type v γ : Type w inst✝⁵ : TopologicalSpace α inst✝⁴ : LinearOrder α inst✝³ : OrderClosedTopology α f g : β → α inst✝² : TopologicalSpace β inst✝¹ : TopologicalSpace γ inst✝ : (x : β) → Decidable (f x ≤ g x) f' g' : β → γ hf : Continuous f hg : Continuous g hf' : ContinuousOn f' {x | f x ≤ g x} hg' : ContinuousOn g' {x | g x ≤ f x} hfg : ∀ (x : β), f x = g x → f' x = g' x ⊢ closure {x | g x < f x} ⊆ {x | g x ≤ f x}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le]
exact closure_lt_subset_le hg hf
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le]
Mathlib.Topology.Order.Basic.662_0.Npdof1X5b8sCkZ2
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g ⊢ Continuous fun b => min (f b) (g b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by
simp only [min_def]
@[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by
Mathlib.Topology.Order.Basic.690_0.Npdof1X5b8sCkZ2
@[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : TopologicalSpace β hf : Continuous f hg : Continuous g ⊢ Continuous fun b => if f b ≤ g b then f b else g b
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def]
exact hf.if_le hg hf hg fun x => id
@[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def]
Mathlib.Topology.Order.Basic.690_0.Npdof1X5b8sCkZ2
@[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝 a) ⊢ Tendsto (fun i => max a (f i)) l (𝓝 a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by
convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h
protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by
Mathlib.Topology.Order.Basic.723_0.Npdof1X5b8sCkZ2
protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a)
Mathlib_Topology_Order_Basic
case h.e'_5.h.e'_3 α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝 a) ⊢ a = ((fun p => max p.1 p.2) ∘ fun b => (a, b)) a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h
simp
protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h
Mathlib.Topology.Order.Basic.723_0.Npdof1X5b8sCkZ2
protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝 a) ⊢ Tendsto (fun i => max (f i) a) l (𝓝 a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by
simp_rw [max_comm _ a]
protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by
Mathlib.Topology.Order.Basic.729_0.Npdof1X5b8sCkZ2
protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝 a) ⊢ Tendsto (fun i => max a (f i)) l (𝓝 a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a]
exact h.max_right
protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a]
Mathlib.Topology.Order.Basic.729_0.Npdof1X5b8sCkZ2
protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝[>] a) ⊢ Tendsto (fun i => max a (f i)) l (𝓝[>] a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by
obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h
theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by
Mathlib.Topology.Order.Basic.735_0.Npdof1X5b8sCkZ2
theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a)
Mathlib_Topology_Order_Basic
case intro α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝[>] a) h₁ : Tendsto f l (𝓝 a) h₂ : ∀ᶠ (i : β) in l, f i ∈ Ioi a ⊢ Tendsto (fun i => max a (f i)) l (𝓝[>] a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h
exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩
theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h
Mathlib.Topology.Order.Basic.735_0.Npdof1X5b8sCkZ2
theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝[>] a) ⊢ Tendsto (fun i => max (f i) a) l (𝓝[>] a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by
simp_rw [max_comm _ a]
theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by
Mathlib.Topology.Order.Basic.741_0.Npdof1X5b8sCkZ2
theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α l : Filter β a : α h : Tendsto f l (𝓝[>] a) ⊢ Tendsto (fun i => max a (f i)) l (𝓝[>] a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a]
exact Filter.tendsto_nhds_max_right h
theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a]
Mathlib.Topology.Order.Basic.741_0.Npdof1X5b8sCkZ2
theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α s : Set α hs : Dense s hbot : ∀ (x : α), IsBot x → x ∈ s x : α ⊢ ∃ y ∈ s, y ≤ x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by
by_cases hx : IsBot x
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by
Mathlib.Topology.Order.Basic.787_0.Npdof1X5b8sCkZ2
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x
Mathlib_Topology_Order_Basic
case pos α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α s : Set α hs : Dense s hbot : ∀ (x : α), IsBot x → x ∈ s x : α hx : IsBot x ⊢ ∃ y ∈ s, y ≤ x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x ·
exact ⟨x, hbot x hx, le_rfl⟩
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x ·
Mathlib.Topology.Order.Basic.787_0.Npdof1X5b8sCkZ2
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x
Mathlib_Topology_Order_Basic
case neg α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α s : Set α hs : Dense s hbot : ∀ (x : α), IsBot x → x ∈ s x : α hx : ¬IsBot x ⊢ ∃ y ∈ s, y ≤ x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ ·
simp only [IsBot, not_forall, not_le] at hx
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ ·
Mathlib.Topology.Order.Basic.787_0.Npdof1X5b8sCkZ2
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x
Mathlib_Topology_Order_Basic
case neg α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α s : Set α hs : Dense s hbot : ∀ (x : α), IsBot x → x ∈ s x : α hx : ∃ x_1, x_1 < x ⊢ ∃ y ∈ s, y ≤ x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx
rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx
Mathlib.Topology.Order.Basic.787_0.Npdof1X5b8sCkZ2
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x
Mathlib_Topology_Order_Basic
case neg.intro.intro α : Type u β : Type v γ : Type w inst✝² : TopologicalSpace α inst✝¹ : LinearOrder α inst✝ : OrderClosedTopology α f g : β → α s : Set α hs : Dense s hbot : ∀ (x : α), IsBot x → x ∈ s x : α hx : ∃ x_1, x_1 < x y : α hys : y ∈ s hy : y < x ⊢ ∃ y ∈ s, y ≤ x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩
exact ⟨y, hys, hy.le⟩
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩
Mathlib.Topology.Order.Basic.787_0.Npdof1X5b8sCkZ2
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : DenselyOrdered α s : Set α hs : Dense s x : α ⊢ Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by
refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2))
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by
Mathlib.Topology.Order.Basic.806_0.Npdof1X5b8sCkZ2
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : DenselyOrdered α s : Set α hs : Dense s x z : α hz : z ∈ Ioi x ⊢ z ∈ ⋃ y ∈ s ∩ Ioi x, Ioi y
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2))
rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2))
Mathlib.Topology.Order.Basic.806_0.Npdof1X5b8sCkZ2
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y
Mathlib_Topology_Order_Basic
case intro.intro.intro α : Type u β : Type v γ : Type w inst✝³ : TopologicalSpace α inst✝² : LinearOrder α inst✝¹ : OrderClosedTopology α f g : β → α inst✝ : DenselyOrdered α s : Set α hs : Dense s x z : α hz : z ∈ Ioi x y : α hys : y ∈ s hxy : x < y hyz : y < z ⊢ z ∈ ⋃ y ∈ s ∩ Ioi x, Ioi y
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩
exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩
Mathlib.Topology.Order.Basic.806_0.Npdof1X5b8sCkZ2
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y
Mathlib_Topology_Order_Basic
α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderClosedTopology (α i) ⊢ OrderClosedTopology ((i : ι) → α i)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by
constructor
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by
Mathlib.Topology.Order.Basic.825_0.Npdof1X5b8sCkZ2
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i)
Mathlib_Topology_Order_Basic
case isClosed_le' α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderClosedTopology (α i) ⊢ IsClosed {p | p.1 ≤ p.2}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor
simp only [Pi.le_def, setOf_forall]
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor
Mathlib.Topology.Order.Basic.825_0.Npdof1X5b8sCkZ2
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i)
Mathlib_Topology_Order_Basic
case isClosed_le' α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderClosedTopology (α i) ⊢ IsClosed (⋂ i, {x | x.1 i ≤ x.2 i})
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall]
exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd'
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall]
Mathlib.Topology.Order.Basic.825_0.Npdof1X5b8sCkZ2
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α ⊢ instTopologicalSpaceOrderDual = generateFrom {s | ∃ a, s = Ioi a ∨ s = Iio a}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by
convert OrderTopology.topology_eq_generate_intervals (α := α) using 6
instance : OrderTopology αᵒᵈ := ⟨by
Mathlib.Topology.Order.Basic.860_0.Npdof1X5b8sCkZ2
instance : OrderTopology αᵒᵈ
Mathlib_Topology_Order_Basic
case h.e'_3.h.h.e'_2.h.h.e'_2.h.h.h.e'_2.h.h.a α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α e_1✝² : TopologicalSpace αᵒᵈ = TopologicalSpace α e_1✝¹ : αᵒᵈ = α e_1✝ : Set αᵒᵈ = Set α x✝¹ : Set αᵒᵈ x✝ : αᵒᵈ ⊢ x✝¹ = Ioi x✝ ∨ x✝¹ = Iio x✝ ↔ x✝¹ = Ioi x✝ ∨ x✝¹ = Iio x✝
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6
apply or_comm
instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6
Mathlib.Topology.Order.Basic.860_0.Npdof1X5b8sCkZ2
instance : OrderTopology αᵒᵈ
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α s : Set α ⊢ IsOpen s ↔ GenerateOpen {s | ∃ a, s = Ioi a ∨ s = Iio a} s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by
rw [t.topology_eq_generate_intervals]
theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by
Mathlib.Topology.Order.Basic.865_0.Npdof1X5b8sCkZ2
theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α s : Set α ⊢ IsOpen s ↔ GenerateOpen {s | ∃ a, s = Ioi a ∨ s = Iio a} s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals];
rfl
theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals];
Mathlib.Topology.Order.Basic.865_0.Npdof1X5b8sCkZ2
theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α ⊢ 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by
rw [t.topology_eq_generate_intervals, nhds_generateFrom]
theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by
Mathlib.Topology.Order.Basic.894_0.Npdof1X5b8sCkZ2
theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α ⊢ ⨅ s ∈ {s | a ∈ s ∧ s ∈ {s | ∃ a, s = Ioi a ∨ s = Iio a}}, 𝓟 s = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom]
simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio]
theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom]
Mathlib.Topology.Order.Basic.894_0.Npdof1X5b8sCkZ2
theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α f : β → α a : α x : Filter β ⊢ Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ (b : β) in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ (b : β) in x, f b < a'
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by
simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]
theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by
Mathlib.Topology.Order.Basic.900_0.Npdof1X5b8sCkZ2
theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a'
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α f : β → α a : α x : Filter β ⊢ ((∀ i ∈ Iio a, ∀ᶠ (a : β) in x, f a ∈ Ioi i) ∧ ∀ i ∈ Ioi a, ∀ᶠ (a : β) in x, f a ∈ Iio i) ↔ (∀ a' < a, ∀ᶠ (b : β) in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ (b : β) in x, f b < a'
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal];
rfl
theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal];
Mathlib.Topology.Order.Basic.900_0.Npdof1X5b8sCkZ2
theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a'
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α ⊢ TendstoIxxClass Icc (𝓝 a) (𝓝 a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by
simp only [nhds_eq_order, iInf_subtype']
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α ⊢ TendstoIxxClass Icc ((⨅ x, 𝓟 (Ioi ↑x)) ⊓ ⨅ x, 𝓟 (Iio ↑x)) ((⨅ x, 𝓟 (Ioi ↑x)) ⊓ ⨅ x, 𝓟 (Iio ↑x))
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype']
refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype']
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α s : Set { i // i ∈ Iio a } × Set { i // i ∈ Ioi a } x✝ : Set.Finite s.1 ∧ Set.Finite s.2 ⊢ ∀ x ∈ (⋂ i ∈ s.1, Ioi ↑i) ∩ ⋂ i ∈ s.2, Iio ↑i, ∀ y ∈ (⋂ i ∈ s.1, Ioi ↑i) ∩ ⋂ i ∈ s.2, Iio ↑i, Icc x y ⊆ (⋂ i ∈ s.1, Ioi ↑i) ∩ ⋂ i ∈ s.2, Iio ↑i
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_
refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
case refine'_1 α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α s : Set { i // i ∈ Iio a } × Set { i // i ∈ Ioi a } x✝ : Set.Finite s.1 ∧ Set.Finite s.2 ⊢ ∀ i ∈ s.1, OrdConnected (Ioi ↑i)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;>
intro _ _
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;>
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
case refine'_2 α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α s : Set { i // i ∈ Iio a } × Set { i // i ∈ Ioi a } x✝ : Set.Finite s.1 ∧ Set.Finite s.2 ⊢ ∀ i ∈ s.2, OrdConnected (Iio ↑i)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;>
intro _ _
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;>
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
case refine'_1 α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α s : Set { i // i ∈ Iio a } × Set { i // i ∈ Ioi a } x✝ : Set.Finite s.1 ∧ Set.Finite s.2 i✝ : { i // i ∈ Iio a } hi✝ : i✝ ∈ s.1 ⊢ OrdConnected (Ioi ↑i✝) case refine'_2 α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α s : Set { i // i ∈ Iio a } × Set { i // i ∈ Ioi a } x✝ : Set.Finite s.1 ∧ Set.Finite s.2 i✝ : { i // i ∈ Ioi a } hi✝ : i✝ ∈ s.2 ⊢ OrdConnected (Iio ↑i✝)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _
exacts [ordConnected_Ioi, ordConnected_Iio]
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _
Mathlib.Topology.Order.Basic.905_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α hu : ∃ u, a < u hl : ∃ l, l < a ⊢ 𝓝 a = ⨅ l, ⨅ (_ : l < a), ⨅ u, ⨅ (_ : a < u), 𝓟 (Ioo l u)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by
simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]
theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by
Mathlib.Topology.Order.Basic.943_0.Npdof1X5b8sCkZ2
theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α a : α hu : ∃ u, a < u hl : ∃ l, l < a ⊢ (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) = (⨅ i, ⨅ (_ : i < a), 𝓟 (Ioi i)) ⊓ ⨅ i, ⨅ (_ : a < i), 𝓟 (Iio i)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio];
rfl
theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio];
Mathlib.Topology.Order.Basic.943_0.Npdof1X5b8sCkZ2
theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α f : β → α a : α x : Filter β hu : ∃ u, a < u hl : ∃ l, l < a h : ∀ (l u : α), l < a → a < u → ∀ᶠ (b : β) in x, l < f b ∧ f b < u ⊢ Tendsto f x (𝓝 a)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by
simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]
theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by
Mathlib.Topology.Order.Basic.948_0.Npdof1X5b8sCkZ2
theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝¹ : TopologicalSpace α inst✝ : Preorder α t : OrderTopology α f : β → α a : α x : Filter β hu : ∃ u, a < u hl : ∃ l, l < a h : ∀ (l u : α), l < a → a < u → ∀ᶠ (b : β) in x, l < f b ∧ f b < u ⊢ ∀ i < a, ∀ (i_2 : α), a < i_2 → ∀ᶠ (a : β) in x, f a ∈ Ioo i i_2
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]
exact fun l hl u => h l u hl
theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]
Mathlib.Topology.Order.Basic.948_0.Npdof1X5b8sCkZ2
theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a)
Mathlib_Topology_Order_Basic
α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i ⊢ TendstoIxxClass Icc (𝓝 f) (𝓝 f)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by
constructor
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i ⊢ Tendsto (fun p => Icc p.1 p.2) (𝓝 f ×ˢ 𝓝 f) (smallSets (𝓝 f))
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor
conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi]
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i | smallSets (𝓝 f)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
rw [nhds_pi, Filter.pi]
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i | smallSets (𝓝 f)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
rw [nhds_pi, Filter.pi]
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i | smallSets (𝓝 f)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
rw [nhds_pi, Filter.pi]
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets =>
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i ⊢ Tendsto (fun p => Icc p.1 p.2) (𝓝 f ×ˢ 𝓝 f) (smallSets (⨅ i, comap (eval i) (𝓝 (f i))))
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi]
simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff]
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi]
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i ⊢ ∀ (i : ι), ∀ s ∈ 𝓝 (f i), ∀ᶠ (a : ((i : ι) → α i) × ((i : ι) → α i)) in 𝓝 f ×ˢ 𝓝 f, Icc a.1 a.2 ⊆ eval i ⁻¹' s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff]
intro i s hs
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff]
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i i : ι s : Set (α i) hs : s ∈ 𝓝 (f i) ⊢ ∀ᶠ (a : ((i : ι) → α i) × ((i : ι) → α i)) in 𝓝 f ×ˢ 𝓝 f, Icc a.1 a.2 ⊆ eval i ⁻¹' s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs
have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i i : ι s : Set (α i) hs : s ∈ 𝓝 (f i) this : Tendsto (fun g => g i) (𝓝 f) (𝓝 (f i)) ⊢ ∀ᶠ (a : ((i : ι) → α i) × ((i : ι) → α i)) in 𝓝 f ×ˢ 𝓝 f, Icc a.1 a.2 ⊆ eval i ⁻¹' s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f
refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
case tendsto_Ixx α✝ : Type u β : Type v γ : Type w ι : Type u_1 α : ι → Type u_2 inst✝² : (i : ι) → Preorder (α i) inst✝¹ : (i : ι) → TopologicalSpace (α i) inst✝ : ∀ (i : ι), OrderTopology (α i) f : (i : ι) → α i i : ι s : Set (α i) hs : s ∈ 𝓝 (f i) this : Tendsto (fun g => g i) (𝓝 f) (𝓝 (f i)) ⊢ ∀ (x : ((i : ι) → α i) × ((i : ι) → α i)), Icc (((fun g => g i) ∘ Prod.fst) x) (((fun g => g i) ∘ Prod.snd) x) ∈ 𝒫 s → Icc x.1 x.2 ⊆ eval i ⁻¹' s
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _
exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _
Mathlib.Topology.Order.Basic.963_0.Npdof1X5b8sCkZ2
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f)
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y ⊢ induced f inst✝¹ ≤ Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by
let _ := Preorder.topology α
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α ⊢ induced f inst✝¹ ≤ Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α;
have : OrderTopology α := ⟨rfl⟩
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α;
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α ⊢ induced f inst✝¹ ≤ Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
refine le_of_nhds_le_nhds fun x => ?_
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α x : α ⊢ 𝓝 x ≤ 𝓝 x
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf]
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α x : α ⊢ (⨅ i ∈ {x_1 | x_1 < f x}, 𝓟 (f ⁻¹' {x | i < x})) ⊓ ⨅ i ∈ {x_1 | f x < x_1}, 𝓟 (f ⁻¹' {x | x < i}) ≤ (⨅ b ∈ {x_1 | f x_1 < f x}, 𝓟 {x | f b < f x}) ⊓ ⨅ b ∈ {x_1 | f x < f x_1}, 𝓟 {x | f x < f b}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf]
refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_)
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf]
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1 α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α x a : α ha : a ∈ {x_1 | f x_1 < f x} ⊢ ⨅ i ∈ {x_1 | x_1 < f x}, 𝓟 (f ⁻¹' {x | i < x}) ≤ 𝓟 {x | f a < f x} case refine_2 α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α x a : α ha : a ∈ {x_1 | f x < f x_1} ⊢ ⨅ i ∈ {x_1 | f x < x_1}, 𝓟 (f ⁻¹' {x | x < i}) ≤ 𝓟 {x | f x < f a}
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_)
exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha]
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_)
Mathlib.Topology.Order.Basic.977_0.Npdof1X5b8sCkZ2
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b ⊢ induced f inst✝¹ = Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by
let _ := Preorder.topology α
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α ⊢ induced f inst✝¹ = Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α;
have : OrderTopology α := ⟨rfl⟩
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α;
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α ⊢ induced f inst✝¹ = Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
refine le_antisymm (induced_topology_le_preorder hf) ?_
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α ⊢ Preorder.topology α ≤ induced f inst✝¹
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_
refine le_of_nhds_le_nhds fun a => ?_
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α ⊢ 𝓝 a ≤ 𝓝 a
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α ⊢ (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ (⨅ i ∈ Iio (f a), 𝓟 (f ⁻¹' Ioi i)) ⊓ ⨅ i ∈ Ioi (f a), 𝓟 (f ⁻¹' Iio i)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]
refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1 α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Iio (f a) ⊢ ⨅ b ∈ Iio a, 𝓟 (Ioi b) ≤ 𝓟 (f ⁻¹' Ioi b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) ·
rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1.inl.intro α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Iio (f a) x : α hx : ¬b < f x ⊢ ⨅ b ∈ Iio a, 𝓟 (Ioi b) ≤ 𝓟 (f ⁻¹' Ioi b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) ·
rcases H₁ hb hx with ⟨y, hya, hyb⟩
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1.inl.intro.intro.intro α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Iio (f a) x : α hx : ¬b < f x y : α hya : y < a hyb : b ≤ f y ⊢ ⨅ b ∈ Iio a, 𝓟 (Ioi b) ≤ 𝓟 (f ⁻¹' Ioi b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩
exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz))
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1.inr α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb✝ : b ∈ Iio (f a) hb : ¬∃ x, ¬b < f x ⊢ ⨅ b ∈ Iio a, 𝓟 (Ioi b) ≤ 𝓟 (f ⁻¹' Ioi b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) ·
push_neg at hb
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1.inr α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb✝ : b ∈ Iio (f a) hb : ∀ (x : α), b < f x ⊢ ⨅ b ∈ Iio a, 𝓟 (Ioi b) ≤ 𝓟 (f ⁻¹' Ioi b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb
exact le_principal_iff.2 (univ_mem' hb)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_2 α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Ioi (f a) ⊢ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ 𝓟 (f ⁻¹' Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) ·
rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_2.inl.intro α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Ioi (f a) x : α hx : ¬f x < b ⊢ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ 𝓟 (f ⁻¹' Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) ·
rcases H₂ hb hx with ⟨y, hya, hyb⟩
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_2.inl.intro.intro.intro α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb : b ∈ Ioi (f a) x : α hx : ¬f x < b y : α hya : a < y hyb : f y ≤ b ⊢ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ 𝓟 (f ⁻¹' Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩
exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_2.inr α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb✝ : b ∈ Ioi (f a) hb : ¬∃ x, ¬f x < b ⊢ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ 𝓟 (f ⁻¹' Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) ·
push_neg at hb
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) ·
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_2.inr α : Type u β : Type v γ : Type w inst✝³ : Preorder α inst✝² : Preorder β inst✝¹ : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : ∀ {x y : α}, f x < f y ↔ x < y H₁ : ∀ {a : α} {b : β} {x : α}, b < f a → ¬b < f x → ∃ y < a, b ≤ f y H₂ : ∀ {a : α} {b : β} {x : α}, f a < b → ¬f x < b → ∃ y, a < y ∧ f y ≤ b x✝ : TopologicalSpace α := Preorder.topology α this : OrderTopology α a : α b : β hb✝ : b ∈ Ioi (f a) hb : ∀ (x : α), f x < b ⊢ ⨅ b ∈ Ioi a, 𝓟 (Iio b) ≤ 𝓟 (f ⁻¹' Iio b)
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) · push_neg at hb
exact le_principal_iff.2 (univ_mem' hb)
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) · push_neg at hb
Mathlib.Topology.Order.Basic.987_0.Npdof1X5b8sCkZ2
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α
Mathlib_Topology_Order_Basic
α✝ : Type u β✝ : Type v γ : Type w α : Type u_1 β : Type u_2 inst✝² : LinearOrder α inst✝¹ : LinearOrder β t : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : StrictMono f hc : OrdConnected (range f) ⊢ induced f t = Preorder.topology α
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) theorem induced_orderTopology' {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β] [Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a x}, x < f a → ∃ b < a, x ≤ f b) (H₂ : ∀ {a x}, f a < x → ∃ b > a, f b ≤ x) : @OrderTopology _ (induced f ta) _ := let _ := induced f ta ⟨induced_topology_eq_preorder hf (fun h _ => H₁ h) (fun h _ => H₂ h)⟩ #align induced_order_topology' induced_orderTopology' theorem induced_orderTopology {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β] [Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y) (H : ∀ {x y}, x < y → ∃ a, x < f a ∧ f a < y) : @OrderTopology _ (induced f ta) _ := induced_orderTopology' f (hf) (fun xa => let ⟨b, xb, ba⟩ := H xa; ⟨b, hf.1 ba, le_of_lt xb⟩) fun ax => let ⟨b, ab, bx⟩ := H ax; ⟨b, hf.1 ab, le_of_lt bx⟩ #align induced_order_topology induced_orderTopology /-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α := by
refine induced_topology_eq_preorder hf.lt_iff_lt (fun h₁ h₂ => ?_) fun h₁ h₂ => ?_
/-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α := by
Mathlib.Topology.Order.Basic.1024_0.Npdof1X5b8sCkZ2
/-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α
Mathlib_Topology_Order_Basic
case refine_1 α✝ : Type u β✝ : Type v γ : Type w α : Type u_1 β : Type u_2 inst✝² : LinearOrder α inst✝¹ : LinearOrder β t : TopologicalSpace β inst✝ : OrderTopology β f : α → β hf : StrictMono f hc : OrdConnected (range f) a✝ : α b✝ : β x✝ : α h₁ : b✝ < f a✝ h₂ : ¬b✝ < f x✝ ⊢ ∃ y < a✝, b✝ ≤ f y
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov -/ import Mathlib.Data.Set.Intervals.Pi import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Order.Filter.Interval import Mathlib.Tactic.TFAE import Mathlib.Topology.Support import Mathlib.Topology.Algebra.Order.LeftRight #align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423" /-! # Theory of topology on ordered spaces ## Main definitions The order topology on an ordered space is the topology generated by all open intervals (or equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`. However, we do *not* register it as an instance (as many existing ordered types already have topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead, we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on the type `α` having already a topological space structure and a preorder structure, the topological structure is equal to the order topology. We also introduce another (mixin) class `OrderClosedTopology α` saying that the set of points `(x, y)` with `x ≤ y` is closed in the product space. This is automatically satisfied on a linear order with the order topology. We prove many basic properties of such topologies. ## Main statements This file contains the proofs of the following facts. For exact requirements (`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc) see their statements. ### Open / closed sets * `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open; * `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open; * `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed; * `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed; * `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}` and `{x | f x < g x}` are included by `{x | f x = g x}`; * `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`. ### Convergence and inequalities * `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually `f x ≤ g x`, then `a ≤ b` * `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b` (resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions that assume the inequalities to hold for all `x`. ### Min, max, `sSup` and `sInf` * `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is continuous. * `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise `min`/`max` tend to `min a b` and `max a b`, respectively. * `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem, sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h` both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`. ## Implementation notes We do _not_ register the order topology as an instance on a preorder (or even on a linear order). Indeed, on many such spaces, a topology has already been constructed in a different way (think of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`), and is in general not defeq to the one generated by the intervals. We make it available as a definition `Preorder.topology α` though, that can be registered as an instance when necessary, or for specific types. -/ open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) universe u v w variable {α : Type u} {β : Type v} {γ : Type w} /-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is closed for all `a : α`. -/ class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | b ≤ a}` is closed. -/ isClosed_le' (a : α) : IsClosed { b : α | b ≤ a } export ClosedIicTopology (isClosed_le') #align is_closed_le' ClosedIicTopology.isClosed_le' /-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is closed for all `a : α`. -/ class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- For any `a`, the set `{b | a ≤ b}` is closed. -/ isClosed_ge' (a : α) : IsClosed { b : α | a ≤ b } export ClosedIciTopology (isClosed_ge') #align is_closed_ge' ClosedIciTopology.isClosed_ge' /-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin. This property is satisfied for the order topology on a linear order, but it can be satisfied more generally, and suffices to derive many interesting properties relating order and topology. -/ class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where /-- The set `{ (x, y) | x ≤ y }` is a closed set. -/ isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 } #align order_closed_topology OrderClosedTopology instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) : Dense (OrderDual.ofDual ⁻¹' s) := hs #align dense.order_dual Dense.orderDual section ClosedIicTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIicTopology α] instance : ClosedIciTopology αᵒᵈ where isClosed_ge' a := isClosed_le' (α := α) a theorem isClosed_Iic {a : α} : IsClosed (Iic a) := isClosed_le' a #align is_closed_Iic isClosed_Iic @[simp] theorem closure_Iic (a : α) : closure (Iic a) = Iic a := isClosed_Iic.closure_eq #align closure_Iic closure_Iic theorem le_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, f c ≤ b) : a ≤ b := (isClosed_le' b).mem_of_tendsto lim h #align le_of_tendsto le_of_tendsto theorem le_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, f c ≤ b) : a ≤ b := le_of_tendsto lim (eventually_of_forall h) #align le_of_tendsto' le_of_tendsto' end ClosedIicTopology section ClosedIciTopology variable [TopologicalSpace α] [Preorder α] [t : ClosedIciTopology α] instance : ClosedIicTopology αᵒᵈ where isClosed_le' a := isClosed_ge' (α := α) a theorem isClosed_Ici {a : α} : IsClosed (Ici a) := isClosed_ge' a #align is_closed_Ici isClosed_Ici @[simp] theorem closure_Ici (a : α) : closure (Ici a) = Ici a := isClosed_Ici.closure_eq #align closure_Ici closure_Ici theorem ge_of_tendsto {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ᶠ c in x, b ≤ f c) : b ≤ a := (isClosed_ge' b).mem_of_tendsto lim h #align ge_of_tendsto ge_of_tendsto theorem ge_of_tendsto' {f : β → α} {a b : α} {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a)) (h : ∀ c, b ≤ f c) : b ≤ a := ge_of_tendsto lim (eventually_of_forall h) #align ge_of_tendsto' ge_of_tendsto' end ClosedIciTopology section OrderClosedTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α] namespace Subtype -- todo: add `OrderEmbedding.orderClosedTopology` instance {p : α → Prop} : OrderClosedTopology (Subtype p) := have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) := continuous_subtype_val.prod_map continuous_subtype_val OrderClosedTopology.mk (t.isClosed_le'.preimage this) end Subtype theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } := t.isClosed_le' #align is_closed_le_prod isClosed_le_prod theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsClosed { b | f b ≤ g b } := continuous_iff_isClosed.mp (hf.prod_mk hg) _ isClosed_le_prod #align is_closed_le isClosed_le instance : ClosedIicTopology α where isClosed_le' _ := isClosed_le continuous_id continuous_const instance : ClosedIciTopology α where isClosed_ge' _ := isClosed_le continuous_const continuous_id instance : OrderClosedTopology αᵒᵈ := ⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩ theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) := IsClosed.inter isClosed_Ici isClosed_Iic #align is_closed_Icc isClosed_Icc @[simp] theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b := isClosed_Icc.closure_eq #align closure_Icc closure_Icc theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ := have : Tendsto (fun b => (f b, g b)) b (𝓝 (a₁, a₂)) := hf.prod_mk_nhds hg show (a₁, a₂) ∈ { p : α × α | p.1 ≤ p.2 } from t.isClosed_le'.mem_of_tendsto this h #align le_of_tendsto_of_tendsto le_of_tendsto_of_tendsto alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto #align tendsto_le_of_eventually_le tendsto_le_of_eventuallyLE theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b] (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto hf hg (eventually_of_forall h) #align le_of_tendsto_of_tendsto' le_of_tendsto_of_tendsto' @[simp] theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b ≤ g b } = { b | f b ≤ g b } := (isClosed_le hf hg).closure_eq #align closure_le_eq closure_le_eq theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } := (closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg #align closure_lt_subset_le closure_lt_subset_le theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β} (hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) (h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x := show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from OrderClosedTopology.isClosed_le'.closure_subset ((hf.prod hg).mem_closure hx h) #align continuous_within_at.closure_le ContinuousWithinAt.closure_le /-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`, then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/ theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) := (hf.prod hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le' #align is_closed.is_closed_le IsClosed.isClosed_le theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x) (hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) : f x ≤ g x := have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩ (closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2 #align le_on_closure le_on_closure theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } := (hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd #align is_closed.epigraph IsClosed.epigraph theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s) (hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } := (hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl) #align is_closed.hypograph IsClosed.hypograph end Preorder section PartialOrder variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α] -- see Note [lower instance priority] instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α := t2_iff_isClosed_diagonal.2 <| by simpa only [diagonal, le_antisymm_iff] using t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst) #align order_closed_topology.to_t2_space OrderClosedTopology.to_t2Space end PartialOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) : IsOpen { b | f b < g b } := by simpa only [lt_iff_not_le] using (isClosed_le hg hf).isOpen_compl #align is_open_lt isOpen_lt theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } := isOpen_lt continuous_fst continuous_snd #align is_open_lt_prod isOpen_lt_prod variable {a b : α} theorem isOpen_Iio : IsOpen (Iio a) := isOpen_lt continuous_id continuous_const #align is_open_Iio isOpen_Iio theorem isOpen_Ioi : IsOpen (Ioi a) := isOpen_lt continuous_const continuous_id #align is_open_Ioi isOpen_Ioi theorem isOpen_Ioo : IsOpen (Ioo a b) := IsOpen.inter isOpen_Ioi isOpen_Iio #align is_open_Ioo isOpen_Ioo @[simp] theorem interior_Ioi : interior (Ioi a) = Ioi a := isOpen_Ioi.interior_eq #align interior_Ioi interior_Ioi @[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq #align interior_Iio interior_Iio @[simp] theorem interior_Ioo : interior (Ioo a b) = Ioo a b := isOpen_Ioo.interior_eq #align interior_Ioo interior_Ioo theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by simp only [interior_Ioo, subset_closure] #align Ioo_subset_closure_interior Ioo_subset_closure_interior theorem Iio_mem_nhds {a b : α} (h : a < b) : Iio b ∈ 𝓝 a := IsOpen.mem_nhds isOpen_Iio h #align Iio_mem_nhds Iio_mem_nhds theorem Ioi_mem_nhds {a b : α} (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h #align Ioi_mem_nhds Ioi_mem_nhds theorem Iic_mem_nhds {a b : α} (h : a < b) : Iic b ∈ 𝓝 a := mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self #align Iic_mem_nhds Iic_mem_nhds theorem Ici_mem_nhds {a b : α} (h : a < b) : Ici a ∈ 𝓝 b := mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self #align Ici_mem_nhds Ici_mem_nhds theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x := IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩ #align Ioo_mem_nhds Ioo_mem_nhds theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self #align Ioc_mem_nhds Ioc_mem_nhds theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self #align Ico_mem_nhds Ico_mem_nhds theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x := mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self #align Icc_mem_nhds Icc_mem_nhds theorem eventually_lt_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u := tendsto_nhds.1 h (· < u) isOpen_Iio hv #align eventually_lt_of_tendsto_lt eventually_lt_of_tendsto_lt theorem eventually_gt_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a := tendsto_nhds.1 h (· > u) isOpen_Ioi hv #align eventually_gt_of_tendsto_gt eventually_gt_of_tendsto_gt theorem eventually_le_of_tendsto_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u := (eventually_lt_of_tendsto_lt hv h).mono fun _ => le_of_lt #align eventually_le_of_tendsto_lt eventually_le_of_tendsto_lt theorem eventually_ge_of_tendsto_gt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v) (h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a := (eventually_gt_of_tendsto_gt hv h).mono fun _ => le_of_lt #align eventually_ge_of_tendsto_gt eventually_ge_of_tendsto_gt variable [TopologicalSpace γ] /-! ### Neighborhoods to the left and to the right on an `OrderClosedTopology` Limits to the left and to the right of real functions are defined in terms of neighborhoods to the left and to the right, either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a` on the right, and similarly on the left. Here we simply prove that all right-neighborhoods of a point are equal, and we'll prove later other useful characterizations which require the stronger hypothesis `OrderTopology α` -/ /-! #### Right neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩ #align Ioo_mem_nhds_within_Ioi Ioo_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Covby.nhdsWithin_Ioi {a b : α} (h : a ⋖ b) : 𝓝[>] a = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Ioi' h.1 theorem Ioc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ioi Ioc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Ico_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Ioi Ico_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b := mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Ioi Icc_mem_nhdsWithin_Ioi -- porting note: new lemma; todo: swap `'`? theorem Icc_mem_nhdsWithin_Ioi' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Ioc_eq_nhds_within_Ioi nhdsWithin_Ioc_eq_nhdsWithin_Ioi @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Ioi {a b : α} (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ioo_eq_nhds_within_Ioi nhdsWithin_Ioo_eq_nhdsWithin_Ioi @[simp] theorem continuousWithinAt_Ioc_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioc_iff_Ioi continuousWithinAt_Ioc_iff_Ioi @[simp] theorem continuousWithinAt_Ioo_iff_Ioi [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Ioi h] #align continuous_within_at_Ioo_iff_Ioi continuousWithinAt_Ioo_iff_Ioi /-! #### Left neighborhoods, point excluded -/ theorem Ioo_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b := by simpa only [dual_Ioo] using Ioo_mem_nhdsWithin_Ioi (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioo_mem_nhds_within_Iio Ioo_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioo_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioo a b ∈ 𝓝[<] b := Ioo_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Covby.nhdsWithin_Iio {a b : α} (h : a ⋖ b) : 𝓝[<] b = ⊥ := empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsWithin_Iio' h.1 theorem Ico_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iio Ico_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ico_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Ioc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Iio Ioc_mem_nhdsWithin_Iio -- porting note: new lemma; todo: swap `'`? theorem Ioc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iio {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b := mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Icc_self #align Icc_mem_nhds_within_Iio Icc_mem_nhdsWithin_Iio theorem Icc_mem_nhdsWithin_Iio' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsWithin_Iio ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := by simpa only [dual_Ioc] using nhdsWithin_Ioc_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ico_eq_nhds_within_Iio nhdsWithin_Ico_eq_nhdsWithin_Iio @[simp] theorem nhdsWithin_Ioo_eq_nhdsWithin_Iio {a b : α} (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := by simpa only [dual_Ioo] using nhdsWithin_Ioo_eq_nhdsWithin_Ioi h.dual #align nhds_within_Ioo_eq_nhds_within_Iio nhdsWithin_Ioo_eq_nhdsWithin_Iio @[simp] theorem continuousWithinAt_Ico_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Iio h] #align continuous_within_at_Ico_iff_Iio continuousWithinAt_Ico_iff_Iio @[simp] theorem continuousWithinAt_Ioo_iff_Iio {a b : α} {f : α → γ} (h : a < b) : ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsWithin_Iio h] #align continuous_within_at_Ioo_iff_Iio continuousWithinAt_Ioo_iff_Iio /-! #### Right neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Ici Ioo_mem_nhdsWithin_Ici theorem Ioc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b := mem_of_superset (Ioo_mem_nhdsWithin_Ici H) Ioo_subset_Ioc_self #align Ioc_mem_nhds_within_Ici Ioc_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b := mem_nhdsWithin.2 ⟨Iio c, isOpen_Iio, H.2, by simp only [inter_comm, Ici_inter_Iio, Ico_subset_Ico_left H.1]⟩ #align Ico_mem_nhds_within_Ici Ico_mem_nhdsWithin_Ici theorem Ico_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Ico a b ∈ 𝓝[≥] a := Ico_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ theorem Icc_mem_nhdsWithin_Ici {a b c : α} (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b := mem_of_superset (Ico_mem_nhdsWithin_Ici H) Ico_subset_Icc_self #align Icc_mem_nhds_within_Ici Icc_mem_nhdsWithin_Ici theorem Icc_mem_nhdsWithin_Ici' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsWithin_Ici ⟨le_rfl, H⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h #align nhds_within_Icc_eq_nhds_within_Ici nhdsWithin_Icc_eq_nhdsWithin_Ici @[simp] theorem nhdsWithin_Ico_eq_nhdsWithin_Ici {a b : α} (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a := nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h #align nhds_within_Ico_eq_nhds_within_Ici nhdsWithin_Ico_eq_nhdsWithin_Ici @[simp] theorem continuousWithinAt_Icc_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Ici h] #align continuous_within_at_Icc_iff_Ici continuousWithinAt_Icc_iff_Ici @[simp] theorem continuousWithinAt_Ico_iff_Ici [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsWithin_Ici h] #align continuous_within_at_Ico_iff_Ici continuousWithinAt_Ico_iff_Ici /-! #### Left neighborhoods, point included -/ theorem Ioo_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b := mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds isOpen_Ioo H #align Ioo_mem_nhds_within_Iic Ioo_mem_nhdsWithin_Iic theorem Ico_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b := mem_of_superset (Ioo_mem_nhdsWithin_Iic H) Ioo_subset_Ico_self #align Ico_mem_nhds_within_Iic Ico_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b := by simpa only [dual_Ico] using Ico_mem_nhdsWithin_Ici (show toDual b ∈ Ico (toDual c) (toDual a) from H.symm) #align Ioc_mem_nhds_within_Iic Ioc_mem_nhdsWithin_Iic theorem Ioc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Ioc a b ∈ 𝓝[≤] b := Ioc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ theorem Icc_mem_nhdsWithin_Iic {a b c : α} (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b := mem_of_superset (Ioc_mem_nhdsWithin_Iic H) Ioc_subset_Icc_self #align Icc_mem_nhds_within_Iic Icc_mem_nhdsWithin_Iic theorem Icc_mem_nhdsWithin_Iic' {a b : α} (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsWithin_Iic ⟨H, le_rfl⟩ @[simp] theorem nhdsWithin_Icc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := by simpa only [dual_Icc] using nhdsWithin_Icc_eq_nhdsWithin_Ici h.dual #align nhds_within_Icc_eq_nhds_within_Iic nhdsWithin_Icc_eq_nhdsWithin_Iic @[simp] theorem nhdsWithin_Ioc_eq_nhdsWithin_Iic {a b : α} (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := by simpa only [dual_Ico] using nhdsWithin_Ico_eq_nhdsWithin_Ici h.dual #align nhds_within_Ioc_eq_nhds_within_Iic nhdsWithin_Ioc_eq_nhdsWithin_Iic @[simp] theorem continuousWithinAt_Icc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsWithin_Iic h] #align continuous_within_at_Icc_iff_Iic continuousWithinAt_Icc_iff_Iic @[simp] theorem continuousWithinAt_Ioc_iff_Iic [TopologicalSpace β] {a b : α} {f : α → β} (h : a < b) : ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsWithin_Iic h] #align continuous_within_at_Ioc_iff_Iic continuousWithinAt_Ioc_iff_Iic end LinearOrder section LinearOrder variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α} section variable [TopologicalSpace β] theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) : { b | f b < g b } ⊆ interior { b | f b ≤ g b } := (interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg #align lt_subset_interior_le lt_subset_interior_le theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg] rintro b ⟨hb₁, hb₂⟩ refine' le_antisymm hb₁ (closure_lt_subset_le hg hf _) convert hb₂ using 2; simp only [not_le.symm]; rfl #align frontier_le_subset_eq frontier_le_subset_eq theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := frontier_le_subset_eq (@continuous_id α _) continuous_const #align frontier_Iic_subset frontier_Iic_subset theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} := frontier_Iic_subset (α := αᵒᵈ) _ #align frontier_Ici_subset frontier_Ici_subset theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf #align frontier_lt_subset_eq frontier_lt_subset_eq theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x }) (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := by refine' continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) _ (hg'.mono _) · rwa [(isClosed_le hf hg).closure_eq] · simp only [not_le] exact closure_lt_subset_le hg hf #align continuous_if_le continuous_if_le theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} (hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g) (hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x := continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg #align continuous.if_le Continuous.if_le theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y)) (hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x := let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi (hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ => h _ h₁ _ h₂ #align tendsto.eventually_lt Filter.Tendsto.eventually_lt nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀) (hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x := hf.eventually_lt hg hfg #align continuous_at.eventually_lt ContinuousAt.eventually_lt @[continuity] protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) : Continuous fun b => min (f b) (g b) := by simp only [min_def] exact hf.if_le hg hf hg fun x => id #align continuous.min Continuous.min @[continuity] protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) : Continuous fun b => max (f b) (g b) := Continuous.min (α := αᵒᵈ) hf hg #align continuous.max Continuous.max end theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 := continuous_fst.min continuous_snd #align continuous_min continuous_min theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 := continuous_fst.max continuous_snd #align continuous_max continuous_max protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) := (continuous_max.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.max Filter.Tendsto.max protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) := (continuous_min.tendsto (a₁, a₂)).comp (hf.prod_mk_nhds hg) #align filter.tendsto.min Filter.Tendsto.min protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max a (f i)) l (𝓝 a) := by convert ((continuous_max.comp (@Continuous.Prod.mk α α _ _ a)).tendsto a).comp h simp #align filter.tendsto.max_right Filter.Tendsto.max_right protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => max (f i) a) l (𝓝 a) := by simp_rw [max_comm _ a] exact h.max_right #align filter.tendsto.max_left Filter.Tendsto.max_left theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩ #align filter.tendsto_nhds_max_right Filter.tendsto_nhds_max_right theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) : Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by simp_rw [max_comm _ a] exact Filter.tendsto_nhds_max_right h #align filter.tendsto_nhds_max_left Filter.tendsto_nhds_max_left theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min a (f i)) l (𝓝 a) := Filter.Tendsto.max_right (α := αᵒᵈ) h #align filter.tendsto.min_right Filter.Tendsto.min_right theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) : Tendsto (fun i => min (f i) a) l (𝓝 a) := Filter.Tendsto.max_left (α := αᵒᵈ) h #align filter.tendsto.min_left Filter.Tendsto.min_left theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min a (f i)) l (𝓝[<] a) := Filter.tendsto_nhds_max_right (α := αᵒᵈ) h #align filter.tendsto_nhds_min_right Filter.tendsto_nhds_min_right theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) : Tendsto (fun i => min (f i) a) l (𝓝[<] a) := Filter.tendsto_nhds_max_left (α := αᵒᵈ) h #align filter.tendsto_nhds_min_left Filter.tendsto_nhds_min_left protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y < x := hs.exists_mem_open isOpen_Iio (exists_lt x) #align dense.exists_lt Dense.exists_lt protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x < y := hs.orderDual.exists_lt x #align dense.exists_gt Dense.exists_gt protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, y ≤ x := (hs.exists_lt x).imp fun _ h => ⟨h.1, h.2.le⟩ #align dense.exists_le Dense.exists_le protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le x #align dense.exists_ge Dense.exists_ge theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) : ∃ y ∈ s, y ≤ x := by by_cases hx : IsBot x · exact ⟨x, hbot x hx, le_rfl⟩ · simp only [IsBot, not_forall, not_le] at hx rcases hs.exists_mem_open isOpen_Iio hx with ⟨y, hys, hy : y < x⟩ exact ⟨y, hys, hy.le⟩ #align dense.exists_le' Dense.exists_le' theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) : ∃ y ∈ s, x ≤ y := hs.orderDual.exists_le' htop x #align dense.exists_ge' Dense.exists_ge' theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) : ∃ z ∈ s, z ∈ Ioo x y := hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h) #align dense.exists_between Dense.exists_between theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2)) rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩ exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩ theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) : Iio x = ⋃ y ∈ s ∩ Iio x, Iio y := Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x end LinearOrder end OrderClosedTopology instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α × β) := ⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter (isClosed_le continuous_fst.snd continuous_snd.snd)⟩ instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor simp only [Pi.le_def, setOf_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : OrderClosedTopology (α → β) := inferInstance #align pi.order_closed_topology' Pi.orderClosedTopology' -- porting note: todo: define `Preorder.topology` before `OrderTopology` and reuse the def /-- The order topology on an ordered type is the topology generated by open intervals. We register it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed. We define it as a mixin. If you want to introduce the order topology on a preorder, use `Preorder.topology`. -/ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where /-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/ topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } #align order_topology OrderTopology /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞ , b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } #align preorder.topology Preorder.topology section OrderTopology section Preorder variable [TopologicalSpace α] [Preorder α] [t : OrderTopology α] instance : OrderTopology αᵒᵈ := ⟨by convert OrderTopology.topology_eq_generate_intervals (α := α) using 6 apply or_comm⟩ theorem isOpen_iff_generate_intervals {s : Set α} : IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by rw [t.topology_eq_generate_intervals]; rfl #align is_open_iff_generate_intervals isOpen_iff_generate_intervals theorem isOpen_lt' (a : α) : IsOpen { b : α | a < b } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩ #align is_open_lt' isOpen_lt' theorem isOpen_gt' (a : α) : IsOpen { b : α | b < a } := isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩ #align is_open_gt' isOpen_gt' theorem lt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x := (isOpen_lt' _).mem_nhds h #align lt_mem_nhds lt_mem_nhds theorem le_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x := (lt_mem_nhds h).mono fun _ => le_of_lt #align le_mem_nhds le_mem_nhds theorem gt_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b := (isOpen_gt' _).mem_nhds h #align gt_mem_nhds gt_mem_nhds theorem ge_mem_nhds {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := (gt_mem_nhds h).mono fun _ => le_of_lt #align ge_mem_nhds ge_mem_nhds theorem nhds_eq_order (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [t.topology_eq_generate_intervals, nhds_generateFrom] simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] #align nhds_eq_order nhds_eq_order theorem tendsto_order {f : β → α} {a : α} {x : Filter β} : Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl #align tendsto_order tendsto_order instance tendstoIccClassNhds (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by simp only [nhds_eq_order, iInf_subtype'] refine ((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass fun s _ => ?_ refine' ((ordConnected_biInter _).inter (ordConnected_biInter _)).out <;> intro _ _ exacts [ordConnected_Ioi, ordConnected_Iio] #align tendsto_Icc_class_nhds tendstoIccClassNhds instance tendstoIcoClassNhds (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self #align tendsto_Ico_class_nhds tendstoIcoClassNhds instance tendstoIocClassNhds (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self #align tendsto_Ioc_class_nhds tendstoIocClassNhds instance tendstoIooClassNhds (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) := tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self #align tendsto_Ioo_class_nhds tendstoIooClassNhds /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold eventually for the filter. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b) (hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) := (hg.Icc hh).of_smallSets <| hgf.and hfh #align tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_of_tendsto_of_tendsto_of_le_of_le' /-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities hold everywhere. -/ theorem tendsto_of_tendsto_of_tendsto_of_le_of_le {f g h : β → α} {b : Filter β} {a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) : Tendsto f b (𝓝 a) := tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (eventually_of_forall hgf) (eventually_of_forall hfh) #align tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_of_tendsto_of_tendsto_of_le_of_le theorem nhds_order_unbounded {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) : 𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl #align nhds_order_unbounded nhds_order_unbounded theorem tendsto_order_unbounded {f : β → α} {a : α} {x : Filter β} (hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) : Tendsto f x (𝓝 a) := by simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal] exact fun l hl u => h l u hl #align tendsto_order_unbounded tendsto_order_unbounded end Preorder instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α} {Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] : TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) := Filter.tendstoIxxClass_inf #align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) : TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by constructor conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi] simp only [smallSets_iInf, smallSets_comap, tendsto_iInf, tendsto_lift', (· ∘ ·), mem_powerset_iff] intro i s hs have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f refine' (tendsto_lift'.1 ((this.comp tendsto_fst).Icc (this.comp tendsto_snd)) s hs).mono _ exact fun p hp g hg => hp ⟨hg.1 _, hg.2 _⟩ #align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi -- porting note: new lemma theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) : induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_of_nhds_le_nhds fun x => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf] refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_) exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha] -- porting note: new lemma theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y) (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) : induced f ‹TopologicalSpace β› = Preorder.topology α := by let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩ refine le_antisymm (induced_topology_le_preorder hf) ?_ refine le_of_nhds_le_nhds fun a => ?_ simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal] refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_) · rcases em (∃ x, ¬(b < f x)) with (⟨x, hx⟩ | hb) · rcases H₁ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz)) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) · rcases em (∃ x, ¬(f x < b)) with (⟨x, hx⟩ | hb) · rcases H₂ hb hx with ⟨y, hya, hyb⟩ exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb) · push_neg at hb exact le_principal_iff.2 (univ_mem' hb) theorem induced_orderTopology' {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β] [Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y) (H₁ : ∀ {a x}, x < f a → ∃ b < a, x ≤ f b) (H₂ : ∀ {a x}, f a < x → ∃ b > a, f b ≤ x) : @OrderTopology _ (induced f ta) _ := let _ := induced f ta ⟨induced_topology_eq_preorder hf (fun h _ => H₁ h) (fun h _ => H₂ h)⟩ #align induced_order_topology' induced_orderTopology' theorem induced_orderTopology {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β] [Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y) (H : ∀ {x y}, x < y → ∃ a, x < f a ∧ f a < y) : @OrderTopology _ (induced f ta) _ := induced_orderTopology' f (hf) (fun xa => let ⟨b, xb, ba⟩ := H xa; ⟨b, hf.1 ba, le_of_lt xb⟩) fun ax => let ⟨b, ab, bx⟩ := H ax; ⟨b, hf.1 ab, le_of_lt bx⟩ #align induced_order_topology induced_orderTopology /-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α := by refine induced_topology_eq_preorder hf.lt_iff_lt (fun h₁ h₂ => ?_) fun h₁ h₂ => ?_ ·
rcases hc.out (mem_range_self _) (mem_range_self _) ⟨not_lt.1 h₂, h₁.le⟩ with ⟨y, rfl⟩
/-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α := by refine induced_topology_eq_preorder hf.lt_iff_lt (fun h₁ h₂ => ?_) fun h₁ h₂ => ?_ ·
Mathlib.Topology.Order.Basic.1024_0.Npdof1X5b8sCkZ2
/-- The topology induced by a strictly monotone function with order-connected range is the preorder topology. -/ nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α] [LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α
Mathlib_Topology_Order_Basic