Documentation

LeanCert.Engine.AD.Dyadic

Domain-aware automatic differentiation with Dyadic intervals #

This module is the bounded-denominator counterpart of AD.DomainChecked. Polynomial dual arithmetic is performed with Dyadic endpoints and outward rounding after every addition and multiplication. Transcendental values use the same verified rational Taylor kernels as the Dyadic value evaluator and are rounded back to Dyadic endpoints.

The public entry points are checked: unsupported syntax, invalid reciprocal or logarithm domains, and positive rounding precisions return EvalError rather than a finite interval.

A value interval and one directional derivative interval, both Dyadic.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[reducible, inline]

      An environment of Dyadic dual intervals.

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

              Total computational kernel. Sound public use goes through the checked entry points below.

              Equations
              Instances For

                Value projection of a Dyadic dual environment.

                Equations
                Instances For

                  Box-dependent domain check for the Dyadic AD kernel.

                  Equations
                  Instances For

                    Explain the first failed support or domain check.

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

                      Checked Dyadic dual evaluation.

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

                        Checked value-and-derivative evaluation along coordinate idx.

                        Equations
                        Instances For

                          Checked Dyadic derivative enclosure along coordinate idx.

                          Equations
                          Instances For

                            Checked Dyadic derivative enclosure for a single-variable expression.

                            Equations
                            Instances For

                              Convenience boundary for callers whose boxes use rational endpoints.

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

                                The value projection of the dual kernel is exactly the ordinary Dyadic value kernel.

                                theorem LeanCert.Engine.evalDualDyadicChecked_val_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : DualDyadicEnv) (cfg : DyadicConfig) (D : DualIntervalDyadic) (hrho : ∀ (i : ℕ), rhoReal i ∈ (rho i).val) (hok : evalDualDyadicChecked e rho cfg = Except.ok D) :
                                Core.Expr.eval rhoReal e ∈ D.val

                                Golden theorem for successful checked Dyadic dual evaluation.

                                theorem LeanCert.Engine.evalWithDerivDyadicChecked_differentiableAt (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalDyadicEnv) (idx : ℕ) (cfg : DyadicConfig) (D : DualIntervalDyadic) (x : ℝ) (hx : x ∈ rho idx) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (hok : evalWithDerivDyadicChecked e rho idx cfg = Except.ok D) :
                                DifferentiableAt ℝ (e.evalAlong rhoReal idx) x

                                Successful checked Dyadic indexed AD proves differentiability throughout the selected input interval.

                                theorem LeanCert.Engine.evalWithDerivDyadicChecked_der_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalDyadicEnv) (idx : ℕ) (cfg : DyadicConfig) (D : DualIntervalDyadic) (x : ℝ) (hx : x ∈ rho idx) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (hok : evalWithDerivDyadicChecked e rho idx cfg = Except.ok D) :
                                deriv (e.evalAlong rhoReal idx) x ∈ D.der

                                Golden theorem: successful checked Dyadic indexed AD encloses the true partial derivative.

                                theorem LeanCert.Engine.derivIntervalDyadicChecked_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalDyadicEnv) (idx : ℕ) (cfg : DyadicConfig) (dI : Core.IntervalDyadic) (x : ℝ) (hx : x ∈ rho idx) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (hok : derivIntervalDyadicChecked e rho idx cfg = Except.ok dI) :
                                deriv (e.evalAlong rhoReal idx) x ∈ dI

                                Golden theorem for the derivative-only Dyadic API.

                                theorem LeanCert.Engine.derivIntervalDyadicCheckedOfRat_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalEnv) (idx : ℕ) (cfg : DyadicConfig) (dI : Core.IntervalDyadic) (x : ℝ) (hx : x ∈ rho idx) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (hok : derivIntervalDyadicCheckedOfRat e rho idx cfg = Except.ok dI) :
                                deriv (e.evalAlong rhoReal idx) x ∈ dI

                                Golden theorem for rational input boxes converted to the Dyadic backend.

                                Compute the first n partial derivatives with the checked Dyadic backend.

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

                                  Rational-input convenience boundary for the first n Dyadic partials.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    theorem LeanCert.Engine.gradientIntervalDyadicChecked_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalDyadicEnv) (n : ℕ) (cfg : DyadicConfig) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (gradient : List Core.IntervalDyadic) (hok : gradientIntervalDyadicChecked e rho n cfg = Except.ok gradient) :
                                    List.Forall₂ (fun (i : ℕ) (dI : Core.IntervalDyadic) => deriv (e.evalAlong rhoReal i) (rhoReal i) ∈ dI) (List.range n) gradient

                                    Golden theorem for the checked Dyadic gradient API.

                                    theorem LeanCert.Engine.gradientIntervalDyadicCheckedOfRat_correct (e : Core.Expr) (rhoReal : ℕ → ℝ) (rho : IntervalEnv) (n : ℕ) (cfg : DyadicConfig) (hrho : ∀ (i : ℕ), rhoReal i ∈ rho i) (gradient : List Core.IntervalDyadic) (hok : gradientIntervalDyadicCheckedOfRat e rho n cfg = Except.ok gradient) :
                                    List.Forall₂ (fun (i : ℕ) (dI : Core.IntervalDyadic) => deriv (e.evalAlong rhoReal i) (rhoReal i) ∈ dI) (List.range n) gradient

                                    Golden theorem for checked Dyadic gradients over rational input boxes.