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.

            Interval evaluation using refined bounds for transcendentals. Uses Taylor-model-based bounds for exp, sin, cos on small intervals. For partial functions (inv, log), returns default. Use evalInterval? instead.

            Equations
            Instances For

              Single-variable refined interval evaluation

              Equations
              Instances For
                theorem LeanCert.Engine.evalIntervalRefined_correct (e : Core.Expr) (hsupp : ExprSupported e) (ρ_real : ) (ρ_int : IntervalEnv) ( : envMem ρ_real ρ_int) :

                Refined interval evaluation is correct for supported expressions

                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

                        Single-variable refined dual evaluation

                        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 : ExprSupported e) (ρ_real : ) (ρ_dual : DualEnv) ( : ∀ (i : ), ρ_real i (ρ_dual i).val) :
                          Core.Expr.eval ρ_real e (evalDualRefined e ρ_dual).val

                          Refined dual evaluation value is correct for supported expressions

                          theorem LeanCert.Engine.evalDualRefined1_val_correct (e : Core.Expr) (hsupp : ExprSupported e) (x : ) (I : Core.IntervalRat) (hx : x I) :
                          Core.Expr.eval (fun (x_1 : ) => x) e (evalDualRefined1 e I).val

                          Single-variable refined dual evaluation is correct for values