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

Commit 421ed70

Browse files
committed
chore(topology/metric_space/baire): review (#3146)
* Simplify some proofs in `topology/metric_space/baire`; * Allow dependency on `hi : i ∈ S` in some `bUnion`/`bInter` lemmas.
1 parent 159766e commit 421ed70

File tree

7 files changed

+91
-85
lines changed

7 files changed

+91
-85
lines changed

src/algebraic_geometry/prime_spectrum.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ topological_space.of_closed (set.range prime_spectrum.zero_locus)
287287
intros Zs h,
288288
rw set.sInter_eq_Inter,
289289
let f : Zs → set R := λ i, classical.some (h i.2),
290-
have hf : ∀ i : Zs, i.1 = zero_locus (f i) := λ i, (classical.some_spec (h i.2)).symm,
290+
have hf : ∀ i : Zs, ↑i = zero_locus (f i) := λ i, (classical.some_spec (h i.2)).symm,
291291
simp only [hf],
292292
exact ⟨_, zero_locus_Union _⟩
293293
end

src/data/set/basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ by simp [ext_iff]
331331

332332
theorem eq_univ_of_forall {s : set α} : (∀ x, x ∈ s) → s = univ := eq_univ_iff_forall.2
333333

334+
lemma eq_univ_of_subset {s t : set α} (h : s ⊆ t) (hs : s = univ) : t = univ :=
335+
eq_univ_of_univ_subset $ hs ▸ h
336+
334337
@[simp] lemma univ_eq_empty_iff : (univ : set α) = ∅ ↔ ¬ nonempty α :=
335338
eq_empty_iff_forall_not_mem.trans ⟨λ H ⟨x⟩, H x trivial, λ H x _, H ⟨x⟩⟩
336339

src/data/set/countable.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ lemma countable_Union {t : α → set β} [encodable α] (ht : ∀a, countable (
119119
by haveI := (λ a, (ht a).to_encodable);
120120
rw Union_eq_range_sigma; apply countable_range
121121

122-
lemma countable.bUnion {s : set α} {t : α → set β} (hs : countable s) (ht : ∀a∈s, countable (t a)) :
123-
countable (⋃a∈s, t a) :=
122+
lemma countable.bUnion {s : set α} {t : Π x ∈ s, set β} (hs : countable s) (ht : ∀a∈s, countable (t a ‹_›)) :
123+
countable (⋃a∈s, t a ‹_›) :=
124124
begin
125125
rw bUnion_eq_Union,
126126
haveI := hs.to_encodable,

src/data/set/lattice.lean

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,13 @@ theorem bUnion_mono {s : set α} {t t' : α → set β} (h : ∀ x ∈ s, t x
283283
(⋃ x ∈ s, t x) ⊆ (⋃ x ∈ s, t' x) :=
284284
bUnion_subset_bUnion (λ x x_in, ⟨x, x_in, h x x_in⟩)
285285

286-
theorem bUnion_eq_Union (s : set α) (t : α → set β) : (⋃ x ∈ s, t x) = (⋃ x : s, t x.1) :=
287-
set.ext $ by simp
286+
theorem bUnion_eq_Union (s : set α) (t : Π x ∈ s, set β) :
287+
(⋃ x ∈ s, t x ‹_›) = (⋃ x : s, t x x.2) :=
288+
supr_subtype'
288289

289-
theorem bInter_eq_Inter (s : set α) (t : α → set β) : (⋂ x ∈ s, t x) = (⋂ x : s, t x.1) :=
290-
set.ext $ by simp
290+
theorem bInter_eq_Inter (s : set α) (t : Π x ∈ s, set β) :
291+
(⋂ x ∈ s, t x ‹_›) = (⋂ x : s, t x x.2) :=
292+
infi_subtype'
291293

292294
theorem bInter_empty (u : α → set β) : (⋂ x ∈ (∅ : set α), u x) = univ :=
293295
show (⨅x ∈ (∅ : set α), u x) = ⊤, -- simplifier should be able to rewrite x ∈ ∅ to false.
@@ -441,9 +443,9 @@ Inf_pair
441443

442444
@[simp] theorem sInter_image (f : α → set β) (s : set α) : ⋂₀ (f '' s) = ⋂ x ∈ s, f x := Inf_image
443445

444-
@[simp] theorem sUnion_range (f : ι → set β) : ⋃₀ (range f) = ⋃ x, f x := Sup_range
446+
@[simp] theorem sUnion_range (f : ι → set β) : ⋃₀ (range f) = ⋃ x, f x := rfl
445447

446-
@[simp] theorem sInter_range (f : ι → set β) : ⋂₀ (range f) = ⋂ x, f x := Inf_range
448+
@[simp] theorem sInter_range (f : ι → set β) : ⋂₀ (range f) = ⋂ x, f x := rfl
447449

448450
lemma sUnion_eq_univ_iff {c : set (set α)} :
449451
⋃₀ c = @set.univ α ↔ ∀ a, ∃ b ∈ c, a ∈ b :=
@@ -519,16 +521,16 @@ theorem bUnion_subset_Union (s : set α) (t : α → set β) :
519521
Union_subset_Union $ λ i, Union_subset $ λ h, by refl
520522

521523
lemma sUnion_eq_bUnion {s : set (set α)} : (⋃₀ s) = (⋃ (i : set α) (h : i ∈ s), i) :=
522-
set.ext $ by simp
524+
by rw [← sUnion_image, image_id']
523525

524526
lemma sInter_eq_bInter {s : set (set α)} : (⋂₀ s) = (⋂ (i : set α) (h : i ∈ s), i) :=
525-
set.ext $ by simp
527+
by rw [← sInter_image, image_id']
526528

527-
lemma sUnion_eq_Union {s : set (set α)} : (⋃₀ s) = (⋃ (i : s), i.1) :=
528-
set.ext $ λ x, by simp
529+
lemma sUnion_eq_Union {s : set (set α)} : (⋃₀ s) = (⋃ (i : s), i) :=
530+
by rw [← sUnion_range, range_coe_subtype]
529531

530-
lemma sInter_eq_Inter {s : set (set α)} : (⋂₀ s) = (⋂ (i : s), i.1) :=
531-
set.ext $ λ x, by simp
532+
lemma sInter_eq_Inter {s : set (set α)} : (⋂₀ s) = (⋂ (i : s), i) :=
533+
by rw [← sInter_range, range_coe_subtype]
532534

533535
lemma union_eq_Union {s₁ s₂ : set α} : s₁ ∪ s₂ = ⋃ b : bool, cond b s₁ s₂ :=
534536
set.ext $ λ x, by simp [bool.exists_bool, or_comm]
@@ -560,28 +562,28 @@ lemma sUnion_inter_sUnion {s t : set (set α)} :
560562
(⋃₀s) ∩ (⋃₀t) = (⋃p ∈ set.prod s t, (p : (set α) × (set α )).1 ∩ p.2) :=
561563
Sup_inf_Sup
562564

563-
lemma sInter_bUnion {S : set (set α)} {T : set α → set (set α)} (hT : ∀s∈S, s = ⋂₀ T s) :
564-
⋂₀ (⋃s∈S, T s) = ⋂₀ S :=
565+
/-- If `S` is a set of sets, and each `s ∈ S` can be represented as an intersection
566+
of sets `T s hs`, then `⋂₀ S` is the intersection of the union of all `T s hs`. -/
567+
lemma sInter_bUnion {S : set (set α)} {T : Π s ∈ S, set (set α)} (hT : ∀s∈S, s = ⋂₀ T s ‹s ∈ S›) :
568+
⋂₀ (⋃s∈S, T s ‹_›) = ⋂₀ S :=
565569
begin
566570
ext,
567571
simp only [and_imp, exists_prop, set.mem_sInter, set.mem_Union, exists_imp_distrib],
568572
split,
569573
{ assume H s sS,
570574
rw [hT s sS, mem_sInter],
571575
assume t tTs,
572-
apply H t s sS tTs },
576+
exact H t s sS tTs },
573577
{ assume H t s sS tTs,
574-
have xs : x ∈ s := H s sS,
575-
have : s ⊆ t,
576-
{ have Z := hT s sS,
577-
rw sInter_eq_bInter at Z,
578-
rw Z, apply bInter_subset_of_mem,
579-
exact tTs },
580-
exact this xs }
578+
suffices : s ⊆ t, exact this (H s sS),
579+
rw [hT s sS, sInter_eq_bInter],
580+
exact bInter_subset_of_mem tTs }
581581
end
582582

583-
lemma sUnion_bUnion {S : set (set α)} {T : set α → set (set α)} (hT : ∀s∈S, s = ⋃₀ T s) :
584-
⋃₀ (⋃s∈S, T s) = ⋃₀ S :=
583+
/-- If `S` is a set of sets, and each `s ∈ S` can be represented as an union
584+
of sets `T s hs`, then `⋃₀ S` is the union of the union of all `T s hs`. -/
585+
lemma sUnion_bUnion {S : set (set α)} {T : Π s ∈ S, set (set α)} (hT : ∀s∈S, s = ⋃₀ T s ‹_›) :
586+
⋃₀ (⋃s∈S, T s ‹_›) = ⋃₀ S :=
585587
begin
586588
ext,
587589
simp only [exists_prop, set.mem_Union, set.mem_set_of_eq],

src/measure_theory/measure_space.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ by rw [measure_eq_measure' (h₁.union h₂),
390390

391391
lemma measure_bUnion {s : set β} {f : β → set α} (hs : countable s)
392392
(hd : pairwise_on s (disjoint on f)) (h : ∀b∈s, is_measurable (f b)) :
393-
μ (⋃b∈s, f b) = ∑'p:s, μ (f p.1) :=
393+
μ (⋃b∈s, f b) = ∑'p:s, μ (f p) :=
394394
begin
395395
haveI := hs.to_encodable,
396396
rw [← measure_Union, bUnion_eq_Union],
@@ -401,7 +401,7 @@ end
401401

402402
lemma measure_sUnion {S : set (set α)} (hs : countable S)
403403
(hd : pairwise_on S disjoint) (h : ∀s∈S, is_measurable s) :
404-
μ (⋃₀ S) = ∑' s:S, μ s.1 :=
404+
μ (⋃₀ S) = ∑' s:S, μ s :=
405405
by rw [sUnion_eq_bUnion, measure_bUnion hs hd h]
406406

407407
lemma measure_bUnion_finset {s : finset ι} {f : ι → set α} (hd : pairwise_on ↑s (disjoint on f))

src/topology/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ by rw [frontier, interior_eq_of_open hs]
386386
lemma is_closed_frontier {s : set α} : is_closed (frontier s) :=
387387
by rw frontier_eq_closure_inter_closure; exact is_closed_inter is_closed_closure is_closed_closure
388388

389-
/-- The frontier of a set has no interior point. -/
389+
/-- The frontier of a closed set has no interior point. -/
390390
lemma interior_frontier {s : set α} (h : is_closed s) : interior (frontier s) = ∅ :=
391391
begin
392392
have A : frontier s = s \ interior s, from h.frontier_eq,

src/topology/metric_space/baire.lean

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ open_locale classical
2525

2626
open filter encodable set
2727

28-
variables {α : Type*} {β : Type*} {γ : Type*}
28+
variables {α : Type*} {β : Type*} {γ : Type*} {ι : Type*}
2929

3030
section is_Gδ
3131
variable [topological_space α]
@@ -38,43 +38,50 @@ def is_Gδ (s : set α) : Prop :=
3838
lemma is_open.is_Gδ {s : set α} (h : is_open s) : is_Gδ s :=
3939
⟨{s}, by simp [h], countable_singleton _, (set.sInter_singleton _).symm⟩
4040

41-
lemma is_Gδ_bInter_of_open {ι : Type*} {I : set ι} (hI : countable I) {f : ι → set α}
41+
lemma is_Gδ_univ : is_Gδ (univ : set α) := is_open_univ.is_Gδ
42+
43+
lemma is_Gδ_bInter_of_open {I : set ι} (hI : countable I) {f : ι → set α}
4244
(hf : ∀i ∈ I, is_open (f i)) : is_Gδ (⋂i∈I, f i) :=
4345
⟨f '' I, by rwa ball_image_iff, hI.image _, by rw sInter_image⟩
4446

45-
lemma is_Gδ_Inter_of_open {ι : Type*} [encodable ι] {f : ι → set α}
47+
lemma is_Gδ_Inter_of_open [encodable ι] {f : ι → set α}
4648
(hf : ∀i, is_open (f i)) : is_Gδ (⋂i, f i) :=
4749
⟨range f, by rwa forall_range_iff, countable_range _, by rw sInter_range⟩
4850

4951
/-- A countable intersection of Gδ sets is a Gδ set. -/
5052
lemma is_Gδ_sInter {S : set (set α)} (h : ∀s∈S, is_Gδ s) (hS : countable S) : is_Gδ (⋂₀ S) :=
5153
begin
52-
have : ∀s : set α, ∃T : set (set α), s ∈ S → ((∀t ∈ T, is_open t) ∧ countable T ∧ s = (⋂₀ T)),
53-
{ assume s,
54-
by_cases hs : s ∈ S,
55-
{ simp [hs], exact h s hs },
56-
{ simp [hs] }},
57-
choose T hT using this,
58-
refine ⟨⋃s∈S, T s, λt ht, _, _, _⟩,
59-
{ simp only [exists_prop, set.mem_Union] at ht,
60-
rcases ht with ⟨s, hs, tTs⟩,
54+
choose T hT using h,
55+
refine ⟨_, _, _, (sInter_bUnion (λ s hs, (hT s hs).2.2)).symm⟩,
56+
{ simp only [mem_Union],
57+
rintros t ⟨s, hs, tTs⟩,
6158
exact (hT s hs).1 t tTs },
6259
{ exact hS.bUnion (λs hs, (hT s hs).2.1) },
63-
{ exact (sInter_bUnion (λs hs, (hT s hs).2.2)).symm }
6460
end
6561

62+
lemma is_Gδ_Inter [encodable ι] {s : ι → set α} (hs : ∀ i, is_Gδ (s i)) : is_Gδ (⋂ i, s i) :=
63+
is_Gδ_sInter (forall_range_iff.2 hs) $ countable_range s
64+
65+
lemma is_Gδ_bInter {s : set ι} (hs : countable s) {t : Π i ∈ s, set α} (ht : ∀ i ∈ s, is_Gδ (t i ‹_›)) :
66+
is_Gδ (⋂ i ∈ s, t i ‹_›) :=
67+
begin
68+
rw [bInter_eq_Inter],
69+
haveI := hs.to_encodable,
70+
exact is_Gδ_Inter (λ x, ht x x.2)
71+
end
72+
73+
lemma is_Gδ.inter {s t : set α} (hs : is_Gδ s) (ht : is_Gδ t) : is_Gδ (s ∩ t) :=
74+
by { rw inter_eq_Inter, exact is_Gδ_Inter (bool.forall_bool.2 ⟨ht, hs⟩) }
75+
6676
/-- The union of two Gδ sets is a Gδ set. -/
6777
lemma is_Gδ.union {s t : set α} (hs : is_Gδ s) (ht : is_Gδ t) : is_Gδ (s ∪ t) :=
6878
begin
69-
rcases hs with ⟨S, Sopen, Scount, sS⟩,
70-
rcases ht with ⟨T, Topen, Tcount, tT⟩,
71-
rw [sS, tT, sInter_union_sInter],
79+
rcases hs with ⟨S, Sopen, Scount, rfl⟩,
80+
rcases ht with ⟨T, Topen, Tcount, rfl⟩,
81+
rw [sInter_union_sInter],
7282
apply is_Gδ_bInter_of_open (countable_prod Scount Tcount),
7383
rintros ⟨a, b⟩ hab,
74-
simp only [set.prod_mk_mem_set_prod_eq] at hab,
75-
have aopen : is_open a := Sopen a hab.1,
76-
have bopen : is_open b := Topen b hab.2,
77-
simp [aopen, bopen, is_open_union]
84+
exact is_open_union (Sopen a hab.1) (Topen b hab.2)
7885
end
7986

8087
end is_Gδ
@@ -224,39 +231,17 @@ theorem dense_sInter_of_Gδ {S : set (set α)} (ho : ∀s∈S, is_Gδ s) (hS : c
224231
begin
225232
-- the result follows from the result for a countable intersection of dense open sets,
226233
-- by rewriting each set as a countable intersection of open sets, which are of course dense.
227-
have : ∀s : set α, ∃T : set (set α), s ∈ S → ((∀t ∈ T, is_open t) ∧ countable T ∧ s = (⋂₀ T)),
228-
{ assume s,
229-
by_cases hs : s ∈ S,
230-
{ simp [hs], exact ho s hs },
231-
{ simp [hs] }},
232-
choose T hT using this,
233-
have : ⋂₀ S = ⋂₀ (⋃s∈S, T s) := (sInter_bUnion (λs hs, (hT s hs).2.2)).symm,
234+
choose T hT using ho,
235+
have : ⋂₀ S = ⋂₀ (⋃s∈S, T s ‹_›) := (sInter_bUnion (λs hs, (hT s hs).2.2)).symm,
234236
rw this,
235-
refine dense_sInter_of_open (λt ht, _) (hS.bUnion (λs hs, (hT s hs).2.1)) (λt ht, _),
237+
refine dense_sInter_of_open _ (hS.bUnion (λs hs, (hT s hs).2.1)) _;
238+
simp only [set.mem_Union, exists_prop]; rintro t ⟨s, hs, tTs⟩,
236239
show is_open t,
237-
{ simp only [exists_prop, set.mem_Union] at ht,
238-
rcases ht with ⟨s, hs, tTs⟩,
239-
exact (hT s hs).1 t tTs },
240+
{ exact (hT s hs).1 t tTs },
240241
show closure t = univ,
241-
{ simp only [exists_prop, set.mem_Union] at ht,
242-
rcases ht with ⟨s, hs, tTs⟩,
243-
apply subset.antisymm (subset_univ _),
244-
rw ← (hd s hs),
245-
apply closure_mono,
246-
have := sInter_subset_of_mem tTs,
247-
rwa ← (hT s hs).2.2 at this }
248-
end
249-
250-
/-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
251-
an index set which is a countable set in any type. -/
252-
theorem dense_bInter_of_Gδ {S : set β} {f : β → set α} (ho : ∀s∈S, is_Gδ (f s))
253-
(hS : countable S) (hd : ∀s∈S, closure (f s) = univ) : closure (⋂s∈S, f s) = univ :=
254-
begin
255-
rw ← sInter_image,
256-
apply dense_sInter_of_Gδ,
257-
{ rwa ball_image_iff },
258-
{ exact hS.image _ },
259-
{ rwa ball_image_iff }
242+
{ apply eq_univ_of_univ_subset,
243+
rw [← hd s hs, (hT s hs).2.2],
244+
exact closure_mono (sInter_subset_of_mem tTs) }
260245
end
261246

262247
/-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
@@ -265,10 +250,26 @@ theorem dense_Inter_of_Gδ [encodable β] {f : β → set α} (ho : ∀s, is_Gδ
265250
(hd : ∀s, closure (f s) = univ) : closure (⋂s, f s) = univ :=
266251
begin
267252
rw ← sInter_range,
268-
apply dense_sInter_of_Gδ,
269-
{ rwa forall_range_iff },
270-
{ exact countable_range _ },
271-
{ rwa forall_range_iff }
253+
exact dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
254+
end
255+
256+
/-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
257+
an index set which is a countable set in any type. -/
258+
theorem dense_bInter_of_Gδ {S : set β} {f : Π x ∈ S, set α} (ho : ∀s∈S, is_Gδ (f s ‹_›))
259+
(hS : countable S) (hd : ∀s∈S, closure (f s ‹_›) = univ) : closure (⋂s∈S, f s ‹_›) = univ :=
260+
begin
261+
rw bInter_eq_Inter,
262+
haveI := hS.to_encodable,
263+
exact dense_Inter_of_Gδ (λ s, ho s s.2) (λ s, hd s s.2)
264+
end
265+
266+
/-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
267+
theorem dense_inter_of_Gδ {s t : set α} (hs : is_Gδ s) (ht : is_Gδ t) (hsc : closure s = univ)
268+
(htc : closure t = univ) :
269+
closure (s ∩ t) = univ :=
270+
begin
271+
rw [inter_eq_Inter],
272+
apply dense_Inter_of_Gδ; simp [bool.forall_bool, *]
272273
end
273274

274275
/-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
@@ -282,7 +283,7 @@ begin
282283
show is_open (g s), from is_open_compl_iff.2 is_closed_frontier,
283284
show closure (g s) = univ,
284285
{ apply subset.antisymm (subset_univ _),
285-
simp [g, interior_frontier (hc s hs)] }},
286+
simp [interior_frontier (hc s hs)] }},
286287
have : (⋂s∈S, g s) ⊆ (⋃s∈S, interior (f s)),
287288
{ assume x hx,
288289
have : x ∈ ⋃s∈S, f s, { have := mem_univ x, rwa ← hU at this },

0 commit comments

Comments
 (0)