Adaptive Bound Verification via Branch-and-Bound #
This file provides adaptive bound verification functions that use the branch-and-bound global optimization algorithm to verify bounds on expressions. Unlike single-shot interval evaluation, these functions automatically subdivide the domain until the bound can be verified or the iteration limit is reached.
Main definitions #
verifyUpperBound- Verify f(x) ≤ bound for all x in box using adaptive subdivisionverifyLowerBound- Verify f(x) ≥ bound for all x in box using adaptive subdivisionverifyUpperBound1- Single-variable versionverifyLowerBound1- Single-variable version
Main theorems #
verifyUpperBound_correct- IfverifyUpperBoundreturns true, the bound holdsverifyLowerBound_correct- IfverifyLowerBoundreturns true, the bound holds
Usage #
These functions are intended to be used as fallbacks when single-shot interval evaluation fails due to over-approximation. They provide better precision at the cost of increased computation.
-- Single-shot fails on tight bounds, but adaptive succeeds
example : verifyUpperBound1 (Expr.sin (Expr.var 0)) ⟨0, 11/10, by norm_num⟩ (85/100) = true := by
native_decide
Configuration for bound verification #
Configuration for adaptive bound verification
- maxIterations : ℕ
Maximum number of subdivisions
- tolerance : ℚ
Stop when box width is below this threshold
- taylorDepth : ℕ
Taylor depth for interval evaluation
- useMonotonicity : Bool
Use monotonicity-based pruning (symbolic pre-pass for gradient signs)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert BoundVerifyConfig to GlobalOptConfig
Equations
- cfg.toGlobalOptConfig = { maxIterations := cfg.maxIterations, tolerance := cfg.tolerance, useMonotonicity := cfg.useMonotonicity, taylorDepth := cfg.taylorDepth }
Instances For
Witness/Epsilon-argmax structures #
A witness point for an optimization result
The coordinates of the witness point
- value : Core.IntervalRat
The function value at this point (interval containing true value)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Result of bound verification with witness information
- verified : Bool
Whether the bound was verified
- computedBound : ℚ
The computed bound (lo for min, hi for max)
- witness : WitnessPoint
Approximate argmin/argmax (midpoint of best box)
- epsilon : ℚ
Width of the best box (epsilon for ε-approximate argmin/argmax)
- iterations : ℕ
Number of iterations used
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract witness point from a box (midpoint of each interval)
Equations
- B.midpoint = List.map (fun (I : LeanCert.Core.IntervalRat) => I.midpoint) B
Instances For
Compute maximum width of a box (the ε in ε-approximate)
Equations
- B.maxWidthQ = List.foldl (fun (acc : ℚ) (I : LeanCert.Core.IntervalRat) => max acc (I.hi - I.lo)) 0 B
Instances For
Evaluate expression at a rational point (using singleton intervals)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Computable bound verification functions #
Verify f(x) ≤ bound for all x in box using adaptive subdivision. Returns true if the maximum of f over the box is ≤ bound.
Equations
- LeanCert.Engine.Optimization.verifyUpperBound e B bound cfg = decide ((LeanCert.Engine.Optimization.globalMaximizeCore e B cfg.toGlobalOptConfig).bound.hi ≤ bound)
Instances For
Verify f(x) ≥ bound for all x in box using adaptive subdivision. Returns true if the minimum of f over the box is ≥ bound.
Equations
- LeanCert.Engine.Optimization.verifyLowerBound e B bound cfg = decide ((LeanCert.Engine.Optimization.globalMinimizeCore e B cfg.toGlobalOptConfig).bound.lo ≥ bound)
Instances For
Verify f(x) < bound for all x in box using adaptive subdivision. Returns true if the maximum of f over the box is < bound.
Equations
- LeanCert.Engine.Optimization.verifyUpperBoundStrict e B bound cfg = decide ((LeanCert.Engine.Optimization.globalMaximizeCore e B cfg.toGlobalOptConfig).bound.hi < bound)
Instances For
Verify f(x) > bound for all x in box using adaptive subdivision. Returns true if the minimum of f over the box is > bound.
Equations
- LeanCert.Engine.Optimization.verifyLowerBoundStrict e B bound cfg = decide ((LeanCert.Engine.Optimization.globalMinimizeCore e B cfg.toGlobalOptConfig).bound.lo > bound)
Instances For
Epsilon-argmax/argmin functions with witness information #
Find the maximum of f over a box, returning result with witness information. The witness is an ε-approximate argmax: a point where f(witness) is within ε of the true maximum, where ε = bestBox.maxWidth.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find the minimum of f over a box, returning result with witness information. The witness is an ε-approximate argmin: a point where f(witness) is within ε of the true minimum, where ε = bestBox.maxWidth.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Verify f(x) ≤ bound with witness information. Returns the verification result along with an ε-approximate argmax.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Verify f(x) ≥ bound with witness information. Returns the verification result along with an ε-approximate argmin.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Single-variable convenience functions #
Convert a single interval to a 1D box
Equations
Instances For
Single-variable version of verifyUpperBound
Equations
Instances For
Single-variable version of verifyLowerBound
Equations
Instances For
Single-variable version of verifyUpperBoundStrict
Equations
Instances For
Single-variable version of verifyLowerBoundStrict
Equations
Instances For
Single-variable version of findMaxWithWitness
Equations
Instances For
Single-variable version of findMinWithWitness
Equations
Instances For
Single-variable version of verifyUpperBoundWithWitness
Equations
Instances For
Single-variable version of verifyLowerBoundWithWitness
Equations
Instances For
Correctness theorems (noncomputable proofs) #
Helper: convert single-variable environment to box membership
Helper: if i ≥ 1, then (fun _ => x) i = 0 is vacuously satisfiable for our purposes
If verifyUpperBound succeeds, the upper bound holds for all points in the box. Note: This uses the noncomputable globalMaximize for the proof, but the computable globalMaximizeCore is used for execution.
If verifyLowerBound succeeds, the lower bound holds for all points in the box.
Expression uses only var 0 #
Predicate: expression only uses variable index 0
Equations
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 (LeanCert.Core.Expr.const q) = true
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 (LeanCert.Core.Expr.var i) = (i == 0)
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 (e1.add e2) = (e1.usesOnlyVar0 && e2.usesOnlyVar0)
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 (e1.mul e2) = (e1.usesOnlyVar0 && e2.usesOnlyVar0)
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.neg = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.inv = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.exp = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.sin = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.cos = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.log = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.atan = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.arsinh = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.atanh = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.sinc = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.erf = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.sinh = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.cosh = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.tanh = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 e.sqrt = e.usesOnlyVar0
- LeanCert.Engine.Optimization.Expr.usesOnlyVar0 LeanCert.Core.Expr.pi = true
Instances For
If an expression uses only var 0, evaluation depends only on ρ 0
Tactic-facing lemmas for adaptive bound verification #
Tactic-facing lemma: if adaptive verification succeeds, upper bound holds. This is the key lemma that tactics use to close goals. Requires that the expression uses only var 0.
Tactic-facing lemma: if adaptive verification succeeds, lower bound holds. Requires that the expression uses only var 0.
Strict upper bound version
Strict lower bound version
Theorem versions for Set.Icc (for tactic compatibility) #
Adaptive upper bound for Set.Icc membership
Adaptive lower bound for Set.Icc membership
Strict upper bound for Set.Icc
Strict lower bound for Set.Icc