Lean / janjarosz05/0kwas / Erdos1094BelowData.lean
Lean reader

Kwas/Erdos1094BelowData.lean

244 lines3 declarationsno sorryimports Kwas.Erdos1094Below1 Kwas.Erdos1094Below2 Kwas.Erdos1094Below3 Kwas.Erdos1094Below4

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Kwas.Erdos1094Below1, Kwas.Erdos1094Below2, Kwas.Erdos1094Below3, Kwas.Erdos1094Below4, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import Kwas.Erdos1094Below1
  2. import Kwas.Erdos1094Below2
  3. import Kwas.Erdos1094Below3
  4. import Kwas.Erdos1094Below4
  5. /-! Erdős Problem 1094: the half `n < k ^ 2` for `k ≤ 1000`, assembled from the kernel runs of
  6. `Kwas.Erdos1094Below1` … `Kwas.Erdos1094Below4` (generated by
  7. `reports/erdos1094_criteria/gen_below.py 1000 10 530,730,875`; continues namespace Erdos1093). -/
  8. namespace Erdos1093
  9. /-- **The half `n < k ^ 2` for `k ≤ 1000`.** Every exception `(n, k)` of Erdős problem 1094 with
  10. `k ≤ 1000` and `n < k ^ 2` is one of the 14 known exceptions (in fact one of the 13 of `below13`). -/
  11. theorem exc_below_sq {n k : ℕ} (hk : k ≤ 1000) (hn : n < k * k) (he : (n, k) ∈ Exc) :
  12. (n, k) ∈ known14 := by
  13. have hk2 : 2 ≤ k := by
  14. obtain ⟨h0, h2, -⟩ := he
  15. by_contra hc
  16. have h1 : k = 1 := by omega
  17. subst h1
  18. omega
  19. rcases Nat.lt_or_ge k 12 with h | h
  20. · exact exc_of_chkFrom_len belowData2 2 10 belowData2_ok belowData2_len (by omega) (by omega) he hn
  21. rcases Nat.lt_or_ge k 22 with h | h
  22. · exact exc_of_chkFrom_len belowData12 12 10 belowData12_ok belowData12_len (by omega) (by omega) he hn
  23. rcases Nat.lt_or_ge k 32 with h | h
  24. · exact exc_of_chkFrom_len belowData22 22 10 belowData22_ok belowData22_len (by omega) (by omega) he hn
  25. rcases Nat.lt_or_ge k 42 with h | h
  26. · exact exc_of_chkFrom_len belowData32 32 10 belowData32_ok belowData32_len (by omega) (by omega) he hn
  27. rcases Nat.lt_or_ge k 52 with h | h
  28. · exact exc_of_chkFrom_len belowData42 42 10 belowData42_ok belowData42_len (by omega) (by omega) he hn
  29. rcases Nat.lt_or_ge k 62 with h | h
  30. · exact exc_of_chkFrom_len belowData52 52 10 belowData52_ok belowData52_len (by omega) (by omega) he hn
  31. rcases Nat.lt_or_ge k 72 with h | h
  32. · exact exc_of_chkFrom_len belowData62 62 10 belowData62_ok belowData62_len (by omega) (by omega) he hn
  33. rcases Nat.lt_or_ge k 82 with h | h
  34. · exact exc_of_chkFrom_len belowData72 72 10 belowData72_ok belowData72_len (by omega) (by omega) he hn
  35. rcases Nat.lt_or_ge k 92 with h | h
  36. · exact exc_of_chkFrom_len belowData82 82 10 belowData82_ok belowData82_len (by omega) (by omega) he hn
  37. rcases Nat.lt_or_ge k 102 with h | h
  38. · exact exc_of_chkFrom_len belowData92 92 10 belowData92_ok belowData92_len (by omega) (by omega) he hn
  39. rcases Nat.lt_or_ge k 112 with h | h
  40. · exact exc_of_chkFrom_len belowData102 102 10 belowData102_ok belowData102_len (by omega) (by omega) he hn
  41. rcases Nat.lt_or_ge k 122 with h | h
  42. · exact exc_of_chkFrom_len belowData112 112 10 belowData112_ok belowData112_len (by omega) (by omega) he hn
  43. rcases Nat.lt_or_ge k 132 with h | h
  44. · exact exc_of_chkFrom_len belowData122 122 10 belowData122_ok belowData122_len (by omega) (by omega) he hn
  45. rcases Nat.lt_or_ge k 142 with h | h
  46. · exact exc_of_chkFrom_len belowData132 132 10 belowData132_ok belowData132_len (by omega) (by omega) he hn
  47. rcases Nat.lt_or_ge k 152 with h | h
  48. · exact exc_of_chkFrom_len belowData142 142 10 belowData142_ok belowData142_len (by omega) (by omega) he hn
  49. rcases Nat.lt_or_ge k 162 with h | h
  50. · exact exc_of_chkFrom_len belowData152 152 10 belowData152_ok belowData152_len (by omega) (by omega) he hn
  51. rcases Nat.lt_or_ge k 172 with h | h
  52. · exact exc_of_chkFrom_len belowData162 162 10 belowData162_ok belowData162_len (by omega) (by omega) he hn
  53. rcases Nat.lt_or_ge k 182 with h | h
  54. · exact exc_of_chkFrom_len belowData172 172 10 belowData172_ok belowData172_len (by omega) (by omega) he hn
  55. rcases Nat.lt_or_ge k 192 with h | h
  56. · exact exc_of_chkFrom_len belowData182 182 10 belowData182_ok belowData182_len (by omega) (by omega) he hn
  57. rcases Nat.lt_or_ge k 202 with h | h
  58. · exact exc_of_chkFrom_len belowData192 192 10 belowData192_ok belowData192_len (by omega) (by omega) he hn
  59. rcases Nat.lt_or_ge k 212 with h | h
  60. · exact exc_of_chkFrom_len belowData202 202 10 belowData202_ok belowData202_len (by omega) (by omega) he hn
  61. rcases Nat.lt_or_ge k 222 with h | h
  62. · exact exc_of_chkFrom_len belowData212 212 10 belowData212_ok belowData212_len (by omega) (by omega) he hn
  63. rcases Nat.lt_or_ge k 232 with h | h
  64. · exact exc_of_chkFrom_len belowData222 222 10 belowData222_ok belowData222_len (by omega) (by omega) he hn
  65. rcases Nat.lt_or_ge k 242 with h | h
  66. · exact exc_of_chkFrom_len belowData232 232 10 belowData232_ok belowData232_len (by omega) (by omega) he hn
  67. rcases Nat.lt_or_ge k 252 with h | h
  68. · exact exc_of_chkFrom_len belowData242 242 10 belowData242_ok belowData242_len (by omega) (by omega) he hn
  69. rcases Nat.lt_or_ge k 262 with h | h
  70. · exact exc_of_chkFrom_len belowData252 252 10 belowData252_ok belowData252_len (by omega) (by omega) he hn
  71. rcases Nat.lt_or_ge k 272 with h | h
  72. · exact exc_of_chkFrom_len belowData262 262 10 belowData262_ok belowData262_len (by omega) (by omega) he hn
  73. rcases Nat.lt_or_ge k 282 with h | h
  74. · exact exc_of_chkFrom_len belowData272 272 10 belowData272_ok belowData272_len (by omega) (by omega) he hn
  75. rcases Nat.lt_or_ge k 292 with h | h
  76. · exact exc_of_chkFrom_len belowData282 282 10 belowData282_ok belowData282_len (by omega) (by omega) he hn
  77. rcases Nat.lt_or_ge k 302 with h | h
  78. · exact exc_of_chkFrom_len belowData292 292 10 belowData292_ok belowData292_len (by omega) (by omega) he hn
  79. rcases Nat.lt_or_ge k 312 with h | h
  80. · exact exc_of_chkFrom_len belowData302 302 10 belowData302_ok belowData302_len (by omega) (by omega) he hn
  81. rcases Nat.lt_or_ge k 322 with h | h
  82. · exact exc_of_chkFrom_len belowData312 312 10 belowData312_ok belowData312_len (by omega) (by omega) he hn
  83. rcases Nat.lt_or_ge k 332 with h | h
  84. · exact exc_of_chkFrom_len belowData322 322 10 belowData322_ok belowData322_len (by omega) (by omega) he hn
  85. rcases Nat.lt_or_ge k 342 with h | h
  86. · exact exc_of_chkFrom_len belowData332 332 10 belowData332_ok belowData332_len (by omega) (by omega) he hn
  87. rcases Nat.lt_or_ge k 352 with h | h
  88. · exact exc_of_chkFrom_len belowData342 342 10 belowData342_ok belowData342_len (by omega) (by omega) he hn
  89. rcases Nat.lt_or_ge k 362 with h | h
  90. · exact exc_of_chkFrom_len belowData352 352 10 belowData352_ok belowData352_len (by omega) (by omega) he hn
  91. rcases Nat.lt_or_ge k 372 with h | h
  92. · exact exc_of_chkFrom_len belowData362 362 10 belowData362_ok belowData362_len (by omega) (by omega) he hn
  93. rcases Nat.lt_or_ge k 382 with h | h
  94. · exact exc_of_chkFrom_len belowData372 372 10 belowData372_ok belowData372_len (by omega) (by omega) he hn
  95. rcases Nat.lt_or_ge k 392 with h | h
  96. · exact exc_of_chkFrom_len belowData382 382 10 belowData382_ok belowData382_len (by omega) (by omega) he hn
  97. rcases Nat.lt_or_ge k 402 with h | h
  98. · exact exc_of_chkFrom_len belowData392 392 10 belowData392_ok belowData392_len (by omega) (by omega) he hn
  99. rcases Nat.lt_or_ge k 412 with h | h
  100. · exact exc_of_chkFrom_len belowData402 402 10 belowData402_ok belowData402_len (by omega) (by omega) he hn
  101. rcases Nat.lt_or_ge k 422 with h | h
  102. · exact exc_of_chkFrom_len belowData412 412 10 belowData412_ok belowData412_len (by omega) (by omega) he hn
  103. rcases Nat.lt_or_ge k 432 with h | h
  104. · exact exc_of_chkFrom_len belowData422 422 10 belowData422_ok belowData422_len (by omega) (by omega) he hn
  105. rcases Nat.lt_or_ge k 442 with h | h
  106. · exact exc_of_chkFrom_len belowData432 432 10 belowData432_ok belowData432_len (by omega) (by omega) he hn
  107. rcases Nat.lt_or_ge k 452 with h | h
  108. · exact exc_of_chkFrom_len belowData442 442 10 belowData442_ok belowData442_len (by omega) (by omega) he hn
  109. rcases Nat.lt_or_ge k 462 with h | h
  110. · exact exc_of_chkFrom_len belowData452 452 10 belowData452_ok belowData452_len (by omega) (by omega) he hn
  111. rcases Nat.lt_or_ge k 472 with h | h
  112. · exact exc_of_chkFrom_len belowData462 462 10 belowData462_ok belowData462_len (by omega) (by omega) he hn
  113. rcases Nat.lt_or_ge k 482 with h | h
  114. · exact exc_of_chkFrom_len belowData472 472 10 belowData472_ok belowData472_len (by omega) (by omega) he hn
  115. rcases Nat.lt_or_ge k 492 with h | h
  116. · exact exc_of_chkFrom_len belowData482 482 10 belowData482_ok belowData482_len (by omega) (by omega) he hn
  117. rcases Nat.lt_or_ge k 502 with h | h
  118. · exact exc_of_chkFrom_len belowData492 492 10 belowData492_ok belowData492_len (by omega) (by omega) he hn
  119. rcases Nat.lt_or_ge k 512 with h | h
  120. · exact exc_of_chkFrom_len belowData502 502 10 belowData502_ok belowData502_len (by omega) (by omega) he hn
  121. rcases Nat.lt_or_ge k 522 with h | h
  122. · exact exc_of_chkFrom_len belowData512 512 10 belowData512_ok belowData512_len (by omega) (by omega) he hn
  123. rcases Nat.lt_or_ge k 531 with h | h
  124. · exact exc_of_chkFrom_len belowData522 522 9 belowData522_ok belowData522_len (by omega) (by omega) he hn
  125. rcases Nat.lt_or_ge k 541 with h | h
  126. · exact exc_of_chkFrom_len belowData531 531 10 belowData531_ok belowData531_len (by omega) (by omega) he hn
  127. rcases Nat.lt_or_ge k 551 with h | h
  128. · exact exc_of_chkFrom_len belowData541 541 10 belowData541_ok belowData541_len (by omega) (by omega) he hn
  129. rcases Nat.lt_or_ge k 561 with h | h
  130. · exact exc_of_chkFrom_len belowData551 551 10 belowData551_ok belowData551_len (by omega) (by omega) he hn
  131. rcases Nat.lt_or_ge k 571 with h | h
  132. · exact exc_of_chkFrom_len belowData561 561 10 belowData561_ok belowData561_len (by omega) (by omega) he hn
  133. rcases Nat.lt_or_ge k 581 with h | h
  134. · exact exc_of_chkFrom_len belowData571 571 10 belowData571_ok belowData571_len (by omega) (by omega) he hn
  135. rcases Nat.lt_or_ge k 591 with h | h
  136. · exact exc_of_chkFrom_len belowData581 581 10 belowData581_ok belowData581_len (by omega) (by omega) he hn
  137. rcases Nat.lt_or_ge k 601 with h | h
  138. · exact exc_of_chkFrom_len belowData591 591 10 belowData591_ok belowData591_len (by omega) (by omega) he hn
  139. rcases Nat.lt_or_ge k 611 with h | h
  140. · exact exc_of_chkFrom_len belowData601 601 10 belowData601_ok belowData601_len (by omega) (by omega) he hn
  141. rcases Nat.lt_or_ge k 621 with h | h
  142. · exact exc_of_chkFrom_len belowData611 611 10 belowData611_ok belowData611_len (by omega) (by omega) he hn
  143. rcases Nat.lt_or_ge k 631 with h | h
  144. · exact exc_of_chkFrom_len belowData621 621 10 belowData621_ok belowData621_len (by omega) (by omega) he hn
  145. rcases Nat.lt_or_ge k 641 with h | h
  146. · exact exc_of_chkFrom_len belowData631 631 10 belowData631_ok belowData631_len (by omega) (by omega) he hn
  147. rcases Nat.lt_or_ge k 651 with h | h
  148. · exact exc_of_chkFrom_len belowData641 641 10 belowData641_ok belowData641_len (by omega) (by omega) he hn
  149. rcases Nat.lt_or_ge k 661 with h | h
  150. · exact exc_of_chkFrom_len belowData651 651 10 belowData651_ok belowData651_len (by omega) (by omega) he hn
  151. rcases Nat.lt_or_ge k 671 with h | h
  152. · exact exc_of_chkFrom_len belowData661 661 10 belowData661_ok belowData661_len (by omega) (by omega) he hn
  153. rcases Nat.lt_or_ge k 681 with h | h
  154. · exact exc_of_chkFrom_len belowData671 671 10 belowData671_ok belowData671_len (by omega) (by omega) he hn
  155. rcases Nat.lt_or_ge k 691 with h | h
  156. · exact exc_of_chkFrom_len belowData681 681 10 belowData681_ok belowData681_len (by omega) (by omega) he hn
  157. rcases Nat.lt_or_ge k 701 with h | h
  158. · exact exc_of_chkFrom_len belowData691 691 10 belowData691_ok belowData691_len (by omega) (by omega) he hn
  159. rcases Nat.lt_or_ge k 711 with h | h
  160. · exact exc_of_chkFrom_len belowData701 701 10 belowData701_ok belowData701_len (by omega) (by omega) he hn
  161. rcases Nat.lt_or_ge k 721 with h | h
  162. · exact exc_of_chkFrom_len belowData711 711 10 belowData711_ok belowData711_len (by omega) (by omega) he hn
  163. rcases Nat.lt_or_ge k 731 with h | h
  164. · exact exc_of_chkFrom_len belowData721 721 10 belowData721_ok belowData721_len (by omega) (by omega) he hn
  165. rcases Nat.lt_or_ge k 741 with h | h
  166. · exact exc_of_chkFrom_len belowData731 731 10 belowData731_ok belowData731_len (by omega) (by omega) he hn
  167. rcases Nat.lt_or_ge k 751 with h | h
  168. · exact exc_of_chkFrom_len belowData741 741 10 belowData741_ok belowData741_len (by omega) (by omega) he hn
  169. rcases Nat.lt_or_ge k 761 with h | h
  170. · exact exc_of_chkFrom_len belowData751 751 10 belowData751_ok belowData751_len (by omega) (by omega) he hn
  171. rcases Nat.lt_or_ge k 771 with h | h
  172. · exact exc_of_chkFrom_len belowData761 761 10 belowData761_ok belowData761_len (by omega) (by omega) he hn
  173. rcases Nat.lt_or_ge k 781 with h | h
  174. · exact exc_of_chkFrom_len belowData771 771 10 belowData771_ok belowData771_len (by omega) (by omega) he hn
  175. rcases Nat.lt_or_ge k 791 with h | h
  176. · exact exc_of_chkFrom_len belowData781 781 10 belowData781_ok belowData781_len (by omega) (by omega) he hn
  177. rcases Nat.lt_or_ge k 801 with h | h
  178. · exact exc_of_chkFrom_len belowData791 791 10 belowData791_ok belowData791_len (by omega) (by omega) he hn
  179. rcases Nat.lt_or_ge k 811 with h | h
  180. · exact exc_of_chkFrom_len belowData801 801 10 belowData801_ok belowData801_len (by omega) (by omega) he hn
  181. rcases Nat.lt_or_ge k 821 with h | h
  182. · exact exc_of_chkFrom_len belowData811 811 10 belowData811_ok belowData811_len (by omega) (by omega) he hn
  183. rcases Nat.lt_or_ge k 831 with h | h
  184. · exact exc_of_chkFrom_len belowData821 821 10 belowData821_ok belowData821_len (by omega) (by omega) he hn
  185. rcases Nat.lt_or_ge k 841 with h | h
  186. · exact exc_of_chkFrom_len belowData831 831 10 belowData831_ok belowData831_len (by omega) (by omega) he hn
  187. rcases Nat.lt_or_ge k 851 with h | h
  188. · exact exc_of_chkFrom_len belowData841 841 10 belowData841_ok belowData841_len (by omega) (by omega) he hn
  189. rcases Nat.lt_or_ge k 861 with h | h
  190. · exact exc_of_chkFrom_len belowData851 851 10 belowData851_ok belowData851_len (by omega) (by omega) he hn
  191. rcases Nat.lt_or_ge k 871 with h | h
  192. · exact exc_of_chkFrom_len belowData861 861 10 belowData861_ok belowData861_len (by omega) (by omega) he hn
  193. rcases Nat.lt_or_ge k 876 with h | h
  194. · exact exc_of_chkFrom_len belowData871 871 5 belowData871_ok belowData871_len (by omega) (by omega) he hn
  195. rcases Nat.lt_or_ge k 886 with h | h
  196. · exact exc_of_chkFrom_len belowData876 876 10 belowData876_ok belowData876_len (by omega) (by omega) he hn
  197. rcases Nat.lt_or_ge k 896 with h | h
  198. · exact exc_of_chkFrom_len belowData886 886 10 belowData886_ok belowData886_len (by omega) (by omega) he hn
  199. rcases Nat.lt_or_ge k 906 with h | h
  200. · exact exc_of_chkFrom_len belowData896 896 10 belowData896_ok belowData896_len (by omega) (by omega) he hn
  201. rcases Nat.lt_or_ge k 916 with h | h
  202. · exact exc_of_chkFrom_len belowData906 906 10 belowData906_ok belowData906_len (by omega) (by omega) he hn
  203. rcases Nat.lt_or_ge k 926 with h | h
  204. · exact exc_of_chkFrom_len belowData916 916 10 belowData916_ok belowData916_len (by omega) (by omega) he hn
  205. rcases Nat.lt_or_ge k 936 with h | h
  206. · exact exc_of_chkFrom_len belowData926 926 10 belowData926_ok belowData926_len (by omega) (by omega) he hn
  207. rcases Nat.lt_or_ge k 946 with h | h
  208. · exact exc_of_chkFrom_len belowData936 936 10 belowData936_ok belowData936_len (by omega) (by omega) he hn
  209. rcases Nat.lt_or_ge k 956 with h | h
  210. · exact exc_of_chkFrom_len belowData946 946 10 belowData946_ok belowData946_len (by omega) (by omega) he hn
  211. rcases Nat.lt_or_ge k 966 with h | h
  212. · exact exc_of_chkFrom_len belowData956 956 10 belowData956_ok belowData956_len (by omega) (by omega) he hn
  213. rcases Nat.lt_or_ge k 976 with h | h
  214. · exact exc_of_chkFrom_len belowData966 966 10 belowData966_ok belowData966_len (by omega) (by omega) he hn
  215. rcases Nat.lt_or_ge k 986 with h | h
  216. · exact exc_of_chkFrom_len belowData976 976 10 belowData976_ok belowData976_len (by omega) (by omega) he hn
  217. rcases Nat.lt_or_ge k 996 with h | h
  218. · exact exc_of_chkFrom_len belowData986 986 10 belowData986_ok belowData986_len (by omega) (by omega) he hn
  219. exact exc_of_chkFrom_len belowData996 996 5 belowData996_ok belowData996_len (by omega) (by omega) he hn
  220. /-- For `k ≤ 1000` and `n < k ^ 2`: `(n, k)` is an exception iff it is one of the 14 known ones. -/
  221. theorem exc_iff_below_sq {n k : ℕ} (hk : k ≤ 1000) (hn : n < k * k) :
  222. (n, k) ∈ Exc ↔ (n, k) ∈ known14 :=
  223. ⟨fun he => exc_below_sq hk hn he, fun h => known14_subset h⟩
  224. /-- For `29 ≤ k ≤ 1000` and every `n` with `2k ≤ n < k ^ 2` some prime `p ≤ k` divides `C(n, k)`.
  225. The range `k + 2 ≤ n < 2k`, which is also needed for `g(k) ≥ k ^ 2`, is in `Kwas.Erdos1094Low`
  226. (`exists_prime_dvd_choose_lt_sq`). -/
  227. theorem exists_prime_dvd_choose_below_sq {n k : ℕ} (h29 : 29 ≤ k) (hk : k ≤ 1000) (h2 : 2 * k ≤ n)
  228. (hn : n < k * k) : ∃ p : ℕ, p.Prime ∧ p ≤ k ∧ p ∣ n.choose k := by
  229. refine exists_prime_dvd_of_not_exc (by omega) h2 hn fun he => ?_
  230. have hmem := exc_below_sq hk hn he
  231. have h28 : k ≤ 28 := known14_k_le _ hmem
  232. omega
  233. end Erdos1093
  234. #print axioms Erdos1093.exc_below_sq
  235. #print axioms Erdos1093.exc_iff_below_sq
  236. #print axioms Erdos1093.exists_prime_dvd_choose_below_sq