Lean / Reader
Lean reader

EPlusPiDenominator.lean

73 lines6 declarationsno sorryimports Mathlib
  1. import Mathlib
  2. /-!
  3. # A kernel-checked rational-denominator bound for `e + π`
  4. `farey_denom_bound`: if `a/b < p/q < c/d` with `b c - a d = 1` (Farey neighbours) and `b, d, q > 0`,
  5. then `q ≥ b + d`.
  6. `e_add_pi_denom_bound`: if `exp 1 + π = p / q` with `q > 0`, then `q ≥ 37445`.
  7. The proof uses only Mathlib's certified decimal bounds `Real.exp_one_gt_d9`, `Real.exp_one_lt_d9`,
  8. `Real.pi_gt_d20`, `Real.pi_lt_d20`, and the consecutive continued-fraction convergents
  9. `159664/27247 < e + π < 59759/10198` (Farey neighbours: `27247 * 59759 - 159664 * 10198 = 1`).
  10. The much stronger bound from the 10^7-digit computation is NOT formalised here.
  11. -/
  12. open Real
  13. theorem farey_denom_bound {a b c d p q : ℤ} (hb : 0 < b) (hd : 0 < d)
  14. (hdet : b * c - a * d = 1) (h1 : a * q < p * b) (h2 : p * d < c * q) : b + d ≤ q := by
  15. have key : q = b * (c * q - p * d) + d * (p * b - a * q) := by
  16. linear_combination (-q) * hdet
  17. have hX : 1 ≤ c * q - p * d := by linarith [Int.lt_iff_add_one_le.mp h2]
  18. have hY : 1 ≤ p * b - a * q := by linarith [Int.lt_iff_add_one_le.mp h1]
  19. have e1 : b * 1 ≤ b * (c * q - p * d) := mul_le_mul_of_nonneg_left hX hb.le
  20. have e2 : d * 1 ≤ d * (p * b - a * q) := mul_le_mul_of_nonneg_left hY hd.le
  21. linarith
  22. theorem e_add_pi_lower : (159664 : ℝ) / 27247 < exp 1 + π := by
  23. have h1 := Real.exp_one_gt_d9
  24. have h2 := Real.pi_gt_d20
  25. norm_num at h1 h2 ⊢
  26. linarith
  27. theorem e_add_pi_upper : exp 1 + π < (59759 : ℝ) / 10198 := by
  28. have h1 := Real.exp_one_lt_d9
  29. have h2 := Real.pi_lt_d20
  30. norm_num at h1 h2 ⊢
  31. linarith
  32. theorem e_add_pi_denom_bound (p q : ℤ) (hq : 0 < q) (h : exp 1 + π = (p : ℝ) / q) :
  33. 37445 ≤ q := by
  34. have hqR : (0 : ℝ) < q := by exact_mod_cast hq
  35. have lo := e_add_pi_lower
  36. have hi := e_add_pi_upper
  37. rw [h] at lo hi
  38. have h1 : (159664 : ℤ) * q < p * 27247 := by
  39. have := (div_lt_div_iff₀ (by norm_num : (0 : ℝ) < 27247) hqR).1 lo
  40. exact_mod_cast this
  41. have h2 : p * 10198 < 59759 * q := by
  42. have := (div_lt_div_iff₀ hqR (by norm_num : (0 : ℝ) < 10198)).1 hi
  43. exact_mod_cast this
  44. have := farey_denom_bound (a := 159664) (b := 27247) (c := 59759) (d := 10198)
  45. (by norm_num) (by norm_num) (by norm_num) h1 h2
  46. linarith
  47. /-- Corollary in the form "e + π is not a fraction with small denominator". -/
  48. theorem e_add_pi_ne_small_fraction (p q : ℤ) (hq : 0 < q) (hsmall : q < 37445) :
  49. exp 1 + π ≠ (p : ℝ) / q := fun h => absurd (e_add_pi_denom_bound p q hq h) (by omega)
  50. /-- Any representation `11 (e + π) = A / D` with `D > 0` (lowest terms or not) has `D ≥ 3405`. -/
  51. theorem eleven_e_add_pi_den_bound (A D : ℤ) (hD : 0 < D)
  52. (h : 11 * (exp 1 + π) = (A : ℝ) / D) : 3405 ≤ D := by
  53. have hDR : (0 : ℝ) < D := by exact_mod_cast hD
  54. have h' : exp 1 + π = (A : ℝ) / ((11 * D : ℤ) : ℝ) := by
  55. push_cast
  56. rw [div_mul_eq_div_div_swap] at *
  57. field_simp
  58. field_simp at h
  59. linarith
  60. have := e_add_pi_denom_bound A (11 * D) (by omega) h'
  61. omega