Documentation

LeanCert.Engine.AD.Transcendental

Automatic Differentiation - Transcendental Functions #

This file provides dual interval implementations for transcendental functions, implementing the chain rule for each.

Main definitions #

Total functions (always succeed) #

Partial functions (return Option) #

Dual for sin (chain rule: d(sin f) = cos(f) * f')

Equations
Instances For

    Dual for cos (chain rule: d(cos f) = -sin(f) * f')

    Equations
    Instances For

      Dual for exp (chain rule: d(exp f) = exp(f) * f')

      Equations
      Instances For

        The interval [0, 1] used to bound derivative factors in (0, 1]

        Equations
        Instances For

          The derivative factor for arctan: 1/(1+x²) is in [0, 1]

          The derivative factor for arsinh: 1/√(1+x²) is in [0, 1]

          Dual for atan (chain rule: d(atan f) = f' / (1 + f²))

          Equations
          Instances For

            Dual for arsinh (chain rule: d(arsinh f) = f' / √(1 + f²))

            Equations
            Instances For

              Dual for sinh (chain rule: d(sinh f) = cosh(f) * f')

              Equations
              Instances For

                Dual for cosh (chain rule: d(cosh f) = sinh(f) * f')

                Equations
                Instances For

                  Dual for tanh (chain rule: d(tanh f) = sech²(f) * f' = (1 - tanh²(f)) * f') Since sech²(x) = 1 - tanh²(x) ∈ (0, 1] for all x, we use [0, 1] as bound.

                  Equations
                  Instances For

                    Interval containing 2/√π ≈ 1.128379...

                    Equations
                    Instances For

                      Dual for erf (chain rule: d(erf f) = (2/√π) * exp(-f²) * f') erf'(x) = (2/√π) * exp(-x²), which is always positive and bounded by 2/√π ≈ 1.13

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

                        Computable dual for erf using expComputable

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

                          Dual for sqrt (chain rule: d(sqrt f) = f' / (2 * sqrt(f))) sqrt'(x) = 1/(2*sqrt(x)) for x > 0, undefined at x = 0. We use sqrtInterval for the value and a conservative bound for the derivative. Note: The derivative blows up as x → 0+, so this uses a wide conservative bound.

                          Equations
                          Instances For

                            Conservative derivative bound [-1, 1] for sinc derivative

                            Equations
                            Instances For

                              Dual for sinc (chain rule: d(sinc f) = sinc'(f) * f') sinc'(x) = (x cos x - sin x) / x² for x ≠ 0, limit 0 at x = 0. We use conservative bound: |sinc'(x)| ≤ 1 for all x.

                              Equations
                              Instances For

                                Partial functions (domain-restricted) #

                                Partial dual for atanh (chain rule: d(atanh f) = f' / (1 - f²)) Returns None if the value interval is not contained in (-1, 1).

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

                                  Partial dual for inv (chain rule: d(1/f) = -f'/f²) Returns None if the value interval contains zero.

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

                                    Partial dual for log (chain rule: d(log f) = f'/f) Returns None if the value interval is not strictly positive.

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

                                      Compute a conservative upper bound on 1/(2*sqrt(lo)) for lo > 0. Uses the fact that:

                                      • For 0 < lo ≤ 1: sqrt(lo) ≥ lo, so 1/(2sqrt(lo)) ≤ 1/(2lo)
                                      • For lo > 1: sqrt(lo) > 1, so 1/(2*sqrt(lo)) < 1/2
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        theorem LeanCert.Engine.DualInterval.sqrtDerivCoef_bound {x lo : } (hlo_pos : 0 < lo) (hx_ge : lo x) :
                                        1 / (2 * x) max (1 / (2 * lo)) (1 / 2)

                                        For lo > 0, the derivative coefficient 1/(2*sqrt(x)) is bounded above for x ≥ lo.

                                        Partial dual for sqrt (chain rule: d(sqrt f) = f' / (2 * sqrt(f))) Returns None if the value interval is not strictly positive.

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