Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
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 | |