Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
Zhangir Azerbayev
squashed?
4365a98
raw
history blame
13.2 kB
/-
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import analysis.special_functions.exp_deriv
/-!
# GrΓΆnwall's inequality
The main technical result of this file is the GrΓΆnwall-like inequality
`norm_le_gronwall_bound_of_norm_deriv_right_le`. It states that if `f : ℝ β†’ E` satisfies `βˆ₯f aβˆ₯ ≀ Ξ΄`
and `βˆ€ x ∈ [a, b), βˆ₯f' xβˆ₯ ≀ K * βˆ₯f xβˆ₯ + Ξ΅`, then for all `x ∈ [a, b]` we have `βˆ₯f xβˆ₯ ≀ Ξ΄ * exp (K *
x) + (Ξ΅ / K) * (exp (K * x) - 1)`.
Then we use this inequality to prove some estimates on the possible rate of growth of the distance
between two approximate or exact solutions of an ordinary differential equation.
The proofs are based on [Hubbard and West, *Differential Equations: A Dynamical Systems Approach*,
Sec. 4.5][HubbardWest-ode], where `norm_le_gronwall_bound_of_norm_deriv_right_le` is called
β€œFundamental Inequality”.
## TODO
- Once we have FTC, prove an inequality for a function satisfying `βˆ₯f' xβˆ₯ ≀ K x * βˆ₯f xβˆ₯ + Ξ΅`,
or more generally `liminf_{yβ†’x+0} (f y - f x)/(y - x) ≀ K x * f x + Ξ΅` with any sign
of `K x` and `f x`.
-/
variables {E : Type*} [normed_add_comm_group E] [normed_space ℝ E]
{F : Type*} [normed_add_comm_group F] [normed_space ℝ F]
open metric set asymptotics filter real
open_locale classical topological_space nnreal
/-! ### Technical lemmas about `gronwall_bound` -/
/-- Upper bound used in several GrΓΆnwall-like inequalities. -/
noncomputable def gronwall_bound (Ξ΄ K Ξ΅ x : ℝ) : ℝ :=
if K = 0 then Ξ΄ + Ξ΅ * x else Ξ΄ * exp (K * x) + (Ξ΅ / K) * (exp (K * x) - 1)
lemma gronwall_bound_K0 (Ξ΄ Ξ΅ : ℝ) : gronwall_bound Ξ΄ 0 Ξ΅ = Ξ» x, Ξ΄ + Ξ΅ * x :=
funext $ Ξ» x, if_pos rfl
lemma gronwall_bound_of_K_ne_0 {Ξ΄ K Ξ΅ : ℝ} (hK : K β‰  0) :
gronwall_bound Ξ΄ K Ξ΅ = Ξ» x, Ξ΄ * exp (K * x) + (Ξ΅ / K) * (exp (K * x) - 1) :=
funext $ Ξ» x, if_neg hK
lemma has_deriv_at_gronwall_bound (Ξ΄ K Ξ΅ x : ℝ) :
has_deriv_at (gronwall_bound Ξ΄ K Ξ΅) (K * (gronwall_bound Ξ΄ K Ξ΅ x) + Ξ΅) x :=
begin
by_cases hK : K = 0,
{ subst K,
simp only [gronwall_bound_K0, zero_mul, zero_add],
convert ((has_deriv_at_id x).const_mul Ξ΅).const_add Ξ΄,
rw [mul_one] },
{ simp only [gronwall_bound_of_K_ne_0 hK],
convert (((has_deriv_at_id x).const_mul K).exp.const_mul Ξ΄).add
((((has_deriv_at_id x).const_mul K).exp.sub_const 1).const_mul (Ξ΅ / K)) using 1,
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel' _ hK],
ring }
end
lemma has_deriv_at_gronwall_bound_shift (Ξ΄ K Ξ΅ x a : ℝ) :
has_deriv_at (Ξ» y, gronwall_bound Ξ΄ K Ξ΅ (y - a)) (K * (gronwall_bound Ξ΄ K Ξ΅ (x - a)) + Ξ΅) x :=
begin
convert (has_deriv_at_gronwall_bound Ξ΄ K Ξ΅ _).comp x ((has_deriv_at_id x).sub_const a),
rw [id, mul_one]
end
lemma gronwall_bound_x0 (Ξ΄ K Ξ΅ : ℝ) : gronwall_bound Ξ΄ K Ξ΅ 0 = Ξ΄ :=
begin
by_cases hK : K = 0,
{ simp only [gronwall_bound, if_pos hK, mul_zero, add_zero] },
{ simp only [gronwall_bound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one, add_zero] }
end
lemma gronwall_bound_Ξ΅0 (Ξ΄ K x : ℝ) : gronwall_bound Ξ΄ K 0 x = Ξ΄ * exp (K * x) :=
begin
by_cases hK : K = 0,
{ simp only [gronwall_bound_K0, hK, zero_mul, exp_zero, add_zero, mul_one] },
{ simp only [gronwall_bound_of_K_ne_0 hK, zero_div, zero_mul, add_zero] }
end
lemma gronwall_bound_Ξ΅0_Ξ΄0 (K x : ℝ) : gronwall_bound 0 K 0 x = 0 :=
by simp only [gronwall_bound_Ξ΅0, zero_mul]
lemma gronwall_bound_continuous_Ξ΅ (Ξ΄ K x : ℝ) : continuous (Ξ» Ξ΅, gronwall_bound Ξ΄ K Ξ΅ x) :=
begin
by_cases hK : K = 0,
{ simp only [gronwall_bound_K0, hK],
exact continuous_const.add (continuous_id.mul continuous_const) },
{ simp only [gronwall_bound_of_K_ne_0 hK],
exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const) }
end
/-! ### Inequality and corollaries -/
/-- A GrΓΆnwall-like inequality: if `f : ℝ β†’ ℝ` is continuous on `[a, b]` and satisfies
the inequalities `f a ≀ Ξ΄` and
`βˆ€ x ∈ [a, b), liminf_{zβ†’x+0} (f z - f x)/(z - x) ≀ K * (f x) + Ξ΅`, then `f x`
is bounded by `gronwall_bound Ξ΄ K Ξ΅ (x - a)` on `[a, b]`.
See also `norm_le_gronwall_bound_of_norm_deriv_right_le` for a version bounding `βˆ₯f xβˆ₯`,
`f : ℝ β†’ E`. -/
theorem le_gronwall_bound_of_liminf_deriv_right_le {f f' : ℝ β†’ ℝ} {Ξ΄ K Ξ΅ : ℝ} {a b : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ x ∈ Ico a b, βˆ€ r, f' x < r β†’
βˆƒαΆ  z in 𝓝[>] x, (z - x)⁻¹ * (f z - f x) < r)
(ha : f a ≀ Ξ΄) (bound : βˆ€ x ∈ Ico a b, f' x ≀ K * f x + Ξ΅) :
βˆ€ x ∈ Icc a b, f x ≀ gronwall_bound Ξ΄ K Ξ΅ (x - a) :=
begin
have H : βˆ€ x ∈ Icc a b, βˆ€ Ξ΅' ∈ Ioi Ξ΅, f x ≀ gronwall_bound Ξ΄ K Ξ΅' (x - a),
{ assume x hx Ξ΅' hΞ΅',
apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hf',
{ rwa [sub_self, gronwall_bound_x0] },
{ exact Ξ» x, has_deriv_at_gronwall_bound_shift Ξ΄ K Ξ΅' x a },
{ assume x hx hfB,
rw [← hfB],
apply lt_of_le_of_lt (bound x hx),
exact add_lt_add_left hΞ΅' _ },
{ exact hx } },
assume x hx,
change f x ≀ (Ξ» Ξ΅', gronwall_bound Ξ΄ K Ξ΅' (x - a)) Ξ΅,
convert continuous_within_at_const.closure_le _ _ (H x hx),
{ simp only [closure_Ioi, left_mem_Ici] },
exact (gronwall_bound_continuous_Ξ΅ Ξ΄ K (x - a)).continuous_within_at
end
/-- A GrΓΆnwall-like inequality: if `f : ℝ β†’ E` is continuous on `[a, b]`, has right derivative
`f' x` at every point `x ∈ [a, b)`, and satisfies the inequalities `βˆ₯f aβˆ₯ ≀ Ξ΄`,
`βˆ€ x ∈ [a, b), βˆ₯f' xβˆ₯ ≀ K * βˆ₯f xβˆ₯ + Ξ΅`, then `βˆ₯f xβˆ₯` is bounded by `gronwall_bound Ξ΄ K Ξ΅ (x - a)`
on `[a, b]`. -/
theorem norm_le_gronwall_bound_of_norm_deriv_right_le {f f' : ℝ β†’ E} {Ξ΄ K Ξ΅ : ℝ} {a b : ℝ}
(hf : continuous_on f (Icc a b)) (hf' : βˆ€ x ∈ Ico a b, has_deriv_within_at f (f' x) (Ici x) x)
(ha : βˆ₯f aβˆ₯ ≀ Ξ΄) (bound : βˆ€ x ∈ Ico a b, βˆ₯f' xβˆ₯ ≀ K * βˆ₯f xβˆ₯ + Ξ΅) :
βˆ€ x ∈ Icc a b, βˆ₯f xβˆ₯ ≀ gronwall_bound Ξ΄ K Ξ΅ (x - a) :=
le_gronwall_bound_of_liminf_deriv_right_le (continuous_norm.comp_continuous_on hf)
(Ξ» x hx r hr, (hf' x hx).liminf_right_slope_norm_le hr) ha bound
/-- If `f` and `g` are two approximate solutions of the same ODE, then the distance between them
can't grow faster than exponentially. This is a simple corollary of GrΓΆnwall's inequality, and some
people call this GrΓΆnwall's inequality too.
This version assumes all inequalities to be true in some time-dependent set `s t`,
and assumes that the solutions never leave this set. -/
theorem dist_le_of_approx_trajectories_ODE_of_mem_set {v : ℝ β†’ E β†’ E} {s : ℝ β†’ set E}
{K : ℝ} (hv : βˆ€ t, βˆ€ x y ∈ s t, dist (v t x) (v t y) ≀ K * dist x y)
{f g f' g' : ℝ β†’ E} {a b : ℝ} {Ξ΅f Ξ΅g Ξ΄ : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (f' t) (Ici t) t)
(f_bound : βˆ€ t ∈ Ico a b, dist (f' t) (v t (f t)) ≀ Ξ΅f)
(hfs : βˆ€ t ∈ Ico a b, f t ∈ s t)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (g' t) (Ici t) t)
(g_bound : βˆ€ t ∈ Ico a b, dist (g' t) (v t (g t)) ≀ Ξ΅g)
(hgs : βˆ€ t ∈ Ico a b, g t ∈ s t)
(ha : dist (f a) (g a) ≀ Ξ΄) :
βˆ€ t ∈ Icc a b, dist (f t) (g t) ≀ gronwall_bound Ξ΄ K (Ξ΅f + Ξ΅g) (t - a) :=
begin
simp only [dist_eq_norm] at ha ⊒,
have h_deriv : βˆ€ t ∈ Ico a b, has_deriv_within_at (Ξ» t, f t - g t) (f' t - g' t) (Ici t) t,
from Ξ» t ht, (hf' t ht).sub (hg' t ht),
apply norm_le_gronwall_bound_of_norm_deriv_right_le (hf.sub hg) h_deriv ha,
assume t ht,
have := dist_triangle4_right (f' t) (g' t) (v t (f t)) (v t (g t)),
rw [dist_eq_norm] at this,
refine this.trans ((add_le_add (add_le_add (f_bound t ht) (g_bound t ht))
(hv t (f t) (hfs t ht) (g t) (hgs t ht))).trans _),
rw [dist_eq_norm, add_comm]
end
/-- If `f` and `g` are two approximate solutions of the same ODE, then the distance between them
can't grow faster than exponentially. This is a simple corollary of GrΓΆnwall's inequality, and some
people call this GrΓΆnwall's inequality too.
This version assumes all inequalities to be true in the whole space. -/
theorem dist_le_of_approx_trajectories_ODE {v : ℝ β†’ E β†’ E}
{K : ℝβ‰₯0} (hv : βˆ€ t, lipschitz_with K (v t))
{f g f' g' : ℝ β†’ E} {a b : ℝ} {Ξ΅f Ξ΅g Ξ΄ : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (f' t) (Ici t) t)
(f_bound : βˆ€ t ∈ Ico a b, dist (f' t) (v t (f t)) ≀ Ξ΅f)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (g' t) (Ici t) t)
(g_bound : βˆ€ t ∈ Ico a b, dist (g' t) (v t (g t)) ≀ Ξ΅g)
(ha : dist (f a) (g a) ≀ Ξ΄) :
βˆ€ t ∈ Icc a b, dist (f t) (g t) ≀ gronwall_bound Ξ΄ K (Ξ΅f + Ξ΅g) (t - a) :=
have hfs : βˆ€ t ∈ Ico a b, f t ∈ (@univ E), from Ξ» t ht, trivial,
dist_le_of_approx_trajectories_ODE_of_mem_set (Ξ» t x hx y hy, (hv t).dist_le_mul x y)
hf hf' f_bound hfs hg hg' g_bound (Ξ» t ht, trivial) ha
/-- If `f` and `g` are two exact solutions of the same ODE, then the distance between them
can't grow faster than exponentially. This is a simple corollary of GrΓΆnwall's inequality, and some
people call this GrΓΆnwall's inequality too.
This version assumes all inequalities to be true in some time-dependent set `s t`,
and assumes that the solutions never leave this set. -/
theorem dist_le_of_trajectories_ODE_of_mem_set {v : ℝ β†’ E β†’ E} {s : ℝ β†’ set E}
{K : ℝ} (hv : βˆ€ t, βˆ€ x y ∈ s t, dist (v t x) (v t y) ≀ K * dist x y)
{f g : ℝ β†’ E} {a b : ℝ} {Ξ΄ : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (v t (f t)) (Ici t) t)
(hfs : βˆ€ t ∈ Ico a b, f t ∈ s t)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (v t (g t)) (Ici t) t)
(hgs : βˆ€ t ∈ Ico a b, g t ∈ s t)
(ha : dist (f a) (g a) ≀ Ξ΄) :
βˆ€ t ∈ Icc a b, dist (f t) (g t) ≀ Ξ΄ * exp (K * (t - a)) :=
begin
have f_bound : βˆ€ t ∈ Ico a b, dist (v t (f t)) (v t (f t)) ≀ 0,
by { intros, rw [dist_self] },
have g_bound : βˆ€ t ∈ Ico a b, dist (v t (g t)) (v t (g t)) ≀ 0,
by { intros, rw [dist_self] },
assume t ht,
have := dist_le_of_approx_trajectories_ODE_of_mem_set hv hf hf' f_bound hfs hg hg' g_bound
hgs ha t ht,
rwa [zero_add, gronwall_bound_Ξ΅0] at this,
end
/-- If `f` and `g` are two exact solutions of the same ODE, then the distance between them
can't grow faster than exponentially. This is a simple corollary of GrΓΆnwall's inequality, and some
people call this GrΓΆnwall's inequality too.
This version assumes all inequalities to be true in the whole space. -/
theorem dist_le_of_trajectories_ODE {v : ℝ β†’ E β†’ E}
{K : ℝβ‰₯0} (hv : βˆ€ t, lipschitz_with K (v t))
{f g : ℝ β†’ E} {a b : ℝ} {Ξ΄ : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (v t (f t)) (Ici t) t)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (v t (g t)) (Ici t) t)
(ha : dist (f a) (g a) ≀ Ξ΄) :
βˆ€ t ∈ Icc a b, dist (f t) (g t) ≀ Ξ΄ * exp (K * (t - a)) :=
have hfs : βˆ€ t ∈ Ico a b, f t ∈ (@univ E), from Ξ» t ht, trivial,
dist_le_of_trajectories_ODE_of_mem_set (Ξ» t x hx y hy, (hv t).dist_le_mul x y)
hf hf' hfs hg hg' (Ξ» t ht, trivial) ha
/-- There exists only one solution of an ODE \(\dot x=v(t, x)\) in a set `s βŠ† ℝ Γ— E` with
a given initial value provided that RHS is Lipschitz continuous in `x` within `s`,
and we consider only solutions included in `s`. -/
theorem ODE_solution_unique_of_mem_set {v : ℝ β†’ E β†’ E} {s : ℝ β†’ set E}
{K : ℝ} (hv : βˆ€ t, βˆ€ x y ∈ s t, dist (v t x) (v t y) ≀ K * dist x y)
{f g : ℝ β†’ E} {a b : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (v t (f t)) (Ici t) t)
(hfs : βˆ€ t ∈ Ico a b, f t ∈ s t)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (v t (g t)) (Ici t) t)
(hgs : βˆ€ t ∈ Ico a b, g t ∈ s t)
(ha : f a = g a) :
βˆ€ t ∈ Icc a b, f t = g t :=
begin
assume t ht,
have := dist_le_of_trajectories_ODE_of_mem_set hv hf hf' hfs hg hg' hgs
(dist_le_zero.2 ha) t ht,
rwa [zero_mul, dist_le_zero] at this
end
/-- There exists only one solution of an ODE \(\dot x=v(t, x)\) with
a given initial value provided that RHS is Lipschitz continuous in `x`. -/
theorem ODE_solution_unique {v : ℝ β†’ E β†’ E}
{K : ℝβ‰₯0} (hv : βˆ€ t, lipschitz_with K (v t))
{f g : ℝ β†’ E} {a b : ℝ}
(hf : continuous_on f (Icc a b))
(hf' : βˆ€ t ∈ Ico a b, has_deriv_within_at f (v t (f t)) (Ici t) t)
(hg : continuous_on g (Icc a b))
(hg' : βˆ€ t ∈ Ico a b, has_deriv_within_at g (v t (g t)) (Ici t) t)
(ha : f a = g a) :
βˆ€ t ∈ Icc a b, f t = g t :=
have hfs : βˆ€ t ∈ Ico a b, f t ∈ (@univ E), from Ξ» t ht, trivial,
ODE_solution_unique_of_mem_set (Ξ» t x hx y hy, (hv t).dist_le_mul x y)
hf hf' hfs hg hg' (Ξ» t ht, trivial) ha