Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e93996c

Browse files
feat(topology/instances/discrete): instances for the discrete topology (#11349)
Prove `first_countable_topology`, `second_countable_topology` and `order_topology` for the discrete topology under appropriate conditions like `encodable`, or being a linear order with `pred` and `succ`. These instances give in particular `second_countable_topology ℕ` and `order_topology ℕ` Co-authored-by: RemyDegenne <remydegenne@gmail.com> Co-authored-by: Patrick Massot <patrickmassot@free.fr>
1 parent 6089f08 commit e93996c

File tree

5 files changed

+171
-6
lines changed

5 files changed

+171
-6
lines changed

src/order/filter/bases.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ end
862862
@[instance] lemma is_countably_generated_principal (s : set α) : is_countably_generated (𝓟 s) :=
863863
is_countably_generated_of_seq ⟨λ _, s, infi_const.symm⟩
864864

865+
@[instance] lemma is_countably_generated_pure (a : α) : is_countably_generated (pure a) :=
866+
by { rw ← principal_singleton, exact is_countably_generated_principal _, }
867+
865868
@[instance] lemma is_countably_generated_bot : is_countably_generated (⊥ : filter α) :=
866869
@principal_empty α ▸ is_countably_generated_principal _
867870

src/order/succ_pred/basic.lean

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,26 @@ protected lemma _root_.has_lt.lt.covby_succ {a b : α} (h : a < b) : a ⋖ succ
111111
@[simp] lemma covby_succ_of_nonempty_Ioi {a : α} (h : (set.Ioi a).nonempty) : a ⋖ succ a :=
112112
has_lt.lt.covby_succ h.some_mem
113113

114+
lemma lt_succ_of_not_is_max {a : α} (ha : ¬ is_max a) : a < succ_order.succ a :=
115+
(le_succ a).lt_of_not_le (λ h, not_exists.2 (maximal_of_succ_le h) (not_is_max_iff.mp ha))
116+
117+
lemma lt_succ_iff_of_not_is_max {a b : α} (ha : ¬ is_max a) : b < succ_order.succ a ↔ b ≤ a :=
118+
⟨le_of_lt_succ, λ h_le, h_le.trans_lt (lt_succ_of_not_is_max ha)⟩
119+
120+
lemma succ_le_iff_of_not_is_max {a b : α} (ha : ¬ is_max a) : succ a ≤ b ↔ a < b :=
121+
⟨(lt_succ_of_not_is_max ha).trans_le, succ_le_of_lt⟩
122+
114123
section no_max_order
115124
variables [no_max_order α] {a b : α}
116125

117126
lemma lt_succ (a : α) : a < succ a :=
118-
(le_succ a).lt_of_not_le $ λ h, not_exists.2 (maximal_of_succ_le h) (exists_gt a)
127+
lt_succ_of_not_is_max (not_is_max a)
119128

120129
lemma lt_succ_iff : a < succ b ↔ a ≤ b :=
121-
⟨le_of_lt_succ, λ h, h.trans_lt $ lt_succ b⟩
130+
lt_succ_iff_of_not_is_max (not_is_max b)
122131

123132
lemma succ_le_iff : succ a ≤ b ↔ a < b :=
124-
⟨(lt_succ a).trans_le, succ_le_of_lt⟩
133+
succ_le_iff_of_not_is_max (not_is_max a)
125134

126135
@[simp] lemma succ_le_succ_iff : succ a ≤ succ b ↔ a ≤ b :=
127136
⟨λ h, le_of_lt_succ $ (lt_succ a).trans_le h, λ h, succ_le_of_lt $ h.trans_lt $ lt_succ b⟩
@@ -267,6 +276,28 @@ begin
267276
end
268277

269278
end complete_lattice
279+
280+
section intervals
281+
variables [preorder α] [succ_order α]
282+
283+
lemma Iic_eq_Iio_succ' {a : α} (ha : ¬ is_max a) :
284+
set.Iic a = set.Iio (succ_order.succ a) :=
285+
by { ext1 x, rw [set.mem_Iic, set.mem_Iio], exact (lt_succ_iff_of_not_is_max ha).symm, }
286+
287+
lemma Iic_eq_Iio_succ [no_max_order α] (a : α) :
288+
set.Iic a = set.Iio (succ_order.succ a) :=
289+
Iic_eq_Iio_succ' (not_is_max a)
290+
291+
lemma Ioi_eq_Ici_succ' {a : α} (ha : ¬ is_max a) :
292+
set.Ioi a = set.Ici (succ_order.succ a) :=
293+
by { ext1 x, rw [set.mem_Ioi, set.mem_Ici], exact (succ_le_iff_of_not_is_max ha).symm, }
294+
295+
lemma Ioi_eq_Ici_succ [no_max_order α] (a : α) :
296+
set.Ioi a = set.Ici (succ_order.succ a) :=
297+
Ioi_eq_Ici_succ' (not_is_max a)
298+
299+
end intervals
300+
270301
end succ_order
271302

272303
/-! ### Predecessor order -/
@@ -323,17 +354,26 @@ protected lemma _root_.has_lt.lt.pred_covby {a b : α} (h : b < a) : pred a ⋖
323354
@[simp] lemma pred_covby_of_nonempty_Iio {a : α} (h : (set.Iio a).nonempty) : pred a ⋖ a :=
324355
has_lt.lt.pred_covby h.some_mem
325356

357+
lemma pred_lt_of_not_is_min {a : α} (ha : ¬ is_min a) : pred_order.pred a < a :=
358+
(pred_le a).lt_of_not_le (λ h, not_exists.2 (minimal_of_le_pred h) (not_is_min_iff.mp ha))
359+
360+
lemma pred_lt_iff_of_not_is_min {a b : α} (ha : ¬ is_min a) : pred_order.pred a < b ↔ a ≤ b :=
361+
⟨le_of_pred_lt, λ h_le, (pred_lt_of_not_is_min ha).trans_le h_le⟩
362+
363+
lemma le_pred_iff_of_not_is_min {a b : α} (hb : ¬ is_min b) : a ≤ pred b ↔ a < b :=
364+
⟨λ h, h.trans_lt (pred_lt_of_not_is_min hb), le_pred_of_lt⟩
365+
326366
section no_min_order
327367
variables [no_min_order α] {a b : α}
328368

329369
lemma pred_lt (a : α) : pred a < a :=
330-
(pred_le a).lt_of_not_le $ λ h, not_exists.2 (minimal_of_le_pred h) (exists_lt a)
370+
pred_lt_of_not_is_min (not_is_min a)
331371

332372
lemma pred_lt_iff : pred a < b ↔ a ≤ b :=
333-
⟨le_of_pred_lt, (pred_lt a).trans_le⟩
373+
pred_lt_iff_of_not_is_min (not_is_min a)
334374

335375
lemma le_pred_iff : a ≤ pred b ↔ a < b :=
336-
⟨λ h, h.trans_lt (pred_lt b), le_pred_of_lt⟩
376+
le_pred_iff_of_not_is_min (not_is_min b)
337377

338378
@[simp] lemma pred_le_pred_iff : pred a ≤ pred b ↔ a ≤ b :=
339379
⟨λ h, le_of_pred_lt $ h.trans_lt (pred_lt b), λ h, le_pred_of_lt $ (pred_lt a).trans_le h⟩
@@ -477,6 +517,28 @@ begin
477517
end
478518

479519
end complete_lattice
520+
521+
section intervals
522+
variables [preorder α] [pred_order α]
523+
524+
lemma Ici_eq_Ioi_pred' {a : α} (ha : ¬ is_min a) :
525+
set.Ici a = set.Ioi (pred_order.pred a) :=
526+
by { ext1 x, rw [set.mem_Ici, set.mem_Ioi], exact (pred_lt_iff_of_not_is_min ha).symm, }
527+
528+
lemma Ici_eq_Ioi_pred [no_min_order α] (a : α) :
529+
set.Ici a = set.Ioi (pred_order.pred a) :=
530+
Ici_eq_Ioi_pred' (not_is_min a)
531+
532+
lemma Iio_eq_Iic_pred' {a : α} (ha : ¬ is_min a) :
533+
set.Iio a = set.Iic (pred_order.pred a) :=
534+
by { ext1 x, rw [set.mem_Iio, set.mem_Iic], exact (le_pred_iff_of_not_is_min ha).symm, }
535+
536+
lemma Iio_eq_Iic_pred [no_min_order α] (a : α) :
537+
set.Iio a = set.Iic (pred_order.pred a) :=
538+
Iio_eq_Iic_pred' (not_is_min a)
539+
540+
end intervals
541+
480542
end pred_order
481543

482544
open succ_order pred_order

src/topology/bases.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ def dense_seq [separable_space α] [nonempty α] : ℕ → α := classical.some
285285

286286
variable {α}
287287

288+
@[priority 100]
289+
instance encodable.separable_space [encodable α] : separable_space α :=
290+
{ exists_countable_dense := ⟨set.univ, set.countable_encodable set.univ, dense_univ⟩ }
291+
288292
/-- In a separable space, a family of nonempty disjoint open sets is countable. -/
289293
lemma _root_.set.pairwise_disjoint.countable_of_is_open [separable_space α] {ι : Type*}
290294
{s : ι → set α} {a : set ι} (h : a.pairwise_disjoint s) (ha : ∀ i ∈ a, is_open (s i))
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/-
2+
Copyright (c) 2022 Rémy Degenne. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Rémy Degenne
5+
-/
6+
7+
import order.succ_pred.basic
8+
import topology.algebra.order.basic
9+
10+
/-!
11+
# Instances related to the discrete topology
12+
13+
We prove that the discrete topology is a first-countable topology, and is second-countable for an
14+
encodable type. Also, in linear orders which are also `pred_order` and `succ_order`, the discrete
15+
topology is the order topology.
16+
17+
When importing this file and `data.nat.succ_pred.basic`, the instances `second_countable_topology ℕ`
18+
and `order_topology ℕ` become available.
19+
20+
-/
21+
22+
open topological_space set
23+
24+
variables {α : Type*} [topological_space α]
25+
26+
@[priority 100]
27+
instance discrete_topology.first_countable_topology [discrete_topology α] :
28+
first_countable_topology α :=
29+
{ nhds_generated_countable :=
30+
by { rw nhds_discrete, exact filter.is_countably_generated_pure } }
31+
32+
@[priority 100]
33+
instance discrete_topology.second_countable_topology_of_encodable
34+
[hd : discrete_topology α] [encodable α] :
35+
second_countable_topology α :=
36+
begin
37+
haveI : ∀ (i : α), second_countable_topology ↥({i} : set α),
38+
from λ i, { is_open_generated_countable :=
39+
⟨{univ}, countable_singleton _, by simp only [eq_iff_true_of_subsingleton]⟩, },
40+
exact second_countable_topology_of_countable_cover (singletons_open_iff_discrete.mpr hd)
41+
(Union_of_singleton α),
42+
end
43+
44+
@[priority 100]
45+
instance discrete_topology.order_topology_of_pred_succ' [h : discrete_topology α] [partial_order α]
46+
[pred_order α] [succ_order α] [no_min_order α] [no_max_order α] :
47+
order_topology α :=
48+
begin
49+
rw h.eq_bot,
50+
refine (eq_bot_of_singletons_open (λ a, _)).symm,
51+
have h_singleton_eq_inter : {a} = Iio (succ_order.succ a) ∩ Ioi (pred_order.pred a),
52+
{ suffices h_singleton_eq_inter' : {a} = Iic a ∩ Ici a,
53+
by rw [h_singleton_eq_inter', pred_order.Ici_eq_Ioi_pred, succ_order.Iic_eq_Iio_succ],
54+
rw [inter_comm, Ici_inter_Iic, Icc_self a], },
55+
rw h_singleton_eq_inter,
56+
apply is_open.inter,
57+
{ exact is_open_generate_from_of_mem ⟨succ_order.succ a, or.inr rfl⟩, },
58+
{ exact is_open_generate_from_of_mem ⟨pred_order.pred a, or.inl rfl⟩, },
59+
end
60+
61+
@[priority 100]
62+
instance discrete_topology.order_topology_of_pred_succ [h : discrete_topology α] [linear_order α]
63+
[pred_order α] [succ_order α] :
64+
order_topology α :=
65+
begin
66+
rw h.eq_bot,
67+
refine (eq_bot_of_singletons_open (λ a, _)).symm,
68+
have h_singleton_eq_inter : {a} = Iic a ∩ Ici a,
69+
by rw [inter_comm, Ici_inter_Iic, Icc_self a],
70+
by_cases ha_top : is_top a,
71+
{ rw [ha_top.Iic_eq, inter_comm, inter_univ] at h_singleton_eq_inter,
72+
by_cases ha_bot : is_bot a,
73+
{ rw ha_bot.Ici_eq at h_singleton_eq_inter,
74+
rw h_singleton_eq_inter,
75+
apply is_open_univ, },
76+
{ rw is_bot_iff_is_min at ha_bot,
77+
rw pred_order.Ici_eq_Ioi_pred' ha_bot at h_singleton_eq_inter,
78+
rw h_singleton_eq_inter,
79+
exact is_open_generate_from_of_mem ⟨pred_order.pred a, or.inl rfl⟩, }, },
80+
{ rw is_top_iff_is_max at ha_top,
81+
rw succ_order.Iic_eq_Iio_succ' ha_top at h_singleton_eq_inter,
82+
by_cases ha_bot : is_bot a,
83+
{ rw [ha_bot.Ici_eq, inter_univ] at h_singleton_eq_inter,
84+
rw h_singleton_eq_inter,
85+
exact is_open_generate_from_of_mem ⟨succ_order.succ a, or.inr rfl⟩, },
86+
{ rw is_bot_iff_is_min at ha_bot,
87+
rw pred_order.Ici_eq_Ioi_pred' ha_bot at h_singleton_eq_inter,
88+
rw h_singleton_eq_inter,
89+
apply is_open.inter,
90+
{ exact is_open_generate_from_of_mem ⟨succ_order.succ a, or.inr rfl⟩ },
91+
{ exact is_open_generate_from_of_mem ⟨pred_order.pred a, or.inl rfl⟩ } } }
92+
end

src/topology/order.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def generate_from (g : set (set α)) : topological_space α :=
6363
is_open_inter := generate_open.inter,
6464
is_open_sUnion := generate_open.sUnion }
6565

66+
lemma is_open_generate_from_of_mem {g : set (set α)} {s : set α} (hs : s ∈ g) :
67+
@is_open _ (generate_from g) s :=
68+
generate_open.basic s hs
69+
6670
lemma nhds_generate_from {g : set (set α)} {a : α} :
6771
@nhds α (generate_from g) a = (⨅s∈{s | a ∈ s ∧ s ∈ g}, 𝓟 s) :=
6872
by rw nhds_def; exact le_antisymm

0 commit comments

Comments
 (0)