Documentation

LeanCert.Engine.IntervalEvalReal

Interval Evaluation with Real Endpoints #

This file implements interval evaluation using IntervalReal (real endpoints), which allows us to support exp in a fully verified way.

Main definitions #

Design notes #

This extends the verified subset from {const, var, add, mul, neg, sin, cos} to also include {exp}. The key insight is that with real endpoints, we can use Real.exp directly and its monotonicity properties.

For numerical computation, users should still use IntervalRat and convert to IntervalReal when they need to reason about exp. This keeps computation efficient while allowing proofs about transcendental functions.

Extended supported expression subset #

Predicate indicating an expression is in the extended verified subset. This includes exp in addition to the base subset. Does NOT support: inv (requires nonzero interval checks)

Instances For

    The base supported subset is a subset of the extended one

    Real-endpoint interval evaluation #

    @[reducible, inline]

    Variable assignment as real-endpoint intervals

    Equations
    Instances For

      Evaluate an expression over real-endpoint intervals.

      For expressions in ExprSupportedExt (const, var, add, mul, neg, sin, cos, exp), this computes correct interval bounds with a fully-verified proof.

      For unsupported expressions (inv, log), this returns a trivial interval. Do not call evalIntervalReal on expressions containing inv or log unless you are prepared for unsound results.

      Equations
      Instances For
        def LeanCert.Engine.envMemReal (ρ_real : ) (ρ_int : IntervalRealEnv) :

        A real environment is contained in a real-interval environment

        Equations
        Instances For

          Membership lemmas for IntervalReal operations #

          Membership for rational casts in singleton

          theorem LeanCert.Engine.IntervalReal.mem_mul' {x y : } {I J : Core.IntervalReal} (hx : x I) (hy : y J) :
          x * y I.mul J

          FTIA for multiplication on IntervalReal

          Main correctness theorem #

          theorem LeanCert.Engine.evalIntervalReal_correct (e : Core.Expr) (hsupp : ExprSupportedExt e) (ρ_real : ) (ρ_int : IntervalRealEnv) ( : envMemReal ρ_real ρ_int) :

          Fundamental correctness theorem for real-endpoint interval evaluation. If variables are in their intervals, the expression evaluates to a value in the computed interval.

          This theorem is FULLY PROVED (no sorry, no axioms) for ExprSupportedExt expressions. This includes exp!

          Convenience functions #

          Evaluate an expression with a single variable over a real-endpoint interval

          Equations
          Instances For
            theorem LeanCert.Engine.evalIntervalReal1_correct (e : Core.Expr) (hsupp : ExprSupportedExt e) (x : ) (I : Core.IntervalReal) (hx : x I) :
            Core.Expr.eval (fun (x_1 : ) => x) e evalIntervalReal1 e I

            Correctness for single-variable evaluation

            Conversion from rational to real interval environment #

            Convert a rational interval environment to a real one

            Equations
            Instances For
              theorem LeanCert.Engine.mem_toIntervalRealEnv {x : } {ρ : IntervalEnv} {i : } (hx : x ρ i) :

              Membership is preserved under conversion

              Tactic-facing lemmas for interval bounds (extended subset with exp) #

              theorem LeanCert.Engine.exprExt_le_of_interval_hi (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c : ) (hhi : (evalIntervalReal1 e I).hi c) (x : ) :
              x ICore.Expr.eval (fun (x_1 : ) => x) e c

              Upper bound lemma for extended subset (includes exp). FULLY PROVED - no sorry, no axioms.

              theorem LeanCert.Engine.exprExt_ge_of_interval_lo (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c : ) (hlo : c (evalIntervalReal1 e I).lo) (x : ) :
              x Ic Core.Expr.eval (fun (x_1 : ) => x) e

              Lower bound lemma for extended subset (includes exp). FULLY PROVED - no sorry, no axioms.

              theorem LeanCert.Engine.exprExt_lt_of_interval_hi_lt (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c : ) (hhi : (evalIntervalReal1 e I).hi < c) (x : ) :
              x ICore.Expr.eval (fun (x_1 : ) => x) e < c

              Strict upper bound for extended subset. FULLY PROVED - no sorry, no axioms.

              theorem LeanCert.Engine.exprExt_gt_of_interval_lo_gt (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c : ) (hlo : c < (evalIntervalReal1 e I).lo) (x : ) :
              x Ic < Core.Expr.eval (fun (x_1 : ) => x) e

              Strict lower bound for extended subset. FULLY PROVED - no sorry, no axioms.

              theorem LeanCert.Engine.exprExt_le_of_mem_interval (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c x : ) (hx : x I) (hhi : (evalIntervalReal1 e I).hi c) :
              Core.Expr.eval (fun (x_1 : ) => x) e c

              Point variant for extended subset.

              theorem LeanCert.Engine.exprExt_ge_of_mem_interval (e : Core.Expr) (hsupp : ExprSupportedExt e) (I : Core.IntervalReal) (c x : ) (hx : x I) (hlo : c (evalIntervalReal1 e I).lo) :
              c Core.Expr.eval (fun (x_1 : ) => x) e

              Point variant for extended subset.