Lean / 0xOsprey/shub-smale-tau9 / RealLowerBound.lean
Lean reader

Research/PvsNP/Tau/RealLowerBound.lean

437 lines20 declarationsno sorry
  1. module
  2. public import Research.PvsNP.Tau.TauConjecture
  3. public import Mathlib.Analysis.Real.Sqrt
  4. @[expose] public section
  5. namespace Research.PvsNP.Tau
  6. /-!
  7. # Unconditional Real-Root Lower Bound Beating Chebyshev (`z_max^{ℝ}(5k + 4) ≥ 8 · 7^(k - 1)`)
  8. Classical Chebyshev polynomials achieve `z_max^{ℝ}(τ) ≥ 2 ^ ((τ - 1) / 2)` (exponential growth
  9. rate `α_ℝ ≥ 1/2 = 0.50`, base `√2 ≈ 1.4142`).
  10. This module formalizes the constant-free `5`-gate-per-step family **`5C`**:
  11. - `u(y) = y * (4 - y)`
  12. - `Q(y) = (u(y) * (u(y) - 3)) ^ 2`
  13. - `f_k(x) = Q^[k](x) - 1`
  14. which has constant-free SLP length `τ(f_k) = 5 * k + 4` and at least `8 * 7 ^ (k - 1)` distinct
  15. real roots for every `k ≥ 1`, improving the unconditional real-root exponential rate to
  16. `α_ℝ ≥ (log_2 7) / 5 ≈ 0.56147 > 0.50` (base `7^(1/5) ≈ 1.4758 > √2`).
  17. The proof is completely elementary: for every `t ∈ (0, 5)`, the eight preimages of `Q(y) = t`
  18. are constructed explicitly via nested square roots and placed in one strictly increasing chain
  19. `y4m < 0 < y1m < y2m < y3m < 2 < y3p < y2p < y1p < 4 < y4p < 5`, yielding seven distinct
  20. preimages inside `(0, 5)` and one additional preimage in `(-1, 0)`.
  21. -/
  22. /-! ## 1. Wire-Evaluation Helpers & Constant-Free SLP of Length `5k + 4` -/
  23. theorem SLP.evalWire_snoc_lt {τ : ℕ} (P : SLP τ) (op : SLPOp) (i j : Fin (τ + 2))
  24. (k : Fin (τ + 3)) (hk : k.val < τ + 2) :
  25. (P.snoc op i j).evalWire k = P.evalWire ⟨k.val, hk⟩ := by
  26. simp [SLP.evalWire, hk]
  27. theorem SLP.evalWire_snoc_last {τ : ℕ} (P : SLP τ) (op : SLPOp) (i j : Fin (τ + 2))
  28. (k : Fin (τ + 3)) (hk : k.val = τ + 2) :
  29. (P.snoc op i j).evalWire k = op.applyPoly (P.evalWire i) (P.evalWire j) := by
  30. have hnot : ¬ k.val < τ + 2 := by omega
  31. simp [SLP.evalWire, hnot]
  32. /-- One iteration of the 5-gate polynomial map `Q₅C(w) = (w(4 - w) · (w(4 - w) - 3)) ^ 2`. -/
  33. noncomputable def q5cStep (w : Polynomial ℤ) : Polynomial ℤ :=
  34. let u := w * (4 - w)
  35. (u * (u - 3)) ^ 2
  36. /-- `k`-fold iterate `Q₅C^[k](X)` in `ℤ[X]`. -/
  37. noncomputable def real5CPoly : ℕ → Polynomial ℤ
  38. | 0 => Polynomial.X
  39. | k + 1 => q5cStep (real5CPoly k)
  40. /-- Append one 5-gate `5C` iteration to an arbitrary `P : SLP τ` given wires `i3`, `i4`, `iw`. -/
  41. def real5CStepSLP {τ : ℕ} (P : SLP τ) (i3 i4 iw : Fin (τ + 2)) : SLP (τ + 5) :=
  42. let s1 : SLP (τ + 1) := .snoc P .sub i4 iw
  43. let s2 : SLP (τ + 2) := .snoc s1 .mul ⟨iw.val, by omega⟩ ⟨τ + 2, by omega⟩
  44. let s3 : SLP (τ + 3) := .snoc s2 .sub ⟨τ + 3, by omega⟩ ⟨i3.val, by omega⟩
  45. let s4 : SLP (τ + 4) := .snoc s3 .mul ⟨τ + 3, by omega⟩ ⟨τ + 4, by omega⟩
  46. .snoc s4 .mul ⟨τ + 5, by omega⟩ ⟨τ + 5, by omega⟩
  47. theorem real5CStepSLP_evalWire_lt {τ : ℕ} (P : SLP τ) (i3 i4 iw : Fin (τ + 2))
  48. (k : Fin (τ + 7)) (hk : k.val < τ + 2) :
  49. (real5CStepSLP P i3 i4 iw).evalWire k = P.evalWire ⟨k.val, hk⟩ := by
  50. unfold real5CStepSLP
  51. dsimp only
  52. rw [SLP.evalWire_snoc_lt _ _ _ _ _ (by omega),
  53. SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega),
  54. SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega),
  55. SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega),
  56. SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega)]
  57. theorem real5CStepSLP_evalPoly {τ : ℕ} (P : SLP τ) (i3 i4 iw : Fin (τ + 2))
  58. (h3 : P.evalWire i3 = 3) (h4 : P.evalWire i4 = 4) :
  59. (real5CStepSLP P i3 i4 iw).evalPoly = q5cStep (P.evalWire iw) := by
  60. unfold SLP.evalPoly real5CStepSLP
  61. dsimp only
  62. set s1 : SLP (τ + 1) := .snoc P .sub i4 iw
  63. set s2 : SLP (τ + 2) := .snoc s1 .mul ⟨iw.val, by omega⟩ ⟨τ + 2, by omega⟩
  64. set s3 : SLP (τ + 3) := .snoc s2 .sub ⟨τ + 3, by omega⟩ ⟨i3.val, by omega⟩
  65. set s4 : SLP (τ + 4) := .snoc s3 .mul ⟨τ + 3, by omega⟩ ⟨τ + 4, by omega⟩
  66. have hs1 : s1.evalWire ⟨τ + 2, by omega⟩ = 4 - P.evalWire iw := by
  67. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  68. simp [SLPOp.applyPoly, h4]
  69. have hs2 : s2.evalWire ⟨τ + 3, by omega⟩ = P.evalWire iw * (4 - P.evalWire iw) := by
  70. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  71. simp only [SLPOp.applyPoly, hs1]
  72. rw [SLP.evalWire_snoc_lt _ _ _ _ _ iw.isLt]
  73. have hs3 : s3.evalWire ⟨τ + 4, by omega⟩ = P.evalWire iw * (4 - P.evalWire iw) - 3 := by
  74. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  75. simp only [SLPOp.applyPoly, hs2]
  76. have hi3 : i3.val < τ + 2 := i3.isLt
  77. rw [SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega),
  78. SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega), h3]
  79. have hs4 : s4.evalWire ⟨τ + 5, by omega⟩ =
  80. P.evalWire iw * (4 - P.evalWire iw) * (P.evalWire iw * (4 - P.evalWire iw) - 3) := by
  81. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  82. simp only [SLPOp.applyPoly, hs3]
  83. rw [SLP.evalWire_snoc_lt _ _ _ _ _ (by dsimp; omega), hs2]
  84. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  85. simp only [SLPOp.applyPoly, hs4, q5cStep, sq]
  86. /-- Wire index holding `real5CPoly k` inside `real5CBaseSLP k`. -/
  87. def real5CWire (k : ℕ) : ℕ :=
  88. if k = 0 then 1 else 5 * k + 4
  89. /-- Constant-free SLP of length `5 * k + 3` computing `3` at wire `3`, `4` at wire `4`,
  90. and `real5CPoly k` at wire `real5CWire k`. -/
  91. def real5CBaseSLP : (k : ℕ) → SLP (5 * k + 3)
  92. | 0 =>
  93. let p1 : SLP 1 := .snoc .nil .add ⟨0, by omega⟩ ⟨0, by omega⟩ -- w2 = 2
  94. let p2 : SLP 2 := .snoc p1 .add ⟨2, by omega⟩ ⟨0, by omega⟩ -- w3 = 3
  95. .snoc p2 .add ⟨2, by omega⟩ ⟨2, by omega⟩ -- w4 = 4
  96. | k + 1 =>
  97. real5CStepSLP (real5CBaseSLP k) ⟨3, by omega⟩ ⟨4, by omega⟩
  98. ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩
  99. /-- Constant-free SLP of length `5 * k + 4` computing `real5CPoly k - 1`. -/
  100. def real5CSLP (k : ℕ) : SLP (5 * k + 4) :=
  101. .snoc (real5CBaseSLP k) .sub
  102. ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩
  103. ⟨0, by omega⟩
  104. theorem real5CBaseSLP_wires (k : ℕ) :
  105. (real5CBaseSLP k).evalWire ⟨3, by omega⟩ = (3 : Polynomial ℤ) ∧
  106. (real5CBaseSLP k).evalWire ⟨4, by omega⟩ = (4 : Polynomial ℤ) ∧
  107. (real5CBaseSLP k).evalWire ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩ =
  108. real5CPoly k := by
  109. induction k with
  110. | zero =>
  111. refine ⟨?_, ?_, ?_⟩
  112. · simp [real5CBaseSLP, SLP.evalWire, SLPOp.applyPoly]; norm_num
  113. · simp [real5CBaseSLP, SLP.evalWire, SLPOp.applyPoly]; norm_num
  114. · simp [real5CBaseSLP, real5CWire, SLP.evalWire, real5CPoly]
  115. | succ k ih =>
  116. rcases ih with ⟨h3, h4, hW⟩
  117. refine ⟨?_, ?_, ?_⟩
  118. · simpa [real5CBaseSLP] using
  119. (real5CStepSLP_evalWire_lt (real5CBaseSLP k) ⟨3, by omega⟩ ⟨4, by omega⟩
  120. ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩
  121. ⟨3, by omega⟩ (by dsimp; omega)).trans h3
  122. · simpa [real5CBaseSLP] using
  123. (real5CStepSLP_evalWire_lt (real5CBaseSLP k) ⟨3, by omega⟩ ⟨4, by omega⟩
  124. ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩
  125. ⟨4, by omega⟩ (by dsimp; omega)).trans h4
  126. · have hfin : (⟨real5CWire (k + 1), by dsimp [real5CWire]; omega⟩ :
  127. Fin (5 * (k + 1) + 3 + 2)) = ⟨(5 * k + 3) + 5 + 1, by omega⟩ := by
  128. ext; simp [real5CWire]; omega
  129. rw [hfin]
  130. simpa [real5CBaseSLP, SLP.evalPoly, real5CPoly, hW] using
  131. real5CStepSLP_evalPoly (real5CBaseSLP k) ⟨3, by omega⟩ ⟨4, by omega⟩
  132. ⟨real5CWire k, by dsimp [real5CWire]; split_ifs <;> omega⟩ h3 h4
  133. theorem real5CSLP_evalPoly (k : ℕ) : (real5CSLP k).evalPoly = real5CPoly k - 1 := by
  134. unfold SLP.evalPoly real5CSLP
  135. rw [SLP.evalWire_snoc_last _ _ _ _ _ rfl]
  136. simp only [SLPOp.applyPoly]
  137. rw [(real5CBaseSLP_wires k).2.2]
  138. have h0 : (⟨0, by omega⟩ : Fin (5 * k + 3 + 2)) = 0 := rfl
  139. rw [h0, (real5CBaseSLP k).evalWire_zero]
  140. theorem real5CPoly_eval_zero (k : ℕ) : (real5CPoly k).eval 0 = 0 := by
  141. induction k with
  142. | zero => simp [real5CPoly]
  143. | succ k ih =>
  144. simp [real5CPoly, q5cStep, ih]
  145. theorem real5CSLP_ne_zero (k : ℕ) : (real5CSLP k).evalPoly ≠ 0 := by
  146. rw [real5CSLP_evalPoly]
  147. intro h0
  148. have hev := congrArg (fun p : Polynomial ℤ => p.eval 0) h0
  149. simp [real5CPoly_eval_zero] at hev
  150. /-! ## 2. Real 1D 7-Branch Horseshoe on `(0, 5)` -/
  151. /-- Real evaluation of one `5C` step: `q5c y = (y(4 - y) · (y(4 - y) - 3)) ^ 2`. -/
  152. def q5c (y : ℝ) : ℝ :=
  153. (y * (4 - y) * (y * (4 - y) - 3)) ^ 2
  154. theorem aeval_real5CPoly (k : ℕ) (r : ℝ) :
  155. Polynomial.aeval r (real5CPoly k) = q5c^[k] r := by
  156. induction k with
  157. | zero => simp [real5CPoly]
  158. | succ k ih =>
  159. rw [Function.iterate_succ_apply']
  160. simp only [real5CPoly, q5cStep, q5c, map_pow, map_mul, map_sub, map_ofNat, ih]
  161. /-- For every `t ∈ (0, 5)`, `q5c y = t` admits 7 distinct solutions in `(0, 5)` and
  162. 8 distinct solutions in `ℝ` (explicitly ordered via nested square roots). -/
  163. theorem q5c_preimages (t : ℝ) (ht0 : 0 < t) (ht5 : t < 5) :
  164. ∃ (S_in S_all : Finset ℝ),
  165. S_in.card = 7 ∧
  166. S_all.card = 8 ∧
  167. (∀ y ∈ S_in, 0 < y ∧ y < 5 ∧ q5c y = t) ∧
  168. (∀ y ∈ S_all, q5c y = t) := by
  169. classical
  170. let s : ℝ := Real.sqrt t
  171. have hs0 : 0 < s := Real.sqrt_pos.mpr ht0
  172. have hssq : s ^ 2 = t := Real.sq_sqrt ht0.le
  173. have hs_lt : s < 9 / 4 := by nlinarith only [hs0, hssq, ht5]
  174. have hA_pos : 0 < 9 - 4 * s := by linarith only [hs_lt]
  175. have hB_gt : 9 < 9 + 4 * s := by linarith only [hs0]
  176. have hB_lt : 9 + 4 * s < 25 := by linarith only [hs_lt]
  177. let d1 : ℝ := Real.sqrt (9 - 4 * s)
  178. let d2 : ℝ := Real.sqrt (9 + 4 * s)
  179. have hd1_pos : 0 < d1 := Real.sqrt_pos.mpr hA_pos
  180. have hd1_sq : d1 ^ 2 = 9 - 4 * s := Real.sq_sqrt hA_pos.le
  181. have hd1_lt : d1 < 3 := by nlinarith only [hd1_pos, hd1_sq, hs0]
  182. have hd2_pos : 0 < d2 := Real.sqrt_pos.mpr (by linarith only [hB_gt])
  183. have hd2_sq : d2 ^ 2 = 9 + 4 * s := Real.sq_sqrt (by linarith only [hB_gt])
  184. have hd2_gt : 3 < d2 := by nlinarith only [hd2_pos, hd2_sq, hB_gt]
  185. have hd2_lt : d2 < 5 := by nlinarith only [hd2_pos, hd2_sq, hB_lt]
  186. let u1 : ℝ := (3 - d1) / 2
  187. let u2 : ℝ := (3 + d1) / 2
  188. let u3 : ℝ := (3 + d2) / 2
  189. let u4 : ℝ := (3 - d2) / 2
  190. have hu4_gt : -1 < u4 := by dsimp [u4]; linarith only [hd2_lt]
  191. have hu4_lt : u4 < 0 := by dsimp [u4]; linarith only [hd2_gt]
  192. have hu1_gt : 0 < u1 := by dsimp [u1]; linarith only [hd1_lt]
  193. have hu12 : u1 < u2 := by dsimp [u1, u2]; linarith only [hd1_pos]
  194. have hu23 : u2 < u3 := by dsimp [u2, u3]; linarith only [hd1_lt, hd2_gt]
  195. have hu3_lt : u3 < 4 := by dsimp [u3]; linarith only [hd2_lt]
  196. have hu1_eq : u1 * (u1 - 3) = -s := by dsimp [u1]; nlinarith only [hd1_sq]
  197. have hu2_eq : u2 * (u2 - 3) = -s := by dsimp [u2]; nlinarith only [hd1_sq]
  198. have hu3_eq : u3 * (u3 - 3) = s := by dsimp [u3]; nlinarith only [hd2_sq]
  199. have hu4_eq : u4 * (u4 - 3) = s := by dsimp [u4]; nlinarith only [hd2_sq]
  200. let r1 : ℝ := Real.sqrt (4 - u1)
  201. let r2 : ℝ := Real.sqrt (4 - u2)
  202. let r3 : ℝ := Real.sqrt (4 - u3)
  203. let r4 : ℝ := Real.sqrt (4 - u4)
  204. have hr3_pos : 0 < r3 := Real.sqrt_pos.mpr (by linarith only [hu3_lt])
  205. have hr2_pos : 0 < r2 := Real.sqrt_pos.mpr (by linarith only [hu23, hu3_lt])
  206. have hr1_pos : 0 < r1 := Real.sqrt_pos.mpr (by linarith only [hu12, hu23, hu3_lt])
  207. have hr4_pos : 0 < r4 := Real.sqrt_pos.mpr (by linarith only [hu4_lt])
  208. have hr1_sq : r1 ^ 2 = 4 - u1 := Real.sq_sqrt (by linarith only [hu12, hu23, hu3_lt])
  209. have hr2_sq : r2 ^ 2 = 4 - u2 := Real.sq_sqrt (by linarith only [hu23, hu3_lt])
  210. have hr3_sq : r3 ^ 2 = 4 - u3 := Real.sq_sqrt (by linarith only [hu3_lt])
  211. have hr4_sq : r4 ^ 2 = 4 - u4 := Real.sq_sqrt (by linarith only [hu4_lt])
  212. have hr32 : r3 < r2 := by nlinarith only [hr3_pos, hr2_pos, hr3_sq, hr2_sq, hu23]
  213. have hr21 : r2 < r1 := by nlinarith only [hr2_pos, hr1_pos, hr2_sq, hr1_sq, hu12]
  214. have hr1_lt2 : r1 < 2 := by nlinarith only [hr1_pos, hr1_sq, hu1_gt]
  215. have hr4_gt2 : 2 < r4 := by nlinarith only [hr4_pos, hr4_sq, hu4_lt]
  216. have hr4_lt3 : r4 < 3 := by nlinarith only [hr4_pos, hr4_sq, hu4_gt]
  217. let y4m : ℝ := 2 - r4
  218. let y1m : ℝ := 2 - r1
  219. let y2m : ℝ := 2 - r2
  220. let y3m : ℝ := 2 - r3
  221. let y3p : ℝ := 2 + r3
  222. let y2p : ℝ := 2 + r2
  223. let y1p : ℝ := 2 + r1
  224. let y4p : ℝ := 2 + r4
  225. have hq : ∀ {u r y : ℝ}, r ^ 2 = 4 - u → (y = 2 - r ∨ y = 2 + r) →
  226. (u * (u - 3) = -s ∨ u * (u - 3) = s) → q5c y = t := by
  227. intro u r y hrsq hy hu
  228. have hyu : y * (4 - y) = u := by rcases hy with rfl | rfl <;> nlinarith only [hrsq]
  229. unfold q5c
  230. rw [hyu]
  231. rcases hu with h | h <;> rw [h] <;> nlinarith only [hssq]
  232. have hq_y4m : q5c y4m = t := hq hr4_sq (Or.inl rfl) (Or.inr hu4_eq)
  233. have hq_y1m : q5c y1m = t := hq hr1_sq (Or.inl rfl) (Or.inl hu1_eq)
  234. have hq_y2m : q5c y2m = t := hq hr2_sq (Or.inl rfl) (Or.inl hu2_eq)
  235. have hq_y3m : q5c y3m = t := hq hr3_sq (Or.inl rfl) (Or.inr hu3_eq)
  236. have hq_y3p : q5c y3p = t := hq hr3_sq (Or.inr rfl) (Or.inr hu3_eq)
  237. have hq_y2p : q5c y2p = t := hq hr2_sq (Or.inr rfl) (Or.inl hu2_eq)
  238. have hq_y1p : q5c y1p = t := hq hr1_sq (Or.inr rfl) (Or.inl hu1_eq)
  239. have hq_y4p : q5c y4p = t := hq hr4_sq (Or.inr rfl) (Or.inr hu4_eq)
  240. have hc0 : y4m < 0 := by dsimp [y4m]; linarith only [hr4_gt2]
  241. have hc1 : 0 < y1m := by dsimp [y1m]; linarith only [hr1_lt2]
  242. have hc2 : y1m < y2m := by dsimp [y1m, y2m]; linarith only [hr21]
  243. have hc3 : y2m < y3m := by dsimp [y2m, y3m]; linarith only [hr32]
  244. have hc4 : y3m < y3p := by dsimp [y3m, y3p]; linarith only [hr3_pos]
  245. have hc5 : y3p < y2p := by dsimp [y3p, y2p]; linarith only [hr32]
  246. have hc6 : y2p < y1p := by dsimp [y2p, y1p]; linarith only [hr21]
  247. have hc7 : y1p < y4p := by dsimp [y1p, y4p]; linarith only [hr1_lt2, hr4_gt2]
  248. have hc8 : y4p < 5 := by dsimp [y4p]; linarith only [hr4_lt3]
  249. let L_in : List ℝ := [y1m, y2m, y3m, y3p, y2p, y1p, y4p]
  250. let L_all : List ℝ := y4m :: L_in
  251. have hpair_in : L_in.Pairwise (· < ·) := by
  252. simp only [L_in, List.pairwise_cons, List.mem_cons, List.not_mem_nil, or_false,
  253. forall_eq_or_imp, forall_eq, List.Pairwise.nil, false_implies, implies_true, and_true]
  254. repeat' constructor
  255. all_goals linarith only [hc2, hc3, hc4, hc5, hc6, hc7]
  256. have hpair_all : L_all.Pairwise (· < ·) := by
  257. refine List.pairwise_cons.mpr ⟨?_, hpair_in⟩
  258. intro x hx
  259. simp only [L_in, List.mem_cons, List.not_mem_nil, or_false] at hx
  260. rcases hx with rfl | rfl | rfl | rfl | rfl | rfl | rfl <;>
  261. linarith only [hc0, hc1, hc2, hc3, hc4, hc5, hc6, hc7]
  262. have hnodup_in : L_in.Nodup := hpair_in.imp ne_of_lt
  263. have hnodup_all : L_all.Nodup := hpair_all.imp ne_of_lt
  264. refine ⟨L_in.toFinset, L_all.toFinset, ?_, ?_, ?_, ?_⟩
  265. · rw [List.toFinset_card_of_nodup hnodup_in]; rfl
  266. · rw [List.toFinset_card_of_nodup hnodup_all]; rfl
  267. · intro y hy
  268. rw [List.mem_toFinset] at hy
  269. simp only [L_in, List.mem_cons, List.not_mem_nil, or_false] at hy
  270. rcases hy with rfl | rfl | rfl | rfl | rfl | rfl | rfl
  271. · exact ⟨by linarith only [hc1], by linarith only [hc2, hc3, hc4, hc5, hc6, hc7, hc8], hq_y1m⟩
  272. · exact ⟨by linarith only [hc1, hc2], by linarith only [hc3, hc4, hc5, hc6, hc7, hc8], hq_y2m⟩
  273. · exact ⟨by linarith only [hc1, hc2, hc3], by linarith only [hc4, hc5, hc6, hc7, hc8], hq_y3m⟩
  274. · exact ⟨by linarith only [hc1, hc2, hc3, hc4], by linarith only [hc5, hc6, hc7, hc8], hq_y3p⟩
  275. · exact ⟨by linarith only [hc1, hc2, hc3, hc4, hc5], by linarith only [hc6, hc7, hc8], hq_y2p⟩
  276. · exact ⟨by linarith only [hc1, hc2, hc3, hc4, hc5, hc6], by linarith only [hc7, hc8], hq_y1p⟩
  277. · exact ⟨by linarith only [hc1, hc2, hc3, hc4, hc5, hc6, hc7], by linarith only [hc8], hq_y4p⟩
  278. · intro y hy
  279. rw [List.mem_toFinset] at hy
  280. simp only [L_all, L_in, List.mem_cons, List.not_mem_nil, or_false] at hy
  281. rcases hy with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl
  282. · exact hq_y4m
  283. · exact hq_y1m
  284. · exact hq_y2m
  285. · exact hq_y3m
  286. · exact hq_y3p
  287. · exact hq_y2p
  288. · exact hq_y1p
  289. · exact hq_y4p
  290. /-- `k`-step preimage tree inside `(0, 5)`: for every `k : ℕ` and `t ∈ (0, 5)`, there exist
  291. `7 ^ k` distinct reals `r ∈ (0, 5)` with `q5c^[k] r = t`. -/
  292. theorem q5c_iter_preimages_in (k : ℕ) :
  293. ∀ t : ℝ, 0 < t → t < 5 →
  294. ∃ S : Finset ℝ, S.card = 7 ^ k ∧ ∀ r ∈ S, 0 < r ∧ r < 5 ∧ q5c^[k] r = t := by
  295. classical
  296. induction k with
  297. | zero =>
  298. intro t ht0 ht5
  299. refine ⟨{t}, by simp, ?_⟩
  300. intro r hr
  301. rw [Finset.mem_singleton] at hr
  302. subst hr
  303. exact ⟨ht0, ht5, rfl⟩
  304. | succ k ih =>
  305. intro t ht0 ht5
  306. rcases q5c_preimages t ht0 ht5 with ⟨S_in, _, hcard_in, _, hS_in, _⟩
  307. choose F hF_card hF_prop using fun (y : ℝ) (hy : y ∈ S_in) =>
  308. ih y (hS_in y hy).1 (hS_in y hy).2.1
  309. let S : Finset ℝ := S_in.attach.biUnion (fun y => F y.1 y.2)
  310. have hdisj : Set.PairwiseDisjoint (S_in.attach : Set {y // y ∈ S_in})
  311. (fun y => F y.1 y.2) := by
  312. intro a _ b _ hab
  313. dsimp [Function.onFun]
  314. rw [Finset.disjoint_left]
  315. intro r hra hrb
  316. have ha_eq := (hF_prop a.1 a.2 r hra).2.2
  317. have hb_eq := (hF_prop b.1 b.2 r hrb).2.2
  318. exact hab (Subtype.ext (ha_eq.symm.trans hb_eq))
  319. refine ⟨S, ?_, ?_⟩
  320. · rw [Finset.card_biUnion hdisj]
  321. calc
  322. ∑ y ∈ S_in.attach, (F y.1 y.2).card
  323. = ∑ _y ∈ S_in.attach, 7 ^ k :=
  324. Finset.sum_congr rfl (fun y _ => hF_card y.1 y.2)
  325. _ = S_in.attach.card * 7 ^ k := by simp
  326. _ = 7 ^ (k + 1) := by rw [Finset.card_attach, hcard_in, pow_succ']
  327. · intro r hr
  328. rcases Finset.mem_biUnion.mp hr with ⟨y, _, hry⟩
  329. have h1 := hF_prop y.1 y.2 r hry
  330. have h2 := hS_in y.1 y.2
  331. refine ⟨h1.1, h1.2.1, ?_⟩
  332. rw [Function.iterate_succ_apply', h1.2.2, h2.2.2]
  333. /-- **Unconditional Real-Root Lower Bound Beating Chebyshev (`z_max^{ℝ}(5k + 4) ≥ 8 · 7^(k - 1)`):**
  334. For every `k ≥ 1`, there exists a constant-free SLP `P : SLP (5 * k + 4)` computing a nonzero
  335. polynomial `f ∈ ℤ[X]` with at least `8 * 7 ^ (k - 1)` distinct real roots. -/
  336. theorem tau_real_5C (k : ℕ) (hk : 1 ≤ k) :
  337. ∃ P : SLP (5 * k + 4),
  338. P.evalPoly ≠ 0 ∧
  339. ∃ S : Finset ℝ,
  340. S.card = 8 * 7 ^ (k - 1) ∧ ∀ r ∈ S, Polynomial.aeval r P.evalPoly = 0 := by
  341. classical
  342. obtain ⟨m, rfl⟩ : ∃ m, k = m + 1 := ⟨k - 1, by omega⟩
  343. refine ⟨real5CSLP (m + 1), real5CSLP_ne_zero (m + 1), ?_⟩
  344. rcases q5c_iter_preimages_in m 1 (by norm_num) (by norm_num) with ⟨T, hT_card, hT_prop⟩
  345. have hstep8 : ∀ (y : ℝ) (hy : y ∈ T), ∃ S_all : Finset ℝ, S_all.card = 8 ∧ ∀ r ∈ S_all, q5c r = y := by
  346. intro y hy
  347. rcases q5c_preimages y (hT_prop y hy).1 (hT_prop y hy).2.1 with ⟨_, S_all, _, hc, _, hq⟩
  348. exact ⟨S_all, hc, hq⟩
  349. choose G hG_card hG_prop using hstep8
  350. let S : Finset ℝ := T.attach.biUnion (fun y => G y.1 y.2)
  351. have hdisj : Set.PairwiseDisjoint (T.attach : Set {y // y ∈ T})
  352. (fun y => G y.1 y.2) := by
  353. intro a _ b _ hab
  354. dsimp [Function.onFun]
  355. rw [Finset.disjoint_left]
  356. intro r hra hrb
  357. have ha_eq := hG_prop a.1 a.2 r hra
  358. have hb_eq := hG_prop b.1 b.2 r hrb
  359. exact hab (Subtype.ext (ha_eq.symm.trans hb_eq))
  360. refine ⟨S, ?_, ?_⟩
  361. · rw [Finset.card_biUnion hdisj]
  362. calc
  363. ∑ y ∈ T.attach, (G y.1 y.2).card
  364. = ∑ _y ∈ T.attach, 8 := Finset.sum_congr rfl (fun y _ => hG_card y.1 y.2)
  365. _ = T.attach.card * 8 := by simp
  366. _ = 8 * 7 ^ m := by rw [Finset.card_attach, hT_card]; ring
  367. · intro r hr
  368. rcases Finset.mem_biUnion.mp hr with ⟨y, _, hry⟩
  369. rw [real5CSLP_evalPoly, map_sub, map_one, aeval_real5CPoly, Function.iterate_succ_apply,
  370. hG_prop y.1 y.2 r hry, (hT_prop y.1 y.2).2.2, sub_self]
  371. /-- Explicit finite domination over Chebyshev's `2 ^ (τ / 2)` rate for all `k ≥ 5` (`τ = 5k + 4`):
  372. `8 * 7 ^ (k - 1) > 2 ^ ((5 * k + 4) / 2)`. -/
  373. theorem tau_real_5C_beats_chebyshev (k : ℕ) (hk : 5 ≤ k) :
  374. ∃ P : SLP (5 * k + 4),
  375. P.evalPoly ≠ 0 ∧
  376. ∃ S : Finset ℝ,
  377. 2 ^ ((5 * k + 4) / 2) < S.card ∧ ∀ r ∈ S, Polynomial.aeval r P.evalPoly = 0 := by
  378. rcases tau_real_5C k (by omega) with ⟨P, hne, S, hcard, hroots⟩
  379. refine ⟨P, hne, S, ?_, hroots⟩
  380. rw [hcard]
  381. clear P hne S hcard hroots
  382. obtain ⟨d, rfl⟩ : ∃ d, k = d + 5 := ⟨k - 5, by omega⟩
  383. clear hk
  384. induction d using Nat.strong_induction_on with
  385. | ind d ih =>
  386. match d with
  387. | 0 => norm_num
  388. | 1 => norm_num
  389. | d' + 2 =>
  390. have hprev := ih d' (by omega)
  391. have hdiv : (5 * (d' + 2 + 5) + 4) / 2 = (5 * (d' + 5) + 4) / 2 + 5 := by omega
  392. rw [hdiv, pow_add]
  393. have hexp : d' + 2 + 5 - 1 = (d' + 5 - 1) + 2 := by omega
  394. rw [hexp, pow_add]
  395. have h32 : 2 ^ 5 < 7 ^ 2 := by norm_num
  396. calc
  397. 2 ^ ((5 * (d' + 5) + 4) / 2) * 2 ^ 5
  398. < (8 * 7 ^ (d' + 5 - 1)) * 2 ^ 5 :=
  399. Nat.mul_lt_mul_of_pos_right hprev (by positivity)
  400. _ ≤ (8 * 7 ^ (d' + 5 - 1)) * 7 ^ 2 :=
  401. Nat.mul_le_mul_left _ h32.le
  402. _ = 8 * (7 ^ (d' + 5 - 1) * 7 ^ 2) := by ring
  403. end Research.PvsNP.Tau
  404. end