-
Notifications
You must be signed in to change notification settings - Fork 259
/
LowerUpperTopology.lean
437 lines (320 loc) · 16.6 KB
/
LowerUpperTopology.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
/-
Copyright (c) 2023 Christopher Hoskin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Christopher Hoskin
-/
import Mathlib.Order.Hom.CompleteLattice
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.Lattice
/-!
# Lower and Upper topology
This file introduces the lower topology on a preorder as the topology generated by the complements
of the left-closed right-infinite intervals.
For completeness we also introduce the dual upper topology, generated by the complements of the
right-closed left-infinite intervals.
## Main statements
- `IsLower.t0Space` - the lower topology on a partial order is T₀
- `IsLower.isTopologicalBasis` - the complements of the upper closures of finite
subsets form a basis for the lower topology
- `IsLower.continuousInf` - the inf map is continuous with respect to the lower topology
## Implementation notes
A type synonym `WithLower` is introduced and for a preorder `α`, `WithLower α`
is made an instance of `TopologicalSpace` by the topology generated by the complements of the
closed intervals to infinity.
We define a mixin class `IsLower` for the class of types which are both a preorder and a
topology and where the topology is generated by the complements of the closed intervals to infinity.
It is shown that `WithLower α` is an instance of `IsLower`.
Similarly for the upper topology.
## Motivation
The lower topology is used with the `Scott` topology to define the Lawson topology. The restriction
of the lower topology to the spectrum of a complete lattice coincides with the hull-kernel topology.
## References
* [Gierz et al, *A Compendium of Continuous Lattices*][GierzEtAl1980]
## Tags
lower topology, upper topology, preorder
-/
open Set TopologicalSpace Topology
namespace Topology
/--
The lower topology is the topology generated by the complements of the left-closed right-infinite
intervals.
-/
def lower (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Ici a)ᶜ = s}
/--
The upper topology is the topology generated by the complements of the right-closed left-infinite
intervals.
-/
def upper (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Iic a)ᶜ = s}
/-- Type synonym for a preorder equipped with the lower set topology. -/
def WithLower (α : Type*) := α
variable {α β}
namespace WithLower
/-- `toLower` is the identity function to the `WithLower` of a type. -/
@[match_pattern] def toLower : α ≃ WithLower α := Equiv.refl _
/-- `ofLower` is the identity function from the `WithLower` of a type. -/
@[match_pattern] def ofLower : WithLower α ≃ α := Equiv.refl _
@[simp] lemma to_WithLower_symm_eq : (@toLower α).symm = ofLower := rfl
@[simp] lemma of_WithLower_symm_eq : (@ofLower α).symm = toLower := rfl
@[simp] lemma toLower_ofLower (a : WithLower α) : toLower (ofLower a) = a := rfl
@[simp] lemma ofLower_toLower (a : α) : ofLower (toLower a) = a := rfl
lemma toLower_inj {a b : α} : toLower a = toLower b ↔ a = b := Iff.rfl
-- Porting note: removed @[simp] to make linter happy
theorem ofLower_inj {a b : WithLower α} : ofLower a = ofLower b ↔ a = b :=
Iff.rfl
/-- A recursor for `WithLower`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithLower α → Sort*} (h : ∀ a, β (toLower a)) : ∀ a, β a := fun a =>
h (ofLower a)
instance [Nonempty α] : Nonempty (WithLower α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithLower α) := ‹Inhabited α›
variable [Preorder α] {s : Set α}
instance : Preorder (WithLower α) := ‹Preorder α›
instance : TopologicalSpace (WithLower α) := lower α
lemma isOpen_preimage_ofLower : IsOpen (ofLower ⁻¹' s) ↔ (lower α).IsOpen s := Iff.rfl
lemma isOpen_def (T : Set (WithLower α)) : IsOpen T ↔ (lower α).IsOpen (WithLower.toLower ⁻¹' T) :=
Iff.rfl
end WithLower
/-- Type synonym for a preorder equipped with the upper topology. -/
def WithUpper (α : Type*) := α
namespace WithUpper
/-- `toUpper` is the identity function to the `WithUpper` of a type. -/
@[match_pattern] def toUpper : α ≃ WithUpper α := Equiv.refl _
/-- `ofUpper` is the identity function from the `WithUpper` of a type. -/
@[match_pattern] def ofUpper : WithUpper α ≃ α := Equiv.refl _
@[simp] lemma to_WithUpper_symm_eq {α} : (@toUpper α).symm = ofUpper := rfl
@[simp] lemma of_WithUpper_symm_eq : (@ofUpper α).symm = toUpper := rfl
@[simp] lemma toUpper_ofUpper (a : WithUpper α) : toUpper (ofUpper a) = a := rfl
@[simp] lemma ofUpper_toUpper (a : α) : ofUpper (toUpper a) = a := rfl
lemma toUpper_inj {a b : α} : toUpper a = toUpper b ↔ a = b := Iff.rfl
lemma ofUpper_inj {a b : WithUpper α} : ofUpper a = ofUpper b ↔ a = b := Iff.rfl
/-- A recursor for `WithUpper`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithUpper α → Sort*} (h : ∀ a, β (toUpper a)) : ∀ a, β a := fun a =>
h (ofUpper a)
instance [Nonempty α] : Nonempty (WithUpper α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithUpper α) := ‹Inhabited α›
variable [Preorder α] {s : Set α}
instance : Preorder (WithUpper α) := ‹Preorder α›
instance : TopologicalSpace (WithUpper α) := upper α
lemma isOpen_preimage_ofUpper : IsOpen (ofUpper ⁻¹' s) ↔ (upper α).IsOpen s := Iff.rfl
lemma isOpen_def {s : Set (WithUpper α)} : IsOpen s ↔ (upper α).IsOpen (toUpper ⁻¹' s) := Iff.rfl
end WithUpper
/--
The lower topology is the topology generated by the complements of the left-closed right-infinite
intervals.
-/
class IsLower (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_lowerTopology : t = lower α
attribute [nolint docBlame] IsLower.topology_eq_lowerTopology
/--
The upper topology is the topology generated by the complements of the right-closed left-infinite
intervals.
-/
class IsUpper (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_upperTopology : t = upper α
attribute [nolint docBlame] IsUpper.topology_eq_upperTopology
instance [Preorder α] : IsLower (WithLower α) := ⟨rfl⟩
instance [Preorder α] : IsUpper (WithUpper α) := ⟨rfl⟩
/--
The lower topology is homeomorphic to the upper topology on the dual order
-/
def WithLower.toDualHomeomorph [Preorder α] : WithLower α ≃ₜ WithUpper αᵒᵈ where
toFun := OrderDual.toDual
invFun := OrderDual.ofDual
left_inv := OrderDual.toDual_ofDual
right_inv := OrderDual.ofDual_toDual
continuous_toFun := continuous_coinduced_rng
continuous_invFun := continuous_coinduced_rng
namespace IsLower
/-- The complements of the upper closures of finite sets are a collection of lower sets
which form a basis for the lower topology. -/
def lowerBasis (α : Type*) [Preorder α] :=
{ s : Set α | ∃ t : Set α, t.Finite ∧ (upperClosure t : Set α)ᶜ = s }
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [IsLower α] {s : Set α}
lemma topology_eq : ‹_› = lower α := topology_eq_lowerTopology
variable {α}
/-- If `α` is equipped with the lower topology, then it is homeomorphic to `WithLower α`.
-/
def withLowerHomeomorph : WithLower α ≃ₜ α :=
WithLower.ofLower.toHomeomorphOfInducing ⟨by erw [topology_eq α, induced_id]; rfl⟩
theorem isOpen_iff_generate_Ici_compl : IsOpen s ↔ GenerateOpen { t | ∃ a, (Ici a)ᶜ = t } s := by
rw [topology_eq α]; rfl
instance _root_.OrderDual.instIsUpper [Preorder α] [TopologicalSpace α] [IsLower α] :
IsUpper αᵒᵈ where
topology_eq_upperTopology := topology_eq_lowerTopology (α := α)
/-- Left-closed right-infinite intervals [a, ∞) are closed in the lower topology. -/
instance : ClosedIciTopology α :=
⟨fun a ↦ isOpen_compl_iff.1 <| isOpen_iff_generate_Ici_compl.2 <| GenerateOpen.basic _ ⟨a, rfl⟩⟩
-- Porting note: The old `IsLower.isClosed_Ici` was removed, since one can now use
-- the general `isClosed_Ici` lemma thanks to the instance above.
/-- The upper closure of a finite set is closed in the lower topology. -/
theorem isClosed_upperClosure (h : s.Finite) : IsClosed (upperClosure s : Set α) := by
simp only [← UpperSet.iInf_Ici, UpperSet.coe_iInf]
exact h.isClosed_biUnion fun _ _ => isClosed_Ici
/-- Every set open in the lower topology is a lower set. -/
theorem isLowerSet_of_isOpen (h : IsOpen s) : IsLowerSet s := by
-- Porting note: `rw` leaves a shadowed assumption
replace h := isOpen_iff_generate_Ici_compl.1 h
induction h with
| basic u h' => obtain ⟨a, rfl⟩ := h'; exact (isUpperSet_Ici a).compl
| univ => exact isLowerSet_univ
| inter u v _ _ hu2 hv2 => exact hu2.inter hv2
| sUnion _ _ ih => exact isLowerSet_sUnion ih
theorem isUpperSet_of_isClosed (h : IsClosed s) : IsUpperSet s :=
isLowerSet_compl.1 <| isLowerSet_of_isOpen h.isOpen_compl
/--
The closure of a singleton `{a}` in the lower topology is the left-closed right-infinite interval
[a, ∞).
-/
@[simp]
theorem closure_singleton (a : α) : closure {a} = Ici a :=
Subset.antisymm ((closure_minimal fun _ h => h.ge) <| isClosed_Ici) <|
(isUpperSet_of_isClosed isClosed_closure).Ici_subset <| subset_closure rfl
protected theorem isTopologicalBasis : IsTopologicalBasis (lowerBasis α) := by
convert isTopologicalBasis_of_subbasis (topology_eq α)
simp_rw [lowerBasis, coe_upperClosure, compl_iUnion]
ext s
constructor
· rintro ⟨F, hF, rfl⟩
refine ⟨(fun a => (Ici a)ᶜ) '' F, ⟨hF.image _, image_subset_iff.2 fun _ _ => ⟨_, rfl⟩⟩, ?_⟩
simp only [sInter_image]
· rintro ⟨F, ⟨hF, hs⟩, rfl⟩
haveI := hF.to_subtype
rw [subset_def, Subtype.forall'] at hs
choose f hf using hs
exact ⟨_, finite_range f, by simp_rw [biInter_range, hf, sInter_eq_iInter]⟩
/-- A function `f : β → α` with lower topology in the codomain is continuous
if and only if the preimage of every interval `Set.Ici a` is a closed set.
-/
lemma continuous_iff_Ici [TopologicalSpace β] {f : β → α} :
Continuous f ↔ ∀ a, IsClosed (f ⁻¹' (Ici a)) := by
obtain rfl := IsLower.topology_eq α
simp [continuous_generateFrom_iff]
/-- A function `f : β → α` with lower topology in the codomain is continuous provided that the
preimage of every interval `Set.Ici a` is a closed set. -/
@[deprecated (since := "2023-12-24")] alias ⟨_, continuous_of_Ici⟩ := continuous_iff_Ici
end Preorder
section PartialOrder
variable [PartialOrder α] [TopologicalSpace α] [IsLower α]
-- see Note [lower instance priority]
/-- The lower topology on a partial order is T₀. -/
instance (priority := 90) t0Space : T0Space α :=
(t0Space_iff_inseparable α).2 fun x y h =>
Ici_injective <| by simpa only [inseparable_iff_closure_eq, closure_singleton] using h
end PartialOrder
end IsLower
namespace IsUpper
/-- The complements of the lower closures of finite sets are a collection of upper sets
which form a basis for the upper topology. -/
def upperBasis (α : Type*) [Preorder α] :=
{ s : Set α | ∃ t : Set α, t.Finite ∧ (lowerClosure t : Set α)ᶜ = s }
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [IsUpper α] {s : Set α}
lemma topology_eq : ‹_› = upper α := topology_eq_upperTopology
variable {α}
/-- If `α` is equipped with the upper topology, then it is homeomorphic to `WithUpper α`.
-/
def withUpperHomeomorph : WithUpper α ≃ₜ α :=
WithUpper.ofUpper.toHomeomorphOfInducing ⟨by erw [topology_eq α, induced_id]; rfl⟩
theorem isOpen_iff_generate_Iic_compl : IsOpen s ↔ GenerateOpen { t | ∃ a, (Iic a)ᶜ = t } s := by
rw [topology_eq α]; rfl
instance _root_.OrderDual.instIsLower [Preorder α] [TopologicalSpace α] [IsUpper α] :
IsLower αᵒᵈ where
topology_eq_lowerTopology := topology_eq_upperTopology (α := α)
/-- Left-infinite right-closed intervals (-∞,a] are closed in the upper topology. -/
instance : ClosedIicTopology α :=
⟨fun a ↦ isOpen_compl_iff.1 <| isOpen_iff_generate_Iic_compl.2 <| GenerateOpen.basic _ ⟨a, rfl⟩⟩
/-- The lower closure of a finite set is closed in the upper topology. -/
theorem isClosed_lowerClosure (h : s.Finite) : IsClosed (lowerClosure s : Set α) :=
IsLower.isClosed_upperClosure (α := αᵒᵈ) h
/-- Every set open in the upper topology is a upper set. -/
theorem isUpperSet_of_isOpen (h : IsOpen s) : IsUpperSet s :=
IsLower.isLowerSet_of_isOpen (α := αᵒᵈ) h
theorem isLowerSet_of_isClosed (h : IsClosed s) : IsLowerSet s :=
isUpperSet_compl.1 <| isUpperSet_of_isOpen h.isOpen_compl
/--
The closure of a singleton `{a}` in the upper topology is the left-infinite right-closed interval
(-∞,a].
-/
@[simp]
theorem closure_singleton (a : α) : closure {a} = Iic a :=
IsLower.closure_singleton (α := αᵒᵈ) _
protected theorem isTopologicalBasis : IsTopologicalBasis (upperBasis α) :=
IsLower.isTopologicalBasis (α := αᵒᵈ)
/-- A function `f : β → α` with upper topology in the codomain is continuous
if and only if the preimage of every interval `Set.Iic a` is a closed set. -/
lemma continuous_iff_Iic [TopologicalSpace β] {f : β → α} :
Continuous f ↔ ∀ a, IsClosed (f ⁻¹' (Iic a)) :=
IsLower.continuous_iff_Ici (α := αᵒᵈ)
/-- A function `f : β → α` with upper topology in the codomain is continuous
provided that the preimage of every interval `Set.Iic a` is a closed set. -/
@[deprecated (since := "2023-12-24")]
lemma continuous_of_Iic [TopologicalSpace β] {f : β → α} (h : ∀ a, IsClosed (f ⁻¹' (Iic a))) :
Continuous f :=
continuous_iff_Iic.2 h
end Preorder
section PartialOrder
variable [PartialOrder α] [TopologicalSpace α] [IsUpper α]
-- see Note [lower instance priority]
/-- The upper topology on a partial order is T₀. -/
instance (priority := 90) t0Space : T0Space α :=
IsLower.t0Space (α := αᵒᵈ)
end PartialOrder
end IsUpper
instance instIsLowerProd [Preorder α] [TopologicalSpace α] [IsLower α]
[OrderBot α] [Preorder β] [TopologicalSpace β] [IsLower β] [OrderBot β] :
IsLower (α × β) where
topology_eq_lowerTopology := by
refine le_antisymm (le_generateFrom ?_) ?_
· rintro _ ⟨x, rfl⟩
exact (isClosed_Ici.prod isClosed_Ici).isOpen_compl
rw [(IsLower.isTopologicalBasis.prod
IsLower.isTopologicalBasis).eq_generateFrom, le_generateFrom_iff_subset_isOpen,
image2_subset_iff]
rintro _ ⟨s, hs, rfl⟩ _ ⟨t, ht, rfl⟩
dsimp
simp_rw [coe_upperClosure, compl_iUnion, prod_eq, preimage_iInter, preimage_compl]
-- without `let`, `refine` tries to use the product topology and fails
let _ : TopologicalSpace (α × β) := lower (α × β)
refine (hs.isOpen_biInter fun a _ => ?_).inter (ht.isOpen_biInter fun b _ => ?_)
· exact GenerateOpen.basic _ ⟨(a, ⊥), by simp [Ici_prod_eq, prod_univ]⟩
· exact GenerateOpen.basic _ ⟨(⊥, b), by simp [Ici_prod_eq, univ_prod]⟩
instance instIsUpperProd [Preorder α] [TopologicalSpace α] [IsUpper α]
[OrderTop α] [Preorder β] [TopologicalSpace β] [IsUpper β] [OrderTop β] :
IsUpper (α × β) where
topology_eq_upperTopology := by
suffices IsLower (α × β)ᵒᵈ from IsLower.topology_eq_lowerTopology (α := (α × β)ᵒᵈ)
exact instIsLowerProd (α := αᵒᵈ) (β := βᵒᵈ)
section CompleteLattice_IsLower
variable [CompleteLattice α] [CompleteLattice β] [TopologicalSpace α] [IsLower α]
[TopologicalSpace β] [IsLower β]
protected lemma _root_.sInfHom.continuous (f : sInfHom α β) : Continuous f := by
refine IsLower.continuous_iff_Ici.2 fun b => ?_
convert isClosed_Ici (a := sInf <| f ⁻¹' Ici b)
refine Subset.antisymm (fun a => sInf_le) fun a ha => le_trans ?_ <|
OrderHomClass.mono (f : α →o β) ha
refine LE.le.trans ?_ (map_sInf f _).ge
simp
-- see Note [lower instance priority]
instance (priority := 90) IsLower.toContinuousInf : ContinuousInf α :=
⟨(infsInfHom : sInfHom (α × α) α).continuous⟩
end CompleteLattice_IsLower
section CompleteLattice_IsUpper
variable [CompleteLattice α] [CompleteLattice β] [TopologicalSpace α] [IsUpper α]
[TopologicalSpace β] [IsUpper β]
protected lemma _root_.sSupHom.continuous (f : sSupHom α β) : Continuous f :=
sInfHom.continuous (α := αᵒᵈ) (β := βᵒᵈ) (sSupHom.dual.toFun f)
-- see Note [lower instance priority]
instance (priority := 90) IsUpper.toContinuousInf : ContinuousSup α :=
⟨(supsSupHom : sSupHom (α × α) α).continuous⟩
end CompleteLattice_IsUpper
lemma isUpper_orderDual [Preorder α] [TopologicalSpace α] : IsUpper αᵒᵈ ↔ IsLower α := by
constructor
· apply OrderDual.instIsLower
· apply OrderDual.instIsUpper
lemma isLower_orderDual [Preorder α] [TopologicalSpace α] : IsLower αᵒᵈ ↔ IsUpper α :=
isUpper_orderDual.symm
end Topology