Documentation

Mathlib.Tactic.Inclusion.Extension.IntervalDyadicReal.Log

Real.log extension for tactic dyadic_interval #

This file implements Real.log extension for the tactic dyadic_interval.

Implementation notes #

We first define Inclusion.IntervalDyadicReal.smallArtanh, which computes artanh of a small rational number num / den using the binary splitting method. Then we use the identity log 2 = 6 * artanh (1 / 17) + 4 * artanh (1 / 19) + 4 * artanh (1 / 31) to obtain a dyadic approximation of log 2.

With these, log x is computed for arbitrary x by first bringing |x| into the interval [1, 2) (writing x = x' * 2 ^ k with |x'| ∈ [1, 2)) and then adding k * log 2; this keeps the argument of the series small, so that it converges quickly.

We use artanh rather than log itself because all the terms of its series are positive (for a positive argument). Hence every truncated partial sum is a lower bound, and an upper bound is obtained by adding a step prec.

References #

The n-th partial sum of the artanh series at num / den, returned as (P, Q) with P / Q equal to this sum. Note that the series converges slowly when the input is close to 1.

Equations
Instances For
    @[irreducible]

    Binary splitting auxiliary function: go a b returns (P, Q, R) on segment [a, b).

    R is the numerator of ∑ k ∈ Finset.Ico a b, ∏ j ∈ Finset.Ico a k, t (j + 1) / t j put over the common denominator of the term ratios ((2 * k + 1) * num ^ 2) / ((2 * k + 3) * den ^ 2).

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Inclusion.IntervalDyadicReal.smallArtanh.go_spec (num den a b : ℕ) :
      (go num den a b).1 = ∏ i ∈ Finset.Ico a b, (2 * i + 1) * num ^ 2 ∧ (go num den a b).2.1 = ∏ i ∈ Finset.Ico a b, (2 * i + 3) * den ^ 2 ∧ (go num den a b).2.2 = ∑ i ∈ Finset.Ico a b, (∏ j ∈ Finset.Ico a i, (2 * j + 1) * num ^ 2) * ∏ j ∈ Finset.Ico i b, (2 * j + 3) * den ^ 2
      theorem Inclusion.IntervalDyadicReal.smallArtanh.den_ne_zero (num den n : ℕ) (hden : den ≠ 0) :
      (smallArtanh num den n).2 ≠ 0
      theorem Inclusion.IntervalDyadicReal.smallArtanh.spec (num den n : ℕ) :
      ↑(smallArtanh num den n).1 / ↑(smallArtanh num den n).2 = ∑ k ∈ Finset.range n, (↑num / ↑den) ^ (2 * k + 1) / (2 * ↑k + 1)
      theorem Inclusion.IntervalDyadicReal.smallArtanh.div_le_artanh {num den : ℕ} (h : num < den) (n : ℕ) :
      ↑(smallArtanh num den n).1 / ↑(smallArtanh num den n).2 ≤ Real.artanh (↑num / ↑den)

      The partial sums computed by smallArtanh are lower bounds for artanh (num / den).

      theorem Inclusion.IntervalDyadicReal.smallArtanh.artanh_le_div_add {num den : ℕ} (h : num < den) (n : ℕ) :
      Real.artanh (↑num / ↑den) ≤ ↑(smallArtanh num den n).1 / ↑(smallArtanh num den n).2 + (↑num / ↑den) ^ (2 * n + 1) / (1 - (↑num / ↑den) ^ 2)

      An upper bound for artanh (num / den) in terms of the partial sums computed by smallArtanh.

      Computes a lower bound l : Dyadic for log 2 with precision prec.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem Inclusion.IntervalDyadicReal.logTwo_spec (prec : ℕ) :
        ↑↑(logTwo prec) ≤ Real.log 2 ∧ Real.log 2 ≤ ↑↑(logTwo prec) + ↑↑(Dyadic.step ↑prec)

        Computes a lower bound l : Dyadic for log (m / 2 ^ m.log2) with precision prec. Note that m / 2 ^ m.log2 ∈ [1, 2) when m ≠ 0.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Inclusion.IntervalDyadicReal.logSum_spec {m : ℕ} (hm : m ≠ 0) (prec : ℕ) :
          ↑↑(logSum m prec) ≤ Real.log (↑m / 2 ^ m.log2) ∧ Real.log (↑m / 2 ^ m.log2) ≤ ↑↑(logSum m prec) + ↑↑(Dyadic.step ↑prec)

          Computes a lower bound for log x with precision prec.

          Equations
          Instances For
            theorem Inclusion.IntervalDyadicReal.lowerLog_spec (x : Dyadic) (prec : ℕ) :
            ↑↑(lowerLog x prec) ≤ Real.log ↑↑x ∧ Real.log ↑↑x ≤ ↑↑(lowerLog x prec) + ↑↑(Dyadic.step ↑prec)

            An enclosure of log x of width step prec, which is exact when log x = 0.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Logarithm of an Interval Dyadic, computed from the enclosures logPoint at the endpoints of its absolute value. When 0 lies in the interval, the result must also contain log 0 = 0.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem Inclusion.IntervalDyadicReal.log_mem {x : ℝ} {I : Interval Dyadic} (prec : ℕ) (hx : x ∈ I) :
                Real.log x ∈ log I prec