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 #
ExprSupportedExt- Extended predicate including expevalIntervalReal- Evaluate an expression over real-endpoint intervalsevalIntervalReal_correct- Correctness theorem (fully proved)
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)
- const (q : ℚ) : ExprSupportedExt (Core.Expr.const q)
- var (idx : ℕ) : ExprSupportedExt (Core.Expr.var idx)
- add {e₁ e₂ : Core.Expr} : ExprSupportedExt e₁ → ExprSupportedExt e₂ → ExprSupportedExt (e₁.add e₂)
- mul {e₁ e₂ : Core.Expr} : ExprSupportedExt e₁ → ExprSupportedExt e₂ → ExprSupportedExt (e₁.mul e₂)
- neg {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.neg
- sin {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.sin
- cos {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.cos
- exp {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.exp
- atan {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.atan
- arsinh {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.arsinh
- sinh {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.sinh
- cosh {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.cosh
- sqrt {e : Core.Expr} : ExprSupportedExt e → ExprSupportedExt e.sqrt
Instances For
The base supported subset is a subset of the extended one
Real-endpoint interval evaluation #
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
- LeanCert.Engine.evalIntervalReal (LeanCert.Core.Expr.const q) ρ = LeanCert.Core.IntervalReal.singleton ↑q
- LeanCert.Engine.evalIntervalReal (LeanCert.Core.Expr.var idx) ρ = ρ idx
- LeanCert.Engine.evalIntervalReal (e₁.add e₂) ρ = (LeanCert.Engine.evalIntervalReal e₁ ρ).add (LeanCert.Engine.evalIntervalReal e₂ ρ)
- LeanCert.Engine.evalIntervalReal (e₁.mul e₂) ρ = (LeanCert.Engine.evalIntervalReal e₁ ρ).mul (LeanCert.Engine.evalIntervalReal e₂ ρ)
- LeanCert.Engine.evalIntervalReal e_2.neg ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).neg
- LeanCert.Engine.evalIntervalReal e_2.inv ρ = { lo := 0, hi := 0, le := LeanCert.Engine.evalIntervalReal._proof_1 }
- LeanCert.Engine.evalIntervalReal e_2.exp ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).expInterval
- LeanCert.Engine.evalIntervalReal e_2.sin ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).sinInterval
- LeanCert.Engine.evalIntervalReal e_2.cos ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).cosInterval
- LeanCert.Engine.evalIntervalReal e_2.log ρ = { lo := 0, hi := 0, le := LeanCert.Engine.evalIntervalReal._proof_1 }
- LeanCert.Engine.evalIntervalReal e_2.atan ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).atanInterval
- LeanCert.Engine.evalIntervalReal e_2.arsinh ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).arsinhInterval
- LeanCert.Engine.evalIntervalReal e_2.atanh ρ = { lo := 0, hi := 0, le := LeanCert.Engine.evalIntervalReal._proof_1 }
- LeanCert.Engine.evalIntervalReal e_2.sinc ρ = { lo := -1, hi := 1, le := LeanCert.Engine.evalIntervalReal._proof_2 }
- LeanCert.Engine.evalIntervalReal e_2.erf ρ = { lo := -1, hi := 1, le := LeanCert.Engine.evalIntervalReal._proof_2 }
- LeanCert.Engine.evalIntervalReal e_2.sinh ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).sinhInterval
- LeanCert.Engine.evalIntervalReal e_2.cosh ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).coshInterval
- LeanCert.Engine.evalIntervalReal e_2.tanh ρ = { lo := -1, hi := 1, le := LeanCert.Engine.evalIntervalReal._proof_2 }
- LeanCert.Engine.evalIntervalReal e_2.sqrt ρ = (LeanCert.Engine.evalIntervalReal e_2 ρ).sqrtInterval
- LeanCert.Engine.evalIntervalReal LeanCert.Core.Expr.pi ρ = { lo := Real.pi, hi := Real.pi, le := ⋯ }
Instances For
A real environment is contained in a real-interval environment
Equations
- LeanCert.Engine.envMemReal ρ_real ρ_int = ∀ (i : ℕ), ρ_real i ∈ ρ_int i
Instances For
Membership lemmas for IntervalReal operations #
Membership in singleton
Membership for rational casts in singleton
FTIA for multiplication on IntervalReal
Main correctness theorem #
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
- LeanCert.Engine.evalIntervalReal1 e I = LeanCert.Engine.evalIntervalReal e fun (x : ℕ) => I
Instances For
Correctness for single-variable evaluation
Conversion from rational to real interval environment #
Convert a rational interval environment to a real one
Equations
Instances For
Membership is preserved under conversion
Tactic-facing lemmas for interval bounds (extended subset with exp) #
Upper bound lemma for extended subset (includes exp). FULLY PROVED - no sorry, no axioms.
Lower bound lemma for extended subset (includes exp). FULLY PROVED - no sorry, no axioms.
Strict upper bound for extended subset. FULLY PROVED - no sorry, no axioms.
Strict lower bound for extended subset. FULLY PROVED - no sorry, no axioms.
Point variant for extended subset.
Point variant for extended subset.