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

Commit 0e533d0

Browse files
urkudmergify[bot]
andauthored
refactor(topology/basic): rewrite some proofs using filter bases (#1967)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent b4c2ec2 commit 0e533d0

File tree

3 files changed

+32
-39
lines changed

3 files changed

+32
-39
lines changed

src/topology/basic.lean

Lines changed: 30 additions & 38 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: Johannes Hölzl, Mario Carneiro, Jeremy Avigad
55
-/
66

7-
import order.filter
7+
import order.filter order.filter.bases
88

99
/-!
1010
# Basic theory of topological spaces.
@@ -387,41 +387,29 @@ localized "notation `𝓝` := nhds" in topological_space
387387

388388
lemma nhds_def (a : α) : 𝓝 a = (⨅ s ∈ {s : set α | a ∈ s ∧ is_open s}, principal s) := rfl
389389

390+
lemma nhds_basis_opens (a : α) : (𝓝 a).has_basis (λ s : set α, a ∈ s ∧ is_open s) id :=
391+
has_basis_binfi_principal
392+
(λ s ⟨has, hs⟩ t ⟨hat, ht⟩, ⟨s ∩ t, ⟨⟨has, hat⟩, is_open_inter hs ht⟩,
393+
⟨inter_subset_left _ _, inter_subset_right _ _⟩⟩)
394+
⟨univ, ⟨mem_univ a, is_open_univ⟩⟩
395+
390396
lemma le_nhds_iff {f a} : f ≤ 𝓝 a ↔ ∀ s : set α, a ∈ s → is_open s → s ∈ f :=
391397
by simp [nhds_def]
392398

393399
lemma nhds_le_of_le {f a} {s : set α} (h : a ∈ s) (o : is_open s) (sf : principal s ≤ f) : 𝓝 a ≤ f :=
394400
by rw nhds_def; exact infi_le_of_le s (infi_le_of_le ⟨h, o⟩ sf)
395401

396-
lemma nhds_sets {a : α} : (𝓝 a).sets = {s | ∃t⊆s, is_open t ∧ a ∈ t} :=
397-
calc (𝓝 a).sets = (⋃s∈{s : set α| a ∈ s ∧ is_open s}, (principal s).sets) : binfi_sets_eq
398-
(assume x ⟨hx₁, hx₂⟩ y ⟨hy₁, hy₂⟩,
399-
⟨x ∩ y, ⟨⟨hx₁, hy₁⟩, is_open_inter hx₂ hy₂⟩,
400-
le_principal_iff.2 (inter_subset_left _ _),
401-
le_principal_iff.2 (inter_subset_right _ _)⟩)
402-
⟨univ, mem_univ _, is_open_univ⟩
403-
... = {s | ∃t⊆s, is_open t ∧ a ∈ t} :
404-
le_antisymm
405-
(supr_le $ assume i, supr_le $ assume ⟨hi₁, hi₂⟩ t ht, ⟨i, ht, hi₂, hi₁⟩)
406-
(assume t ⟨i, hi₁, hi₂, hi₃⟩, mem_Union.2 ⟨i, mem_Union.2 ⟨⟨hi₃, hi₂⟩, hi₁⟩⟩)
402+
lemma mem_nhds_sets_iff {a : α} {s : set α} :
403+
s ∈ 𝓝 a ↔ ∃t⊆s, is_open t ∧ a ∈ t :=
404+
(nhds_basis_opens a).mem_iff.trans
405+
⟨λ ⟨t, ⟨hat, ht⟩, hts⟩, ⟨t, hts, ht, hat⟩, λ ⟨t, hts, ht, hat⟩, ⟨t, ⟨hat, ht⟩, hts⟩⟩
407406

408407
lemma map_nhds {a : α} {f : α → β} :
409408
map f (𝓝 a) = (⨅ s ∈ {s : set α | a ∈ s ∧ is_open s}, principal (image f s)) :=
410-
calc map f (𝓝 a) = (⨅ s ∈ {s : set α | a ∈ s ∧ is_open s}, map f (principal s)) :
411-
map_binfi_eq
412-
(assume x ⟨hx₁, hx₂⟩ y ⟨hy₁, hy₂⟩,
413-
⟨x ∩ y, ⟨⟨hx₁, hy₁⟩, is_open_inter hx₂ hy₂⟩,
414-
le_principal_iff.2 (inter_subset_left _ _),
415-
le_principal_iff.2 (inter_subset_right _ _)⟩)
416-
⟨univ, mem_univ _, is_open_univ⟩
417-
... = _ : by simp only [map_principal]
409+
((nhds_basis_opens a).map f).eq_binfi
418410

419411
attribute [irreducible] nhds
420412

421-
lemma mem_nhds_sets_iff {a : α} {s : set α} :
422-
s ∈ 𝓝 a ↔ ∃t⊆s, is_open t ∧ a ∈ t :=
423-
by simp only [nhds_sets, mem_set_of_eq, exists_prop]
424-
425413
lemma mem_of_nhds {a : α} {s : set α} : s ∈ 𝓝 a → a ∈ s :=
426414
λ H, let ⟨t, ht, _, hs⟩ := mem_nhds_sets_iff.1 H in ht hs
427415

@@ -435,8 +423,8 @@ iff.intro
435423
(λ h s os xs, h s (mem_nhds_sets os xs))
436424
(λ h t,
437425
begin
438-
change t ∈ (𝓝 x).sets → P t,
439-
rw nhds_sets,
426+
change t ∈ 𝓝 x → P t,
427+
rw mem_nhds_sets_iff,
440428
rintros ⟨s, hs, opens, xs⟩,
441429
exact hP _ _ hs (h s opens xs),
442430
end)
@@ -512,6 +500,14 @@ mem_closure_iff.trans
512500
(H _ is_open_interior (mem_interior_iff_mem_nhds.2 ht)),
513501
λ H o oo ao, H _ (mem_nhds_sets oo ao)⟩
514502

503+
theorem mem_closure_iff_nhds_basis {a : α} {p : β → Prop} {s : β → set α} (h : (𝓝 a).has_basis p s)
504+
{t : set α} :
505+
a ∈ closure t ↔ ∀ i, p i → ∃ y ∈ t, y ∈ s i :=
506+
mem_closure_iff_nhds.trans
507+
⟨λ H i hi, let ⟨x, hx⟩ := (H _ $ h.mem_of_mem hi) in ⟨x, hx.2, hx.1⟩,
508+
λ H t' ht', let ⟨i, hi, hit⟩ := (h t').1 ht', ⟨x, xt, hx⟩ := H i hi in
509+
⟨x, hit hx, xt⟩⟩
510+
515511
/-- `x` belongs to the closure of `s` if and only if some ultrafilter
516512
supported on `s` converges to `x`. -/
517513
lemma mem_closure_iff_ultrafilter {s : set α} {x : α} :
@@ -611,8 +607,8 @@ lemma is_closed_Union_of_locally_finite {f : β → set α}
611607
is_open_iff_nhds.mpr $ assume a, assume h : a ∉ (⋃i, f i),
612608
have ∀i, a ∈ -f i,
613609
from assume i hi, h $ mem_Union.2 ⟨i, hi⟩,
614-
have ∀i, - f i ∈ (𝓝 a).sets,
615-
by rw [nhds_sets]; exact assume i, ⟨- f i, subset.refl _, h₂ i, this i⟩,
610+
have ∀i, - f i ∈ (𝓝 a),
611+
by simp only [mem_nhds_sets_iff]; exact assume i, ⟨- f i, subset.refl _, h₂ i, this i⟩,
616612
let ⟨t, h_sets, (h_fin : finite {i | (f i ∩ t).nonempty })⟩ := h₁ a in
617613

618614
calc 𝓝 a ≤ principal (t ∩ (⋂ i∈{i | (f i ∩ t).nonempty }, - f i)) :
@@ -664,11 +660,9 @@ lemma continuous_at.comp {g : β → γ} {f : α → β} {x : α}
664660
hg.comp hf
665661

666662
lemma continuous.tendsto {f : α → β} (hf : continuous f) (x) :
667-
tendsto f (𝓝 x) (𝓝 (f x)) | s :=
668-
show s ∈ 𝓝 (f x) → s ∈ map f (𝓝 x),
669-
by simp [nhds_sets]; exact
670-
assume t t_subset t_open fx_in_t,
671-
⟨f ⁻¹' t, preimage_mono t_subset, hf t t_open, fx_in_t⟩
663+
tendsto f (𝓝 x) (𝓝 (f x)) :=
664+
((nhds_basis_opens x).tendsto_iff $ nhds_basis_opens $ f x).2 $
665+
λ t ⟨hxt, ht⟩, ⟨f ⁻¹' t, ⟨hxt, hf _ ht⟩, subset.refl _⟩
672666

673667
lemma continuous.continuous_at {f : α → β} {x : α} (h : continuous f) :
674668
continuous_at f x :=
@@ -679,9 +673,9 @@ lemma continuous_iff_continuous_at {f : α → β} : continuous f ↔ ∀ x, con
679673
assume hf : ∀x, tendsto f (𝓝 x) (𝓝 (f x)),
680674
assume s, assume hs : is_open s,
681675
have ∀a, f a ∈ s → s ∈ 𝓝 (f a),
682-
by simp [nhds_sets]; exact assume a ha, ⟨s, subset.refl s, hs, ha,
676+
from λ a ha, mem_nhds_sets hs ha,
683677
show is_open (f ⁻¹' s),
684-
by simp [is_open_iff_nhds]; exact assume a ha, hf a (this a ha)⟩
678+
from is_open_iff_nhds.2 $ λ a ha, le_principal_iff.2 $ hf _ (this a ha)⟩
685679

686680
lemma continuous_const {b : β} : continuous (λa:α, b) :=
687681
continuous_iff_continuous_at.mpr $ assume a, tendsto_const_nhds
@@ -755,9 +749,7 @@ lemma pcontinuous_iff' {f : α →. β} :
755749
begin
756750
split,
757751
{ intros h x y h',
758-
rw [ptendsto'_def],
759-
change ∀ (s : set β), s ∈ (𝓝 y).sets → pfun.preimage f s ∈ (𝓝 x).sets,
760-
rw [nhds_sets, nhds_sets],
752+
simp only [ptendsto'_def, mem_nhds_sets_iff],
761753
rintros s ⟨t, tsubs, opent, yt⟩,
762754
exact ⟨f.preimage t, pfun.preimage_mono _ tsubs, h _ opent, ⟨y, yt, h'⟩⟩
763755
},

src/topology/bounded_continuous_function.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ instance : metric_space (α →ᵇ β) :=
120120
(dist_le (add_nonneg dist_nonneg' dist_nonneg')).2 $ λ x,
121121
le_trans (dist_triangle _ _ _) (add_le_add (dist_coe_le_dist _) (dist_coe_le_dist _)) }
122122

123+
/-- Constant as a continuous bounded function. -/
123124
def const (b : β) : α →ᵇ β := ⟨λx, b, continuous_const, 0, by simp [le_refl]⟩
124125

125126
/-- If the target space is inhabited, so is the space of bounded continuous functions -/

src/topology/order.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ continuous_iff_coinduced_le.2 $ le_top
500500
theorem mem_nhds_induced [T : topological_space α] (f : β → α) (a : β) (s : set β) :
501501
s ∈ @nhds β (topological_space.induced f T) a ↔ ∃ u ∈ 𝓝 (f a), f ⁻¹' u ⊆ s :=
502502
begin
503-
simp only [nhds_sets, is_open_induced_iff, exists_prop, set.mem_set_of_eq],
503+
simp only [mem_nhds_sets_iff, is_open_induced_iff, exists_prop, set.mem_set_of_eq],
504504
split,
505505
{ rintros ⟨u, usub, ⟨v, openv, ueq⟩, au⟩,
506506
exact ⟨v, ⟨v, set.subset.refl v, openv, by rwa ←ueq at au⟩, by rw ueq; exact usub⟩ },

0 commit comments

Comments
 (0)