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

Commit e8ff6ff

Browse files
feat(*): random lemmas about sets and filters (#3118)
This is the first in a series of PR that will culminate in a proof of Heine's theorem (a continuous function from a compact separated uniform space to any uniform space is uniformly continuous). I'm slicing a 600 lines files into PRs. This first PR is only about sets, filters and a bit of topology. Uniform spaces stuff will come later. Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
1 parent cd9e8b5 commit e8ff6ff

File tree

5 files changed

+134
-8
lines changed

5 files changed

+134
-8
lines changed

src/data/set/basic.lean

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ lemma exists_mem_of_nonempty (α) : ∀ [nonempty α], ∃x:α, x ∈ (univ : se
340340
instance univ_decidable : decidable_pred (@set.univ α) :=
341341
λ x, is_true trivial
342342

343+
/-- `diagonal α` is the subset of `α × α` consisting of all pairs of the form `(a, a)`. -/
344+
def diagonal (α : Type*) : set (α × α) := {p | p.1 = p.2}
345+
343346
/-! ### Lemmas about union -/
344347

345348
theorem union_def {s₁ s₂ : set α} : s₁ ∪ s₂ = {a | a ∈ s₁ ∨ a ∈ s₂} := rfl
@@ -495,6 +498,16 @@ by finish [subset_def, ext_iff, iff_def]
495498
theorem inter_eq_self_of_subset_right {s t : set α} (h : t ⊆ s) : s ∩ t = t :=
496499
by finish [subset_def, ext_iff, iff_def]
497500

501+
lemma inter_compl_nonempty_iff {α : Type*} {s t : set α} : (s ∩ -t).nonempty ↔ ¬ s ⊆ t :=
502+
begin
503+
split,
504+
{ rintros ⟨x ,xs, xt⟩ sub,
505+
exact xt (sub xs) },
506+
{ intros h,
507+
rcases not_subset.mp h with ⟨x, xs, xt⟩,
508+
exact ⟨x, xs, xt⟩ }
509+
end
510+
498511
theorem union_inter_cancel_left {s t : set α} : (s ∪ t) ∩ s = s :=
499512
by finish [ext_iff, iff_def]
500513

@@ -987,6 +1000,13 @@ begin
9871000
simp [mem_def, h]
9881001
end
9891002

1003+
lemma preimage_coe_coe_diagonal {α : Type*} (s : set α) :
1004+
(prod.map coe coe) ⁻¹' (diagonal α) = diagonal s :=
1005+
begin
1006+
ext ⟨⟨x, x_in⟩, ⟨y, y_in⟩⟩,
1007+
simp [set.diagonal],
1008+
end
1009+
9901010
end preimage
9911011

9921012
/-! ### Image of a set under a function -/
@@ -1508,6 +1528,7 @@ begin
15081528
rintro ⟨s, hs₁, hs₂⟩, refine ⟨subtype.val ⁻¹' s, _⟩,
15091529
rw [image_preimage_eq_of_subset], exact hs₂, rw [range_val], exact hs₁
15101530
end
1531+
15111532
end subtype
15121533

15131534
namespace set

src/order/filter/bases.lean

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,22 @@ lemma has_basis.forall_nonempty_iff_ne_bot (hl : l.has_basis p s) :
249249
lemma basis_sets (l : filter α) : l.has_basis (λ s : set α, s ∈ l) id :=
250250
⟨λ t, exists_sets_subset_iff.symm⟩
251251

252+
lemma has_basis_self {l : filter α} {P : set α → Prop} :
253+
has_basis l (λ s, s ∈ l ∧ P s) id ↔ ∀ t, (t ∈ l ↔ ∃ r ∈ l, P r ∧ r ⊆ t) :=
254+
begin
255+
split,
256+
{ rintros ⟨h⟩ t,
257+
convert h t,
258+
ext s,
259+
tauto, },
260+
{ intro h,
261+
constructor,
262+
intro t,
263+
convert h t,
264+
ext s,
265+
tauto }
266+
end
267+
252268
lemma at_top_basis [nonempty α] [semilattice_sup α] :
253269
(@at_top α _).has_basis (λ _, true) Ici :=
254270
⟨λ t, by simpa only [exists_prop, true_and] using @mem_at_top_sets α _ _ t⟩
@@ -331,6 +347,10 @@ lemma has_basis.comap (f : β → α) (hl : l.has_basis p s) :
331347
exact ⟨s i, ⟨i, hi, subset.refl _⟩, H⟩ }
332348
end
333349

350+
lemma comap_has_basis (f : α → β) (l : filter β) :
351+
has_basis (comap f l) (λ s : set β, s ∈ l) (λ s, f ⁻¹' s) :=
352+
⟨λ t, mem_comap_sets⟩
353+
334354
lemma has_basis.prod_self (hl : l.has_basis p s) :
335355
(l.prod l).has_basis p (λ i, (s i).prod (s i)) :=
336356
begin
@@ -356,6 +376,20 @@ lemma has_basis.forall_iff (hl : l.has_basis p s) {P : set α → Prop}
356376
⟨λ H i hi, H (s i) $ hl.mem_of_mem hi,
357377
λ H s hs, let ⟨i, hi, his⟩ := hl.mem_iff.1 hs in mono his (H i hi)⟩
358378

379+
lemma has_basis.sInter_sets (h : has_basis l p s) :
380+
⋂₀ l.sets = ⋂ i ∈ set_of p, s i :=
381+
begin
382+
ext x,
383+
suffices : (∀ t ∈ l, x ∈ t) ↔ ∀ i, p i → x ∈ s i,
384+
by simpa only [mem_Inter, mem_set_of_eq, mem_sInter],
385+
simp_rw h.mem_iff,
386+
split,
387+
{ intros h i hi,
388+
exact h (s i) ⟨i, hi, subset.refl _⟩ },
389+
{ rintros h _ ⟨i, hi, sub⟩,
390+
exact sub (h i hi) },
391+
end
392+
359393
variables [preorder ι] (l p s)
360394

361395
/-- `is_antimono_basis p s` means the image of `s` bounded by `p` is a filter basis
@@ -408,6 +442,28 @@ lemma has_basis.prod (hla : la.has_basis pa sa) (hlb : lb.has_basis pb sb) :
408442
(la.prod lb).has_basis (λ i : ι × ι', pa i.1 ∧ pb i.2) (λ i, (sa i.1).prod (sb i.2)) :=
409443
(hla.comap prod.fst).inf (hlb.comap prod.snd)
410444

445+
lemma has_basis.prod' {la : filter α} {lb : filter β} {ι : Type*} {p : ι → Prop}
446+
{sa : ι → set α} {sb : ι → set β}
447+
(hla : la.has_basis p sa) (hlb : lb.has_basis p sb)
448+
(h_dir : ∀ {i j}, p i → p j → ∃ k, p k ∧ sa k ⊆ sa i ∧ sb k ⊆ sb j) :
449+
(la.prod lb).has_basis p (λ i, (sa i).prod (sb i)) :=
450+
begin
451+
intros t,
452+
rw mem_prod_iff,
453+
split,
454+
{ rintros ⟨u, u_in, v, v_in, huv⟩,
455+
rcases hla.mem_iff.mp u_in with ⟨i, hi, si⟩,
456+
rcases hlb.mem_iff.mp v_in with ⟨j, hj, sj⟩,
457+
rcases h_dir hi hj with ⟨k, hk, ki, kj⟩,
458+
use [k, hk],
459+
calc
460+
(sa k).prod (sb k) ⊆ (sa i).prod (sb j) : set.prod_mono ki kj
461+
... ⊆ u.prod v : set.prod_mono si sj
462+
... ⊆ t : huv, },
463+
{ rintro ⟨i, hi, h⟩,
464+
exact ⟨sa i, hla.mem_of_mem hi, sb i, hlb.mem_of_mem hi, h⟩ },
465+
end
466+
411467
lemma has_antimono_basis.tendsto [semilattice_sup ι] [nonempty ι] {l : filter α}
412468
{p : ι → Prop} {s : ι → set α} (hl : l.has_antimono_basis p s) {φ : ι → α}
413469
(h : ∀ i : ι, φ i ∈ s i) : tendsto φ at_top l :=

src/order/filter/basic.lean

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,21 @@ begin
487487
use [a, hUV ha] }
488488
end
489489

490+
lemma inf_principal_ne_bot_iff (f : filter α) (s : set α) :
491+
f ⊓ principal s ≠ ⊥ ↔ ∀ U ∈ f, (U ∩ s).nonempty :=
492+
begin
493+
rw inf_ne_bot_iff,
494+
apply forall_congr,
495+
intros U,
496+
split,
497+
{ intros h U_in,
498+
exact h U_in (mem_principal_self s) },
499+
{ intros h V U_in V_in,
500+
rw mem_principal_sets at V_in,
501+
cases h U_in with x hx,
502+
exact ⟨x, hx.1, V_in hx.2⟩ },
503+
end
504+
490505
lemma inf_eq_bot_iff {f g : filter α} :
491506
f ⊓ g = ⊥ ↔ ∃ U V, (U ∈ f) ∧ (V ∈ g) ∧ U ∩ V = ∅ :=
492507
begin
@@ -1291,6 +1306,22 @@ theorem map_comap_of_surjective {f : α → β} (hf : function.surjective f) (l
12911306
map f (comap f l) = l :=
12921307
le_antisymm map_comap_le (le_map_comap_of_surjective hf l)
12931308

1309+
lemma subtype_coe_map_comap (s : set α) (f : filter α) :
1310+
map (coe : s → α) (comap (coe : s → α) f) = f ⊓ principal s :=
1311+
begin
1312+
apply le_antisymm,
1313+
{ rw [map_le_iff_le_comap, comap_inf, comap_principal],
1314+
have : (coe : s → α) ⁻¹' s = univ, by { ext x, simp },
1315+
rw [this, principal_univ],
1316+
simp [le_refl _] },
1317+
{ intros V V_in,
1318+
rcases V_in with ⟨W, W_in, H⟩,
1319+
rw mem_inf_sets,
1320+
use [W, W_in, s, mem_principal_self s],
1321+
erw [← image_subset_iff, subtype.image_preimage_val] at H,
1322+
exact H }
1323+
end
1324+
12941325
lemma comap_ne_bot {f : filter β} {m : α → β} (hm : ∀t∈ f, ∃a, m a ∈ t) :
12951326
comap m f ≠ ⊥ :=
12961327
forall_sets_nonempty_iff_ne_bot.mp $ assume s ⟨t, ht, t_s⟩,
@@ -1893,6 +1924,14 @@ le_antisymm
18931924
... ⊆ _ : by rwa [image_subset_iff])
18941925
((tendsto.comp (le_refl _) tendsto_fst).prod_mk (tendsto.comp (le_refl _) tendsto_snd))
18951926

1927+
lemma tendsto.prod_map {δ : Type*} {f : α → γ} {g : β → δ} {a : filter α} {b : filter β}
1928+
{c : filter γ} {d : filter δ} (hf : tendsto f a c) (hg : tendsto g b d) :
1929+
tendsto (prod.map f g) (a ×ᶠ b) (c ×ᶠ d) :=
1930+
begin
1931+
erw [tendsto, ← prod_map_map_eq],
1932+
exact filter.prod_mono hf hg,
1933+
end
1934+
18961935
lemma map_prod (m : α × β → γ) (f : filter α) (g : filter β) :
18971936
map m (f.prod g) = (f.map (λa b, m (a, b))).seq g :=
18981937
begin

src/topology/algebra/ordered.lean

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/
193193
lemma is_closed.is_closed_le [topological_space β] {f g : β → α} {s : set β} (hs : is_closed s)
194194
(hf : continuous_on f s) (hg : continuous_on g s) :
195195
is_closed {x ∈ s | f x ≤ g x} :=
196-
begin
197-
have A : {x ∈ s | f x ≤ g x} ⊆ s := inter_subset_left _ _,
198-
refine is_closed_of_closure_subset (λ x hx, _),
199-
have B : x ∈ s := closure_minimal A hs hx,
200-
exact ⟨B, ((hf x B).mono A).closure_le hx ((hg x B).mono A) (λ y, and.right)⟩
201-
end
196+
(hf.prod hg).preimage_closed_of_closed hs order_closed_topology.is_closed_le'
202197

203198
end preorder
204199

src/topology/continuous_on.lean

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ equipped with the subspace topology.
2323
open set filter
2424
open_locale topological_space
2525

26-
variables {α : Type*} {β : Type*} {γ : Type*}
26+
variables {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
2727
variables [topological_space α]
2828

2929
/-- The "neighborhood within" filter. Elements of `nhds_within a s` are sets containing the
@@ -205,7 +205,7 @@ theorem tendsto_nhds_within_iff_subtype {s : set α} {a : α} (h : a ∈ s) (f :
205205
tendsto f (nhds_within a s) l ↔ tendsto (s.restrict f) (𝓝 ⟨a, h⟩) l :=
206206
by { simp only [tendsto, nhds_within_eq_map_subtype_val h, filter.map_map], refl }
207207

208-
variables [topological_space β] [topological_space γ]
208+
variables [topological_space β] [topological_space γ] [topological_space δ]
209209

210210
/-- A function between topological spaces is continuous at a point `x₀` within a subset `s`
211211
if `f x` tends to `f x₀` when `x` tends to `x₀` while staying within `s`. -/
@@ -241,6 +241,16 @@ tendsto_inf.2 ⟨h, tendsto_principal.2 $
241241
mem_inf_sets_of_right $ mem_principal_sets.2 $
242242
λ x, mem_image_of_mem _⟩
243243

244+
lemma continuous_within_at.prod_map {f : α → γ} {g : β → δ} {s : set α} {t : set β}
245+
{x : α} {y : β}
246+
(hf : continuous_within_at f s x) (hg : continuous_within_at g t y) :
247+
continuous_within_at (prod.map f g) (s.prod t) (x, y) :=
248+
begin
249+
unfold continuous_within_at at *,
250+
rw [nhds_within_prod_eq, prod.map, nhds_prod_eq],
251+
exact hf.prod_map hg,
252+
end
253+
244254
theorem continuous_on_iff {f : α → β} {s : set α} :
245255
continuous_on f s ↔ ∀ x ∈ s, ∀ t : set β, is_open t → f x ∈ t → ∃ u, is_open u ∧ x ∈ u ∧
246256
u ∩ s ⊆ f ⁻¹' t :=
@@ -277,6 +287,11 @@ have ∀ t, is_closed (s.restrict f ⁻¹' t) ↔ ∃ (u : set α), is_closed u
277287
end,
278288
by rw [continuous_on_iff_continuous_restrict, continuous_iff_is_closed]; simp only [this]
279289

290+
lemma continuous_on.prod_map {f : α → γ} {g : β → δ} {s : set α} {t : set β}
291+
(hf : continuous_on f s) (hg : continuous_on g t) :
292+
continuous_on (prod.map f g) (s.prod t) :=
293+
λ ⟨x, y⟩ ⟨hx, hy⟩, continuous_within_at.prod_map (hf x hx) (hg y hy)
294+
280295
lemma continuous_on_empty (f : α → β) : continuous_on f ∅ :=
281296
λ x, false.elim
282297

0 commit comments

Comments
 (0)