The areas / V15. Real analysis in one variable
Mathlib.Analysis.SpecialFunctions.Bernstein
15 declarations. Mathlib docs · Source
Bernstein approximations and Weierstrass' theorem
We prove that the Bernstein approximations
∑ k : Fin (n+1), (n.choose k * x^k * (1-x)^(n-k)) • f (k/n : ℝ)
for a continuous function f : C([0,1], E) taking values in a locally convex vector space
converge uniformly to f as n tends to infinity.
This statement directly applies to the cases when the codomain is a (semi)normed space
or, more generally, has a topology defined by a family of seminorms.
Our proof follows [Richard Beals' Analysis, an introduction][beals2004], §7D. The original proof, due to Bernstein in 1912, is probabilistic, and relies on Bernoulli's theorem, which gives bounds for how quickly the observed frequencies in a Bernoulli trial approach the underlying probability.
The proof here does not directly rely on Bernoulli's theorem, but can also be given a probabilistic account.
- Consider a weighted coin which with probability
xproduces heads, and with probability1-xproduces tails. - The value of
bernstein n k xis the probability that such a coin gives exactlykheads in a sequence ofntosses. - If such an appearance of
kheads results in a payoff off(k / n), then-th Bernstein approximation forfevaluated atxis the expected payoff. - The main estimate in the proof bounds the probability that
the observed frequency of heads differs from
xby more than someδ, obtaining a bound of(4 * n * δ^2)⁻¹, irrespective ofx. - This ensures that for
nlarge, the Bernstein approximation is (uniformly) close to the payoff functionf.
(You don't need to think in these terms to follow the proof below: it's a giant calc block!)
This result proves Weierstrass' theorem that polynomials are dense in C([0,1], ℝ),
although we defer an abstract statement of this until later.
We now give a slight reformulation of bernsteinPolynomial.variance.
We now set up some of the basic machinery of the proof that the Bernstein approximations converge uniformly.
A key player is the set S f ε h n x,
for some function f : C(I, E), h : 0 < ε, n : ℕ and x : I.
This is the set of points k in Fin (n+1) such that
k/n is within δ of x, where δ is the modulus of uniform continuity for f,
chosen so ‖f x - f y‖ < ε/2 when |x - y| < δ.
We show that if k ∉ S, then 1 ≤ δ^-2 * (x - k/n)^2.
theorem bernsteinApproximation.congr_simp E1 #
∀ {E : Type u_1} [inst : AddCommGroup E] [inst_1 : TopologicalSpace E] [inst_2 : IsTopologicalAddGroup E]
[inst_3 : Module ℝ E] [inst_4 : ContinuousSMul ℝ E] (n n_1 : ℕ),
n = n_1 → ∀ (f f_1 : C(↑unitInterval, E)), f = f_1 → bernsteinApproximation n f = bernsteinApproximation n_1 f_1
def bernstein E1 #
ℕ → ℕ → C(↑unitInterval, ℝ)
The Bernstein polynomials, as continuous functions on [0,1].
theorem bernstein_apply E0 #
∀ (n ν : ℕ) (x : ↑unitInterval), (bernstein n ν) x = ↑(n.choose ν) * ↑x ^ ν * (1 - ↑x) ^ (n - ν)
theorem bernstein_nonneg E0 #
∀ {n ν : ℕ} {x : ↑unitInterval}, 0 ≤ (bernstein n ν) x
def Mathlib.Meta.Positivity.evalBernstein E1 #
Mathlib.Meta.Positivity.PositivityExt
Extension of the positivity tactic for Bernstein polynomials: they are always non-negative.
def bernstein.z E1 #
{n : ℕ} → Fin (n + 1) → ↑unitInterval
Send k : Fin (n+1) to the equally spaced points k/n in the unit interval.
theorem bernstein.z_zero E0 #
∀ {n : ℕ}, bernstein.z 0 = 0
theorem bernstein.z_last E0 #
∀ {n : ℕ}, n ≠ 0 → bernstein.z (Fin.last n) = 1
theorem bernstein.probability E0 #
∀ (n : ℕ) (x : ↑unitInterval), ∑ k, (bernstein n ↑k) x = 1
theorem bernstein.variance E1 #
∀ {n : ℕ}, n ≠ 0 → ∀ (x : ↑unitInterval), ∑ k, (↑x - ↑(bernstein.z k)) ^ 2 * (bernstein n ↑k) x = ↑x * (1 - ↑x) / ↑n
def bernsteinApproximation E1 #
{E : Type u_1} →
[inst : AddCommGroup E] →
[inst_1 : TopologicalSpace E] →
[IsTopologicalAddGroup E] →
[inst_3 : Module ℝ E] → [ContinuousSMul ℝ E] → ℕ → C(↑unitInterval, E) → C(↑unitInterval, E)
The n-th approximation of a continuous function on [0,1] by Bernstein polynomials,
given by ∑ k, bernstein n k x • f (k/n).
theorem bernsteinApproximation.apply E1 #
∀ {E : Type u_1} [inst : AddCommGroup E] [inst_1 : TopologicalSpace E] [inst_2 : IsTopologicalAddGroup E]
[inst_3 : Module ℝ E] [inst_4 : ContinuousSMul ℝ E] (n : ℕ) (f : C(↑unitInterval, E)) (x : ↑unitInterval),
(bernsteinApproximation n f) x = ∑ k, (bernstein n ↑k) x • f (bernstein.z k)
theorem bernsteinApproximation.apply_zero E0 #
∀ {E : Type u_1} [inst : AddCommGroup E] [inst_1 : TopologicalSpace E] [inst_2 : IsTopologicalAddGroup E]
[inst_3 : Module ℝ E] [inst_4 : ContinuousSMul ℝ E] (n : ℕ) (f : C(↑unitInterval, E)),
(bernsteinApproximation n f) 0 = f 0
theorem bernsteinApproximation.apply_one E0 #
∀ {E : Type u_1} [inst : AddCommGroup E] [inst_1 : TopologicalSpace E] [inst_2 : IsTopologicalAddGroup E]
[inst_3 : Module ℝ E] [inst_4 : ContinuousSMul ℝ E] {n : ℕ},
n ≠ 0 → ∀ (f : C(↑unitInterval, E)), (bernsteinApproximation n f) 1 = f 1
theorem bernsteinApproximation_uniform E1 #
∀ {E : Type u_1} [inst : AddCommGroup E] [inst_1 : TopologicalSpace E] [inst_2 : IsTopologicalAddGroup E]
[inst_3 : Module ℝ E] [inst_4 : ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] (f : C(↑unitInterval, E)),
Filter.Tendsto (fun n ↦ bernsteinApproximation n f) Filter.atTop (nhds f)
The Bernstein approximations
∑ k : Fin (n+1), f (k/n : ℝ) * n.choose k * x^k * (1-x)^(n-k)
for a continuous function f : C([0,1], ℝ) converge uniformly to f as n tends to infinity.
This is the proof given in [Richard Beals' Analysis, an introduction][beals2004], §7D, and reproduced on wikipedia.