N-Dimensional Boxes for Global Optimization #
This file provides the Box type for representing n-dimensional domains
as products of intervals, along with helper functions for branch-and-bound
optimization.
Main definitions #
Box- A list of intervals representing an n-dimensional boxBox.toEnv- Convert a box to an interval environmentBox.mem- Membership: a point (list of reals) is in a boxBox.widestDim- Find the dimension with the largest width (for splitting)Box.split- Split a box along a given dimensionBox.volume- Product of interval widths (heuristic measure)
Design #
A Box is represented as List IntervalRat, where the i-th element is the
interval for the i-th variable. This allows boxes of any dimension.
For expressions with n variables (var 0 through var n-1), a box should
have at least n intervals. The conversion Box.toEnv returns default
for out-of-bounds indices.
Box type and basic operations #
An n-dimensional box as a list of intervals. The i-th element is the interval for variable i.
Instances For
A point in ℝⁿ represented as a list of reals
Equations
Instances For
A rational point in ℚⁿ
Equations
Instances For
Convert a box to an interval environment.
Returns default for out-of-bounds indices (i.e., the whole real line approximation).
Instances For
Check if a point is in a box. A point is in a box if each coordinate is in the corresponding interval.
Equations
- LeanCert.Engine.Optimization.Box.mem p B = ∃ (h : List.length p = List.length B), ∀ (i : Fin (List.length B)), p[↑i] ∈ B[↑i]
Instances For
Membership for a real function (environment) in a box. This is the key notion for correctness: ρ ∈ B means ρ i ∈ B[i] for all i < B.length.
Equations
- LeanCert.Engine.Optimization.Box.envMem ρ B = ∀ (i : Fin (List.length B)), ρ ↑i ∈ B[↑i]
Instances For
envMem implies the general IntervalEnv membership for toEnv NOTE: For indices beyond the box dimension, we use the default interval [0,0]. This means expressions should only use variables 0..B.length-1 for correct results.
Width and dimension selection #
Width of an interval
Equations
Instances For
Get the width of each dimension
Equations
Instances For
Find the index of the maximum element in a list (returns 0 for empty list)
Equations
- One or more equations did not get rendered due to their size.
- LeanCert.Engine.Optimization.Box.maxIdx [] = 0
- LeanCert.Engine.Optimization.Box.maxIdx [head] = 0
Instances For
Find the dimension with the widest interval (heuristic for splitting). Returns 0 if the box is empty.
Equations
Instances For
Alternative: find widest dimension with explicit fold
Equations
- One or more equations did not get rendered due to their size.
Instances For
Box splitting #
Volume and size heuristics #
Volume of a box (product of widths). Returns 0 for empty box.
Instances For
Box construction helpers #
Create a unit box [0,1]ⁿ
Equations
- LeanCert.Engine.Optimization.Box.unit n = List.replicate n { lo := 0, hi := 1, le := LeanCert.Engine.Optimization.Box.unit._proof_1 }
Instances For
Create a symmetric box [-1,1]ⁿ
Equations
- LeanCert.Engine.Optimization.Box.symmetric n = List.replicate n { lo := -1, hi := 1, le := LeanCert.Engine.Optimization.Box.symmetric._proof_1 }