Skip to content

Commit a06940b

Browse files
urkuderic-wieser
andcommitted
feat: forward-port #18321 (#3101)
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent be0f288 commit a06940b

File tree

6 files changed

+94
-60
lines changed

6 files changed

+94
-60
lines changed

Mathlib/Data/Analysis/Topology.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Mario Carneiro
55
66
! This file was ported from Lean 3 source module data.analysis.topology
7-
! leanprover-community/mathlib commit 28aa996fc6fb4317f0083c4e6daf79878d81be33
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
1111
import Mathlib.Data.Analysis.Filter
1212
import Mathlib.Topology.Bases
13+
import Mathlib.Topology.LocallyFinite
1314

1415
/-!
1516
# Computational realization of topological spaces (experimental)

Mathlib/Topology/Constructions.lean

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro, Patrick Massot
55
66
! This file was ported from Lean 3 source module topology.constructions
7-
! leanprover-community/mathlib commit 0c1f285a9f6e608ae2bdffa3f993eafb01eba829
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
1111
import Mathlib.Topology.Maps
12-
import Mathlib.Topology.LocallyFinite
1312
import Mathlib.Order.Filter.Pi
1413

1514
/-!
@@ -1069,24 +1068,6 @@ theorem tendsto_subtype_rng {β : Type _} {p : α → Prop} {b : Filter β} {f :
10691068
| ⟨a, ha⟩ => by rw [nhds_subtype_eq_comap, tendsto_comap_iff]; rfl
10701069
#align tendsto_subtype_rng tendsto_subtype_rng
10711070

1072-
-- porting note: todo: see https://github.com/leanprover-community/mathlib/pull/18321
1073-
theorem continuous_subtype_nhds_cover {ι : Sort _} {f : α → β} {c : ι → α → Prop}
1074-
(c_cover : ∀ x : α, ∃ i, { x | c i x } ∈ 𝓝 x)
1075-
(f_cont : ∀ i, Continuous fun x : Subtype (c i) => f x) : Continuous f :=
1076-
continuous_iff_continuousAt.mpr fun x => by
1077-
rcases c_cover x with ⟨i, c_sets⟩
1078-
lift x to Subtype (c i) using mem_of_mem_nhds c_sets
1079-
refine' (inducing_subtype_val.continuousAt_iff' _).1 (f_cont i).continuousAt
1080-
rwa [Subtype.range_coe]
1081-
#align continuous_subtype_nhds_cover continuous_subtype_nhds_cover
1082-
1083-
/- porting note: todo: see https://github.com/leanprover-community/mathlib/pull/18321
1084-
1085-
I failed to quickly fix the proof. This is a leaf lemma, and it is going to be replaced by a lemma
1086-
formulated using `ContinuousOn`.
1087-
-/
1088-
#noalign continuous_subtype_is_closed_cover
1089-
10901071
theorem closure_subtype {x : { a // p a }} {s : Set { a // p a }} :
10911072
x ∈ closure s ↔ (x : α) ∈ closure (((↑) : _ → α) '' s) :=
10921073
closure_induced

Mathlib/Topology/ContinuousFunction/Basic.lean

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Nicolò Cavalleri
55
66
! This file was ported from Lean 3 source module topology.continuous_function.basic
7-
! leanprover-community/mathlib commit 6efec6bb9fcaed3cf1baaddb2eaadd8a2a06679c
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -365,17 +365,12 @@ variable {ι : Type _} (S : ι → Set α) (φ : ∀ i : ι, C(S i, β))
365365
/-- A family `φ i` of continuous maps `C(S i, β)`, where the domains `S i` contain a neighbourhood
366366
of each point in `α` and the functions `φ i` agree pairwise on intersections, can be glued to
367367
construct a continuous map in `C(α, β)`. -/
368-
noncomputable def liftCover : C(α, β) := by
369-
have H : (⋃ i, S i) = Set.univ := by
370-
rw [Set.eq_univ_iff_forall]
371-
intro x
372-
rw [Set.mem_unionᵢ]
373-
obtain ⟨i, hi⟩ := hS x
374-
exact ⟨i, mem_of_mem_nhds hi⟩
375-
refine' ⟨Set.liftCover S (fun i => φ i) hφ H, continuous_subtype_nhds_cover hS _⟩
376-
intro i
377-
convert (φ i).continuous
378-
apply Set.liftCover_coe
368+
noncomputable def liftCover : C(α, β) :=
369+
haveI H : (⋃ i, S i) = Set.univ :=
370+
Set.unionᵢ_eq_univ_iff.2 fun x ↦ (hS x).imp fun _ ↦ mem_of_mem_nhds
371+
mk (Set.liftCover S (fun i ↦ φ i) hφ H) <| continuous_of_cover_nhds hS fun i ↦ by
372+
rw [continuousOn_iff_continuous_restrict]
373+
simpa only [Set.restrict, Set.liftCover_coe] using (φ i).continuous
379374
#align continuous_map.lift_cover ContinuousMap.liftCover
380375

381376
variable {S φ hφ hS}

Mathlib/Topology/ContinuousOn.lean

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Sébastien Gouëzel
55
66
! This file was ported from Lean 3 source module topology.continuous_on
7-
! leanprover-community/mathlib commit bcfa726826abd57587355b4b5b7e78ad6527b7e4
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -227,9 +227,9 @@ theorem nhdsWithin_eq_nhdsWithin {a : α} {s t u : Set α} (h₀ : a ∈ s) (h
227227
rw [nhdsWithin_restrict t h₀ h₁, nhdsWithin_restrict u h₀ h₁, h₂]
228228
#align nhds_within_eq_nhds_within nhdsWithin_eq_nhdsWithin
229229

230-
-- porting note: new lemma; todo: make it `@[simp]`
231-
theorem nhdsWithin_eq_nhds {a : α} {s : Set α} : 𝓝[s] a = 𝓝 a ↔ s ∈ 𝓝 a :=
230+
@[simp] theorem nhdsWithin_eq_nhds {a : α} {s : Set α} : 𝓝[s] a = 𝓝 a ↔ s ∈ 𝓝 a :=
232231
inf_eq_left.trans le_principal_iff
232+
#align nhds_within_eq_nhds nhdsWithin_eq_nhds
233233

234234
theorem IsOpen.nhdsWithin_eq {a : α} {s : Set α} (h : IsOpen s) (ha : a ∈ s) : 𝓝[s] a = 𝓝 a :=
235235
nhdsWithin_eq_nhds.2 <| h.mem_nhds ha
@@ -252,6 +252,22 @@ theorem nhdsWithin_union (a : α) (s t : Set α) : 𝓝[s ∪ t] a = 𝓝[s] a
252252
rw [← inf_sup_left, sup_principal]
253253
#align nhds_within_union nhdsWithin_union
254254

255+
theorem nhdsWithin_bunionᵢ {ι} {I : Set ι} (hI : I.Finite) (s : ι → Set α) (a : α) :
256+
𝓝[⋃ i ∈ I, s i] a = ⨆ i ∈ I, 𝓝[s i] a :=
257+
Set.Finite.induction_on hI (by simp) fun _ _ hT ↦ by
258+
simp only [hT, nhdsWithin_union, supᵢ_insert, bunionᵢ_insert]
259+
#align nhds_within_bUnion nhdsWithin_bunionᵢ
260+
261+
theorem nhdsWithin_unionₛ {S : Set (Set α)} (hS : S.Finite) (a : α) :
262+
𝓝[⋃₀ S] a = ⨆ s ∈ S, 𝓝[s] a := by
263+
rw [unionₛ_eq_bunionᵢ, nhdsWithin_bunionᵢ hS]
264+
#align nhds_within_sUnion nhdsWithin_unionₛ
265+
266+
theorem nhdsWithin_unionᵢ {ι} [Finite ι] (s : ι → Set α) (a : α) :
267+
𝓝[⋃ i, s i] a = ⨆ i, 𝓝[s i] a := by
268+
rw [← unionₛ_range, nhdsWithin_unionₛ (finite_range s), supᵢ_range]
269+
#align nhds_within_Union nhdsWithin_unionᵢ
270+
255271
theorem nhdsWithin_inter (a : α) (s t : Set α) : 𝓝[s ∩ t] a = 𝓝[s] a ⊓ 𝓝[t] a := by
256272
delta nhdsWithin
257273
rw [inf_left_comm, inf_assoc, inf_principal, ← inf_assoc, inf_idem]
@@ -267,9 +283,9 @@ theorem nhdsWithin_inter_of_mem {a : α} {s t : Set α} (h : s ∈ 𝓝[t] a) :
267283
exact nhdsWithin_le_of_mem h
268284
#align nhds_within_inter_of_mem nhdsWithin_inter_of_mem
269285

270-
-- porting note: new lemma
271286
theorem nhdsWithin_inter_of_mem' {a : α} {s t : Set α} (h : t ∈ 𝓝[s] a) : 𝓝[s ∩ t] a = 𝓝[s] a := by
272287
rw [inter_comm, nhdsWithin_inter_of_mem h]
288+
#align nhds_within_inter_of_mem' nhdsWithin_inter_of_mem'
273289

274290
@[simp]
275291
theorem nhdsWithin_singleton (a : α) : 𝓝[{a}] a = pure a := by
@@ -652,6 +668,14 @@ theorem ContinuousOn.prod_map {f : α → γ} {g : β → δ} {s : Set α} {t :
652668
fun ⟨x, y⟩ ⟨hx, hy⟩ => ContinuousWithinAt.prod_map (hf x hx) (hg y hy)
653669
#align continuous_on.prod_map ContinuousOn.prod_map
654670

671+
theorem continuous_of_cover_nhds {ι : Sort _} {f : α → β} {s : ι → Set α}
672+
(hs : ∀ x : α, ∃ i, s i ∈ 𝓝 x) (hf : ∀ i, ContinuousOn f (s i)) :
673+
Continuous f :=
674+
continuous_iff_continuousAt.mpr fun x ↦ let ⟨i, hi⟩ := hs x; by
675+
rw [ContinuousAt, ← nhdsWithin_eq_nhds.2 hi]
676+
exact hf _ _ (mem_of_mem_nhds hi)
677+
#align continuous_of_cover_nhds continuous_of_cover_nhds
678+
655679
theorem continuousOn_empty (f : α → β) : ContinuousOn f ∅ := fun _ => False.elim
656680
#align continuous_on_empty continuousOn_empty
657681

Mathlib/Topology/LocallyFinite.lean

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yury Kudryashov
55
66
! This file was ported from Lean 3 source module topology.locally_finite
7-
! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
11-
import Mathlib.Topology.Basic
11+
import Mathlib.Topology.ContinuousOn
1212
import Mathlib.Order.Filter.SmallSets
1313

1414
/-!
@@ -77,36 +77,68 @@ theorem exists_mem_basis {ι' : Sort _} (hf : LocallyFinite f) {p : ι' → Prop
7777
⟨i, hpi, hi Subset.rfl⟩
7878
#align locally_finite.exists_mem_basis LocallyFinite.exists_mem_basis
7979

80+
protected theorem nhdsWithin_unionᵢ (hf : LocallyFinite f) (a : X) :
81+
𝓝[⋃ i, f i] a = ⨆ i, 𝓝[f i] a := by
82+
rcases hf a with ⟨U, haU, hfin⟩
83+
refine le_antisymm ?_ (Monotone.le_map_supᵢ fun _ _ ↦ nhdsWithin_mono _)
84+
calc
85+
𝓝[⋃ i, f i] a = 𝓝[⋃ i, f i ∩ U] a := by
86+
rw [← unionᵢ_inter, ← nhdsWithin_inter_of_mem' (nhdsWithin_le_nhds haU)]
87+
_ = 𝓝[⋃ i ∈ {j | (f j ∩ U).Nonempty}, (f i ∩ U)] a := by
88+
simp only [mem_setOf_eq, unionᵢ_nonempty_self]
89+
_ = ⨆ i ∈ {j | (f j ∩ U).Nonempty}, 𝓝[f i ∩ U] a := nhdsWithin_bunionᵢ hfin _ _
90+
_ ≤ ⨆ i, 𝓝[f i ∩ U] a := supᵢ₂_le_supᵢ _ _
91+
_ ≤ ⨆ i, 𝓝[f i] a := supᵢ_mono fun i ↦ nhdsWithin_mono _ <| inter_subset_left _ _
92+
#align locally_finite.nhds_within_Union LocallyFinite.nhdsWithin_unionᵢ
93+
94+
theorem continuousOn_unionᵢ' {g : X → Y} (hf : LocallyFinite f)
95+
(hc : ∀ i x, x ∈ closure (f i) → ContinuousWithinAt g (f i) x) :
96+
ContinuousOn g (⋃ i, f i) := by
97+
rintro x -
98+
rw [ContinuousWithinAt, hf.nhdsWithin_unionᵢ, tendsto_supᵢ]
99+
intro i
100+
by_cases hx : x ∈ closure (f i)
101+
· exact hc i _ hx
102+
· rw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx
103+
rw [hx]
104+
exact tendsto_bot
105+
#align locally_finite.continuous_on_Union' LocallyFinite.continuousOn_unionᵢ'
106+
107+
theorem continuousOn_unionᵢ {g : X → Y} (hf : LocallyFinite f) (h_cl : ∀ i, IsClosed (f i))
108+
(h_cont : ∀ i, ContinuousOn g (f i)) : ContinuousOn g (⋃ i, f i) :=
109+
hf.continuousOn_unionᵢ' fun i x hx ↦ h_cont i x <| (h_cl i).closure_subset hx
110+
#align locally_finite.continuous_on_Union LocallyFinite.continuousOn_unionᵢ
111+
112+
protected theorem continuous' {g : X → Y} (hf : LocallyFinite f) (h_cov : (⋃ i, f i) = univ)
113+
(hc : ∀ i x, x ∈ closure (f i) → ContinuousWithinAt g (f i) x) :
114+
Continuous g :=
115+
continuous_iff_continuousOn_univ.2 <| h_cov ▸ hf.continuousOn_unionᵢ' hc
116+
#align locally_finite.continuous' LocallyFinite.continuous'
117+
118+
protected theorem continuous {g : X → Y} (hf : LocallyFinite f) (h_cov : (⋃ i, f i) = univ)
119+
(h_cl : ∀ i, IsClosed (f i)) (h_cont : ∀ i, ContinuousOn g (f i)) :
120+
Continuous g :=
121+
continuous_iff_continuousOn_univ.2 <| h_cov ▸ hf.continuousOn_unionᵢ h_cl h_cont
122+
#align locally_finite.continuous LocallyFinite.continuous
123+
80124
protected theorem closure (hf : LocallyFinite f) : LocallyFinite fun i => closure (f i) := by
81125
intro x
82126
rcases hf x with ⟨s, hsx, hsf⟩
83127
refine' ⟨interior s, interior_mem_nhds.2 hsx, hsf.subset fun i hi => _⟩
84-
exact
85-
(hi.mono isOpen_interior.closure_inter).of_closure.mono
86-
(inter_subset_inter_right _ interior_subset)
128+
exact (hi.mono isOpen_interior.closure_inter).of_closure.mono
129+
(inter_subset_inter_right _ interior_subset)
87130
#align locally_finite.closure LocallyFinite.closure
88131

132+
theorem closure_unionᵢ (h : LocallyFinite f) : closure (⋃ i, f i) = ⋃ i, closure (f i) := by
133+
ext x
134+
simp only [mem_closure_iff_nhdsWithin_neBot, h.nhdsWithin_unionᵢ, supᵢ_neBot, mem_unionᵢ]
135+
#align locally_finite.closure_Union LocallyFinite.closure_unionᵢ
136+
89137
theorem isClosed_unionᵢ (hf : LocallyFinite f) (hc : ∀ i, IsClosed (f i)) :
90138
IsClosed (⋃ i, f i) := by
91-
simp only [← isOpen_compl_iff, compl_unionᵢ, isOpen_iff_mem_nhds, mem_interᵢ]
92-
intro a ha
93-
replace ha : ∀ i, f iᶜ ∈ 𝓝 a := fun i => (hc i).compl_mem_nhds (ha i)
94-
rcases hf a with ⟨t, h_nhds, h_fin⟩
95-
have : (t ∩ ⋂ i ∈ { i | (f i ∩ t).Nonempty }, f iᶜ) ∈ 𝓝 a :=
96-
inter_mem h_nhds ((binterᵢ_mem h_fin).2 fun i _ => ha i)
97-
filter_upwards [this]
98-
simp only [mem_inter_iff, mem_interᵢ]
99-
rintro b ⟨hbt, hn⟩ i hfb
100-
exact hn i ⟨b, hfb, hbt⟩ hfb
139+
simp only [← closure_eq_iff_isClosed, hf.closure_unionᵢ, (hc _).closure_eq]
101140
#align locally_finite.is_closed_Union LocallyFinite.isClosed_unionᵢ
102141

103-
theorem closure_unionᵢ (h : LocallyFinite f) : closure (⋃ i, f i) = ⋃ i, closure (f i) :=
104-
Subset.antisymm
105-
(closure_minimal (unionᵢ_mono fun _ => subset_closure) <|
106-
h.closure.isClosed_unionᵢ fun _ => isClosed_closure)
107-
(unionᵢ_subset fun _ => closure_mono <| subset_unionᵢ _ _)
108-
#align locally_finite.closure_Union LocallyFinite.closure_unionᵢ
109-
110142
/-- If `f : β → set α` is a locally finite family of closed sets, then for any `x : α`, the
111143
intersection of the complements to `f i`, `x ∉ f i`, is a neighbourhood of `x`. -/
112144
theorem interᵢ_compl_mem_nhds (hf : LocallyFinite f) (hc : ∀ i, IsClosed (f i)) (x : X) :

Mathlib/Topology/SubsetProperties.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov
55
66
! This file was ported from Lean 3 source module topology.subset_properties
7-
! leanprover-community/mathlib commit 59694bd07f0a39c5beccba34bd9f413a160782bf
7+
! leanprover-community/mathlib commit 55d771df074d0dd020139ee1cd4b95521422df9f
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -14,6 +14,7 @@ import Mathlib.Data.Finset.Order
1414
import Mathlib.Data.Set.Accumulate
1515
import Mathlib.Data.Set.BoolIndicator
1616
import Mathlib.Topology.Bornology.Basic
17+
import Mathlib.Topology.LocallyFinite
1718
import Mathlib.Order.Minimal
1819

1920
/-!

0 commit comments

Comments
 (0)