Documentation

LeanCert.Engine.Optimization.Box

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 #

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 #

@[reducible, inline]

An n-dimensional box as a list of intervals. The i-th element is the interval for variable i.

Equations
Instances For
    @[reducible, inline]

    A point in ℝⁿ represented as a list of reals

    Equations
    Instances For
      @[reducible, inline]

      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).

        Equations
        Instances For

          The dimension (number of intervals) of a box

          Equations
          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
            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
              Instances For
                theorem LeanCert.Engine.Optimization.Box.envMem_toEnv (ρ : ) (B : Box) (h : envMem ρ B) (hzero : iList.length B, ρ i = 0) :

                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 #

                Find the index of the maximum element in a list (returns 0 for empty list)

                Equations
                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 #

                      Split a box along a given dimension by bisecting that interval. Returns the original box if the dimension is out of bounds.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Split along the widest dimension

                        Equations
                        Instances For

                          Volume and size heuristics #

                          Volume of a box (product of widths). Returns 0 for empty box.

                          Equations
                          Instances For

                            Maximum width across all dimensions

                            Equations
                            Instances For

                              Check if a box is "small" (max width below threshold)

                              Equations
                              Instances For

                                Box construction helpers #

                                Create a box from a list of (lo, hi) pairs

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Create a box from bounds: [lo₀, hi₀] × ... × [loₙ₋₁, hiₙ₋₁]

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Membership lemmas #

                                    theorem LeanCert.Engine.Optimization.Box.coord_mem_of_mem (p : Point) (B : Box) (h : mem p B) (i : Fin (List.length B)) :
                                    p[i] B[i]

                                    If a point is in a box, its i-th coordinate is in the i-th interval

                                    theorem LeanCert.Engine.Optimization.Box.mem_split_cases (B : Box) (d : ) (hd : d < List.length B) (p : Point) (hp : mem p B) :
                                    mem p (B.split d).1 mem p (B.split d).2

                                    After splitting, any point in the original box is in one of the halves.

                                    theorem LeanCert.Engine.Optimization.Box.envMem_split_cases (B : Box) (d : ) (hd : d < List.length B) (ρ : ) ( : envMem ρ B) :
                                    envMem ρ (B.split d).1 envMem ρ (B.split d).2

                                    Environment membership after splitting.