Verified bounds and global minima by dyadic branch and bound #
With the dyadic evaluator of ConvexAnalysis.IntervalDyadic, a bound c ≤ e(x) for all x in
a box is a computation: enclose the range of e on the box in interval arithmetic and compare
the lower endpoint with c. If the enclosure is too wide, bisect the box and test the halves.
This file makes this a Bool-valued function that the kernel evaluates, with a bound on
the depth of the bisection, and proves that its result true implies the bound. From a lower
bound on a box and an upper bound at a point of the box follows a verified enclosure [L, U] of
the global minimum of e on the box, and the same bisection proves that a system of equations
has no zero in a box.
Main definitions #
ConvexAnalysis.DyadicInterval.bisect X: the two halves of a boxXof dyadic intervals, split at the midpoint of a widest side.ConvexAnalysis.DyadicInterval.allPieces P d X: the bisection test:P X, or else, ifd > 0,allPieces P (d - 1)for both halves ofX; sotruemeans thatPholds on every piece of a subdivision ofXof depth at mostd.ConvexAnalysis.RatArithExpr.meanValueEval prec e X: the mean value forme(c) + ∑ i, ∂ᵢe(X) (Xᵢ - cᵢ)at the centercofX, computed in dyadic interval arithmetic with the symbolic partial derivativesConvexAnalysis.RatArithExpr.pderiv.ConvexAnalysis.RatArithExpr.boxTest prec e ok mvfWidth X: the predicateokholds for the endpoints of the natural interval extension ofeonXor, on boxes whose sides have width at mostmvfWidth, for those of the mean value form, so the better of the two enclosures is used.ConvexAnalysis.RatArithExpr.lowerBoundTest,ConvexAnalysis.RatArithExpr.strictLowerBoundTest,ConvexAnalysis.RatArithExpr.upperBoundTest,ConvexAnalysis.RatArithExpr.strictUpperBoundTest: the bound tests forc ≤ e,c < e,e ≤ cande < con a rational box, by bisection.ConvexAnalysis.RatArithExpr.exclusionTest: the exclusion test for a system of equations: on every piece some component of the system has an enclosure without0.ConvexAnalysis.RatArithExpr.minimumTest: the verified global minimum test: a pointpof the box withe(p) ≤ Uand the lower bound test forL.
Main statements #
ConvexAnalysis.DyadicInterval.forall_of_allPieces: a property that follows fromP Xon every boxXholds on the whole box ifallPieces P d Xreturnstrue.ConvexAnalysis.RatArithExpr.eval_mem_of_meanValueEval: the computed mean value form encloses the range (Neumaier, Theorem 2.3.3 with computed enclosures).ConvexAnalysis.RatArithExpr.le_eval_of_lowerBoundTest,ConvexAnalysis.RatArithExpr.lt_eval_of_strictLowerBoundTest,ConvexAnalysis.RatArithExpr.eval_le_of_upperBoundTest,ConvexAnalysis.RatArithExpr.eval_lt_of_strictUpperBoundTest: if a bound test returnstrue, the bound holds at every point of the box.ConvexAnalysis.RatArithExpr.forall_exists_ne_zero_of_exclusionTest: if the exclusion test returnstrue, the system has no zero in the box.ConvexAnalysis.RatArithExpr.exists_isMinOn_of_minimumTest,ConvexAnalysis.RatArithExpr.sInf_mem_Icc_of_minimumTest: if the minimum test returnstrue,eattains its minimum on the box, and the minimum lies in[L, U].
Implementation notes #
- Bisection.
ConvexAnalysis.DyadicInterval.bisectsplits a widest side (the first one) at the midpoint of its dyadic endpoints, which is again dyadic, so the pieces need no rounding. The soundness proofs use only that the two halves cover the box, not where the split is. - Depth-first, with fuel.
ConvexAnalysis.DyadicInterval.allPiecesis defined by structural recursion on the depth, so the kernel evaluates it (decide +kernel);||and&&are evaluated lazily, so a piece is split only if its test fails, and the run stops at the first piece of depthdwhose test fails. Bisection along a widest side halves the largest width at least everynsteps, so afterdbisections every side of a piece is at most2^(-⌊d / n⌋)times the largest side of the box. The depth is only a bound: the pieces actually tested are those of an adaptive subdivision, fine where the bound is tight and coarse elsewhere. - The better of two enclosures. The natural interval extension overestimates the range of
eon a box of widthwbyO(w)if every square root has an argument away from0(ConvexAnalysis.ArithExpr.exists_length_intervalEval_le), the mean value form byO(w²)(ConvexAnalysis.ArithExpr.exists_meanValueForm_pderiv_approx), but it is wider on large boxes and needs the derivatives.ConvexAnalysis.RatArithExpr.boxTesttries the natural extension first and computes the mean value form only if the natural extension fails; for the tests of this file this is the same as testing the intersection of the two enclosures. Near a nondegenerate minimum the lower bound of the mean value form ise(c) - O(w²), so a toleranceεneeds boxes of widthO(√ε)there instead ofO(ε). On a wide box the mean value form almost always fails, and computing it there costs about three evaluations ofe(the center and the partial derivatives); so it is computed only on pieces whose sides have width at mostmvfWidth(a negative value turns it off). For the six-hump camel function on[0, 2] × [-1, 1]with the lower bound-1.035,mvfWidth = 1/64cuts the kernel time from about9to about3seconds compared with the mean value form on every piece, and for tolerances near10⁻⁴on[-2, 2] × [-1, 1]the mean value form cuts the number of boxes tested from about25000(natural extension only) to about700. - Kernel cost. Interval operations in dyadic arithmetic take about
0.5ms each in the kernel (Intarithmetic is not accelerated, onlyNat), so a piece costs10–50ms for a polynomial of degree six in two variables, and the kernel's caches grow by about0.2GB per second of evaluation. Writingeso that its natural extension is tight matters more than the depth: the six-hump camel function asx² ((x² - 63/20)² / 3 + 277/400) + x y + 4 (y² - 1/2)² - 1needs201boxes for the lower bound-1.035on[0, 2] × [-1, 1]withmvfWidth = 1/64, in the expanded form4 x² - 2.1 x⁴ + x⁶ / 3 + x y - 4 y² + 4 y⁴3229. The depth itself costs nothing: a piece at depthdis a term withdnested bisections, but its evaluation is as fast as that of the same box given directly (the kernel caches the shared subterms). - Examples.
ConvexAnalysis.ComputerAssistedProofsencloses the global minimum of the six-hump camel function (ConvexAnalysis.exists_isMinOn_sixHumpCamel), proves two strict bounds (ConvexAnalysis.mul_exp_neg_lt,ConvexAnalysis.lt_sub_one_mul_sub_two_mul_sub_three_mul_sub_four) and excludes the solutions of a near-miss system (ConvexAnalysis.not_exists_sq_add_sq_eq_one_and_mul_eq), each in1–3.5seconds of kernel time. - Relation to
ConvexAnalysis.BranchAndBound. The minimum test is the bound part of a branch and bound run (Moore–Kearfott–Cloud, Section 11.2, Algorithm 11.1: bisection in a direction of maximum width, deletion of boxes whose lower bound exceeds an upper bound from a point evaluation): every piece is deleted, here by its boundL, and the incumbent is the upper boundUat the pointp, which is found outside Lean. Why the test succeeds for everyLbelow the minimum at a large enough depth, up to the rounding at the precision2⁻ᵖʳᵉᶜ, is the uniform convergence of the enclosures on small boxes:ConvexAnalysis.ArithExpr.exists_length_intervalEval_lefor the natural extension (defined on the whole box, square roots of arguments away from0) andConvexAnalysis.ArithExpr.exists_meanValueForm_pderiv_approxfor the mean value form; the convergence of best-first branch and bound with these bounds isConvexAnalysis.BranchAndBound.exists_isMinOn_and_tendsto_intervalandConvexAnalysis.BranchAndBound.exists_isMinOn_and_tendsto_meanValue_pderiv. None of this is needed for soundness, and it is not connected formally. - Searches on 2026-12-01 (Mathlib
5a27f5e): Mathlib'sdyadic_interval [binSplit := n]splits each interval of the goal uniformly into2ⁿpieces and takes the hull of the results; there is no adaptive subdivision, no mean value form and no global optimization in Mathlib. No pull request (any state) matches "branch and bound", "global optimization", "interval bound", "global minimum interval" or "bisection interval".
References #
- R. E. Moore, R. B. Kearfott, M. J. Cloud, Introduction to Interval Analysis, SIAM, 2009, Section 11.2.
- A. Neumaier, Interval Methods for Systems of Equations, Cambridge University Press, 1990, Section 2.3.
Tags #
interval arithmetic, dyadic numbers, branch and bound, bisection, global optimization, verified global minimum, exclusion test, mean value form, computer-assisted proof
Bisection of dyadic boxes #
The point where a dyadic interval D = [a, b] is split: the midpoint of a and b
(Inclusion.IntervalDyadicReal.midpoint), kept in [a, b].
Equations
- ConvexAnalysis.DyadicInterval.splitPoint D = max D.toProd.1 (min (Inclusion.IntervalDyadicReal.midpoint D.toProd.1 D.toProd.2) D.toProd.2)
Instances For
The split point lies above the lower endpoint.
The split point lies below the upper endpoint.
The lower half [a, m] of D = [a, b], for the split point m.
Equations
- ConvexAnalysis.DyadicInterval.lowerHalf D = { fst := D.toProd.1, snd := ConvexAnalysis.DyadicInterval.splitPoint D, fst_le_snd := ⋯ }
Instances For
The upper half [m, b] of D = [a, b], for the split point m.
Equations
- ConvexAnalysis.DyadicInterval.upperHalf D = { fst := ConvexAnalysis.DyadicInterval.splitPoint D, snd := D.toProd.2, fst_le_snd := ⋯ }
Instances For
The width b - a of a dyadic interval [a, b].
Equations
- ConvexAnalysis.DyadicInterval.width D = D.toProd.2 - D.toProd.1
Instances For
Every side of the box X has width at most w.
Equations
- ConvexAnalysis.DyadicInterval.isNarrow w X = (List.finRange n).all fun (i : Fin n) => decide (↑(ConvexAnalysis.DyadicInterval.width (X i)) ≤ w)
Instances For
The index of a widest side of a box of dyadic intervals (the first one), or none if the
box has no sides.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The bisection of a box X of dyadic intervals: the two boxes obtained by splitting a
widest side (ConvexAnalysis.DyadicInterval.widest) at its midpoint.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The two halves of a bisection cover the box.
The bisection test allPieces P d X: P X holds, or d > 0 and the bisection test
with depth d - 1 succeeds on both halves of X (ConvexAnalysis.DyadicInterval.bisect). So
true means that P holds on every piece of a subdivision of X by at most d successive
bisections.
Equations
- One or more equations did not get rendered due to their size.
- ConvexAnalysis.DyadicInterval.allPieces P 0 x✝ = P x✝
Instances For
Soundness of the bisection test: if P X implies a property Q at every point of the
box X, for every box X, and the bisection test allPieces P d X succeeds, then Q holds at
every point of the box X.
The box of dyadic intervals [⌊lo i⌋, ⌈hi i⌉] containing the rational box [lo, hi]
(ConvexAnalysis.DyadicInterval.ofRat).
Equations
- ConvexAnalysis.DyadicInterval.ratBox prec lo hi i = ConvexAnalysis.DyadicInterval.ofRat (lo i) (hi i) prec
Instances For
Enclosures on a box: the natural extension and the mean value form #
The mean value form of e on the box X of dyadic intervals, computed in dyadic
interval arithmetic at the precision 2⁻ᵖʳᵉᶜ: F(c) + ∑ i, Gᵢ (Xᵢ - cᵢ), where c is the center
of X (the split points), F(c) the dyadic evaluation of e at c and Gᵢ the dyadic
evaluation of the symbolic partial derivative ConvexAnalysis.RatArithExpr.pderiv i e on X.
It is none if one of these evaluations fails or the result is unbounded.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The computed mean value form encloses the range (Neumaier, Theorem 2.3.3,
with derivative enclosures by interval differentiation and all operations rounded outward): if
ConvexAnalysis.RatArithExpr.meanValueEval prec e X = some D, the value of e at every point of
the box X lies in D. This is ConvexAnalysis.ArithExpr.mem_meanValueForm_pderiv with the
computed enclosures.
The box test boxTest prec e ok mvfWidth X: the predicate ok a b holds for the
endpoints [a, b] of the dyadic natural interval extension
ConvexAnalysis.RatArithExpr.dyadicEval of e on X, or, if not and every side of X has width
at most mvfWidth, for those of the mean value form
ConvexAnalysis.RatArithExpr.meanValueEval.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Soundness of the box test: if ok a b implies a property Q of all reals in [a, b]
and the box test succeeds on X, then Q (e x) holds at every point x of the box X.
Bound tests and the exclusion test #
The bound test with the predicate ok on the rational box [lo, hi]: the bisection test
ConvexAnalysis.DyadicInterval.allPieces with the box test ConvexAnalysis.RatArithExpr.boxTest,
of depth depth, on the dyadic box ConvexAnalysis.DyadicInterval.ratBox prec lo hi.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Soundness of the bound test: if ok a b implies Q on [a, b] and the bound test
succeeds, then Q (e x) holds for every x in the box [lo, hi].
The lower bound test for c ≤ e(x) on the box [lo, hi], by bisection of depth at most
depth (ConvexAnalysis.RatArithExpr.le_eval_of_lowerBoundTest).
Equations
- ConvexAnalysis.RatArithExpr.lowerBoundTest prec e lo hi c depth mvfWidth = ConvexAnalysis.RatArithExpr.boundTest prec e (fun (a x : Dyadic) => decide (c ≤ ↑a)) lo hi depth mvfWidth
Instances For
The strict lower bound test for c < e(x) on the box [lo, hi]
(ConvexAnalysis.RatArithExpr.lt_eval_of_strictLowerBoundTest).
Equations
- ConvexAnalysis.RatArithExpr.strictLowerBoundTest prec e lo hi c depth mvfWidth = ConvexAnalysis.RatArithExpr.boundTest prec e (fun (a x : Dyadic) => decide (c < ↑a)) lo hi depth mvfWidth
Instances For
The upper bound test for e(x) ≤ c on the box [lo, hi]
(ConvexAnalysis.RatArithExpr.eval_le_of_upperBoundTest).
Equations
- ConvexAnalysis.RatArithExpr.upperBoundTest prec e lo hi c depth mvfWidth = ConvexAnalysis.RatArithExpr.boundTest prec e (fun (x b : Dyadic) => decide (↑b ≤ c)) lo hi depth mvfWidth
Instances For
The strict upper bound test for e(x) < c on the box [lo, hi]
(ConvexAnalysis.RatArithExpr.eval_lt_of_strictUpperBoundTest).
Equations
- ConvexAnalysis.RatArithExpr.strictUpperBoundTest prec e lo hi c depth mvfWidth = ConvexAnalysis.RatArithExpr.boundTest prec e (fun (x b : Dyadic) => decide (↑b < c)) lo hi depth mvfWidth
Instances For
A verified lower bound: if the lower bound test
ConvexAnalysis.RatArithExpr.lowerBoundTest succeeds, then c ≤ e(x) for every x in the box
[lo, hi].
A verified strict lower bound: if the test
ConvexAnalysis.RatArithExpr.strictLowerBoundTest succeeds, then c < e(x) for every x in the
box [lo, hi].
A verified upper bound: if the upper bound test
ConvexAnalysis.RatArithExpr.upperBoundTest succeeds, then e(x) ≤ c for every x in the box
[lo, hi].
A verified strict upper bound: if the test
ConvexAnalysis.RatArithExpr.strictUpperBoundTest succeeds, then e(x) < c for every x in the
box [lo, hi].
The exclusion test for the system F : Fin m → RatArithExpr (Fin n) on the box
[lo, hi]: the bisection test of depth depth in which a piece passes if the enclosure of some
component F k (the natural interval extension, or the mean value form on pieces of width at
most mvfWidth, ConvexAnalysis.RatArithExpr.boxTest) does not contain 0
(ConvexAnalysis.RatArithExpr.forall_exists_ne_zero_of_exclusionTest).
Equations
- One or more equations did not get rendered due to their size.
Instances For
A verified exclusion of zeros: if the exclusion test
ConvexAnalysis.RatArithExpr.exclusionTest succeeds, the system (F k).toArithExpr.eval x = 0
has no solution x in the box [lo, hi]: at every point some equation fails.
Verified global minima #
The global minimum test for e on the box [lo, hi] with a rational point p, the
bounds L and U and the depth depth: p lies in the box, the natural interval extension of
e is defined on the box, the dyadic evaluation of e at p is at most U, and the lower bound
test for L succeeds (ConvexAnalysis.RatArithExpr.exists_isMinOn_of_minimumTest). The
condition on the natural extension gives the continuity of e on the box; it can fail for a
continuous e whose natural extension on the whole box overestimates too much, for example
(x² - x + 1)⁻¹ on [0, 1], where the extension of the denominator is [0, 2].
Equations
- One or more equations did not get rendered due to their size.
Instances For
A verified global minimum: if the minimum test ConvexAnalysis.RatArithExpr.minimumTest
succeeds, then e attains its minimum on the box [lo, hi], and the minimum value lies in
[L, U]. The upper bound comes from the point p (e(p) ≤ U), the lower bound from the lower
bound test (ConvexAnalysis.RatArithExpr.le_eval_of_lowerBoundTest); the minimum is attained since
e is continuous on the box, where its natural interval extension is defined
(ConvexAnalysis.ArithExpr.continuousOn_eval).
A verified enclosure of the infimum: if the minimum test
ConvexAnalysis.RatArithExpr.minimumTest succeeds, the infimum of e on the box [lo, hi]
lies in [L, U] (and is a minimum, ConvexAnalysis.RatArithExpr.exists_isMinOn_of_minimumTest).