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/T11Aux.lean

All files · 167 lines · source at the verified commit

1module
2
3public import E424.ToolDefs
4
5@[expose] public section
6
7/-!
8# Erdős 424: helpers for tool T11 (Fourier transform of the triangle kernel).
9Derivative and piecewise-integration facts for `tri`, used by `T11_fourier_tri`.
10-/
11
12set_option linter.style.header false
13open Complex MeasureTheory
14
15namespace E424
16
17
18/-- Antiderivative of `(p + q x) e^{cx}` for `c ≠ 0`. -/
19lemma hasDerivAt_linExp (p q c : ℂ) (hc : c ≠ 0) (x : ℝ) :
20 HasDerivAt (fun y : ℝ => (p + q * y) * exp (c * y) / c - q * exp (c * y) / c ^ 2)
21 ((p + q * x) * exp (c * x)) x := by
22 have hy : HasDerivAt (fun y : ℝ => (y : ℂ)) 1 x := by
23 simpa using (hasDerivAt_id x).ofReal_comp
24 have he : HasDerivAt (fun y : ℝ => exp (c * y)) (exp (c * x) * (c * 1)) x :=
25 (hy.const_mul c).cexp
26 have h1 := (((hy.const_mul q).const_add p).mul he).div_const c
27 have h2 := (he.const_mul q).div_const (c ^ 2)
28 refine HasDerivAt.congr_deriv (h1.sub h2) ?_
29 field_simp
30 ring
31
32lemma tri_eq_neg (Q x : ℝ) (hQ : 0 < Q) (hx : x ≤ 0) (hxa : -Q⁻¹ ≤ x) :
33 tri Q x = Q + Q ^ 2 * x := by
34 have hQx : -1 ≤ Q * x := by
35 have := mul_le_mul_of_nonneg_left hxa hQ.le
36 rwa [mul_neg, mul_inv_cancel₀ hQ.ne'] at this
37 unfold tri
38 rw [abs_of_nonpos hx, max_eq_right (by nlinarith)]
39 ring
40
41lemma tri_eq_pos (Q x : ℝ) (hQ : 0 < Q) (hx : 0 ≤ x) (hxa : x ≤ Q⁻¹) :
42 tri Q x = Q - Q ^ 2 * x := by
43 have hQx : Q * x ≤ 1 := by
44 have := mul_le_mul_of_nonneg_left hxa hQ.le
45 rwa [mul_inv_cancel₀ hQ.ne'] at this
46 unfold tri
47 rw [abs_of_nonneg hx, max_eq_right (by nlinarith)]
48 ring
49
50lemma tri_eq_zero (Q x : ℝ) (hQ : 0 < Q) (hx : Q⁻¹ ≤ |x|) : tri Q x = 0 := by
51 have : Q * |x| ≥ 1 := by
52 have := mul_le_mul_of_nonneg_left hx hQ.le
53 rwa [mul_inv_cancel₀ hQ.ne'] at this
54 unfold tri
55 rw [max_eq_left (by linarith), mul_zero]
56
57
58
59/-- Integral over `ℝ` of a function vanishing off `[-Q⁻¹, Q⁻¹]`, split at `0`. -/
60lemma integral_split_tri {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (Q : ℝ) (hQ : 0 < Q)
61 (g : ℝ → E) (hg : Continuous g) (hz : ∀ x, Q⁻¹ ≤ |x| → g x = 0) :
62 ∫ x, g x = (∫ x in (-Q⁻¹)..0, g x) + ∫ x in (0)..Q⁻¹, g x := by
63 have hpos : 0 ≤ Q⁻¹ := by positivity
64 have hle : -Q⁻¹ ≤ Q⁻¹ := by linarith
65 have h1 : ∫ x, g x = ∫ x in Set.Icc (-Q⁻¹) Q⁻¹, g x := by
66 refine (setIntegral_eq_integral_of_forall_compl_eq_zero ?_).symm
67 intro x hx
68 apply hz
69 rcases le_or_gt (-Q⁻¹) x with h | h
70 · have : Q⁻¹ < x := by
71 by_contra h'
72 exact hx ⟨h, not_lt.mp h'⟩
73 exact le_abs.mpr (Or.inl this.le)
74 · exact le_abs.mpr (Or.inr (by linarith))
75 rw [h1, integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hle,
76 ← intervalIntegral.integral_add_adjacent_intervals (b := 0)
77 (hg.intervalIntegrable _ _) (hg.intervalIntegrable _ _)]
78
79lemma integral_poly (p q a b : ℝ) :
80 ∫ x in a..b, (p + q * x) = (p * b + q * b ^ 2 / 2) - (p * a + q * a ^ 2 / 2) := by
81 rw [intervalIntegral.integral_eq_sub_of_hasDerivAt (f := fun x => p * x + q * x ^ 2 / 2)
82 (fun x _ => by
83 have h := (((hasDerivAt_id x).const_mul p).add
84 ((((hasDerivAt_pow 2 x)).const_mul q).div_const 2))
85 refine HasDerivAt.congr_deriv h ?_
86 ring)
87 (by apply Continuous.intervalIntegrable; fun_prop)]
88
89lemma tri_continuous (Q : ℝ) : Continuous (tri Q) := by
90 unfold tri
91 fun_prop
92
93
94/-- Algebra closing the `t ≠ 0` case of the triangle transform: the four exponential
95terms collapse to `Q² (e^{ca} + e^{-ca} - 2) / c²`, which is the squared sinc. -/
96lemma tri_fourier_alg (Q t : ℝ) (hQ : 0 < Q) (ht : t ≠ 0) (c : ℂ) (hc : c = -(t : ℂ) * I) :
97 (((Q : ℂ) + (Q : ℂ) ^ 2 * (0 : ℝ)) * exp (c * (0 : ℝ)) / c - (Q : ℂ) ^ 2 * exp (c * (0 : ℝ)) / c ^ 2)
98 - (((Q : ℂ) + (Q : ℂ) ^ 2 * (-Q⁻¹ : ℝ)) * exp (c * (-Q⁻¹ : ℝ)) / c - (Q : ℂ) ^ 2 * exp (c * (-Q⁻¹ : ℝ)) / c ^ 2)
99 + (((Q : ℂ) + (-(Q : ℂ) ^ 2) * (Q⁻¹ : ℝ)) * exp (c * (Q⁻¹ : ℝ)) / c - (-(Q : ℂ) ^ 2) * exp (c * (Q⁻¹ : ℝ)) / c ^ 2)
100 - (((Q : ℂ) + (-(Q : ℂ) ^ 2) * (0 : ℝ)) * exp (c * (0 : ℝ)) / c - (-(Q : ℂ) ^ 2) * exp (c * (0 : ℝ)) / c ^ 2)
101 = ((Real.sinc (t / (2 * Q)) ^ 2 : ℝ) : ℂ) := by
102 have hQ0 : (Q : ℂ) ≠ 0 := by exact_mod_cast hQ.ne'
103 have ht0 : (t : ℂ) ≠ 0 := by exact_mod_cast ht
104 have hcne : c ≠ 0 := by rw [hc]; simp [ht0]
105 have hc2 : c ^ 2 = -(t : ℂ) ^ 2 := by
106 rw [hc]; linear_combination (t : ℂ) ^ 2 * Complex.I_sq
107 have hsum : exp (c * (-Q⁻¹ : ℝ)) + exp (c * (Q⁻¹ : ℝ))
108 = 2 * (1 - 2 * Complex.sin ((t : ℂ) / (2 * Q)) ^ 2) := by
109 have e1 : exp (c * ((-Q⁻¹ : ℝ) : ℂ)) = exp ((t : ℂ) / Q * I) := by
110 congr 1; rw [hc]; push_cast; ring
111 have e2 : exp (c * ((Q⁻¹ : ℝ) : ℂ)) = exp (-((t : ℂ) / Q) * I) := by
112 congr 1; rw [hc]; push_cast; ring
113 have hx : (t : ℂ) / Q = 2 * ((t : ℂ) / (2 * Q)) := by field_simp
114 rw [e1, e2, ← Complex.two_cos, hx, Complex.cos_two_mul, Complex.sin_sq]
115 ring
116 have hy : t / (2 * Q) ≠ 0 := div_ne_zero ht (by positivity)
117 rw [Real.sinc_of_ne_zero hy]
118 push_cast at hsum ⊢
119 generalize exp (c * (Q : ℂ)⁻¹) = u at *
120 generalize exp (c * -(Q : ℂ)⁻¹) = v at *
121 generalize Complex.sin ((t : ℂ) / (2 * Q)) = S at *
122 have hv : v = 2 * (1 - 2 * S ^ 2) - u := by linear_combination hsum
123 subst hv
124 have hQi : (Q : ℂ) + -(Q : ℂ) ^ 2 * (Q : ℂ)⁻¹ = 0 := by field_simp; ring
125 simp only [mul_zero, zero_mul, add_zero, Complex.exp_zero, mul_one, hQi, zero_div]
126 rw [hc2]
127 field_simp
128 ring
129
130/-- `sinc² y ≤ 2 / (1 + y²)`, the integrable majorant of `sinc²`. -/
131lemma sinc_sq_le (y : ℝ) : Real.sinc y ^ 2 ≤ 2 * (1 + y ^ 2)⁻¹ := by
132 by_cases hy : |y| ≤ 1
133 · have h1 : Real.sinc y ^ 2 ≤ 1 := by
134 have := Real.abs_sinc_le_one y
135 nlinarith [abs_nonneg (Real.sinc y), sq_abs (Real.sinc y)]
136 have hy2 : y ^ 2 ≤ 1 := by nlinarith [sq_abs y, abs_nonneg y]
137 have h2 : 1 ≤ 2 * (1 + y ^ 2)⁻¹ := by
138 rw [← div_eq_mul_inv, le_div_iff₀ (by positivity)]
139 linarith
140 linarith
141 · have hy0 : y ≠ 0 := by rintro rfl; simp at hy
142 have hy2 : 1 < y ^ 2 := by nlinarith [sq_abs y, abs_nonneg y]
143 rw [Real.sinc_of_ne_zero hy0, div_pow]
144 calc Real.sin y ^ 2 / y ^ 2 ≤ 1 / y ^ 2 :=
145 div_le_div_of_nonneg_right (Real.sin_sq_le_one y) (by positivity)
146 _ ≤ 2 * (1 + y ^ 2)⁻¹ := by
147 rw [div_le_iff₀ (by positivity)]
148 rw [← div_eq_mul_inv, div_mul_eq_mul_div, le_div_iff₀ (by positivity)]
149 nlinarith
150
151/-- `t ↦ sinc (t / (2 Q))²` is integrable on `ℝ` for `Q > 0`. -/
152lemma integrable_sinc_sq (Q : ℝ) (hQ : 0 < Q) :
153 Integrable (fun t : ℝ => Real.sinc (t / (2 * Q)) ^ 2) := by
154 refine Integrable.mono' (g := fun t : ℝ => 2 * (1 + (t / (2 * Q)) ^ 2)⁻¹) ?_ ?_ ?_
155 · have := (integrable_inv_one_add_sq.comp_mul_left' (R := 1 / (2 * Q))
156 (by positivity)).const_mul 2
157 convert this using 1
158 funext t
159 ring_nf
160 · exact (by fun_prop : Continuous fun t : ℝ =>
161 Real.sinc (t / (2 * Q)) ^ 2).aestronglyMeasurable
162 · exact Filter.Eventually.of_forall fun t => by
163 rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)]
164 exact sinc_sq_le _
165
166end E424
167