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

Commit 16ef291

Browse files
committed
feat(order/filter/*, topology/subset_properties): define "coproduct" of two filters (#6372)
Define the "coproduct" of two filters (unclear if this is really a categorical coproduct) as ```lean protected def coprod (f : filter α) (g : filter β) : filter (α × β) := f.comap prod.fst ⊔ g.comap prod.snd ``` and prove the three lemmas which motivated this construction ([Zulip](https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there.20code.20for.20X.3F/topic/Filter.20golf)): coproduct of cofinite filters is the cofinite filter, coproduct of cocompact filters is the cocompact filter, and ```lean (tendsto f a c) → (tendsto g b d) → (tendsto (prod.map f g) (a.coprod b) (c.coprod d)) ``` Co-authored by: Kevin Buzzard <k.buzzard@imperial.ac.uk> Co-authored by: Patrick Massot <patrickmassot@free.fr>
1 parent 0fa0d61 commit 16ef291

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

src/order/filter/basic.lean

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,6 +2405,86 @@ by simp only [tendsto_def, mem_prod_iff, prod_sub_preimage_iff, exists_prop, iff
24052405

24062406
end prod
24072407

2408+
/-! ### Coproducts of filters -/
2409+
2410+
section coprod
2411+
variables {s : set α} {t : set β} {f : filter α} {g : filter β}
2412+
2413+
/-- Coproduct of filters. -/
2414+
protected def coprod (f : filter α) (g : filter β) : filter (α × β) :=
2415+
f.comap prod.fst ⊔ g.comap prod.snd
2416+
2417+
lemma mem_coprod_iff {s : set (α×β)} {f : filter α} {g : filter β} :
2418+
s ∈ f.coprod g ↔ ((∃ t₁ ∈ f, prod.fst ⁻¹' t₁ ⊆ s) ∧ (∃ t₂ ∈ g, prod.snd ⁻¹' t₂ ⊆ s)) :=
2419+
by simp [filter.coprod]
2420+
2421+
@[mono] lemma coprod_mono {f₁ f₂ : filter α} {g₁ g₂ : filter β} (hf : f₁ ≤ f₂) (hg : g₁ ≤ g₂) :
2422+
f₁.coprod g₁ ≤ f₂.coprod g₂ :=
2423+
sup_le_sup (comap_mono hf) (comap_mono hg)
2424+
2425+
lemma principal_coprod_principal (s : set α) (t : set β) :
2426+
(𝓟 s).coprod (𝓟 t) = 𝓟 (sᶜ.prod tᶜ)ᶜ :=
2427+
begin
2428+
rw [filter.coprod, comap_principal, comap_principal, sup_principal],
2429+
congr,
2430+
ext x,
2431+
simp ; tauto,
2432+
end
2433+
2434+
-- this inequality can be strict; see `map_const_principal_coprod_map_id_principal` and
2435+
-- `map_prod_map_const_id_principal_coprod_principal` below.
2436+
lemma map_prod_map_coprod_le {α₁ : Type u} {α₂ : Type v} {β₁ : Type w} {β₂ : Type x}
2437+
{f₁ : filter α₁} {f₂ : filter α₂} {m₁ : α₁ → β₁} {m₂ : α₂ → β₂} :
2438+
map (prod.map m₁ m₂) (f₁.coprod f₂) ≤ (map m₁ f₁).coprod (map m₂ f₂) :=
2439+
begin
2440+
intros s,
2441+
simp only [mem_map, mem_coprod_iff],
2442+
rintros ⟨⟨u₁, hu₁, h₁⟩, ⟨u₂, hu₂, h₂⟩⟩,
2443+
refine ⟨⟨m₁ ⁻¹' u₁, hu₁, λ _ hx, h₁ _⟩, ⟨m₂ ⁻¹' u₂, hu₂, λ _ hx, h₂ _⟩⟩; convert hx
2444+
end
2445+
2446+
/-- Characterization of the coproduct of the `filter.map`s of two principal filters `𝓟 {a}` and
2447+
`𝓟 {i}`, the first under the constant function `λ a, b` and the second under the identity function.
2448+
Together with the next lemma, `map_prod_map_const_id_principal_coprod_principal`, this provides an
2449+
example showing that the inequality in the lemma `map_prod_map_coprod_le` can be strict. -/
2450+
lemma map_const_principal_coprod_map_id_principal {α β ι : Type*} (a : α) (b : β) (i : ι) :
2451+
(map (λ _ : α, b) (𝓟 {a})).coprod (map id (𝓟 {i}))
2452+
= 𝓟 (({b} : set β).prod (univ : set ι) ∪ (univ : set β).prod {i}) :=
2453+
begin
2454+
rw [map_principal, map_principal, principal_coprod_principal],
2455+
congr,
2456+
ext ⟨b', i'⟩,
2457+
simp,
2458+
tauto,
2459+
end
2460+
2461+
/-- Characterization of the `filter.map` of the coproduct of two principal filters `𝓟 {a}` and
2462+
`𝓟 {i}`, under the `prod.map` of two functions, respectively the constant function `λ a, b` and the
2463+
identity function. Together with the previous lemma,
2464+
`map_const_principal_coprod_map_id_principal`, this provides an example showing that the inequality
2465+
in the lemma `map_prod_map_coprod_le` can be strict. -/
2466+
lemma map_prod_map_const_id_principal_coprod_principal {α β ι : Type*} (a : α) (b : β) (i : ι) :
2467+
map (prod.map (λ _ : α, b) id) ((𝓟 {a}).coprod (𝓟 {i}))
2468+
= 𝓟 (({b} : set β).prod (univ : set ι)) :=
2469+
begin
2470+
rw [principal_coprod_principal, map_principal],
2471+
congr,
2472+
ext ⟨b', i'⟩,
2473+
split,
2474+
{ rintros ⟨⟨a'', i''⟩, h₁, ⟨h₂, h₃⟩⟩,
2475+
simp },
2476+
{ rintros ⟨h₁, h₂⟩,
2477+
use (a, i'),
2478+
simpa using h₁.symm }
2479+
end
2480+
2481+
lemma tendsto.prod_map_coprod {δ : Type*} {f : α → γ} {g : β → δ} {a : filter α} {b : filter β}
2482+
{c : filter γ} {d : filter δ} (hf : tendsto f a c) (hg : tendsto g b d) :
2483+
tendsto (prod.map f g) (a.coprod b) (c.coprod d) :=
2484+
map_prod_map_coprod_le.trans (coprod_mono hf hg)
2485+
2486+
end coprod
2487+
24082488
end filter
24092489

24102490
open_locale filter

src/order/filter/cofinite.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ lemma frequently_cofinite_iff_infinite {p : α → Prop} :
4848
by simp only [filter.frequently, filter.eventually, mem_cofinite, compl_set_of, not_not,
4949
set.infinite]
5050

51+
/-- The coproduct of the cofinite filters on two types is the cofinite filter on their product. -/
52+
lemma coprod_cofinite {β : Type*} :
53+
(cofinite : filter α).coprod (cofinite : filter β) = cofinite :=
54+
begin
55+
ext S,
56+
simp only [mem_coprod_iff, exists_prop, mem_comap_sets, mem_cofinite],
57+
split,
58+
{ rintro ⟨⟨A, hAf, hAS⟩, B, hBf, hBS⟩,
59+
rw [← compl_subset_compl, ← preimage_compl] at hAS hBS,
60+
exact (hAf.prod hBf).subset (subset_inter hAS hBS) },
61+
{ intro hS,
62+
refine ⟨⟨(prod.fst '' Sᶜ)ᶜ, _, _⟩, ⟨(prod.snd '' Sᶜ)ᶜ, _, _⟩⟩,
63+
{ simpa using hS.image prod.fst },
64+
{ simpa [compl_subset_comm] using subset_preimage_image prod.fst Sᶜ },
65+
{ simpa using hS.image prod.snd },
66+
{ simpa [compl_subset_comm] using subset_preimage_image prod.snd Sᶜ } },
67+
end
68+
5169
end filter
5270

5371
open filter

src/topology/subset_properties.lean

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,34 @@ instance [compact_space α] [compact_space β] : compact_space (α ⊕ β) :=
654654
exact (compact_range continuous_inl).union (compact_range continuous_inr)
655655
end
656656

657+
/-- The coproduct of the cocompact filters on two topological spaces is the cocompact filter on
658+
their product. -/
659+
lemma filter.coprod_cocompact {β : Type*} [topological_space β]:
660+
(filter.cocompact α).coprod (filter.cocompact β) = filter.cocompact (α × β) :=
661+
begin
662+
ext S,
663+
simp only [mem_coprod_iff, exists_prop, mem_comap_sets, filter.mem_cocompact],
664+
split,
665+
{ rintro ⟨⟨A, ⟨t, ht, hAt⟩, hAS⟩, B, ⟨t', ht', hBt'⟩, hBS⟩,
666+
refine ⟨t.prod t', ht.prod ht', _⟩,
667+
refine subset.trans _ (union_subset hAS hBS),
668+
rw compl_subset_comm at ⊢ hAt hBt',
669+
refine subset.trans _ (set.prod_mono hAt hBt'),
670+
intros x,
671+
simp only [compl_union, mem_inter_eq, mem_prod, mem_preimage, mem_compl_eq],
672+
tauto },
673+
{ rintros ⟨t, ht, htS⟩,
674+
refine ⟨⟨(prod.fst '' t)ᶜ, _, _⟩, ⟨(prod.snd '' t)ᶜ, _, _⟩⟩,
675+
{ exact ⟨prod.fst '' t, ht.image continuous_fst, subset.rfl⟩ },
676+
{ rw preimage_compl,
677+
rw compl_subset_comm at ⊢ htS,
678+
exact subset.trans htS (subset_preimage_image prod.fst _) },
679+
{ exact ⟨prod.snd '' t, ht.image continuous_snd, subset.rfl⟩ },
680+
{ rw preimage_compl,
681+
rw compl_subset_comm at ⊢ htS,
682+
exact subset.trans htS (subset_preimage_image prod.snd _) } }
683+
end
684+
657685
section tychonoff
658686
variables {ι : Type*} {π : ι → Type*} [∀ i, topological_space (π i)]
659687

0 commit comments

Comments
 (0)