import Mathlib/-!# A kernel-checked rational-denominator bound for `e + π``farey_denom_bound`: if `a/b < p/q < c/d` with `b c - a d = 1` (Farey neighbours) and `b, d, q > 0`,then `q ≥ b + d`.`e_add_pi_denom_bound`: if `exp 1 + π = p / q` with `q > 0`, then `q ≥ 37445`.The proof uses only Mathlib's certified decimal bounds `Real.exp_one_gt_d9`, `Real.exp_one_lt_d9`,`Real.pi_gt_d20`, `Real.pi_lt_d20`, and the consecutive continued-fraction convergents`159664/27247 < e + π < 59759/10198` (Farey neighbours: `27247 * 59759 - 159664 * 10198 = 1`).The much stronger bound from the 10^7-digit computation is NOT formalised here.-/open Realtheorem farey_denom_bound {a b c d p q : ℤ} (hb : 0 < b) (hd : 0 < d)(hdet : b * c - a * d = 1) (h1 : a * q < p * b) (h2 : p * d < c * q) : b + d ≤ q := byhave key : q = b * (c * q - p * d) + d * (p * b - a * q) := bylinear_combination (-q) * hdethave hX : 1 ≤ c * q - p * d := by linarith [Int.lt_iff_add_one_le.mp h2]have hY : 1 ≤ p * b - a * q := by linarith [Int.lt_iff_add_one_le.mp h1]have e1 : b * 1 ≤ b * (c * q - p * d) := mul_le_mul_of_nonneg_left hX hb.lehave e2 : d * 1 ≤ d * (p * b - a * q) := mul_le_mul_of_nonneg_left hY hd.lelinariththeorem e_add_pi_lower : (159664 : ℝ) / 27247 < exp 1 + π := byhave h1 := Real.exp_one_gt_d9have h2 := Real.pi_gt_d20norm_num at h1 h2 ⊢linariththeorem e_add_pi_upper : exp 1 + π < (59759 : ℝ) / 10198 := byhave h1 := Real.exp_one_lt_d9have h2 := Real.pi_lt_d20norm_num at h1 h2 ⊢linariththeorem e_add_pi_denom_bound (p q : ℤ) (hq : 0 < q) (h : exp 1 + π = (p : ℝ) / q) :37445 ≤ q := byhave hqR : (0 : ℝ) < q := by exact_mod_cast hqhave lo := e_add_pi_lowerhave hi := e_add_pi_upperrw [h] at lo hihave h1 : (159664 : ℤ) * q < p * 27247 := byhave := (div_lt_div_iff₀ (by norm_num : (0 : ℝ) < 27247) hqR).1 loexact_mod_cast thishave h2 : p * 10198 < 59759 * q := byhave := (div_lt_div_iff₀ hqR (by norm_num : (0 : ℝ) < 10198)).1 hiexact_mod_cast thishave := farey_denom_bound (a := 159664) (b := 27247) (c := 59759) (d := 10198)(by norm_num) (by norm_num) (by norm_num) h1 h2linarith/-- Corollary in the form "e + π is not a fraction with small denominator". -/theorem e_add_pi_ne_small_fraction (p q : ℤ) (hq : 0 < q) (hsmall : q < 37445) :exp 1 + π ≠ (p : ℝ) / q := fun h => absurd (e_add_pi_denom_bound p q hq h) (by omega)