Khachiyan's perturbed-and-boxed system and iteration budget
DefinitionSmaleNinth_KhachiyanDeciding a linear system by the ellipsoid method requires converting it into one that is bounded and, when feasible, of guaranteed positive volume — the ellipsoid iteration can only detect a feasible set that is not vanishingly thin, and cannot terminate on a set that is unbounded. For integer data this conversion is possible with explicit constants, and this module fixes one admissible choice of them.
Throughout, and have all entries bounded in absolute value by an integer .
The perturbation and the box. The two basic constants are
Here is a relaxation small enough not to create feasibility where there was none, and is a box radius large enough that a feasible system has a solution inside the box; both magnitudes come from Cramer-type determinant bounds on integer matrices, whose determinants are either or at least in absolute value while being at most in size.
The perturbed-and-boxed system. These are combined into the single system in variables with rows
whose solution set is the object the ellipsoid method is actually run on.
The geometric budget. Three further quantities describe that run: the enclosing radius , bounding the perturbed-and-boxed solution set inside the ball of radius about the origin; the volume floor , a lower bound for that solution set's volume when it is nonempty; and the iteration budget
obtained by feeding the enclosing cube's volume and the strict volume floor into the ellipsoid method's volume-halving iteration count.
Conventions. Only the polynomial order of these constants matters — is polynomial in and — and every step below tolerates replacing them by any other valid choice; they are pinned down here so that the statements built on them are fully explicit rather than asymptotic. The definitions are total functions of and and degenerate outside the intended range: for the perturbation and the volume floor collapse to and the budget to a junk value, which is why every statement using them assumes . Nothing here asserts a property of these quantities; the assertions are the accompanying theorems.
import Definitions.Def_Polyhedron
import Definitions.Def_LinearOptimization_Ellipsoid
/-!
The perturbed-and-boxed system through which the ellipsoid method decides
the feasibility of a linear system with integer data — the quantitative
scaffolding of Khachiyan's theorem.
Source: L.G. Khachiyan, *A polynomial algorithm in linear programming*,
Soviet Math. Doklady 20 (1979) 191–194, in the standard textbook
quantification of B. Korte, J. Vygen, *Combinatorial Optimization*, 6th ed.,
Springer, §4.4–4.5, and Bertsimas–Tsitsiklis, *Introduction to Linear
Optimization*, §8.4. The constants below follow the classical
Cramer–Hadamard estimates; they are chosen generously (any valid choice
of the same polynomial order works) and are fixed here once so that every
statement built on them is fully explicit:
- `khachiyanEps n U = 1 / (2 (n+1) (n+1)! U^(n+1))` — a perturbation so
small that `{x | Ax ≥ b}` and `{x | Ax ≥ b − ε𝟙}` are simultaneously
empty or nonempty (via Farkas and a Cramer bound on a basic dual
certificate).
- `khachiyanBox n U = n!·U^n + 1` — a box radius `M` such that a nonempty
`{x | Ax ≥ b}` contains a point with `|x_j| ≤ M − 1` (Cramer–Hadamard
bound on a point of a minimal face).
- `khachiyanSystemA / khachiyanSystemb` — the stacked system
`Ax ≥ b − ε𝟙, x ≥ −M𝟙, −x ≥ −M𝟙` (rows: `A`, then `I`, then `−I`),
a bounded polyhedron that is nonempty iff the original system is, and in
that case is full-dimensional with an explicit volume lower bound.
- `khachiyanVolLB n U = (ε/(nU))^n` — the volume lower bound (a cube of
side `ε/(nU)` around a bounded feasible point fits inside the system).
- `khachiyanRadius n U = (n+1)·M` — the perturbed system lies in the ball
`E(0, r²I)` of this radius `r`.
- `khachiyanIterations n U = ⌈2(n+1)·log((2r)^n / (v/2))⌉` — the
iteration budget fed to the ellipsoid method of the platform's
`LinearOptimization` development (Bertsimas–Tsitsiklis Chapter 8), with
`V = (2r)^n` the enclosing-cube volume bound and `v/2` a strict lower
bound for the nonempty case. It is polynomially bounded in `n` and
`log U`.
-/
open Matrix LinearOptimization
namespace SmaleNinth
/-- The Khachiyan perturbation `ε = 1 / (2 (n+1) (n+1)! U^(n+1))` for a
system in `n` variables with integer entries bounded by `U`. -/
noncomputable def khachiyanEps (n U : ℕ) : ℝ :=
1 / (2 * ((n : ℝ) + 1) * ((n + 1).factorial : ℝ) * (U : ℝ) ^ (n + 1))
/-- The Khachiyan box radius `M = n!·U^n + 1`: a nonempty system with data
bounded by `U` has a solution of sup-norm at most `M − 1`. -/
noncomputable def khachiyanBox (n U : ℕ) : ℝ :=
(n.factorial : ℝ) * (U : ℝ) ^ n + 1
/-- The constraint matrix of the perturbed-and-boxed system: the rows of
`A` (cast to `ℝ`), then `I` (the constraints `x_j ≥ −M`), then `−I` (the
constraints `−x_j ≥ −M`). -/
noncomputable def khachiyanSystemA {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℤ) :
Matrix (Fin (m + n + n)) (Fin n) ℝ :=
fun i j =>
if h : (i : ℕ) < m then (A ⟨(i : ℕ), h⟩ j : ℝ)
else if (i : ℕ) < m + n then (if (j : ℕ) = (i : ℕ) - m then 1 else 0)
else (if (j : ℕ) = (i : ℕ) - m - n then -1 else 0)
/-- The right-hand side of the perturbed-and-boxed system: `b_i − ε` on the
original rows, `−M` on all `2n` box rows. -/
noncomputable def khachiyanSystemb {m : ℕ} (n U : ℕ) (b : Fin m → ℤ) :
Fin (m + n + n) → ℝ :=
fun i =>
if h : (i : ℕ) < m then (b ⟨(i : ℕ), h⟩ : ℝ) - khachiyanEps n U
else -(khachiyanBox n U)
/-- The volume lower bound `v = (ε/(nU))^n` for the nonempty case. -/
noncomputable def khachiyanVolLB (n U : ℕ) : ℝ :=
(khachiyanEps n U / ((n : ℝ) * (U : ℝ))) ^ n
/-- The enclosing-ball radius `r = (n+1)·M` for the perturbed-and-boxed
system. -/
noncomputable def khachiyanRadius (n U : ℕ) : ℝ :=
((n : ℝ) + 1) * khachiyanBox n U
/-- The ellipsoid-method iteration budget
`t* = ⌈2(n+1)·log(V/v')⌉` with `V = (2r)^n` (the enclosing cube's volume)
and `v' = v/2` (a strict volume lower bound in the nonempty case). -/
noncomputable def khachiyanIterations (n U : ℕ) : ℕ :=
⌈2 * ((n : ℝ) + 1) *
Real.log ((2 * khachiyanRadius n U) ^ n / (khachiyanVolLB n U / 2))⌉₊
end SmaleNinth
Read-back
What the Lean code literally says, in plain math · claude-fable-5
Read-back: Def_SmaleNinth_Khachiyan
Seven definitions in the namespace SmaleNinth. All are total functions of natural-number parameters (and, for the two "system" definitions, of an integer matrix or vector); every occurrence of , , a factorial, or an integer entry below denotes its cast into the real numbers. None of these definitions refer to the imported polyhedron, ellipsoid, ellipsoidBall, or any other definition from the dependency files; they are standalone arithmetic and matrix constructions.
khachiyanEps
For natural numbers , the real number
where is the factorial of the natural number and is the real power of the cast of . Edge cases. If the denominator is (since forces ), and division by zero in the reals yields the junk value — not a positive perturbation. For the value is a genuine positive rational; e.g. . There is no hypothesis anywhere in the definition requiring or .
khachiyanBox
For natural numbers , the real number
Edge cases. For the convention (which holds in the code even when ) gives . For and , . The value is always .
khachiyanSystemA
Given natural numbers (implicit, read off from the matrix's shape) and an integer matrix (indexed by ), this is the real matrix
whose rows are indexed by and whose entry in row , column is defined by a three-way case split on the numeric value of :
- if (first block, rows): , the real cast of the corresponding integer entry (row of itself);
- else if (second block, rows): if and otherwise, where is truncated natural subtraction; since this branch only fires when , the subtraction is genuine and ranges over , so this block is the identity matrix ;
- else (third block, the remaining rows, ): if and otherwise; again the subtraction is genuine on this branch and ranges over , so this block is .
In block form:
The column-index comparison is a comparison of the underlying natural numbers. Edge cases. If the matrix has no columns and only the first block's index range is inhabited ( is an empty matrix); if the first branch never fires and . The truncated subtraction never produces an out-of-range junk value because each branch's guard ensures the subtrahend does not exceed .
khachiyanSystemb
Given a natural number (implicit, read off from the vector) and explicit natural numbers , and an integer vector , this is the real vector with
where is khachiyanEps and is khachiyanBox. Note that and are free explicit arguments: nothing in the definition ties to the column count of any matrix or ties to a bound on the entries of (or of any ) — the caller may pass any values, and coherence with khachiyanSystemA (which produces rows for its own implicit ) is only by matching indices at the use site. Edge cases. With the perturbation is the junk value , so the first block is just the cast of ; with the second case is never reached.
khachiyanVolLB
For natural numbers , the real number
with = khachiyanEps and the product formed from the real casts. Edge cases. For the zeroth power gives regardless of the (division-by-zero) base — even though the base is then (junk). For and , both and the denominator , so the base is and . For , the value is a genuine positive number.
khachiyanRadius
For natural numbers , the real number
with = khachiyanBox. Always ; e.g. and .
khachiyanIterations
For natural numbers , the natural number
where = khachiyanRadius, = khachiyanVolLB, is the real natural logarithm as a total function (with the junk convention for ), and is the ceiling into the natural numbers, which sends every non-positive real to . The exponent in is a natural power of a real. Edge cases. For : , , so for every . For and : , so the argument of is (division-by-zero junk), , and — a zero iteration budget. Nothing in the definition guards against these degenerate parameter choices; the definition itself asserts no property of the number it produces (in particular no claim that it bounds any algorithm's iterations — that would be the content of theorems stated elsewhere).
Confirmed by the mission captain (proposal self-audit).