Skip to content

Commit cfe7ade

Browse files
committed
feat(Topology/Order): add more CovBy.nhdsWithin... lemmas (#18567)
- Add lemmas about `𝓝[<] a` and `𝓝[≀] a` in a `PredOrder`. - Add lemmas about `𝓝[>] a` and `𝓝[β‰₯] a` in a `SuccOrder`. - Add `CovBy.nhdsWithin_Ici` and `CovBy.nhdsWithin_Iic`. - Prove that an `OrderClosedTopology` on a linear order which is a `PredOrder` and a `SuccOrder` is discrete. - Cleanup theorems about `OrderTopology` vs `DiscreteTopology`.
1 parent 04897df commit cfe7ade

File tree

2 files changed

+49
-66
lines changed

2 files changed

+49
-66
lines changed

β€ŽMathlib/Topology/Instances/Discrete.lean

Lines changed: 16 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Copyright (c) 2022 RΓ©my Degenne. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: RΓ©my Degenne
55
-/
6-
import Mathlib.Order.SuccPred.Basic
76
import Mathlib.Topology.Order.Basic
87

98
/-!
@@ -42,70 +41,25 @@ theorem DiscreteTopology.secondCountableTopology_of_encodable {Ξ± : Type*}
4241
[TopologicalSpace Ξ±] [DiscreteTopology Ξ±] [Countable Ξ±] : SecondCountableTopology Ξ± :=
4342
DiscreteTopology.secondCountableTopology_of_countable
4443

45-
theorem bot_topologicalSpace_eq_generateFrom_of_pred_succOrder {Ξ±} [LinearOrder Ξ±] [PredOrder Ξ±]
46-
[SuccOrder Ξ±] [NoMinOrder Ξ±] [NoMaxOrder Ξ±] :
47-
(βŠ₯ : TopologicalSpace Ξ±) = generateFrom { s | βˆƒ a, s = Ioi a ∨ s = Iio a } := by
48-
refine (eq_bot_of_singletons_open fun a => ?_).symm
49-
have h_singleton_eq_inter : {a} = Iio (succ a) ∩ Ioi (pred a) := by
50-
suffices h_singleton_eq_inter' : {a} = Iic a ∩ Ici a by
51-
rw [h_singleton_eq_inter', ← Ioi_pred, ← Iio_succ]
52-
rw [inter_comm, Ici_inter_Iic, Icc_self a]
53-
rw [h_singleton_eq_inter]
54-
letI := Preorder.topology Ξ±
55-
apply IsOpen.inter
56-
· exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩
57-
· exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩
58-
59-
theorem discreteTopology_iff_orderTopology_of_pred_succ' [LinearOrder Ξ±] [PredOrder Ξ±]
60-
[SuccOrder Ξ±] [NoMinOrder Ξ±] [NoMaxOrder Ξ±] : DiscreteTopology Ξ± ↔ OrderTopology Ξ± := by
61-
refine ⟨fun h => ⟨?_⟩, fun h => ⟨?_⟩⟩
62-
Β· rw [h.eq_bot]
63-
exact bot_topologicalSpace_eq_generateFrom_of_pred_succOrder
64-
Β· rw [h.topology_eq_generate_intervals]
65-
exact bot_topologicalSpace_eq_generateFrom_of_pred_succOrder.symm
66-
67-
instance (priority := 100) DiscreteTopology.orderTopology_of_pred_succ' [h : DiscreteTopology Ξ±]
68-
[LinearOrder Ξ±] [PredOrder Ξ±] [SuccOrder Ξ±] [NoMinOrder Ξ±] [NoMaxOrder Ξ±] : OrderTopology Ξ± :=
69-
discreteTopology_iff_orderTopology_of_pred_succ'.1 h
70-
7144
theorem LinearOrder.bot_topologicalSpace_eq_generateFrom {Ξ±} [LinearOrder Ξ±] [PredOrder Ξ±]
7245
[SuccOrder Ξ±] : (βŠ₯ : TopologicalSpace Ξ±) = generateFrom { s | βˆƒ a, s = Ioi a ∨ s = Iio a } := by
73-
refine (eq_bot_of_singletons_open fun a => ?_).symm
74-
have h_singleton_eq_inter : {a} = Iic a ∩ Ici a := by rw [inter_comm, Ici_inter_Iic, Icc_self a]
75-
by_cases ha_top : IsTop a
76-
Β· rw [ha_top.Iic_eq, inter_comm, inter_univ] at h_singleton_eq_inter
77-
by_cases ha_bot : IsBot a
78-
Β· rw [ha_bot.Ici_eq] at h_singleton_eq_inter
79-
rw [h_singleton_eq_inter]
80-
-- Porting note: Specified instance for `isOpen_univ` explicitly to fix an error.
81-
apply @isOpen_univ _ (generateFrom { s | βˆƒ a, s = Ioi a ∨ s = Iio a })
82-
Β· rw [isBot_iff_isMin] at ha_bot
83-
rw [← Ioi_pred_of_not_isMin ha_bot] at h_singleton_eq_inter
84-
rw [h_singleton_eq_inter]
85-
exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩
86-
Β· rw [isTop_iff_isMax] at ha_top
87-
rw [← Iio_succ_of_not_isMax ha_top] at h_singleton_eq_inter
88-
by_cases ha_bot : IsBot a
89-
Β· rw [ha_bot.Ici_eq, inter_univ] at h_singleton_eq_inter
90-
rw [h_singleton_eq_inter]
91-
exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩
92-
Β· rw [isBot_iff_isMin] at ha_bot
93-
rw [← Ioi_pred_of_not_isMin ha_bot] at h_singleton_eq_inter
94-
rw [h_singleton_eq_inter]
95-
-- Porting note: Specified instance for `IsOpen.inter` explicitly to fix an error.
96-
letI := Preorder.topology Ξ±
97-
apply IsOpen.inter
98-
· exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩
99-
· exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩
46+
let _ := Preorder.topology Ξ±
47+
have : OrderTopology α := ⟨rfl⟩
48+
exact DiscreteTopology.of_predOrder_succOrder.eq_bot.symm
49+
50+
@[deprecated (since := "2024-11-02")]
51+
alias bot_topologicalSpace_eq_generateFrom_of_pred_succOrder :=
52+
LinearOrder.bot_topologicalSpace_eq_generateFrom
10053

10154
theorem discreteTopology_iff_orderTopology_of_pred_succ [LinearOrder Ξ±] [PredOrder Ξ±]
10255
[SuccOrder Ξ±] : DiscreteTopology Ξ± ↔ OrderTopology Ξ± := by
103-
refine ⟨fun h => ⟨?_⟩, fun h => ⟨?_⟩⟩
104-
Β· rw [h.eq_bot]
105-
exact LinearOrder.bot_topologicalSpace_eq_generateFrom
106-
Β· rw [h.topology_eq_generate_intervals]
107-
exact LinearOrder.bot_topologicalSpace_eq_generateFrom.symm
56+
refine ⟨fun h ↦ ⟨?_⟩, fun h ↦ .of_predOrder_succOrder⟩
57+
rw [h.eq_bot, LinearOrder.bot_topologicalSpace_eq_generateFrom]
58+
59+
@[deprecated (since := "2024-11-02")]
60+
alias discreteTopology_iff_orderTopology_of_pred_succ' :=
61+
discreteTopology_iff_orderTopology_of_pred_succ
10862

109-
instance (priority := 100) DiscreteTopology.orderTopology_of_pred_succ [h : DiscreteTopology Ξ±]
110-
[LinearOrder Ξ±] [PredOrder Ξ±] [SuccOrder Ξ±] : OrderTopology Ξ± :=
111-
discreteTopology_iff_orderTopology_of_pred_succ.mp h
63+
instance OrderTopology.of_discreteTopology [LinearOrder Ξ±] [PredOrder Ξ±] [SuccOrder Ξ±]
64+
[DiscreteTopology Ξ±] : OrderTopology Ξ± :=
65+
discreteTopology_iff_orderTopology_of_pred_succ.mp β€Ή_β€Ί

β€ŽMathlib/Topology/Order/OrderClosed.lean

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,16 @@ theorem Ioo_mem_nhdsWithin_Iio' (H : a < b) : Ioo a b ∈ 𝓝[<] b := by
237237
theorem Ioo_mem_nhdsWithin_Iio (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b :=
238238
mem_of_superset (Ioo_mem_nhdsWithin_Iio' H.1) <| Ioo_subset_Ioo_right H.2
239239

240-
theorem CovBy.nhdsWithin_Iio (h : a β‹– b) : 𝓝[<] b = βŠ₯ :=
240+
protected theorem CovBy.nhdsWithin_Iio (h : a β‹– b) : 𝓝[<] b = βŠ₯ :=
241241
empty_mem_iff_bot.mp <| h.Ioo_eq β–Έ Ioo_mem_nhdsWithin_Iio' h.1
242242

243+
protected theorem PredOrder.nhdsWithin_Iio [PredOrder Ξ±] : 𝓝[<] a = βŠ₯ := by
244+
if h : IsMin a then simp [h.Iio_eq]
245+
else exact (Order.pred_covBy_of_not_isMin h).nhdsWithin_Iio
246+
243247
theorem Ico_mem_nhdsWithin_Iio (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b :=
244248
mem_of_superset (Ioo_mem_nhdsWithin_Iio H) Ioo_subset_Ico_self
245-
-- Porting note (#11215): TODO: swap `'`?
249+
246250
-- Porting note (#11215): TODO: swap `'`?
247251
theorem Ico_mem_nhdsWithin_Iio' (H : a < b) : Ico a b ∈ 𝓝[<] b :=
248252
Ico_mem_nhdsWithin_Iio ⟨H, le_rfl⟩
@@ -282,6 +286,12 @@ theorem continuousWithinAt_Ioo_iff_Iio (h : a < b) :
282286
#### Point included
283287
-/
284288

289+
protected theorem CovBy.nhdsWithin_Iic (H : a β‹– b) : 𝓝[≀] b = pure b := by
290+
rw [← Iio_insert, nhdsWithin_insert, H.nhdsWithin_Iio, sup_bot_eq]
291+
292+
protected theorem PredOrder.nhdsWithin_Iic [PredOrder Ξ±] : 𝓝[≀] b = pure b := by
293+
rw [← Iio_insert, nhdsWithin_insert, PredOrder.nhdsWithin_Iio, sup_bot_eq]
294+
285295
theorem Ioc_mem_nhdsWithin_Iic' (H : a < b) : Ioc a b ∈ 𝓝[≀] b :=
286296
inter_mem (nhdsWithin_le_nhds <| Ioi_mem_nhds H) self_mem_nhdsWithin
287297

@@ -446,9 +456,12 @@ theorem Ioo_mem_nhdsWithin_Ioi {a b c : α} (H : b ∈ Ico a c) : Ioo a c ∈
446456
theorem Ioo_mem_nhdsWithin_Ioi' {a b : Ξ±} (H : a < b) : Ioo a b ∈ 𝓝[>] a :=
447457
Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, H⟩
448458

449-
theorem CovBy.nhdsWithin_Ioi {a b : Ξ±} (h : a β‹– b) : 𝓝[>] a = βŠ₯ :=
459+
protected theorem CovBy.nhdsWithin_Ioi {a b : Ξ±} (h : a β‹– b) : 𝓝[>] a = βŠ₯ :=
450460
empty_mem_iff_bot.mp <| h.Ioo_eq β–Έ Ioo_mem_nhdsWithin_Ioi' h.1
451461

462+
protected theorem SuccOrder.nhdsWithin_Ioi [SuccOrder Ξ±] : 𝓝[>] a = βŠ₯ :=
463+
PredOrder.nhdsWithin_Iio (Ξ± := Ξ±α΅’α΅ˆ)
464+
452465
theorem Ioc_mem_nhdsWithin_Ioi {a b c : Ξ±} (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b :=
453466
mem_of_superset (Ioo_mem_nhdsWithin_Ioi H) Ioo_subset_Ioc_self
454467

@@ -492,6 +505,12 @@ theorem continuousWithinAt_Ioo_iff_Ioi (h : a < b) :
492505
### Point included
493506
-/
494507

508+
protected theorem CovBy.nhdsWithin_Ici (H : a β‹– b) : 𝓝[β‰₯] a = pure a :=
509+
H.toDual.nhdsWithin_Iic
510+
511+
protected theorem SuccOrder.nhdsWithin_Ici [SuccOrder Ξ±] : 𝓝[β‰₯] a = pure a :=
512+
PredOrder.nhdsWithin_Iic (Ξ± := Ξ±α΅’α΅ˆ)
513+
495514
theorem Ico_mem_nhdsWithin_Ici' (H : a < b) : Ico a b ∈ 𝓝[β‰₯] a :=
496515
inter_mem_nhdsWithin _ <| Iio_mem_nhds H
497516

@@ -666,7 +685,17 @@ theorem Ico_mem_nhds {a b x : Ξ±} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x
666685
theorem Icc_mem_nhds {a b x : Ξ±} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x :=
667686
mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self
668687

669-
variable [TopologicalSpace Ξ³]
688+
/-- The only order closed topology on a linear order which is a `PredOrder` and a `SuccOrder`
689+
is the discrete topology.
690+
691+
This theorem is not an instance,
692+
because it causes searches for `PredOrder` and `SuccOrder` with their `Preorder` arguments
693+
and very rarely matches. -/
694+
theorem DiscreteTopology.of_predOrder_succOrder [PredOrder Ξ±] [SuccOrder Ξ±] :
695+
DiscreteTopology Ξ± := by
696+
refine discreteTopology_iff_nhds.mpr fun a ↦ ?_
697+
rw [← nhdsWithin_univ, ← Iic_union_Ioi, nhdsWithin_union, PredOrder.nhdsWithin_Iic,
698+
SuccOrder.nhdsWithin_Ioi, sup_bot_eq]
670699

671700
end LinearOrder
672701

0 commit comments

Comments
Β (0)