Documentation

LeanCert.Engine.IntervalEvalRefined

Refined Interval Evaluation using Taylor Models #

This file provides interval evaluation functions that use Taylor-model-based bounds for transcendental functions (exp, sin, cos) when the interval is small, falling back to coarse bounds for larger intervals.

Main definitions #

Design #

The refined evaluators give tighter bounds on small intervals by using Taylor approximations. For example, expIntervalRefined uses a degree-5 Taylor model when the interval width is ≤ 1, which gives much tighter bounds than the monotonicity-based expInterval.

The correctness proofs follow directly from the Taylor model correctness theorems (mem_expIntervalRefined, etc.).

Refined transcendental intervals #

We define refined versions of sin and cos intervals using Taylor models, following the same pattern as expIntervalRefined.

Refined interval bound for sin using Taylor models. For small intervals (width ≤ 1), uses degree-5 Taylor model. For larger intervals, uses the global [-1, 1] bound.

Equations
Instances For

    FTIA for refined sin: if x ∈ I, then sin(x) ∈ sinIntervalRefined I

    Refined interval bound for cos using Taylor models. For small intervals (width ≤ 1), uses degree-5 Taylor model. For larger intervals, uses the global [-1, 1] bound.

    Equations
    Instances For

      FTIA for refined cos: if x ∈ I, then cos(x) ∈ cosIntervalRefined I

      Refined interval bound for log using Taylor models. For strictly positive intervals with width ≤ 1, uses degree-5 Taylor model. For larger intervals or non-positive intervals, falls back to coarse bound.

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

        FTIA for refined log: if x ∈ I and I is positive, then log(x) ∈ logIntervalRefined I

        noncomputable def LeanCert.Engine.atanhIntervalRefined' (I : Core.IntervalRat) (hlo : -1 < I.lo) (hhi : I.hi < 1) :

        Refined interval bound for atanh using Taylor models. For small intervals with |x| < 1 and width ≤ 1, uses degree-5 Taylor model. For larger intervals, uses computed bound via monotonicity. Requires -1 < I.lo and I.hi < 1 for correctness.

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

          Refined interval bound for atanh (version without proof arguments, falls back to default)

          Equations
          Instances For
            theorem LeanCert.Engine.mem_atanhIntervalRefined {x : ℝ} {I : Core.IntervalRat} (hx : x ∈ I) (hlo : -1 < I.lo) (hhi : I.hi < 1) :

            FTIA for refined atanh: if x ∈ I and I ⊂ (-1, 1), then atanh(x) ∈ atanhIntervalRefined I

            Refined interval evaluation #

            Interval evaluation that uses Taylor-model-based bounds for transcendental functions when the interval is reasonably small.

            Strict refined interval evaluation.

            Unsupported partial operations return none, and compound expressions return none if a required subexpression fails.

            Equations
            Instances For

              Strict single-variable refined interval evaluation.

              Equations
              Instances For

                A supported expression always succeeds in the strict refined evaluator.

                Refined evaluation with failure ruled out by the supported-expression proof.

                Equations
                Instances For

                  Single-variable refined evaluation with an explicit support proof.

                  Equations
                  Instances For
                    theorem LeanCert.Engine.evalIntervalRefined?_correct (e : Core.Expr) (ρ_real : ℕ → ℝ) (ρ_int : IntervalEnv) (hρ : envMem ρ_real ρ_int) {I : Core.IntervalRat} (hI : evalIntervalRefined? e ρ_int = some I) :
                    Core.Expr.eval ρ_real e ∈ I

                    Strict refined interval evaluation is correct whenever it returns an interval.

                    theorem LeanCert.Engine.evalIntervalRefined1?_correct (e : Core.Expr) (x : ℝ) (I J : Core.IntervalRat) (hx : x ∈ I) (hJ : evalIntervalRefined1? e I = some J) :
                    Core.Expr.eval (fun (x_1 : ℕ) => x) e ∈ J

                    Strict single-variable refined interval evaluation is correct.

                    theorem LeanCert.Engine.evalIntervalRefined_correct (e : Core.Expr) (hsupp : ADSupported e) (ρ_real : ℕ → ℝ) (ρ_int : IntervalEnv) (hρ : envMem ρ_real ρ_int) :
                    Core.Expr.eval ρ_real e ∈ evalIntervalRefined e hsupp ρ_int

                    Refined interval evaluation is correct for supported expressions

                    theorem LeanCert.Engine.evalIntervalRefined1_correct (e : Core.Expr) (hsupp : ADSupported e) (x : ℝ) (I : Core.IntervalRat) (hx : x ∈ I) :
                    Core.Expr.eval (fun (x_1 : ℕ) => x) e ∈ evalIntervalRefined1 e hsupp I

                    Single-variable refined evaluation is correct

                    Refined dual interval (AD) evaluation #

                    Automatic differentiation using refined interval bounds.

                    Refined dual interval for exp

                    Equations
                    Instances For

                      Refined dual interval for sin: d/dx sin(f(x)) = cos(f(x)) * f'(x)

                      Equations
                      Instances For

                        Refined dual interval for cos: d/dx cos(f(x)) = -sin(f(x)) * f'(x)

                        Equations
                        Instances For

                          Refined dual interval evaluation. For partial functions (inv, log), returns default.

                          Equations
                          Instances For

                            Correctness of refined dual evaluation #

                            Refined exp preserves value correctness

                            Refined sin preserves value correctness

                            Refined cos preserves value correctness

                            atan preserves value correctness

                            arsinh preserves value correctness

                            theorem LeanCert.Engine.evalDualRefined_val_correct (e : Core.Expr) (hsupp : ADSupported e) (ρ_real : ℕ → ℝ) (ρ_dual : DualEnv) (hρ : ∀ (i : ℕ), ρ_real i ∈ (ρ_dual i).val) :

                            Refined dual evaluation value is correct for supported expressions

                            Single-variable refined dual evaluation is correct for values