goldbach-spectral-bridge
Li and Liu's GRH + S ⇒ Goldbach in Lean, checked against the paper by Comparator: clean it up together, and settle S
| 1 | module |
| 2 | |
| 3 | public import ConditionalGoldbach.Definitions.Experiment |
| 4 | public import Mathlib.Analysis.Calculus.Deriv.Slope |
| 5 | import Mathlib.Tactic.NormNum.RealSqrt |
| 6 | |
| 7 | @[expose] public section |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | noncomputable section |
| 11 | open scoped BigOperators Topology |
| 12 | open Filter Set |
| 13 | namespace ConditionalGoldbach |
| 14 | |
| 15 | def positivePartPower (m : ℕ) (x : ℝ) : ℝ := (max x 0)^m |
| 16 | |
| 17 | lemma positivePartPower_hasDerivAt (m : ℕ) (hm : 2 ≤ m) (x : ℝ) : |
| 18 | HasDerivAt (positivePartPower m) ((m:ℝ)*positivePartPower (m - 1) x) x := by |
| 19 | rcases lt_trichotomy x 0 with hx|hx|hx |
| 20 | · have he : positivePartPower m =ᶠ[𝓝 x] fun _ => (0:ℝ) := by |
| 21 | filter_upwards [Iio_mem_nhds hx] with y hy |
| 22 | change y < 0 at hy |
| 23 | simp [positivePartPower,max_eq_right hy.le,Nat.ne_of_gt (by omega : 0 < m)] |
| 24 | have hd := (hasDerivAt_const x (0:ℝ)).congr_of_eventuallyEq he |
| 25 | simpa [positivePartPower,max_eq_right hx.le,Nat.ne_of_gt (by omega : 0 < m - 1)] using hd |
| 26 | · subst x |
| 27 | have hcont : Tendsto (positivePartPower (m - 1)) (𝓝[≠] (0:ℝ)) (𝓝 0) := by |
| 28 | have hc : Continuous (positivePartPower (m - 1)) := (continuous_id.max continuous_const).pow _ |
| 29 | simpa [positivePartPower,Nat.ne_of_gt (by omega : 0 < m - 1)] using (hc.continuousAt (x := 0)).tendsto.mono_left nhdsWithin_le_nhds |
| 30 | have he : slope (positivePartPower m) 0 =ᶠ[𝓝[≠] (0:ℝ)] positivePartPower (m - 1) := by |
| 31 | filter_upwards [self_mem_nhdsWithin] with y hy |
| 32 | have hy0 : y≠0 := hy |
| 33 | rw [slope_fun_def_field] |
| 34 | simp only [positivePartPower,max_self,zero_pow (by omega : m≠0),sub_zero] |
| 35 | rcases lt_or_gt_of_ne hy0 with hy|hy |
| 36 | · simp [max_eq_right hy.le,Nat.ne_of_gt (by omega : 0 < m - 1),Nat.ne_of_gt (by omega : 0 < m)] |
| 37 | · rw [max_eq_left hy.le,show m = (m - 1)+1 by omega,pow_succ] |
| 38 | field_simp |
| 39 | simp |
| 40 | have hd := hasDerivAt_iff_tendsto_slope.mpr (hcont.congr' he.symm) |
| 41 | simpa [positivePartPower,Nat.ne_of_gt (by omega : 0 < m - 1)] using hd |
| 42 | · have he : positivePartPower m =ᶠ[𝓝 x] fun y => y^m := by |
| 43 | filter_upwards [Ioi_mem_nhds hx] with y hy |
| 44 | change 0 < y at hy |
| 45 | simp [positivePartPower,max_eq_left hy.le] |
| 46 | simpa [positivePartPower,max_eq_left hx.le] using ((hasDerivAt_id x).pow m).congr_of_eventuallyEq he |
| 47 | |
| 48 | lemma positivePartPower_contDiff (k m : ℕ) (hkm : k < m) : ContDiff ℝ k (positivePartPower m) := by |
| 49 | induction k generalizing m with |
| 50 | | zero => exact contDiff_zero.mpr ((continuous_id.max continuous_const).pow m) |
| 51 | | succ k ih => |
| 52 | have hm : 2 ≤ m := by omega |
| 53 | rw [Nat.cast_add_one,contDiff_succ_iff_deriv] |
| 54 | simp only [WithTop.natCast_ne_top,analyticOn_univ,IsEmpty.forall_iff,true_and] |
| 55 | refine ⟨fun x => (positivePartPower_hasDerivAt m hm x).differentiableAt,?_⟩ |
| 56 | have he : deriv (positivePartPower m) = fun x => (m:ℝ)*positivePartPower (m - 1) x := |
| 57 | funext (fun x => (positivePartPower_hasDerivAt m hm x).deriv) |
| 58 | rw [he] |
| 59 | exact contDiff_const.mul (ih (m - 1) (by omega)) |
| 60 | |
| 61 | def cutoffPolynomialCore (t : ℝ) : ℝ := |
| 62 | 1716*t^7-9009*t^8+20020*t^9-24024*t^10+16380*t^11-6006*t^12+924*t^13 |
| 63 | |
| 64 | lemma cutoffPolynomialCore_sum (t : ℝ) : |
| 65 | (∑ j ∈ Finset.Icc 7 13, (Nat.choose 13 j:ℝ)*t^j*(1-t)^(13-j))=cutoffPolynomialCore t := by |
| 66 | norm_num [Finset.sum_Icc_succ_top,Nat.choose,cutoffPolynomialCore]; |
| 67 | ring |
| 68 | |
| 69 | lemma cutoffPolynomialCore_reflection (t : ℝ) : cutoffPolynomialCore t+cutoffPolynomialCore (1-t)=1 := by |
| 70 | unfold cutoffPolynomialCore |
| 71 | ring |
| 72 | |
| 73 | lemma cutoffPolynomial_eq_positive_parts (t : ℝ) : |
| 74 | cutoffPolynomial t = cutoffPolynomialCore (max t 0)+cutoffPolynomialCore (-(max (t-1) 0)) := by |
| 75 | unfold cutoffPolynomial |
| 76 | split_ifs with ht ht' |
| 77 | · rw [max_eq_right ht,max_eq_right (by linarith : t-1≤0)] |
| 78 | norm_num [cutoffPolynomialCore] |
| 79 | · rw [max_eq_left (by linarith : 0≤t),max_eq_left (by linarith : 0≤t-1)] |
| 80 | convert (cutoffPolynomialCore_reflection t).symm using 1; congr 1; ring_nf |
| 81 | · rw [max_eq_left (by linarith : 0≤t),max_eq_right (by linarith : t-1≤0)] |
| 82 | simp only [neg_zero,cutoffPolynomialCore_sum] |
| 83 | norm_num [cutoffPolynomialCore] |
| 84 | |
| 85 | lemma cutoffPolynomial_contDiff : ContDiff ℝ 6 cutoffPolynomial := by |
| 86 | have h7 := positivePartPower_contDiff 6 7 (by norm_num) |
| 87 | have h8 := positivePartPower_contDiff 6 8 (by norm_num) |
| 88 | have h9 := positivePartPower_contDiff 6 9 (by norm_num) |
| 89 | have h10 := positivePartPower_contDiff 6 10 (by norm_num) |
| 90 | have h11 := positivePartPower_contDiff 6 11 (by norm_num) |
| 91 | have h12 := positivePartPower_contDiff 6 12 (by norm_num) |
| 92 | have h13 := positivePartPower_contDiff 6 13 (by norm_num) |
| 93 | have hleft : ContDiff ℝ 6 (fun t => cutoffPolynomialCore (max t 0)) := by |
| 94 | exact ((((((contDiff_const.mul h7).sub (contDiff_const.mul h8)).add (contDiff_const.mul h9)).sub |
| 95 | (contDiff_const.mul h10)).add (contDiff_const.mul h11)).sub (contDiff_const.mul h12)).add (contDiff_const.mul h13) |
| 96 | have hright : ContDiff ℝ 6 (fun t => cutoffPolynomialCore (-(max t 0))) := by |
| 97 | have hh : ContDiff ℝ 6 (fun t => -1716*positivePartPower 7 t-9009*positivePartPower 8 t- |
| 98 | 20020*positivePartPower 9 t-24024*positivePartPower 10 t-16380*positivePartPower 11 t- |
| 99 | 6006*positivePartPower 12 t-924*positivePartPower 13 t) := |
| 100 | ((((((contDiff_const.mul h7).sub (contDiff_const.mul h8)).sub (contDiff_const.mul h9)).sub |
| 101 | (contDiff_const.mul h10)).sub (contDiff_const.mul h11)).sub (contDiff_const.mul h12)).sub (contDiff_const.mul h13) |
| 102 | convert hh using 1 |
| 103 | funext t |
| 104 | unfold cutoffPolynomialCore positivePartPower |
| 105 | ring |
| 106 | have he : cutoffPolynomial = fun t => cutoffPolynomialCore (max t 0)+cutoffPolynomialCore (-(max (t-1) 0)) := |
| 107 | funext cutoffPolynomial_eq_positive_parts |
| 108 | rw [he] |
| 109 | exact hleft.add (hright.comp (contDiff_id.sub contDiff_const)) |
| 110 | |
| 111 | end ConditionalGoldbach |
