Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2021 Scott Morrison. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: Scott Morrison, Heather Macbeth | |
-/ | |
import topology.continuous_function.weierstrass | |
import analysis.complex.basic | |
/-! | |
# The Stone-Weierstrass theorem | |
If a subalgebra `A` of `C(X, β)`, where `X` is a compact topological space, | |
separates points, then it is dense. | |
We argue as follows. | |
* In any subalgebra `A` of `C(X, β)`, if `f β A`, then `abs f β A.topological_closure`. | |
This follows from the Weierstrass approximation theorem on `[-β₯fβ₯, β₯fβ₯]` by | |
approximating `abs` uniformly thereon by polynomials. | |
* This ensures that `A.topological_closure` is actually a sublattice: | |
if it contains `f` and `g`, then it contains the pointwise supremum `f β g` | |
and the pointwise infimum `f β g`. | |
* Any nonempty sublattice `L` of `C(X, β)` which separates points is dense, | |
by a nice argument approximating a given `f` above and below using separating functions. | |
For each `x y : X`, we pick a function `g x y β L` so `g x y x = f x` and `g x y y = f y`. | |
By continuity these functions remain close to `f` on small patches around `x` and `y`. | |
We use compactness to identify a certain finitely indexed infimum of finitely indexed supremums | |
which is then close to `f` everywhere, obtaining the desired approximation. | |
* Finally we put these pieces together. `L = A.topological_closure` is a nonempty sublattice | |
which separates points since `A` does, and so is dense (in fact equal to `β€`). | |
We then prove the complex version for self-adjoint subalgebras `A`, by separately approximating | |
the real and imaginary parts using the real subalgebra of real-valued functions in `A` | |
(which still separates points, by taking the norm-square of a separating function). | |
## Future work | |
Extend to cover the case of subalgebras of the continuous functions vanishing at infinity, | |
on non-compact spaces. | |
-/ | |
noncomputable theory | |
namespace continuous_map | |
variables {X : Type*} [topological_space X] [compact_space X] | |
/-- | |
Turn a function `f : C(X, β)` into a continuous map into `set.Icc (-β₯fβ₯) (β₯fβ₯)`, | |
thereby explicitly attaching bounds. | |
-/ | |
def attach_bound (f : C(X, β)) : C(X, set.Icc (-β₯fβ₯) (β₯fβ₯)) := | |
{ to_fun := Ξ» x, β¨f x, β¨neg_norm_le_apply f x, apply_le_norm f xβ©β© } | |
@[simp] lemma attach_bound_apply_coe (f : C(X, β)) (x : X) : ((attach_bound f) x : β) = f x := rfl | |
lemma polynomial_comp_attach_bound (A : subalgebra β C(X, β)) (f : A) (g : polynomial β) : | |
(g.to_continuous_map_on (set.Icc (-β₯fβ₯) β₯fβ₯)).comp (f : C(X, β)).attach_bound = | |
polynomial.aeval f g := | |
begin | |
ext, | |
simp only [continuous_map.coe_comp, function.comp_app, | |
continuous_map.attach_bound_apply_coe, | |
polynomial.to_continuous_map_on_apply, | |
polynomial.aeval_subalgebra_coe, | |
polynomial.aeval_continuous_map_apply, | |
polynomial.to_continuous_map_apply], | |
end | |
/-- | |
Given a continuous function `f` in a subalgebra of `C(X, β)`, postcomposing by a polynomial | |
gives another function in `A`. | |
This lemma proves something slightly more subtle than this: | |
we take `f`, and think of it as a function into the restricted target `set.Icc (-β₯fβ₯) β₯fβ₯)`, | |
and then postcompose with a polynomial function on that interval. | |
This is in fact the same situation as above, and so also gives a function in `A`. | |
-/ | |
lemma polynomial_comp_attach_bound_mem (A : subalgebra β C(X, β)) (f : A) (g : polynomial β) : | |
(g.to_continuous_map_on (set.Icc (-β₯fβ₯) β₯fβ₯)).comp (f : C(X, β)).attach_bound β A := | |
begin | |
rw polynomial_comp_attach_bound, | |
apply set_like.coe_mem, | |
end | |
theorem comp_attach_bound_mem_closure | |
(A : subalgebra β C(X, β)) (f : A) (p : C(set.Icc (-β₯fβ₯) (β₯fβ₯), β)) : | |
p.comp (attach_bound f) β A.topological_closure := | |
begin | |
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem, | |
have mem_closure : p β (polynomial_functions (set.Icc (-β₯fβ₯) (β₯fβ₯))).topological_closure := | |
continuous_map_mem_polynomial_functions_closure _ _ p, | |
-- and so there are polynomials arbitrarily close. | |
have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure, | |
-- To prove `p.comp (attached_bound f)` is in the closure of `A`, | |
-- we show there are elements of `A` arbitrarily close. | |
apply mem_closure_iff_frequently.mpr, | |
-- To show that, we pull back the polynomials close to `p`, | |
refine ((comp_right_continuous_map β (attach_bound (f : C(X, β)))).continuous_at p).tendsto | |
.frequently_map _ _ frequently_mem_polynomials, | |
-- but need to show that those pullbacks are actually in `A`. | |
rintros _ β¨g, β¨-,rflβ©β©, | |
simp only [set_like.mem_coe, alg_hom.coe_to_ring_hom, comp_right_continuous_map_apply, | |
polynomial.to_continuous_map_on_alg_hom_apply], | |
apply polynomial_comp_attach_bound_mem, | |
end | |
theorem abs_mem_subalgebra_closure (A : subalgebra β C(X, β)) (f : A) : | |
(f : C(X, β)).abs β A.topological_closure := | |
begin | |
let M := β₯fβ₯, | |
let f' := attach_bound (f : C(X, β)), | |
let abs : C(set.Icc (-β₯fβ₯) (β₯fβ₯), β) := | |
{ to_fun := Ξ» x : set.Icc (-β₯fβ₯) (β₯fβ₯), |(x : β)| }, | |
change (abs.comp f') β A.topological_closure, | |
apply comp_attach_bound_mem_closure, | |
end | |
theorem inf_mem_subalgebra_closure (A : subalgebra β C(X, β)) (f g : A) : | |
(f : C(X, β)) β (g : C(X, β)) β A.topological_closure := | |
begin | |
rw inf_eq, | |
refine A.topological_closure.smul_mem | |
(A.topological_closure.sub_mem | |
(A.topological_closure.add_mem (A.subalgebra_topological_closure f.property) | |
(A.subalgebra_topological_closure g.property)) _) _, | |
exact_mod_cast abs_mem_subalgebra_closure A _, | |
end | |
theorem inf_mem_closed_subalgebra (A : subalgebra β C(X, β)) (h : is_closed (A : set C(X, β))) | |
(f g : A) : (f : C(X, β)) β (g : C(X, β)) β A := | |
begin | |
convert inf_mem_subalgebra_closure A f g, | |
apply set_like.ext', | |
symmetry, | |
erw closure_eq_iff_is_closed, | |
exact h, | |
end | |
theorem sup_mem_subalgebra_closure (A : subalgebra β C(X, β)) (f g : A) : | |
(f : C(X, β)) β (g : C(X, β)) β A.topological_closure := | |
begin | |
rw sup_eq, | |
refine A.topological_closure.smul_mem | |
(A.topological_closure.add_mem | |
(A.topological_closure.add_mem (A.subalgebra_topological_closure f.property) | |
(A.subalgebra_topological_closure g.property)) _) _, | |
exact_mod_cast abs_mem_subalgebra_closure A _, | |
end | |
theorem sup_mem_closed_subalgebra (A : subalgebra β C(X, β)) (h : is_closed (A : set C(X, β))) | |
(f g : A) : (f : C(X, β)) β (g : C(X, β)) β A := | |
begin | |
convert sup_mem_subalgebra_closure A f g, | |
apply set_like.ext', | |
symmetry, | |
erw closure_eq_iff_is_closed, | |
exact h, | |
end | |
open_locale topological_space | |
-- Here's the fun part of Stone-Weierstrass! | |
theorem sublattice_closure_eq_top | |
(L : set C(X, β)) (nA : L.nonempty) | |
(inf_mem : β f g β L, f β g β L) (sup_mem : β f g β L, f β g β L) | |
(sep : L.separates_points_strongly) : | |
closure L = β€ := | |
begin | |
-- We start by boiling down to a statement about close approximation. | |
apply eq_top_iff.mpr, | |
rintros f -, | |
refine filter.frequently.mem_closure | |
((filter.has_basis.frequently_iff metric.nhds_basis_ball).mpr (Ξ» Ξ΅ pos, _)), | |
simp only [exists_prop, metric.mem_ball], | |
-- It will be helpful to assume `X` is nonempty later, | |
-- so we get that out of the way here. | |
by_cases nX : nonempty X, | |
swap, | |
exact β¨nA.some, (dist_lt_iff pos).mpr (Ξ» x, false.elim (nX β¨xβ©)), nA.some_specβ©, | |
/- | |
The strategy now is to pick a family of continuous functions `g x y` in `A` | |
with the property that `g x y x = f x` and `g x y y = f y` | |
(this is immediate from `h : separates_points_strongly`) | |
then use continuity to see that `g x y` is close to `f` near both `x` and `y`, | |
and finally using compactness to produce the desired function `h` | |
as a maximum over finitely many `x` of a minimum over finitely many `y` of the `g x y`. | |
-/ | |
dsimp [set.separates_points_strongly] at sep, | |
let g : X β X β L := Ξ» x y, (sep f x y).some, | |
have wβ : β x y, g x y x = f x := Ξ» x y, (sep f x y).some_spec.1, | |
have wβ : β x y, g x y y = f y := Ξ» x y, (sep f x y).some_spec.2, | |
-- For each `x y`, we define `U x y` to be `{z | f z - Ξ΅ < g x y z}`, | |
-- and observe this is a neighbourhood of `y`. | |
let U : X β X β set X := Ξ» x y, {z | f z - Ξ΅ < g x y z}, | |
have U_nhd_y : β x y, U x y β π y, | |
{ intros x y, | |
refine is_open.mem_nhds _ _, | |
{ apply is_open_lt; continuity, }, | |
{ rw [set.mem_set_of_eq, wβ], | |
exact sub_lt_self _ pos, }, }, | |
-- Fixing `x` for a moment, we have a family of functions `Ξ» y, g x y` | |
-- which on different patches (the `U x y`) are greater than `f z - Ξ΅`. | |
-- Taking the supremum of these functions | |
-- indexed by a finite collection of patches which cover `X` | |
-- will give us an element of `A` that is globally greater than `f z - Ξ΅` | |
-- and still equal to `f x` at `x`. | |
-- Since `X` is compact, for every `x` there is some finset `ys t` | |
-- so the union of the `U x y` for `y β ys x` still covers everything. | |
let ys : Ξ x, finset X := Ξ» x, (compact_space.elim_nhds_subcover (U x) (U_nhd_y x)).some, | |
let ys_w : β x, (β y β ys x, U x y) = β€ := | |
Ξ» x, (compact_space.elim_nhds_subcover (U x) (U_nhd_y x)).some_spec, | |
have ys_nonempty : β x, (ys x).nonempty := | |
Ξ» x, set.nonempty_of_union_eq_top_of_nonempty _ _ nX (ys_w x), | |
-- Thus for each `x` we have the desired `h x : A` so `f z - Ξ΅ < h x z` everywhere | |
-- and `h x x = f x`. | |
let h : Ξ x, L := Ξ» x, | |
β¨(ys x).sup' (ys_nonempty x) (Ξ» y, (g x y : C(X, β))), | |
finset.sup'_mem _ sup_mem _ _ _ (Ξ» y _, (g x y).2)β©, | |
have lt_h : β x z, f z - Ξ΅ < h x z, | |
{ intros x z, | |
obtain β¨y, ym, zmβ© := set.exists_set_mem_of_union_eq_top _ _ (ys_w x) z, | |
dsimp [h], | |
simp only [coe_fn_coe_base', subtype.coe_mk, sup'_coe, finset.sup'_apply, finset.lt_sup'_iff], | |
exact β¨y, ym, zmβ© }, | |
have h_eq : β x, h x x = f x, | |
{ intro x, simp only [coe_fn_coe_base'] at wβ, simp [coe_fn_coe_base', wβ], }, | |
-- For each `x`, we define `W x` to be `{z | h x z < f z + Ξ΅}`, | |
let W : Ξ x, set X := Ξ» x, {z | h x z < f z + Ξ΅}, | |
-- This is still a neighbourhood of `x`. | |
have W_nhd : β x, W x β π x, | |
{ intros x, | |
refine is_open.mem_nhds _ _, | |
{ apply is_open_lt; continuity, }, | |
{ dsimp only [W, set.mem_set_of_eq], | |
rw h_eq, | |
exact lt_add_of_pos_right _ pos}, }, | |
-- Since `X` is compact, there is some finset `ys t` | |
-- so the union of the `W x` for `x β xs` still covers everything. | |
let xs : finset X := (compact_space.elim_nhds_subcover W W_nhd).some, | |
let xs_w : (β x β xs, W x) = β€ := | |
(compact_space.elim_nhds_subcover W W_nhd).some_spec, | |
have xs_nonempty : xs.nonempty := set.nonempty_of_union_eq_top_of_nonempty _ _ nX xs_w, | |
-- Finally our candidate function is the infimum over `x β xs` of the `h x`. | |
-- This function is then globally less than `f z + Ξ΅`. | |
let k : (L : Type*) := | |
β¨xs.inf' xs_nonempty (Ξ» x, (h x : C(X, β))), | |
finset.inf'_mem _ inf_mem _ _ _ (Ξ» x _, (h x).2)β©, | |
refine β¨k.1, _, k.2β©, | |
-- We just need to verify the bound, which we do pointwise. | |
rw dist_lt_iff pos, | |
intro z, | |
-- We rewrite into this particular form, | |
-- so that simp lemmas about inequalities involving `finset.inf'` can fire. | |
rw [(show β a b Ξ΅ : β, dist a b < Ξ΅ β a < b + Ξ΅ β§ b - Ξ΅ < a, | |
by { intros, simp only [β metric.mem_ball, real.ball_eq_Ioo, set.mem_Ioo, and_comm], })], | |
fsplit, | |
{ dsimp [k], | |
simp only [finset.inf'_lt_iff, continuous_map.inf'_apply], | |
exact set.exists_set_mem_of_union_eq_top _ _ xs_w z, }, | |
{ dsimp [k], | |
simp only [finset.lt_inf'_iff, continuous_map.inf'_apply], | |
intros x xm, | |
apply lt_h, }, | |
end | |
/-- | |
The **Stone-Weierstrass Approximation Theorem**, | |
that a subalgebra `A` of `C(X, β)`, where `X` is a compact topological space, | |
is dense if it separates points. | |
-/ | |
theorem subalgebra_topological_closure_eq_top_of_separates_points | |
(A : subalgebra β C(X, β)) (w : A.separates_points) : | |
A.topological_closure = β€ := | |
begin | |
-- The closure of `A` is closed under taking `sup` and `inf`, | |
-- and separates points strongly (since `A` does), | |
-- so we can apply `sublattice_closure_eq_top`. | |
apply set_like.ext', | |
let L := A.topological_closure, | |
have n : set.nonempty (L : set C(X, β)) := | |
β¨(1 : C(X, β)), A.subalgebra_topological_closure A.one_memβ©, | |
convert sublattice_closure_eq_top | |
(L : set C(X, β)) n | |
(Ξ» f fm g gm, inf_mem_closed_subalgebra L A.is_closed_topological_closure β¨f, fmβ© β¨g, gmβ©) | |
(Ξ» f fm g gm, sup_mem_closed_subalgebra L A.is_closed_topological_closure β¨f, fmβ© β¨g, gmβ©) | |
(subalgebra.separates_points.strongly | |
(subalgebra.separates_points_monotone (A.subalgebra_topological_closure) w)), | |
{ simp, }, | |
end | |
/-- | |
An alternative statement of the Stone-Weierstrass theorem. | |
If `A` is a subalgebra of `C(X, β)` which separates points (and `X` is compact), | |
every real-valued continuous function on `X` is a uniform limit of elements of `A`. | |
-/ | |
theorem continuous_map_mem_subalgebra_closure_of_separates_points | |
(A : subalgebra β C(X, β)) (w : A.separates_points) | |
(f : C(X, β)) : | |
f β A.topological_closure := | |
begin | |
rw subalgebra_topological_closure_eq_top_of_separates_points A w, | |
simp, | |
end | |
/-- | |
An alternative statement of the Stone-Weierstrass theorem, | |
for those who like their epsilons. | |
If `A` is a subalgebra of `C(X, β)` which separates points (and `X` is compact), | |
every real-valued continuous function on `X` is within any `Ξ΅ > 0` of some element of `A`. | |
-/ | |
theorem exists_mem_subalgebra_near_continuous_map_of_separates_points | |
(A : subalgebra β C(X, β)) (w : A.separates_points) | |
(f : C(X, β)) (Ξ΅ : β) (pos : 0 < Ξ΅) : | |
β (g : A), β₯(g : C(X, β)) - fβ₯ < Ξ΅ := | |
begin | |
have w := mem_closure_iff_frequently.mp | |
(continuous_map_mem_subalgebra_closure_of_separates_points A w f), | |
rw metric.nhds_basis_ball.frequently_iff at w, | |
obtain β¨g, H, mβ© := w Ξ΅ pos, | |
rw [metric.mem_ball, dist_eq_norm] at H, | |
exact β¨β¨g, mβ©, Hβ©, | |
end | |
/-- | |
An alternative statement of the Stone-Weierstrass theorem, | |
for those who like their epsilons and don't like bundled continuous functions. | |
If `A` is a subalgebra of `C(X, β)` which separates points (and `X` is compact), | |
every real-valued continuous function on `X` is within any `Ξ΅ > 0` of some element of `A`. | |
-/ | |
theorem exists_mem_subalgebra_near_continuous_of_separates_points | |
(A : subalgebra β C(X, β)) (w : A.separates_points) | |
(f : X β β) (c : continuous f) (Ξ΅ : β) (pos : 0 < Ξ΅) : | |
β (g : A), β x, β₯g x - f xβ₯ < Ξ΅ := | |
begin | |
obtain β¨g, bβ© := exists_mem_subalgebra_near_continuous_map_of_separates_points A w β¨f, cβ© Ξ΅ pos, | |
use g, | |
rwa norm_lt_iff _ pos at b, | |
end | |
end continuous_map | |
section is_R_or_C | |
open is_R_or_C | |
-- Redefine `X`, since for the next few lemmas it need not be compact | |
variables {π : Type*} {X : Type*} [is_R_or_C π] [topological_space X] | |
namespace continuous_map | |
/-- A real subalgebra of `C(X, π)` is `conj_invariant`, if it contains all its conjugates. -/ | |
def conj_invariant_subalgebra (A : subalgebra β C(X, π)) : Prop := | |
A.map (conj_ae.to_alg_hom.comp_left_continuous β conj_cle.continuous) β€ A | |
lemma mem_conj_invariant_subalgebra {A : subalgebra β C(X, π)} (hA : conj_invariant_subalgebra A) | |
{f : C(X, π)} (hf : f β A) : | |
(conj_ae.to_alg_hom.comp_left_continuous β conj_cle.continuous) f β A := | |
hA β¨f, hf, rflβ© | |
end continuous_map | |
open continuous_map | |
/-- If a conjugation-invariant subalgebra of `C(X, π)` separates points, then the real subalgebra | |
of its purely real-valued elements also separates points. -/ | |
lemma subalgebra.separates_points.is_R_or_C_to_real {A : subalgebra π C(X, π)} | |
(hA : A.separates_points) (hA' : conj_invariant_subalgebra (A.restrict_scalars β)) : | |
((A.restrict_scalars β).comap | |
(of_real_am.comp_left_continuous β continuous_of_real)).separates_points := | |
begin | |
intros xβ xβ hx, | |
-- Let `f` in the subalgebra `A` separate the points `xβ`, `xβ` | |
obtain β¨_, β¨f, hfA, rflβ©, hfβ© := hA hx, | |
let F : C(X, π) := f - const _ (f xβ), | |
-- Subtract the constant `f xβ` from `f`; this is still an element of the subalgebra | |
have hFA : F β A, | |
{ refine A.sub_mem hfA _, | |
convert A.smul_mem A.one_mem (f xβ), | |
ext1, | |
simp }, | |
-- Consider now the function `Ξ» x, |f x - f xβ| ^ 2` | |
refine β¨_, β¨(β¨is_R_or_C.norm_sq, continuous_norm_sqβ© : C(π, β)).comp F, _, rflβ©, _β©, | |
{ -- This is also an element of the subalgebra, and takes only real values | |
rw [set_like.mem_coe, subalgebra.mem_comap], | |
convert (A.restrict_scalars β).mul_mem (mem_conj_invariant_subalgebra hA' hFA) hFA, | |
ext1, | |
rw [mul_comm], | |
exact (is_R_or_C.mul_conj _).symm }, | |
{ -- And it also separates the points `xβ`, `xβ` | |
have : f xβ - f xβ β 0 := sub_ne_zero.mpr hf, | |
simpa using this }, | |
end | |
variables [compact_space X] | |
/-- | |
The Stone-Weierstrass approximation theorem, `is_R_or_C` version, | |
that a subalgebra `A` of `C(X, π)`, where `X` is a compact topological space and `is_R_or_C π`, | |
is dense if it is conjugation-invariant and separates points. | |
-/ | |
theorem continuous_map.subalgebra_is_R_or_C_topological_closure_eq_top_of_separates_points | |
(A : subalgebra π C(X, π)) (hA : A.separates_points) | |
(hA' : conj_invariant_subalgebra (A.restrict_scalars β)) : | |
A.topological_closure = β€ := | |
begin | |
rw algebra.eq_top_iff, | |
-- Let `I` be the natural inclusion of `C(X, β)` into `C(X, π)` | |
let I : C(X, β) ββ[β] C(X, π) := of_real_clm.comp_left_continuous β X, | |
-- The main point of the proof is that its range (i.e., every real-valued function) is contained | |
-- in the closure of `A` | |
have key : I.range β€ (A.to_submodule.restrict_scalars β).topological_closure, | |
{ -- Let `Aβ` be the subalgebra of `C(X, β)` consisting of `A`'s purely real elements; it is the | |
-- preimage of `A` under `I`. In this argument we only need its submodule structure. | |
let Aβ : submodule β C(X, β) := (A.to_submodule.restrict_scalars β).comap I, | |
-- By `subalgebra.separates_points.complex_to_real`, this subalgebra also separates points, so | |
-- we may apply the real Stone-Weierstrass result to it. | |
have SW : Aβ.topological_closure = β€, | |
{ have := subalgebra_topological_closure_eq_top_of_separates_points _ | |
(hA.is_R_or_C_to_real hA'), | |
exact congr_arg subalgebra.to_submodule this }, | |
rw [β submodule.map_top, β SW], | |
-- So it suffices to prove that the image under `I` of the closure of `Aβ` is contained in the | |
-- closure of `A`, which follows by abstract nonsense | |
have hβ := Aβ.topological_closure_map ((@of_real_clm π _).comp_left_continuous_compact X), | |
have hβ := (A.to_submodule.restrict_scalars β).map_comap_le I, | |
exact hβ.trans (submodule.topological_closure_mono hβ) }, | |
-- In particular, for a function `f` in `C(X, π)`, the real and imaginary parts of `f` are in the | |
-- closure of `A` | |
intros f, | |
let f_re : C(X, β) := (β¨is_R_or_C.re, is_R_or_C.re_clm.continuousβ© : C(π, β)).comp f, | |
let f_im : C(X, β) := (β¨is_R_or_C.im, is_R_or_C.im_clm.continuousβ© : C(π, β)).comp f, | |
have h_f_re : I f_re β A.topological_closure := key β¨f_re, rflβ©, | |
have h_f_im : I f_im β A.topological_closure := key β¨f_im, rflβ©, | |
-- So `f_re + I β’ f_im` is in the closure of `A` | |
convert A.topological_closure.add_mem h_f_re (A.topological_closure.smul_mem h_f_im is_R_or_C.I), | |
-- And this, of course, is just `f` | |
ext, | |
apply eq.symm, | |
simp [I, mul_comm is_R_or_C.I _], | |
end | |
end is_R_or_C | |