Documentation

LeanCert.Core.IntervalRat.LogReduction

Verified Argument Reduction for Logarithm #

This file provides argument reduction for computing log(q) using the identity: log(q) = log(m) + k * log(2) where m = q * 2^(-k) is in a "good" range [1/2, 2] for Taylor series convergence.

Main definitions #

Main theorems #

Design notes #

This reduction allows us to use the rapidly converging atanh-based series: log(m) = 2 * atanh((m-1)/(m+1)) For m ∈ [1/2, 2], we have (m-1)/(m+1) ∈ [-1/3, 1/3], where atanh converges very fast.

Argument Reduction #

Find k such that q * 2^(-k) is approximately in [1/2, 2]. Implementation: k = log2(num) - log2(den) approximately.

Equations
Instances For

    The reduced mantissa m = q * 2^(-k).

    Equations
    Instances For
      theorem LeanCert.Core.LogReduction.reconstruction_eq {q : } (hq : 0 < q) :
      have k := reductionExponent q; have m := reduceMantissa q; q = m * 2 ^ k

      The main algebraic theorem: q = m * 2^k for positive q

      theorem LeanCert.Core.LogReduction.reduced_bounds_weak {q : } (hq : 0 < q) :
      have m := reduceMantissa q; 1 / 4 m m 4

      The reduced mantissa is bounded: 1/4 ≤ m ≤ 4 for q > 0. (We use slightly weaker bounds than [1/2, 2] for simpler proofs, but the series still converges rapidly.)

      theorem LeanCert.Core.LogReduction.reduced_bounds {q : } (hq : 0 < q) :
      have m := reduceMantissa q; 1 / 2 m m 2

      Tighter bounds: 1/2 ≤ m ≤ 2 for most q > 0

      The reduced mantissa is positive for positive input

      Connection to Real.log #

      theorem LeanCert.Core.LogReduction.log_reduction {q : } (hq : 0 < q) :
      have k := reductionExponent q; have m := reduceMantissa q; Real.log q = Real.log m + k * Real.log 2

      Key algebraic identity for Real.log: log(q) = log(m) + k * log(2)

      theorem LeanCert.Core.LogReduction.atanh_arg_bounds {m : } (hlo : 1 / 2 m) (hhi : m 2) :
      have y := (m - 1) / (m + 1); -1 / 3 y y 1 / 3

      The transformation y = (m-1)/(m+1) maps m ∈ [1/2, 2] to y ∈ [-1/3, 1/3]

      theorem LeanCert.Core.LogReduction.log_via_atanh {m : } (hm_pos : 0 < m) :
      Real.log m = 2 * Real.atanh ((m - 1) / (m + 1))

      log(m) = 2 * atanh((m-1)/(m+1)) for m > 0 with m ≠ 1