This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/Tools/T8.lean

All files · 226 lines · source at the verified commit

1module
2
3public import E424.ToolDefs
4public import E424.Tools.T8Aux
5
6@[expose] public section
7
8/-!
9# Erdős 424: tool T8. Absolute existential constants; Mathlib only.
10-/
11
12set_option linter.style.header false
13open Finset MeasureTheory intervalIntegral
14
15namespace E424
16
17/-- **T8**, second derivative test for integrals. Proof: with `μ = √λ` and `q(t) = t/(t²+λ)`,
18`G e^{iφ} = (-i G q(φ')) (i φ' e^{iφ}) + G λ/(φ'²+λ) e^{iφ}`. Integrate the first term by parts
19(`|q| ≤ 1/(2μ)`, `∫|(Gq)'| ≤ G1 (b-a)/(2μ) + G0 ∫ φ''/(φ'²+λ)`), and bound the second by
20`G0 ∫ φ''/(φ'²+λ)`. The last integral is `≤ π/μ` by the substitution `t = φ'(x)`. -/
21theorem T8_second_derivative_integral : ∃ C > 0,
22 ∀ (a b lam G0 G1 : ℝ) (φ φ' φ'' G G' : ℝ → ℝ),
23 a ≤ b → 0 < lam → 0 ≤ G0 → 0 ≤ G1 →
24 (∀ x ∈ Set.Icc a b, HasDerivAt φ (φ' x) x ∧ HasDerivAt φ' (φ'' x) x ∧ lam ≤ φ'' x) →
25 ContinuousOn φ'' (Set.Icc a b) →
26 (∀ x ∈ Set.Icc a b, HasDerivAt G (G' x) x ∧ |G x| ≤ G0 ∧ |G' x| ≤ G1) →
27 ContinuousOn G' (Set.Icc a b) →
28 ‖∫ x in a..b, (G x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I)‖ ≤
29 C * (G0 + G1 * (b - a)) / Real.sqrt lam := by
30 refine ⟨8, by norm_num, ?_⟩
31 intro a b lam G0 G1 φ φ' φ'' G G' hab hlam hG0 hG1 hφ hφ''c hG hG'c
32 have hs : 0 < √lam := Real.sqrt_pos.mpr hlam
33 have huI : Set.uIcc a b = Set.Icc a b := Set.uIcc_of_le hab
34 have hφ0 : ∀ x ∈ Set.Icc a b, HasDerivAt φ (φ' x) x := fun x hx => (hφ x hx).1
35 have hφ1 : ∀ x ∈ Set.Icc a b, HasDerivAt φ' (φ'' x) x := fun x hx => (hφ x hx).2.1
36 have hφlb : ∀ x ∈ Set.Icc a b, lam ≤ φ'' x := fun x hx => (hφ x hx).2.2
37 have cφ : ContinuousOn φ (Set.Icc a b) := fun x hx => (hφ0 x hx).continuousAt.continuousWithinAt
38 have cφ' : ContinuousOn φ' (Set.Icc a b) := fun x hx => (hφ1 x hx).continuousAt.continuousWithinAt
39 have cG : ContinuousOn G (Set.Icc a b) := fun x hx => (hG x hx).1.continuousAt.continuousWithinAt
40 have cK : ContinuousOn (fun x => 1 / (φ' x ^ 2 + lam) * φ'' x) (Set.Icc a b) := by
41 refine ContinuousOn.mul (ContinuousOn.div continuousOn_const (by fun_prop) fun x hx => ?_) hφ''c
42 nlinarith [sq_nonneg (φ' x)]
43 -- the pieces of the integrand
44 have hDerivP : ∀ x ∈ Set.Icc a b, HasDerivAt (fun x => G x * (φ' x / (φ' x ^ 2 + lam)))
45 (G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x)) x :=
46 fun x hx => (hG x hx).1.mul ((hasDerivAt_q lam (φ' x) hlam).comp x (hφ1 x hx))
47 have hDerivE : ∀ x ∈ Set.Icc a b, HasDerivAt (fun x => Complex.exp ((φ x : ℂ) * Complex.I))
48 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I)) x := by
49 intro x hx
50 refine (((hφ0 x hx).ofReal_comp.mul_const Complex.I).cexp).congr_deriv ?_
51 ring
52 -- bounds on the real pieces
53 have hPb : ∀ x ∈ Set.Icc a b, |G x * (φ' x / (φ' x ^ 2 + lam))| ≤ G0 * (1 / (2 * √lam)) := by
54 intro x hx
55 rw [abs_mul]
56 exact mul_le_mul (hG x hx).2.1 (abs_q_le lam (φ' x) hlam) (abs_nonneg _) hG0
57 have hPd' : ∀ x ∈ Set.Icc a b,
58 |G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x)|
59 ≤ G1 * (1 / (2 * √lam)) + G0 * (1 / (φ' x ^ 2 + lam) * φ'' x) := by
60 intro x hx
61 have hK0 : 0 ≤ φ'' x := by linarith [hφlb x hx]
62 have e1 : |G' x * (φ' x / (φ' x ^ 2 + lam))| ≤ G1 * (1 / (2 * √lam)) := by
63 rw [abs_mul]
64 exact mul_le_mul (hG x hx).2.2 (abs_q_le lam (φ' x) hlam) (abs_nonneg _) hG1
65 have e2 : |G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x)|
66 ≤ G0 * (1 / (φ' x ^ 2 + lam) * φ'' x) := by
67 rw [abs_mul, abs_mul, abs_of_nonneg hK0]
68 have h4 : |(lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2| * φ'' x ≤ 1 / (φ' x ^ 2 + lam) * φ'' x :=
69 mul_le_mul_of_nonneg_right (abs_q'_le lam (φ' x) hlam) hK0
70 exact mul_le_mul (hG x hx).2.1 h4 (mul_nonneg (abs_nonneg _) hK0) hG0
71 exact (abs_add_le _ _).trans (add_le_add e1 e2)
72 have hK : ∀ x ∈ Set.Icc a b, 0 ≤ 1 / (φ' x ^ 2 + lam) * φ'' x := fun x hx =>
73 mul_nonneg (one_div_nonneg.mpr (by nlinarith [sq_nonneg (φ' x)])) (by linarith [hφlb x hx])
74 -- continuity on [a, b] of the pieces of the integrand
75 have cP : ContinuousOn (fun x => G x * (φ' x / (φ' x ^ 2 + lam))) (Set.Icc a b) :=
76 fun x hx => (hDerivP x hx).continuousAt.continuousWithinAt
77 have cE : ContinuousOn (fun x => Complex.exp ((φ x : ℂ) * Complex.I)) (Set.Icc a b) :=
78 fun x hx => (hDerivE x hx).continuousAt.continuousWithinAt
79 have cPd : ContinuousOn (fun x => G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x)) (Set.Icc a b) := by
80 have hq : ContinuousOn (fun x => φ' x / (φ' x ^ 2 + lam)) (Set.Icc a b) :=
81 ContinuousOn.div cφ' (by fun_prop) fun x _ => by nlinarith [sq_nonneg (φ' x)]
82 have hq' : ContinuousOn (fun x => (lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2) (Set.Icc a b) :=
83 ContinuousOn.div (by fun_prop) (by fun_prop) fun x _ => by nlinarith [sq_nonneg (φ' x)]
84 exact (hG'c.mul hq).add (cG.mul (hq'.mul hφ''c))
85 -- splitting the integrand: `G e^{iφ} = (-i G q(φ')) (i φ' e^{iφ}) + G λ/(φ'²+λ) e^{iφ}`
86 have hsplit : ∀ x ∈ Set.Icc a b, (G x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I) =
87 ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) *
88 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I)) +
89 ((G x * (lam / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I) := by
90 intro x hx
91 have hD : φ' x ^ 2 + lam ≠ 0 := (by nlinarith [sq_nonneg (φ' x)] : (0 : ℝ) < φ' x ^ 2 + lam).ne'
92 have hDc : (φ' x : ℂ) ^ 2 + lam ≠ 0 := by exact_mod_cast hD
93 have hr : (G x : ℂ) * ((φ' x : ℂ) / ((φ' x : ℂ) ^ 2 + lam)) * (φ' x : ℂ) +
94 (G x : ℂ) * ((lam : ℂ) / ((φ' x : ℂ) ^ 2 + lam)) = G x := by
95 field_simp
96 push_cast
97 linear_combination ((G x : ℂ) * ((φ' x : ℂ) / ((φ' x : ℂ) ^ 2 + lam)) * (φ' x : ℂ) *
98 Complex.exp ((φ x : ℂ) * Complex.I)) * Complex.I_mul_I - Complex.exp ((φ x : ℂ) * Complex.I) * hr
99 -- continuity of the two integrands
100 have cPc : ContinuousOn (fun x => ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ)) (Set.Icc a b) :=
101 Complex.continuous_ofReal.comp_continuousOn cP
102 have cφc : ContinuousOn (fun x => (φ' x : ℂ)) (Set.Icc a b) :=
103 Complex.continuous_ofReal.comp_continuousOn cφ'
104 have cF1 : ContinuousOn (fun x => ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) *
105 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I))) (Set.Icc a b) :=
106 (cPc.mul continuousOn_const).mul (continuousOn_const.mul cφc |>.mul cE)
107 have cF2 : ContinuousOn (fun x => ((G x * (lam / (φ' x ^ 2 + lam)) : ℝ) : ℂ) *
108 Complex.exp ((φ x : ℂ) * Complex.I)) (Set.Icc a b) := by
109 have cm : ContinuousOn (fun x => G x * (lam / (φ' x ^ 2 + lam))) (Set.Icc a b) :=
110 cG.mul (ContinuousOn.div continuousOn_const (by fun_prop) fun x _ =>
111 (by nlinarith [sq_nonneg (φ' x)] : (0 : ℝ) < φ' x ^ 2 + lam).ne')
112 exact (Complex.continuous_ofReal.comp_continuousOn cm).mul cE
113 -- integration by parts on the first piece `(-i G q(φ')) · (i φ' e^{iφ})`
114 have hu : ∀ x ∈ Set.uIcc a b,
115 HasDerivAt (fun x => ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I))
116 (((G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x) :
117 ℝ) : ℂ) * (-Complex.I)) x := by
118 intro x hx
119 rw [huI] at hx
120 exact (hDerivP x hx).ofReal_comp.mul_const _
121 have hv : ∀ x ∈ Set.uIcc a b, HasDerivAt (fun x => Complex.exp ((φ x : ℂ) * Complex.I))
122 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I)) x := by
123 intro x hx
124 rw [huI] at hx
125 exact hDerivE x hx
126 have cPd' : ContinuousOn (fun x => ((G' x * (φ' x / (φ' x ^ 2 + lam)) +
127 G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x) : ℝ) : ℂ) * (-Complex.I))
128 (Set.uIcc a b) := by
129 rw [huI]
130 exact (Complex.continuous_ofReal.comp_continuousOn cPd).mul continuousOn_const
131 have cF1' : ContinuousOn (fun x => ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) *
132 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I))) (Set.uIcc a b) := by
133 rw [huI]; exact cF1
134 have cF2' : ContinuousOn (fun x => ((G x * (lam / (φ' x ^ 2 + lam)) : ℝ) : ℂ) *
135 Complex.exp ((φ x : ℂ) * Complex.I)) (Set.uIcc a b) := by
136 rw [huI]; exact cF2
137 have cV : ContinuousOn (fun x => Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I))
138 (Set.uIcc a b) := by
139 rw [huI]; exact (continuousOn_const.mul cφc).mul cE
140 have ibp := intervalIntegral.integral_mul_deriv_eq_deriv_mul hu hv cPd'.intervalIntegrable
141 cV.intervalIntegrable
142 beta_reduce at ibp
143 -- the integrand splits into the two pieces
144 have hsplitI : Set.EqOn (fun x => (G x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I))
145 (fun x => ((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) *
146 (Complex.I * (φ' x : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I)) +
147 ((G x * (lam / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * Complex.exp ((φ x : ℂ) * Complex.I))
148 (Set.uIcc a b) := fun x hx => by rw [huI] at hx; exact hsplit x hx
149 rw [intervalIntegral.integral_congr hsplitI,
150 intervalIntegral.integral_add cF1'.intervalIntegrable cF2'.intervalIntegrable, ibp]
151 -- norms: each piece of the bound
152 have hE1 : ∀ x : ℝ, ‖Complex.exp ((φ x : ℂ) * Complex.I)‖ = 1 :=
153 fun x => Complex.norm_exp_ofReal_mul_I (φ x)
154 -- the kernel `1/(φ'²+λ) · φ''` and its integral
155 have hKi : IntervalIntegrable (fun x => 1 / (φ' x ^ 2 + lam) * φ'' x) volume a b :=
156 (show ContinuousOn (fun x => 1 / (φ' x ^ 2 + lam) * φ'' x) (Set.uIcc a b) by
157 rw [huI]; exact cK).intervalIntegrable
158 have hIK : ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x ≤ Real.pi / √lam :=
159 le_trans (le_abs_self _) (abs_intervalIntegral_kernel_le a b lam hlam φ' φ''
160 (fun x hx => by rw [huI] at hx; exact hφ1 x hx) (by rw [huI]; exact hφ''c))
161 -- endpoint terms
162 have hend : ∀ x ∈ Set.Icc a b, ‖((G x * (φ' x / (φ' x ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) *
163 Complex.exp ((φ x : ℂ) * Complex.I)‖ ≤ G0 * (1 / (2 * √lam)) := by
164 intro x hx
165 rw [norm_mul, norm_mul, Complex.norm_real, Real.norm_eq_abs, norm_neg, Complex.norm_I,
166 hE1, mul_one, mul_one]
167 exact hPb x hx
168 -- the derivative term
169 have hD1 : ‖∫ x in a..b, ((G' x * (φ' x / (φ' x ^ 2 + lam)) +
170 G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x) : ℝ) : ℂ) * (-Complex.I) *
171 Complex.exp ((φ x : ℂ) * Complex.I)‖ ≤
172 ∫ x in a..b, (G1 * (1 / (2 * √lam)) + G0 * (1 / (φ' x ^ 2 + lam) * φ'' x)) := by
173 refine intervalIntegral.norm_integral_le_of_norm_le hab
174 (Filter.Eventually.of_forall fun x hx => ?_) ?_
175 · have hx' : x ∈ Set.Icc a b := Set.Ioc_subset_Icc_self hx
176 rw [norm_mul, norm_mul, Complex.norm_real, Real.norm_eq_abs, norm_neg, Complex.norm_I,
177 hE1, mul_one, mul_one]
178 exact hPd' x hx'
179 · exact (show ContinuousOn (fun x => G1 * (1 / (2 * √lam)) + G0 * (1 / (φ' x ^ 2 + lam) * φ'' x))
180 (Set.uIcc a b) by rw [huI]; exact continuousOn_const.add (continuousOn_const.mul cK)).intervalIntegrable
181 have hgint : ∫ x in a..b, (G1 * (1 / (2 * √lam)) + G0 * (1 / (φ' x ^ 2 + lam) * φ'' x)) =
182 (b - a) * (G1 * (1 / (2 * √lam))) + G0 * ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x := by
183 rw [intervalIntegral.integral_add intervalIntegrable_const (hKi.const_mul G0),
184 intervalIntegral.integral_const, intervalIntegral.integral_const_mul, smul_eq_mul]
185 -- the second piece
186 have hD2 : ‖∫ x in a..b, ((G x * (lam / (φ' x ^ 2 + lam)) : ℝ) : ℂ) *
187 Complex.exp ((φ x : ℂ) * Complex.I)‖ ≤ G0 * ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x := by
188 rw [← intervalIntegral.integral_const_mul]
189 refine intervalIntegral.norm_integral_le_of_norm_le hab
190 (Filter.Eventually.of_forall fun x hx => ?_) (hKi.const_mul G0)
191 have hx' : x ∈ Set.Icc a b := Set.Ioc_subset_Icc_self hx
192 have hD : 0 < φ' x ^ 2 + lam := by nlinarith [sq_nonneg (φ' x)]
193 have hm : lam / (φ' x ^ 2 + lam) ≤ 1 / (φ' x ^ 2 + lam) * φ'' x := by
194 rw [one_div_mul_eq_div]
195 exact div_le_div_of_nonneg_right (hφlb x hx') hD.le
196 rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, hE1, mul_one, abs_mul,
197 abs_of_nonneg (div_nonneg hlam.le hD.le)]
198 exact mul_le_mul (hG x hx').2.1 hm (by positivity) hG0
199 -- assemble
200 have hIK' := hIK
201 have hLa : 0 ≤ b - a := by linarith
202 have hA := hend b ⟨hab, le_refl b⟩
203 have hB := hend a ⟨le_refl a, hab⟩
204 have hsum : ‖((G b * (φ' b / (φ' b ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ b : ℂ) * Complex.I) - ((G a * (φ' a / (φ' a ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ a : ℂ) * Complex.I) - (∫ x in a..b, ((G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ x : ℂ) * Complex.I))‖ ≤ G0 * (1 / (2 * √lam)) + G0 * (1 / (2 * √lam)) +
205 ((b - a) * (G1 * (1 / (2 * √lam))) + G0 * ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x) := by
206 have h1 := norm_sub_le (((G b * (φ' b / (φ' b ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ b : ℂ) * Complex.I)) (((G a * (φ' a / (φ' a ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ a : ℂ) * Complex.I))
207 have h2 := norm_sub_le (((G b * (φ' b / (φ' b ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ b : ℂ) * Complex.I) - ((G a * (φ' a / (φ' a ^ 2 + lam)) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ a : ℂ) * Complex.I)) (∫ x in a..b, ((G' x * (φ' x / (φ' x ^ 2 + lam)) + G x * ((lam - φ' x ^ 2) / (φ' x ^ 2 + lam) ^ 2 * φ'' x) : ℝ) : ℂ) * (-Complex.I) * Complex.exp ((φ x : ℂ) * Complex.I))
208 linarith
209 rw [hgint] at hD1
210 have hpi : Real.pi < 3.15 := Real.pi_lt_d2
211 have hfinal : G0 * (1 / (2 * √lam)) + G0 * (1 / (2 * √lam)) +
212 ((b - a) * (G1 * (1 / (2 * √lam))) + G0 * ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x) +
213 G0 * ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x ≤ 8 * (G0 + G1 * (b - a)) / √lam := by
214 have ht : 0 < 1 / √lam := by positivity
215 have hI2 : ∫ x in a..b, 1 / (φ' x ^ 2 + lam) * φ'' x ≤ Real.pi * (1 / √lam) := by
216 rw [← div_eq_mul_one_div]; exact hIK
217 have e1 : 1 / (2 * √lam) = (1 / √lam) * (1 / 2) := by rw [one_div_mul_one_div]; ring
218 have e2 : 8 * (G0 + G1 * (b - a)) / √lam = 8 * (G0 + G1 * (b - a)) * (1 / √lam) := by ring
219 rw [e1, e2]
220 nlinarith [mul_nonneg hG0 ht.le, mul_nonneg (mul_nonneg hG1 hLa) ht.le,
221 mul_le_mul_of_nonneg_left hI2 hG0, mul_nonneg hG0 (by linarith : (0:ℝ) ≤ 3.15 - Real.pi)]
222 refine (norm_add_le _ _).trans ?_
223 linarith [hsum, hD2, hfinal]
224
225end E424
226