Pratik Patil

RationalLogEvaluation.lean

1module2public import SubentropyCertificates.LogEnclosure34/-! Rational endpoints for evaluating the logarithms in Appendix F. -/5@[expose] public section6open Finset7namespace SubentropyCertificates.LogEnclosure89def logLower (n : ℕ) (y : ℚ) : ℚ :=10  let z := (y-1)/(y+1)11  2 * ∑ j ∈ range n, z^(2*j+1)/(2*j+1 : ℚ)1213def logUpper (n : ℕ) (y : ℚ) : ℚ :=14  let z := (y-1)/(y+1)15  logLower n y + 2*z^(2*n+1)/((2*n+1 : ℚ)*(1-z^2))1617/-- The computable rational endpoints enclose the real logarithm. -/18theorem rational_log_bounds (n : ℕ) {y : ℚ} (hy : 1 ≤ y) :19    (logLower n y : ℝ) ≤ Real.log y ∧ Real.log y ≤ (logUpper n y : ℝ) := by20  have h := rational_log_enclosure (y := (y : ℝ)) (by exact_mod_cast hy) n21  dsimp only at h22  unfold logUpper logLower23  push_cast24  constructor <;> linarith [h.1,h.2]2526/-- A finite rational interval after restoring the factor 2^m for a small argument. -/27theorem scaled_log_bounds (n m : ℕ) {x : ℚ} (hx : 0 < x) (hy : 1 ≤ 2^m*x) :28    (logLower n (2^m*x) - m*logUpper n 2 : ℚ) ≤ Real.log x ∧29      Real.log x ≤ (logUpper n (2^m*x) - m*logLower n 2 : ℚ) := by30  have h := rational_log_bounds n hy31  have h2 := rational_log_bounds n (y := 2) (by norm_num)32  have he : Real.log ((2^m*x : ℚ) : ℝ) = (m:ℝ)*Real.log 2 + Real.log x := by33    push_cast34    rw [Real.log_mul (by positivity) (by exact_mod_cast hx.ne'), Real.log_pow]35  rw [he] at h36  push_cast at h2 ⊢37  constructor38  · linarith [mul_le_mul_of_nonneg_left h2.2 (Nat.cast_nonneg (α := ℝ) m),h.1]39  · linarith [mul_le_mul_of_nonneg_left h2.1 (Nat.cast_nonneg (α := ℝ) m),h.2]4041end SubentropyCertificates.LogEnclosure

Axioms used

Choose a statement to see which axioms its proof uses.