File size: 10,976 Bytes
f18e7de | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | import OAI.MathematicalPhysics.AlternatingFlow.Model
namespace OAI
section QuantitativeDevelopment
open scoped BigOperators ContDiff
namespace AlternatingNS
namespace Quantitative
noncomputable def rhoTerm (m : ℕ) (x : ℝ) : ℝ := x⁻¹ ^ m * expNegInvGlue x
lemma rhoTerm_smooth (m : ℕ) : ContDiff ℝ ∞ (rhoTerm m) := by
change ContDiff ℝ ∞ (fun x => x⁻¹ ^ m * expNegInvGlue x)
simpa only [Polynomial.eval_X_pow] using
(expNegInvGlue.contDiff_polynomial_eval_inv_mul (n := ⊤) (Polynomial.X ^ m : Polynomial ℝ))
lemma rhoTerm_deriv (m : ℕ) :
deriv (rhoTerm m) = fun x => rhoTerm (m + 2) x - m * rhoTerm (m + 1) x := by
funext x
have h := (expNegInvGlue.hasDerivAt_polynomial_eval_inv_mul
(Polynomial.X ^ m : Polynomial ℝ) x).deriv
simp only [Polynomial.eval_X_pow] at h
change deriv (rhoTerm m) x = _ at h
rw [h]
simp only [Polynomial.derivative_X_pow, Polynomial.eval_mul, Polynomial.eval_sub,
Polynomial.eval_C, Polynomial.eval_X_pow, rhoTerm]
cases m with
| zero => norm_num
| succ m => simp only [Nat.succ_sub_one, Nat.cast_add, Nat.cast_one, pow_succ]; ring
lemma exp_monomial_bound (y : ℝ) (hy : 0 ≤ y) (m : ℕ) :
y ^ m * Real.exp (-y) ≤ m.factorial := by
have h := Real.pow_div_factorial_le_exp y hy m
have hp : (0 : ℝ) < m.factorial := by exact_mod_cast Nat.factorial_pos m
have h' := (div_le_iff₀ hp).mp h
calc
_ ≤ (Real.exp y * m.factorial) * Real.exp (-y) :=
mul_le_mul_of_nonneg_right h' (Real.exp_pos _).le
_ = _ := by rw [mul_right_comm, ← Real.exp_add]; simp
lemma rhoTerm_bound (m : ℕ) (x : ℝ) : |rhoTerm m x| ≤ m.factorial := by
by_cases hx : x ≤ 0
· simp [rhoTerm, expNegInvGlue.zero_of_nonpos hx]
· have hx' : 0 < x := lt_of_not_ge hx
rw [rhoTerm, expNegInvGlue, ite_eq_right hx,
abs_of_nonneg (mul_nonneg (pow_nonneg (inv_pos.mpr hx').le _) (Real.exp_pos _).le)]
exact exp_monomial_bound x⁻¹ (inv_pos.mpr hx').le m
lemma rhoTerm_derivative_bound (r m : ℕ) (x : ℝ) :
|iteratedDeriv r (rhoTerm m) x| ≤
((m + 2 * r).factorial : ℝ) * (m + 2 * r + 1 : ℕ) ^ r := by
induction r generalizing m with
| zero => simpa using rhoTerm_bound m x
| succ r ih =>
rw [iteratedDeriv_succ', rhoTerm_deriv]
have hs (j : ℕ) : ContDiffAt ℝ (r : ℕ∞ω) (rhoTerm j) x :=
((rhoTerm_smooth j).of_le (WithTop.coe_le_coe.mpr le_top)).contDiffAt
change |iteratedDeriv r (rhoTerm (m + 2) - fun x => (m : ℝ) * rhoTerm (m + 1) x) x| ≤ _
rw [iteratedDeriv_sub (hs _) (contDiffAt_const.mul (hs _)), iteratedDeriv_const_mul _ (hs _)]
have ht : m + 2 + 2 * r = m + 2 * (r + 1) := by omega
have hf : ((m + 1 + 2 * r).factorial : ℝ) ≤ (m + 2 * (r + 1)).factorial := by
exact_mod_cast Nat.factorial_le (by omega : m + 1 + 2 * r ≤ m + 2 * (r + 1))
have hp : ((m + 1 + 2 * r + 1 : ℕ) : ℝ) ^ r ≤ (m + 2 * (r + 1) + 1 : ℕ) ^ r := by
apply pow_le_pow_left₀ (by positivity)
exact_mod_cast (by omega : m + 1 + 2 * r + 1 ≤ m + 2 * (r + 1) + 1)
have hsmall := (ih (m + 1)).trans (mul_le_mul hf hp (by positivity) (by positivity))
have hbig := ih (m + 2)
rw [ht] at hbig
calc
_ ≤ |iteratedDeriv r (rhoTerm (m + 2)) x| + (m : ℝ) * |iteratedDeriv r (rhoTerm (m + 1)) x| := by
simpa only [Real.norm_eq_abs, abs_mul, Nat.abs_cast] using
norm_sub_le (iteratedDeriv r (rhoTerm (m + 2)) x) ((m : ℝ) * iteratedDeriv r (rhoTerm (m + 1)) x)
_ ≤ ((m + 2 * (r + 1)).factorial : ℝ) * (m + 2 * (r + 1) + 1 : ℕ) ^ r +
m * (((m + 2 * (r + 1)).factorial : ℝ) * (m + 2 * (r + 1) + 1 : ℕ) ^ r) :=
add_le_add hbig (mul_le_mul_of_nonneg_left hsmall (Nat.cast_nonneg _))
_ ≤ _ := by
rw [pow_succ]
have hm : (m : ℝ) + 1 ≤ (m + 2 * (r + 1) + 1 : ℕ) := by
push_cast; nlinarith
nlinarith [mul_nonneg (show (0 : ℝ) ≤ (m + 2 * (r + 1)).factorial by positivity)
(show (0 : ℝ) ≤ (m + 2 * (r + 1) + 1 : ℕ) ^ r by positivity)]
lemma rho_derivative_bound (r : ℕ) (x : ℝ) :
|iteratedDeriv r expNegInvGlue x| ≤ ((2 * r).factorial : ℝ) * (2 * r + 1 : ℕ) ^ r := by
have he : rhoTerm 0 = expNegInvGlue := by funext x; simp [rhoTerm]
simpa only [he, zero_add] using rhoTerm_derivative_bound r 0 x
def rhoBound (r : ℕ) : ℕ := (2 * r).factorial * (2 * r + 1) ^ r
lemma rho_jet_bound (r : ℕ) (x : ℝ) :
‖iteratedFDeriv ℝ r expNegInvGlue x‖ ≤ rhoBound r := by
simpa only [norm_iteratedFDeriv_eq_norm_iteratedDeriv, Real.norm_eq_abs,
rhoBound, Nat.cast_mul, Nat.cast_pow] using rho_derivative_bound r x
lemma transition_denom_lower (x : ℝ) :
(1 / 9 : ℝ) ≤ expNegInvGlue x + expNegInvGlue (1 - x) := by
have he : (1 / 9 : ℝ) ≤ Real.exp (-2) := by
rw [Real.exp_neg]
apply (le_inv_comm₀ (by norm_num) (Real.exp_pos _)).mpr
have h : Real.exp (2 : ℝ) = Real.exp 1 ^ 2 := by
simp
rw [h]
nlinarith [Real.exp_one_lt_three, Real.exp_pos 1]
have hhalf : (1 / 9 : ℝ) ≤ expNegInvGlue (1 / 2) := by
norm_num [expNegInvGlue] at *
exact he
by_cases hx : (1 / 2 : ℝ) ≤ x
· exact le_trans (hhalf.trans (expNegInvGlue.monotone hx))
(le_add_of_nonneg_right (expNegInvGlue.nonneg _))
· exact le_trans (hhalf.trans (expNegInvGlue.monotone (by linarith : 1 / 2 ≤ 1 - x)))
(le_add_of_nonneg_left (expNegInvGlue.nonneg _))
lemma inverse_jet_bound (q r : ℕ) {x : ℝ} (hx : 0 < x) (hq : x⁻¹ ≤ q) :
‖iteratedFDeriv ℝ r (fun x : ℝ => x⁻¹) x‖ ≤ (r.factorial * q ^ (r + 1) : ℕ) := by
rw [norm_iteratedFDeriv_eq_norm_iteratedDeriv, iteratedDeriv_eq_iterate, iter_deriv_inv]
have hexp : (-1 - (r : ℤ)) = -((r + 1 : ℕ) : ℤ) := by omega
rw [hexp, zpow_neg, zpow_natCast, ← inv_pow, norm_mul, norm_mul, norm_pow]
simp only [norm_neg, norm_one, one_pow, one_mul, Real.norm_eq_abs,
Nat.abs_cast, Nat.cast_mul, Nat.cast_pow,
abs_of_nonneg (pow_nonneg (inv_pos.mpr hx).le _)]
gcongr
def reciprocalBound (q : ℕ) (B : ℕ → ℕ) (r : ℕ) : ℕ :=
r.factorial * (r.factorial * q ^ (r + 1)) *
(1 + ∑ i ∈ Finset.range (r + 1), B i) ^ r
lemma reciprocal_jet_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(f : E → ℝ) (hf : ContDiff ℝ ∞ f) (B : ℕ → ℕ)
(hB : ∀ r x, ‖iteratedFDeriv ℝ r f x‖ ≤ B r)
(q : ℕ) (hq : 1 ≤ q) (hpos : ∀ x, 0 < f x) (hrecip : ∀ x, (f x)⁻¹ ≤ q)
(r : ℕ) (x : E) :
‖iteratedFDeriv ℝ r (fun x => (f x)⁻¹) x‖ ≤ reciprocalBound q B r := by
classical
let D : ℝ := 1 + ∑ i ∈ Finset.range (r + 1), (B i : ℝ)
let C : ℝ := r.factorial * (q : ℝ) ^ (r + 1)
have hD : 1 ≤ D := le_add_of_nonneg_right (Finset.sum_nonneg (fun i _ => Nat.cast_nonneg _))
have hd (i : ℕ) (hi : i ≤ r) : (B i : ℝ) ≤ D := by
have h := Finset.single_le_sum (s := Finset.range (r + 1))
(f := fun i => (B i : ℝ)) (fun i _ => Nat.cast_nonneg _) (Finset.mem_range.mpr (by omega : i < r + 1))
dsimp [D]; linarith
have hu : UniqueDiffOn ℝ (Set.Ioi (0 : ℝ)) := isOpen_Ioi.uniqueDiffOn
have hinv : ContDiffOn ℝ ∞ (fun y : ℝ => y⁻¹) (Set.Ioi 0) :=
(contDiffOn_inv ℝ).mono (by intro y hy; simpa using ne_of_gt hy)
have h := norm_iteratedFDeriv_comp_le' (g := fun y : ℝ => y⁻¹) (f := f)
(t := Set.Ioi 0) (fun y hy => by rcases hy with ⟨z, rfl⟩; exact hpos z)
hu hinv hf (WithTop.coe_le_coe.mpr le_top : (r : ℕ∞ω) ≤ ∞) x (C := C) (D := D) ?_ ?_
· simpa only [reciprocalBound, C, D, Nat.cast_mul, Nat.cast_pow, Nat.cast_add,
Nat.cast_one, Nat.cast_sum, Function.comp_def] using h
· intro i hi
rw [iteratedFDerivWithin_eq_iteratedFDeriv hu (contDiffAt_inv ℝ (hpos x).ne') (hpos x)]
apply (inverse_jet_bound q i (hpos x) (hrecip x)).trans
dsimp [C]
push_cast
apply mul_le_mul
· exact_mod_cast Nat.factorial_le hi
· exact pow_le_pow_right₀ (by exact_mod_cast hq) (by omega)
· positivity
· positivity
· intro i hi hir
exact (hB i x).trans ((hd i hir).trans (le_self_pow₀ hD (by omega)))
noncomputable def transitionDenom (x : ℝ) : ℝ := expNegInvGlue x + expNegInvGlue (1 - x)
lemma transitionDenom_smooth : ContDiff ℝ ∞ transitionDenom :=
expNegInvGlue.contDiff.add (expNegInvGlue.contDiff.comp (contDiff_const.sub contDiff_id))
lemma transitionDenom_bound (r : ℕ) (x : ℝ) :
‖iteratedFDeriv ℝ r transitionDenom x‖ ≤ (2 * rhoBound r : ℕ) := by
have hs : ContDiff ℝ ∞ (fun x => expNegInvGlue (1 - x)) :=
expNegInvGlue.contDiff.comp (contDiff_const.sub contDiff_id)
unfold transitionDenom
rw [fun_iteratedFDeriv_add_apply (expNegInvGlue.contDiff (n := ⊤) |>.of_le
(WithTop.coe_le_coe.mpr le_top : (r : ℕ∞ω) ≤ ∞) |>.contDiffAt)
(hs.of_le (WithTop.coe_le_coe.mpr le_top) |>.contDiffAt)]
apply (norm_add_le _ _).trans
have h₂ : ‖iteratedFDeriv ℝ r (fun x => expNegInvGlue (1 - x)) x‖ ≤ rhoBound r := by
rw [norm_iteratedFDeriv_eq_norm_iteratedDeriv, iteratedDeriv_comp_const_sub]
simp only [norm_smul, norm_pow, norm_neg, norm_one, one_pow, one_mul]
simpa only [norm_iteratedFDeriv_eq_norm_iteratedDeriv] using rho_jet_bound r (1 - x)
have h₁ := rho_jet_bound r x
push_cast
linarith
def transitionInvBound (r : ℕ) : ℕ := reciprocalBound 9 (fun i => 2 * rhoBound i) r
lemma transitionInv_bound (r : ℕ) (x : ℝ) :
‖iteratedFDeriv ℝ r (fun x => (transitionDenom x)⁻¹) x‖ ≤ transitionInvBound r := by
apply reciprocal_jet_bound transitionDenom transitionDenom_smooth
(fun i => 2 * rhoBound i) transitionDenom_bound 9 (by norm_num)
(fun x => Real.smoothTransition.pos_denom x) _ r x
intro x
exact (inv_le_comm₀ (Real.smoothTransition.pos_denom x) (by norm_num : (0 : ℝ) < 9)).mpr
(by simpa only [one_div] using transition_denom_lower x)
def transitionBound (r : ℕ) : ℕ :=
∑ i ∈ Finset.range (r + 1), r.choose i * rhoBound i * transitionInvBound (r - i)
lemma transition_jet_bound (r : ℕ) (x : ℝ) :
‖iteratedFDeriv ℝ r Real.smoothTransition x‖ ≤ transitionBound r := by
have he : Real.smoothTransition = fun x => expNegInvGlue x * (transitionDenom x)⁻¹ := by
funext x; simp only [Real.smoothTransition, transitionDenom, div_eq_mul_inv]
rw [he]
apply (norm_iteratedFDeriv_mul_le (expNegInvGlue.contDiff (n := ⊤))
(transitionDenom_smooth.inv (fun x => (Real.smoothTransition.pos_denom x).ne')) x
(WithTop.coe_le_coe.mpr le_top : (r : ℕ∞ω) ≤ ∞)).trans
simp only [transitionBound, Nat.cast_sum, Nat.cast_mul]
apply Finset.sum_le_sum
intro i _
apply mul_le_mul _ (transitionInv_bound (r - i) x) (norm_nonneg _) (by positivity)
exact mul_le_mul_of_nonneg_left (rho_jet_bound i x) (Nat.cast_nonneg _)
end Quantitative
end AlternatingNS
end QuantitativeDevelopment
end OAI
|