Lean / Reader
Lean reader

Erdos824Marked.lean

169 lines4 declarationsno sorryimports Erdos824.Final Erdos821.P7.Support

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Erdos824.Final, Erdos821.P7.Support, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import Erdos824.Final
  2. import Erdos821.P7.Support
  3. /- The cardinal estimates below adapt Yao Xu's Count/Count.lean (Apache-2.0)
  4. to count the literal support before its projection to smooth successor primes. -/
  5. noncomputable section
  6. open scoped BigOperators
  7. open Filter Erdos821.Blueprint Erdos821.Blueprint.Analytic
  8. attribute [local instance] Classical.propDecidable
  9. namespace Erdos824Marked
  10. def supported (C : CandidateData) (x : ℝ) (j : ℕ) : Finset ℕ :=
  11. ((Finset.Icc 1 ⌊2*x⌋₊).filter (fun u => Nat.Prime (2*u-1))).filter
  12. (fun u => C.weighted x j u ≠ 0)
  13. theorem row_factors (C : CandidateData) {δ x : ℝ} (hG : C.Geometry δ)
  14. {j u : ℕ} (hj : C.j₀ ≤ j) (hu : 0 < u) (hw : C.weighted x j u ≠ 0) :
  15. 3 ≤ C.bands.r₀ ∧ ∃ f : Fin C.bands.r₀ → ℕ,
  16. (∀ i, f i ∈ C.bands.band x 0) ∧ (∏ i, f i) ∣ u := by
  17. have hcnt := hG.1.2.2.2.2.2.2.1
  18. rw [hG.2.1, hG.2.2.1, hG.2.2.2.1] at hcnt
  19. have hreal : (3 : ℝ) ≤ C.bands.r₀ := by linarith
  20. have h0 : 0 < j := lt_of_lt_of_le (Nat.zero_lt_of_lt hG.2.2.2.2.2.2.2.1) hj
  21. have hcoef : C.bands.aQ x j (groupFreePart (C.bands.groups x) u) ≠ 0 :=
  22. (mul_ne_zero_iff.mp (mul_ne_zero_iff.mp hw).1).1
  23. obtain ⟨z, hz⟩ := Erdos821.P7Core.exists_list_of_coefficient_ne_zero C.bands x j _ hcoef
  24. let zrow : Fin (C.bands.last x + 1) := 0
  25. refine ⟨by exact_mod_cast hreal, fun i => (z (zrow,i)).val, ?_, ?_⟩
  26. · intro i
  27. have hm := (z (zrow,i)).property
  28. simpa [BandData.slotValues, zrow, Nat.ne_of_gt h0, Ne.symm (Nat.ne_of_gt h0)] using hm
  29. · have hd : (∏ i, (z (zrow,i)).val) ∣ C.bands.listProduct z := by
  30. unfold BandData.listProduct
  31. rw [Fintype.prod_prod_type]
  32. exact Finset.dvd_prod_of_mem (fun j' => ∏ i, (z (j',i)).val) (Finset.mem_univ zrow)
  33. rw [hz] at hd
  34. exact hd.trans (Erdos821.S56Core.groupFreePart_dvd _ _ hu)
  35. theorem support_mass {x : ℝ} {C : CandidateData} {jstar : ℕ} {K : ℝ}
  36. (hup : ∀ u : ℕ, C.weighted x jstar u ≤ Real.exp (K * Real.sqrt (L x))) :
  37. C.succPrimeMass x jstar ≤ ((supported C x jstar).card : ℝ) *
  38. Real.exp (K * Real.sqrt (L x)) := by
  39. set F : Finset ℕ :=
  40. (Finset.Icc 1 ⌊2 * x⌋₊).filter (fun u => Nat.Prime (2 * u - 1)) with hFdef
  41. set S : Finset ℕ :=
  42. F.filter (fun u => C.weighted x jstar u ≠ 0) with hSdef
  43. set W : ℝ := Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) with hWdef
  44. have hprime_eq : C.succPrimeMass x jstar = ∑ u ∈ F, C.weighted x jstar u := rfl
  45. have hSF : S ⊆ F := Finset.filter_subset _ _
  46. have hsum_eq : ∑ u ∈ F, C.weighted x jstar u = ∑ u ∈ S, C.weighted x jstar u := by
  47. symm
  48. apply Finset.sum_subset hSF
  49. intro u huF huS
  50. have hne : ¬ (C.weighted x jstar u ≠ 0) := by
  51. intro hne
  52. exact huS (Finset.mem_filter.mpr ⟨huF, hne⟩)
  53. exact not_ne_iff.mp hne
  54. have hsum_le : ∑ u ∈ S, C.weighted x jstar u ≤ (S.card : ℝ) * W := by
  55. have h := Finset.sum_le_card_nsmul S (fun u => C.weighted x jstar u) W
  56. (fun u _ => hup u)
  57. rw [nsmul_eq_mul] at h
  58. exact h
  59. exact hprime_eq.le.trans (hsum_eq.le.trans hsum_le)
  60. theorem supply (δ : ℝ) (hδ : 0 < δ) (hδ' : δ < 1 / 4) :
  61. ∃ C : CandidateData, C.Geometry δ ∧ C.Bounds δ ∧ ∃ j : ℕ, C.j₀ ≤ j ∧
  62. ∀ σ : ℝ, 0 < σ → ∀ᶠ x : ℝ in atTop, x ^ (1-σ) ≤ ((supported C x j).card : ℝ) := by
  63. have h := Erdos824.Final.packageInterfaces
  64. have hc := h.classical
  65. have hs := h.sieve hc
  66. have hii := h.typeII hc (h.shift hc hs (h.transference hc) (h.ideal hc))
  67. obtain ⟨C, hC⟩ := h.candidateGeometry δ hδ hδ'
  68. have hb := h.candidateBounds δ C hC
  69. have hp := h.extraction hc hs hii (h.proxies hc hs) δ C hC hb
  70. (h.candidateTypeI δ C hC hb) (h.balanced δ C hC hb)
  71. refine ⟨C, hC, hb, ?_⟩
  72. rcases hb with ⟨K, CA, cmin, cmax, hK, _, _, hBounds⟩
  73. rcases hp with ⟨jstar, hjstar, c, hc, hPrime⟩
  74. refine ⟨jstar, hjstar, ?_⟩
  75. intro σ hσ
  76. have hBj := hBounds jstar hjstar
  77. have hAbs := Erdos824.Succ.Count.absorb K (CA + 1) σ c hK hσ hc
  78. have hGe5 : ∀ᶠ x : ℝ in atTop, (5 : ℝ) ≤ x := Filter.eventually_ge_atTop 5
  79. filter_upwards [hBj, hPrime, hAbs, hGe5] with x hB hP hA h5
  80. rcases hB with ⟨hmass_lo, _, _, _, hup, hsupp_full⟩
  81. have hxpos : 0 < x := by linarith
  82. have hxnn : 0 ≤ x := le_of_lt hxpos
  83. have hLpos : 0 < Erdos821.Blueprint.Analytic.L x :=
  84. Real.log_pos (by linarith : (1 : ℝ) < x)
  85. have hLnn : 0 ≤ Erdos821.Blueprint.Analytic.L x := le_of_lt hLpos
  86. have hWpos : 0 < Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) :=
  87. Real.exp_pos _
  88. have hWnn : 0 ≤ Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) :=
  89. le_of_lt hWpos
  90. -- Upper bound: prime mass by smooth count times maximal weight.
  91. have hle1 : C.succPrimeMass x jstar ≤
  92. ((supported C x jstar).card : ℝ) *
  93. Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) :=
  94. support_mass hup
  95. -- Lower bound chain: `c * (x * L ^ (-CA)) / L ≤ card * W`.
  96. have hLneg : Erdos821.Blueprint.Analytic.L x ^ (-CA) =
  97. (Erdos821.Blueprint.Analytic.L x ^ CA)⁻¹ :=
  98. Real.rpow_neg hLnn CA
  99. have hLrpow_pos : 0 < Erdos821.Blueprint.Analytic.L x ^ CA :=
  100. Real.rpow_pos_of_pos hLpos CA
  101. have hLneg_pos : 0 < Erdos821.Blueprint.Analytic.L x ^ (-CA) :=
  102. Real.rpow_pos_of_pos hLpos (-CA)
  103. have hlow : c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA)) /
  104. Erdos821.Blueprint.Analytic.L x ≤
  105. ((supported C x jstar).card : ℝ) *
  106. Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) := by
  107. have h1 : c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA)) ≤
  108. c * C.mass x jstar := by
  109. apply mul_le_mul_of_nonneg_left _ (le_of_lt hc)
  110. exact hmass_lo
  111. have h3 : c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA)) /
  112. Erdos821.Blueprint.Analytic.L x ≤
  113. c * C.mass x jstar / Erdos821.Blueprint.Analytic.L x := by
  114. have hLinvnn : 0 ≤ (Erdos821.Blueprint.Analytic.L x)⁻¹ :=
  115. inv_nonneg.mpr (le_of_lt hLpos)
  116. calc c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA)) /
  117. Erdos821.Blueprint.Analytic.L x
  118. = (c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA))) *
  119. (Erdos821.Blueprint.Analytic.L x)⁻¹ := by rw [div_eq_mul_inv]
  120. _ ≤ (c * C.mass x jstar) * (Erdos821.Blueprint.Analytic.L x)⁻¹ :=
  121. mul_le_mul_of_nonneg_right h1 hLinvnn
  122. _ = c * C.mass x jstar / Erdos821.Blueprint.Analytic.L x := by
  123. rw [div_eq_mul_inv]
  124. exact le_trans h3 (le_trans hP hle1)
  125. -- Combine with absorption to get `x ^ (1 - σ) ≤ card`.
  126. have hLadd : Erdos821.Blueprint.Analytic.L x ^ (CA + 1) =
  127. Erdos821.Blueprint.Analytic.L x ^ CA *
  128. Erdos821.Blueprint.Analytic.L x := by
  129. have h := Real.rpow_add hLpos CA (1 : ℝ)
  130. rwa [Real.rpow_one] at h
  131. have hLadd_pos : 0 < Erdos821.Blueprint.Analytic.L x ^ (CA + 1) :=
  132. Real.rpow_pos_of_pos hLpos (CA + 1)
  133. set D : ℝ := Erdos821.Blueprint.Analytic.L x ^ (CA + 1) *
  134. Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) * c⁻¹ with hDdef
  135. have hDpos : 0 < D := by
  136. rw [hDdef]
  137. exact mul_pos (mul_pos hLadd_pos hWpos) (inv_pos.mpr hc)
  138. have hDnn : 0 ≤ D := le_of_lt hDpos
  139. have hAle : D ≤ x ^ σ := hA
  140. -- `x / D ≤ card`: from `hlow` via `x / D = (c * (x * L ^ (-CA)) / L) / W`.
  141. have hEq : x / D =
  142. (c * (x * Erdos821.Blueprint.Analytic.L x ^ (-CA)) /
  143. Erdos821.Blueprint.Analytic.L x) /
  144. Real.exp (K * Real.sqrt (Erdos821.Blueprint.Analytic.L x)) := by
  145. rw [hDdef, hLadd, hLneg]
  146. field_simp
  147. have hxD : x / D ≤ ((supported C x jstar).card : ℝ) := by
  148. rw [hEq]
  149. exact (div_le_iff₀ hWpos).mpr hlow
  150. -- `x ^ (1 - σ) = x / x ^ σ ≤ x / D`.
  151. have hxσpos : 0 < x ^ σ := Real.rpow_pos_of_pos hxpos σ
  152. have hrw : x ^ (1 - σ) = x / x ^ σ := by
  153. have h1 : x ^ (1 - σ) = x ^ (1 : ℝ) / x ^ σ := Real.rpow_sub hxpos 1 σ
  154. rwa [Real.rpow_one] at h1
  155. calc x ^ (1 - σ) = x / x ^ σ := hrw
  156. _ ≤ x / D :=
  157. div_le_div_of_nonneg_left hxnn hDpos hAle
  158. _ ≤ ((supported C x jstar).card : ℝ) := hxD
  159. #print axioms row_factors
  160. #print axioms supply
  161. end Erdos824Marked