Global Optimization via Branch-and-Bound #
This file implements verified global optimization over intervals using branch-and-bound with interval arithmetic and derivative bounds.
Phase Status #
This module is now largely Phase 1 (verified). The core correctness theorems are fully proved for the ExprSupported subset.
Main definitions #
minimizeInterval- Find a lower bound on min f over an intervalmaximizeInterval- Find an upper bound on max f over an interval- Correctness theorems (fully proved for ExprSupported)
Algorithm #
Branch-and-bound with the following pruning rules:
- Interval evaluation: If f([a,b]) = [lo, hi], then min f ≥ lo
- Monotonicity: If f'([a,b]) > 0, f is increasing, so min is at a
- Subdivision: Split interval and recurse
Optimization result #
Result of an optimization computation
- valueBound : Core.IntervalRat
Interval containing the optimum value
- argBound : Option Core.IntervalRat
Interval containing an optimizing point (if found)
- depth : ℕ
Depth of search performed
Instances For
Minimization #
Check if derivative interval is strictly positive
Equations
- LeanCert.Engine.derivStrictlyPositive e I varIdx = decide (0 < (LeanCert.Engine.derivInterval e (fun (x : ℕ) => I) varIdx).lo)
Instances For
Check if derivative interval is strictly negative
Equations
- LeanCert.Engine.derivStrictlyNegative e I varIdx = decide ((LeanCert.Engine.derivInterval e (fun (x : ℕ) => I) varIdx).hi < 0)
Instances For
Simple branch-and-bound minimization.
Returns an interval [lo, hi] such that:
- lo ≤ min_{x ∈ I} f(x)
- hi ≥ min_{x ∈ I} f(x)
Equations
- LeanCert.Engine.minimizeInterval e I varIdx maxDepth = LeanCert.Engine.minimizeInterval.go e varIdx maxDepth I maxDepth
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Base case correctness: interval evaluation gives a valid lower bound. This theorem is FULLY PROVED - no sorry, no axioms.
Derivative bounds and monotonicity #
For single-variable expressions evaluated with (fun _ => I), derivative is correct. We use evalWithDeriv1 which directly uses varActive for all variables.
Derivative is in derivInterval for expressions that only use var 0. FULLY PROVED - no sorry.
If the derivative interval is strictly positive, derivative is positive everywhere
If the derivative interval is strictly negative, derivative is negative everywhere
Strictly positive derivative implies strict monotonicity
Strictly negative derivative implies strict antitonicity
Monotonicity-based bounds #
For increasing functions, minimum is at the left endpoint
For decreasing functions, minimum is at the right endpoint
Interval at left endpoint gives valid lower bound for increasing functions
Interval at right endpoint gives valid lower bound for decreasing functions
Full optimization correctness #
Helper: membership in bisected intervals
Helper lemma for go correctness. FULLY PROVED for varIdx = 0 and UsesOnlyVar0 expressions.
Correctness: the minimum is in the computed interval. FULLY PROVED for varIdx = 0 and UsesOnlyVar0 expressions.
Maximization #
Maximize by minimizing the negation
Equations
- One or more equations did not get rendered due to their size.
Instances For
Correctness: the maximum is in the computed interval. FULLY PROVED for varIdx = 0 and UsesOnlyVar0 expressions.
Bounds checking #
Check if f(x) ≥ c for all x in I
Equations
- LeanCert.Engine.checkLowerBound e I c varIdx maxDepth = decide (c ≤ (LeanCert.Engine.minimizeInterval e I varIdx maxDepth).valueBound.lo)
Instances For
Check if f(x) ≤ c for all x in I
Equations
- LeanCert.Engine.checkUpperBound e I c varIdx maxDepth = decide ((LeanCert.Engine.maximizeInterval e I varIdx maxDepth).valueBound.hi ≤ c)
Instances For
N-Variable Optimization Infrastructure #
The following section provides generalized optimization infrastructure that works with arbitrary variable indices and multi-variable environments. This allows optimizing along any coordinate while holding other variables fixed.
Key types:
IntervalEnv := Nat → IntervalRat- maps variable indices to intervalsevalAlong e ρ idx- evaluateseas a function of variableidx
The main advantage is that we can now optimize expressions with multiple variables by fixing all but one variable and optimizing along that coordinate.
N-variable derivative bounds #
If the derivative interval along idx is strictly positive, derivative is positive everywhere.
Generalized version that works with any variable index and environment.
If the derivative interval along idx is strictly negative, derivative is negative everywhere.
Generalized version that works with any variable index and environment.
Strictly positive derivative along idx implies strict monotonicity.
Generalized n-variable version.
Strictly negative derivative along idx implies strict antitonicity.
Generalized n-variable version.
N-variable monotonicity-based bounds #
For increasing functions along idx, minimum is at the left endpoint.
Generalized n-variable version.
For decreasing functions along idx, minimum is at the right endpoint.
Generalized n-variable version.
N-variable minimization algorithm #
Check if derivative interval along idx is strictly positive
Equations
- LeanCert.Engine.derivStrictlyPositive_idx e ρ idx = decide (0 < (LeanCert.Engine.derivInterval e ρ idx).lo)
Instances For
Check if derivative interval along idx is strictly negative
Equations
- LeanCert.Engine.derivStrictlyNegative_idx e ρ idx = decide ((LeanCert.Engine.derivInterval e ρ idx).hi < 0)
Instances For
Update an interval environment at a specific index
Instances For
N-variable branch-and-bound minimization along coordinate idx.
Returns an interval [lo, hi] such that for any ρ_real with ρ_real i ∈ ρ i:
- lo ≤ min_{t ∈ ρ idx} evalAlong e ρ_real idx t
- hi ≥ min_{t ∈ ρ idx} evalAlong e ρ_real idx t
Equations
- LeanCert.Engine.minimizeIntervalIdx e ρ idx maxDepth = LeanCert.Engine.minimizeIntervalIdx.go e ρ idx maxDepth (ρ idx) maxDepth
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
N-variable minimization correctness #
Base case correctness for n-variable optimization. Interval evaluation gives a valid lower bound.
Helper: membership in bisected intervals
Helper lemma for go correctness in n-variable setting
Correctness theorem for n-variable minimization: For any real environment ρ_real satisfying ρ_int, and any t in ρ_int idx, the computed lower bound is valid.
FULLY PROVED - no sorry, no axioms.
N-variable maximization via minimization of negation
Equations
- One or more equations did not get rendered due to their size.
Instances For
Correctness theorem for n-variable maximization
Backward-compatible wrappers #
Alternative single-variable minimization as a thin wrapper around minimizeIntervalIdx.
This is equivalent to the original minimizeInterval but uses the generalized n-variable
implementation.
Equations
- LeanCert.Engine.minimizeInterval' e I varIdx maxDepth = LeanCert.Engine.minimizeIntervalIdx e (fun (x : ℕ) => I) varIdx maxDepth
Instances For
Correctness theorem for single-variable minimization via the idx API.
This doesn't require UsesOnlyVar0 - works for any expression.
Alternative maximization as a thin wrapper around maximizeIntervalIdx.
Equations
- LeanCert.Engine.maximizeInterval' e I varIdx maxDepth = LeanCert.Engine.maximizeIntervalIdx e (fun (x : ℕ) => I) varIdx maxDepth
Instances For
Correctness theorem for single-variable maximization via the idx API.