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 #
reductionExponent- Find k such that q * 2^(-k) is in [1/2, 2]reduceMantissa- The reduced mantissa m = q * 2^(-k)
Main theorems #
reconstruction_eq- Algebraic identity: q = m * 2^kreduced_bounds- Bounds on m: 1/2 ≤ m ≤ 2 for q > 0
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
- LeanCert.Core.LogReduction.reduceMantissa q = if q ≤ 0 then 1 else have k := LeanCert.Core.LogReduction.reductionExponent q; q * 2 ^ (-k)
Instances For
The main algebraic theorem: q = m * 2^k for positive q
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.)
Tighter bounds: 1/2 ≤ m ≤ 2 for most q > 0
The reduced mantissa is positive for positive input
Connection to Real.log #
Key algebraic identity for Real.log: log(q) = log(m) + k * log(2)