Lean / Reader
Lean reader

RecordProducts.lean

60 lines7 declarationsno sorryimports Mathlib.Tactic RecordBounds

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

  1. import Mathlib.Tactic
  2. import RecordBounds
  3. namespace ReciprocalRecords
  4. noncomputable section
  5. def pairProduct (x y : ℝ) : ℝ := |x| * |y| * |x-y|
  6. def fourProduct (x y z u : ℝ) : ℝ :=
  7. |x| * |y| * |z| * |u| * |x-y| * |x-z| * |x-u| * |y-z| * |y-u| * |z-u|
  8. theorem gap_bound {x y : ℝ} (h : |y| ≤ |x|) : |x - y| ≤ 2 * |x| := by
  9. calc |x-y| ≤ |x| + |y| := abs_sub _ _
  10. _ ≤ 2 * |x| := by linarith
  11. theorem pairProduct_le {x y : ℝ} (h : |y| ≤ |x|) :
  12. pairProduct x y ≤ 2 * |x|^2 * |y| := by
  13. calc
  14. _ ≤ |x| * |y| * (2 * |x|) := by
  15. unfold pairProduct
  16. exact mul_le_mul_of_nonneg_left (gap_bound h) (by positivity)
  17. _ = _ := by ring
  18. theorem fourProduct_le {x y z u : ℝ} (hxy : |y| ≤ |x|) (hyz : |z| ≤ |y|) (hzu : |u| ≤ |z|) :
  19. fourProduct x y z u ≤ 64 * |x|^4 * |y|^3 * |z|^2 * |u| := by
  20. calc
  21. _ ≤ |x| * |y| * |z| * |u| * (2*|x|) * (2*|x|) * (2*|x|) *
  22. (2*|y|) * (2*|y|) * (2*|z|) := by
  23. unfold fourProduct
  24. gcongr
  25. · exact gap_bound hxy
  26. · exact gap_bound (hyz.trans hxy)
  27. · exact gap_bound (hzu.trans (hyz.trans hxy))
  28. · exact gap_bound hyz
  29. · exact gap_bound (hzu.trans hyz)
  30. · exact gap_bound hzu
  31. _ = _ := by ring
  32. /-- If a common denominator rules out a good approximation at the left endpoint,
  33. equal minima at both endpoints are inconsistent with the proposed right bound. -/
  34. theorem interval_drop {d₀ d₁ L c y : ℝ} (hL : 0 < L)
  35. (h₀ : 1 / L ≤ d₀) (h₁ : d₁ ≤ Real.exp (-c*y))
  36. (hlog : Real.log L < c*y) : d₁ < d₀ := by
  37. apply lt_of_le_of_lt h₁
  38. apply lt_of_lt_of_le _ h₀
  39. rw [neg_mul, Real.exp_neg, one_div, inv_lt_inv₀ (Real.exp_pos _) hL]
  40. rwa [← Real.log_lt_log_iff hL (Real.exp_pos _), Real.log_exp]
  41. /-- Every good index supplies an interval of good earlier indices for a larger exponent. -/
  42. theorem density_interval {f : ℕ → ℝ} (hf : Antitone f) {m n : ℕ} (hmn : m ≤ n)
  43. {c c' : ℝ} (hgood : Real.exp (-c * n) < f n) (hcut : c*n ≤ c'*m) :
  44. Real.exp (-c'*m) < f m := by
  45. apply lt_of_le_of_lt _ (lt_of_lt_of_le hgood (hf hmn))
  46. apply Real.exp_le_exp.mpr
  47. linarith
  48. end
  49. end ReciprocalRecords