Mathlib.Optimization
Optimization helpers staged for Mathlib: exact rational linear programming, weighted-simplex KKT certificates, active-set minimizers, truncation reductions, and boundary-slice selectors.
SimplexActiveSetDefs 5 core · 0 supporting This file contains the shared definitions for the linear-plus-weighted-norm second-order cone program min_{t ∈ Δ_M} Σ αᵢ tᵢ + κ √(Σ βᵢ tᵢ²) over the three-point simplex.
Weighted-simplex active-set SOCP: shared definitions
This file contains the shared definitions for the linear-plus-weighted-norm
second-order cone program
min_{t ∈ Δ_M} Σ αᵢ tᵢ + κ √(Σ βᵢ tᵢ²) over the three-point simplex. It defines
the objective wsObj, simplex membership InSimplex, KKT support data
IsAdmissibleSupport, the induced active-set point activeSetPoint, and the
κ = 0 exposed minimizer face exposedMinFace.
Given three linear coefficients and three weights, a real scale, and a three-coordinate allocation, the weighted-simplex objective value is the linear weighted sum of the allocation plus the scale times the square root of the weighted sum of squared coordinates.
For a real total mass and a three-coordinate allocation, the scaled three-point simplex membership condition holds exactly when every coordinate is nonnegative and the three coordinates sum to the total mass.
Definition (Lean source)
Given three linear coefficients and three weights, a scale, a set of selected coordinates, and a real multiplier, the admissible-support condition holds exactly when the selected set is nonempty, its summed squared multiplier gaps divided by their weights equal the squared scale, every selected coefficient is strictly below the multiplier, and every unselected coefficient is at least the multiplier.
Given a total mass, three linear coefficients and three weights, a selected coordinate set, and a multiplier, the active-set allocation assigns each selected coordinate the total mass times its multiplier gap divided by its weight and by the sum of those ratios, and assigns every unselected coordinate zero.
Given a total mass and three linear coefficients, the exposed minimum face is the set of three-coordinate allocations that belong to the scaled simplex and have every nonzero coordinate's coefficient no larger than every coefficient.
SimplexTruncationDefs 3 core · 0 supporting The parity-truncated simplex K_d, its boundary segment H_d (truncSegPoint), and the endpoint/interior selector s⋆ (truncSelector).
Weighted-simplex truncation: shared definitions
The parity-truncated simplex K_d, its boundary segment H_d (truncSegPoint),
and the endpoint/interior selector s⋆ (truncSelector). Split out of the main
truncation file so both the convexity/reduction helper and the 1-D slice helper can
reference them.
For a total mass and truncation threshold and a three-coordinate allocation, the truncated-simplex membership condition holds exactly when the allocation belongs to the scaled three-point simplex and its second and third coordinates sum to at least the threshold.
For a total mass, threshold, and segment coordinate, the truncation-boundary point is the three-coordinate allocation whose first coordinate is the total mass minus the threshold, whose second coordinate is the segment coordinate, and whose third coordinate is the threshold minus that coordinate.
Definition (Lean source)
Given a total mass and threshold, three linear coefficients and three weights, and a scale, the boundary-segment selector first sets the difference of the second and third coefficients to as its first intermediate quantity and the weighted squared first coordinate to as its second intermediate quantity; it then returns zero when is at least , returns when is at most its negative, and otherwise returns .
Definition (Lean source)
RationalLP 14 core · 3 supporting This module proves attainment and strong duality for a finite linear program whose variables and coefficients are rational. ★ exists_rational_optimal_primal_dual
Exact certificates for rational linear programs
This module proves attainment and strong duality for a finite linear program whose variables and coefficients are rational. The proof uses certified Fourier--Motzkin elimination: primal variables are eliminated while the objective coordinate is retained, and every generated inequality records its nonnegative rational combination of the original rows. The lower endpoint of the resulting one-dimensional rational polyhedron is rational; elimination back-substitution gives a rational primal optimizer, while the recorded combination gives rational nonnegative dual multipliers of the same value.
The standard form minimizes c ⬝ᵥ x subject to A i ⬝ᵥ x ≤ b i, where ⬝ᵥ is Mathlib's
dotProduct. Variables are
unrestricted in sign. Equalities and nonnegative variables are represented by
pairs of inequalities, so this form faithfully covers arbitrary finite
rational LPs.
A linear inequality in ordinary variables x and a retained objective coordinate t, written a · x + s * t ≤ b.
Definition (Lean source)
Given a number of ordinary coordinates, an augmented rational inequality, a rational ordinary-variable vector, and a retained rational objective coordinate, the inequality-satisfaction condition holds exactly when the dot product of the ordinary coefficients and vector plus the objective coefficient times the retained coordinate is no greater than the right-hand side.
Definition (Lean source)
Given an augmented rational inequality with one more ordinary coordinate, the tail inequality removes its first ordinary coefficient while retaining its objective coefficient and right-hand side.
Definition (Lean source)
Given two augmented rational inequalities with one more ordinary coordinate, the cancellation inequality has each remaining coefficient, its objective coefficient, and its right-hand side equal to the negative first coefficient of the second inequality times the corresponding quantity of the first, plus the first coefficient of the first inequality times the corresponding quantity of the second.
Definition (Lean source)
Given a list of augmented rational inequalities with one more ordinary coordinate, the one-step Fourier--Motzkin elimination output contains the tails of all rows whose first coefficient is zero and, for every row with negative first coefficient and every row with positive first coefficient, their cancellation inequality.
Definition (Lean source)
For a nonnegative number of ordinary coordinates and a list of augmented rational inequalities in that many coordinates, the complete Fourier--Motzkin elimination output is the original list when there are no ordinary coordinates and otherwise is obtained by one first-coordinate elimination followed by complete elimination of the remaining coordinates.
Definition (Lean source)
A rational LP in inequality form: minimize c · x subject to A i · x ≤ b i, with the constraints indexed by an arbitrary type (finiteness is assumed by the algorithms and theorems that need it).
Given a constraint-label set, a number of ordinary variables, a rational linear program, and a rational vector of those variables, the primal-feasibility condition holds exactly when, for every constraint, the dot product of its coefficient row with the vector is no greater than its right-hand side.
Definition (Lean source)
Given a constraint-label set, a number of ordinary variables, a rational linear program, and a rational vector of those variables, the primal objective value is the dot product of the program's objective coefficient vector with that variable vector.
Definition (Lean source)
An augmented inequality together with rational combination weights over a fixed finite family of original rows. The structure does not require the weights to be nonnegative; nonnegativity, which makes the derived row a valid consequence of the original ones, is tracked separately by the elimination construction. The coefficient identity is stated through a common projection of the original variables; this makes repeated elimination independent of coordinate-reassociation bookkeeping.
Definition (Lean source)
A fully eliminated inequality with nonnegative provenance on the original rows and with every original-variable coefficient certified to cancel.
Definition (Lean source)
Given a finite set of constraint labels and number of ordinary variables, a finite rational linear program, and rational multipliers for its constraints, the dual-feasibility condition holds exactly when every multiplier is nonnegative and, for every ordinary coordinate, the multiplier-weighted sum of constraint coefficients equals the negative objective coefficient.
Definition (Lean source)
Given a finite set of constraint labels and number of ordinary variables, a finite rational linear program, and rational constraint multipliers, the dual objective value is the negative of the multiplier-weighted sum of the constraint right-hand sides.
Definition (Lean source)
Exact rational LP attainment and strong duality. If a finite rational linear program in inequality form has a feasible rational point and its objective is bounded below on feasible rational points, then it has a rational optimal primal point and rational nonnegative dual multipliers with the same objective value.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
eliminateOne_ifftheorem — One Fourier–Motzkin elimination step preserves exactly the feasible values of the retained objective coordinate.hypothesest :ℚconclusion(∃ z : ℚ, ∀ r ∈ rows, r.Holds (cons z x) t) ↔ ∀ r ∈ eliminateOne rows, r.Holds x tProof (Lean source)
theorem eliminateOne_iff {rows : List (AugmentedIneq (n + 1))} {x : Fin n → ℚ} {t : ℚ} : (∃ z : ℚ, ∀ r ∈ rows, r.Holds (cons z x) t) ↔ ∀ r ∈ eliminateOne rows, r.Holds x t := by constructor · rintro ⟨z, hz⟩ simpa using mem_eliminateOne_of_holds (x := cons z x) hz · exact exists_head_of_eliminateOne -
eliminateAll_ifftheorem — Eliminating all ordinary variables preserves exactly the feasible values of the retained objective coordinate.hypothesesn :ℕList (AugmentedIneq n)t :ℚconclusion(∃ x : Fin n → ℚ, ∀ r ∈ rows, r.Holds x t)↔ ∀ r ∈ eliminateAll n rows, r.Holds elim0 tProof (Lean source)
theorem eliminateAll_iff {n : ℕ} {rows : List (AugmentedIneq n)} {t : ℚ} : (∃ x : Fin n → ℚ, ∀ r ∈ rows, r.Holds x t) ↔ ∀ r ∈ eliminateAll n rows, r.Holds elim0 t := by induction n with | zero => simp only [eliminateAll] constructor · rintro ⟨x, hx⟩ simpa only [Subsingleton.elim x elim0] using hx · intro hx exact ⟨Fin.elim0, hx⟩ | succ n ih => rw [eliminateAll, ← ih] constructor · rintro ⟨x, hx⟩ exact ⟨Fin.tail x, (eliminateOne_iff.mp ⟨x 0, by simpa using hx⟩)⟩ · rintro ⟨x, hx⟩ obtain ⟨z, hz⟩ := eliminateOne_iff.mpr hx exact ⟨Fin.cons z x, hz⟩ -
exists_rational_primal_optimizertheorem — If a finite rational linear program has a feasible rational point and its objective is bounded below on feasible rational points, then it has a rational primal optimizer.hypothesesι :sharedType u_1n :sharedℕP :Program ι nhne :∃ x, P.PrimalFeasible xhbdd :∃ l : ℚ, ∀ x, P.PrimalFeasible x → l ≤ P.objective xconclusion∃ xStar : Fin n → ℚ,P.PrimalFeasible xStarconclusion 1x :P.PrimalFeasible xP.objective xStar ≤ P.objective xProof (Lean source)
theorem exists_rational_primal_optimizer (P : Program ι n) (hne : ∃ x, P.PrimalFeasible x) (hbdd : ∃ l : ℚ, ∀ x, P.PrimalFeasible x → l ≤ P.objective x) : ∃ xStar : Fin n → ℚ, P.PrimalFeasible xStar ∧ ∀ x, P.PrimalFeasible x → P.objective xStar ≤ P.objective x := by have hobjne : ∃ t : ℚ, ∀ r ∈ P.objectiveRows, r.Holds elim0 t := by obtain ⟨x, hx⟩ := hne exact ⟨P.objective x, (objectiveRows_iff P _).1 ⟨x, hx, rfl⟩⟩ have hobjbdd : ∃ l : ℚ, ∀ t : ℚ, (∀ r ∈ P.objectiveRows, r.Holds elim0 t) → l ≤ t := by obtain ⟨l, hl⟩ := hbdd refine ⟨l, ?_⟩ intro t ht obtain ⟨x, hx, hxt⟩ := (objectiveRows_iff P t).2 ht simpa [← hxt] using hl x hx obtain ⟨v, hvfeas, hvmin, _⟩ := scalar_endpoint P.objectiveRows hobjne hobjbdd obtain ⟨xStar, hxStar, hxval⟩ := (objectiveRows_iff P v).2 hvfeas refine ⟨xStar, hxStar, ?_⟩ intro x hx rw [hxval] exact hvmin (P.objective x) ((objectiveRows_iff P _).1 ⟨x, hx, rfl⟩)
SimplexActiveSet 1 core · 0 supporting This file packages the active-set/KKT solution of the linear-plus-weighted-norm second-order cone program min_{t ∈ Δ_M} Σ αᵢ tᵢ + κ √(Σ βᵢ tᵢ²) over the three-point simplex. ★ weighted_simplex_active_set
Weighted-simplex active-set SOCP
This file packages the active-set/KKT solution of the linear-plus-weighted-norm
second-order cone program
min_{t ∈ Δ_M} Σ αᵢ tᵢ + κ √(Σ βᵢ tᵢ²) over the three-point simplex. Strict
convexity for κ > 0 gives a unique minimizer, realized by the admissible
support/multiplier pair; for κ = 0, the minimizer set is the exposed
α-minimizing face. The headline theorem is weighted_simplex_active_set.
The shared definitions live in SimplexActiveSetDefs; the analytic content lives
in WeightedSimplexKKT (κ > 0 optimality), WeightedSimplexExists (admissible
support existence), and WeightedSimplexFace (κ = 0 face).
Weighted-simplex active-set solution. Fix a positive total simplex mass M, linear weights α, coordinate weights β that are all strictly positive, and a nonnegative regularization parameter κ, and consider minimizing the second-order-cone objective Σ αᵢtᵢ + κ·√(Σβᵢtᵢ²) over the three-point simplex Δ_M of total mass M. Then the following two facts hold: whenever κ is strictly positive, there is a unique admissible support/multiplier pair (S, λ), its induced active-set point lies in Δ_M and is the unique global minimizer of the objective, with optimal value the closed form M · λ; and whenever κ equals zero, a point of Δ_M minimizes the objective exactly when it lies on the exposed α-minimizing face. This encodes the displayed KKT coordinate formula, the uniqueness of the admissible support, the value formula, and the κ = 0 face clause.
Formal statement
Proof (Lean source)
SimplexTruncation 2 core · 0 supporting This file packages the constrained minimizer of the weighted-simplex SOCP over the parity-truncated simplex K_d = {t ∈ Δ_M : t_y + t_z ≥ d}. ★ trunc_from_minimizer★ weighted_simplex_truncation
Weighted-simplex truncation
This file packages the constrained minimizer of the weighted-simplex SOCP over
the parity-truncated simplex K_d = {t ∈ Δ_M : t_y + t_z ≥ d}. If the relaxed
optimum over Δ_M is feasible, it is also optimal over K_d; otherwise an
optimum lies on the boundary segment H_d with the explicit endpoint/interior
selector sStar from the 1-D convex slice. The headline theorem is
weighted_simplex_truncation, with trunc_from_minimizer as the reusable
relaxed-minimizer dichotomy.
The definitions (InTruncSimplex, truncSegPoint, truncSelector) live in
SimplexTruncationDefs; the convexity/boundary-reduction step in
SimplexTruncationConvex; the 1-D slice minimization in SimplexTruncationSlice;
and the relaxed-optimum global-minimizer certificates in
SimplexTruncationMinimizers. This file glues them into a single dichotomy
(trunc_from_minimizer) and the headline lemma.
Truncation dichotomy from a relaxed minimizer. Fix a truncation threshold d at most the total simplex mass M, a linear weighting α, coordinate weights β with its zeroth entry nonnegative and its remaining two entries fixed equal to 1, and a nonnegative regularization parameter κ. Given a point t_rel of the simplex Δ_M that globally minimizes the weighted objective wsObj over Δ_M, then the constrained problem over the truncated simplex K_d = {t ∈ Δ_M : t₁ + t₂ ≥ d} splits into two cases: if t_rel already satisfies the truncation constraint, it remains a global minimizer over K_d; otherwise, the face selector point truncSegPoint M d sStar is feasible for K_d and is a global minimizer over K_d. This is the κ-agnostic core shared by the κ > 0 and κ = 0 branches of the headline lemma.
Formal statement
Proof (Lean source)
Weighted-simplex truncation. In the notation of weighted_simplex_active_set, fix a positive total simplex mass M, a truncation threshold d at most M, a linear weighting α, coordinate weights β that are everywhere strictly positive with its last two entries fixed equal to 1, and a nonnegative regularization parameter κ. Then the global minimizer of the weighted-simplex objective over the truncated simplex K_d = {t ∈ Δ_M : t₁ + t₂ ≥ d} is given, case by case on the sign of κ, by the active-set/face-selector construction below.
Formal statement
Proof (Lean source)
SimplexTruncationConvex 2 core · 2 supporting Two-point convexity of the SOCP objective wsObj (linear term plus a nonnegative multiple of the weighted ℓ² norm), and the geometric consequence that on the truncated simplex K_d any feasible point is dominated in object ★ wsObj_segment_le★ truncSeg_reduction
Weighted-simplex truncation: convexity and boundary reduction
Two-point convexity of the SOCP objective wsObj (linear term plus a nonnegative
multiple of the weighted ℓ² norm), and the geometric consequence that on the
truncated simplex K_d any feasible point is dominated in objective value by a
point of the truncation face H_d, once the relaxed global minimizer is known to
be infeasible (t_rel_y + t_rel_z < d).
Two-point convexity of the weighted-simplex objective. For nonnegative coordinate weights β and a nonnegative SOCP scale κ, if θ lies between 0 and 1 then the objective evaluated at the convex combination of two points is at most the same convex combination of the objective values at and at .
Formal statement
Proof (Lean source)
Boundary reduction onto the truncation face. Fix nonnegative coordinate weights β and a nonnegative SOCP scale κ. If t_rel lies in the three-coordinate simplex and globally minimizes the objective over that simplex, while t_rel fails the parity cut defining the truncated sub-simplex, since its last two coordinates sum to strictly less than , then for every point t of the truncated sub-simplex , there is some between and such that the boundary point of the truncation face attains an objective value no larger than the objective at t.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
weighted_sqrt_segment_lelemma — The weighted Euclidean root-mean-square of a convex combination is no larger than the same convex combination of the two weighted root-mean-squares.hypothesesProof (Lean source)
lemma weighted_sqrt_segment_le (β : Fin 3 → ℝ) (hβ : ∀ i, 0 ≤ β i) (u v : Fin 3 → ℝ) (θ : ℝ) (hθ0 : 0 ≤ θ) (hθ1 : θ ≤ 1) : sqrt (∑ i, β i * ((1 - θ) * u i + θ * v i) ^ 2) ≤ (1 - θ) * sqrt (∑ i, β i * u i ^ 2) + θ * sqrt (∑ i, β i * v i ^ 2) := by have hθc : 0 ≤ 1 - θ := by linarith have hvec : weightedVec β (fun i => (1 - θ) * u i + θ * v i) = (1 - θ) • weightedVec β u + θ • weightedVec β v := by ext i simp [weightedVec] ring calc sqrt (∑ i, β i * ((1 - θ) * u i + θ * v i) ^ 2) = ‖weightedVec β (fun i => (1 - θ) * u i + θ * v i)‖ := by rw [weightedVec_norm β (fun i => (1 - θ) * u i + θ * v i) hβ] _ = ‖(1 - θ) • weightedVec β u + θ • weightedVec β v‖ := by rw [hvec] _ ≤ ‖(1 - θ) • weightedVec β u‖ + ‖θ • weightedVec β v‖ := norm_add_le _ _ _ = (1 - θ) * sqrt (∑ i, β i * u i ^ 2) + θ * sqrt (∑ i, β i * v i ^ 2) := by rw [norm_smul, norm_smul, weightedVec_norm β u hβ, weightedVec_norm β v hβ] simp [Real.norm_eq_abs, abs_of_nonneg hθc, abs_of_nonneg hθ0] -
eq_truncSegPoint_of_simplex_facelemma — A three-coordinate vector with total mass M whose last two coordinates sum to d is the corresponding point on the truncation segment, indexed by its second coordinate.hypothesesconclusionx = truncSegPoint M d (x 1)Proof (Lean source)
lemma eq_truncSegPoint_of_simplex_face (M d : ℝ) (x : Fin 3 → ℝ) (hx : InSimplex M x) (hxd : x 1 + x 2 = d) : x = truncSegPoint M d (x 1) := by funext i fin_cases i · have hsum := hx.2 rw [Fin.sum_univ_three] at hsum simp [truncSegPoint] linarith · simp [truncSegPoint] · simp [truncSegPoint] linarith
SimplexTruncationMinimizers 2 core · 0 supporting Self-contained proofs that the two relaxed-optimum descriptions used by the truncation lemma really are global minimizers of wsObj over the full simplex Δ_M, so the truncation argument does not depend on weighted_simplex ★ activeSetPoint_isMinimizer★ exposedMinFace_isMinimizer
Weighted-simplex truncation: relaxed global minimizers
Self-contained proofs that the two relaxed-optimum descriptions used by the
truncation lemma really are global minimizers of wsObj over the full simplex
Δ_M, so the truncation argument does not depend on weighted_simplex_active_set:
* activeSetPoint_isMinimizer (κ > 0): any KKT-admissible support/multiplier pair
induces a simplex point that globally minimizes wsObj. The optimality is a
Cauchy–Schwarz (weighted ℓ²) certificate: κ β_i t*_i / ‖t*‖_β = λ − α_i on the
support and α_j ≥ λ off it, so the first-order (subgradient) inequality collapses
to λ·(Σ s − M) = 0.
* exposedMinFace_isMinimizer (κ = 0): a point of the exposed α-minimizing face
minimizes the (now purely linear) objective, since its mass sits on argmin α.
KKT admissible ⟹ global minimizer (κ > 0). For a positive total mass M, positive coordinate weights β, a positive SOCP scale κ, and a KKT-admissible support/multiplier pair (S, λ): a nonempty index set S with , strict activity on S, and inactivity off S, the induced active-set point lies in the simplex and globally minimizes the objective over that simplex.
Formal statement
Proof (Lean source)
Exposed face ⟹ global minimizer (κ = 0). If t_rel lies in the simplex and every coordinate at which it is nonzero attains the minimum value of α, then t_rel globally minimizes the purely linear objective — wsObj at — over the whole simplex.
Formal statement
Proof (Lean source)
SimplexTruncationSlice 2 core · 4 supporting On the truncation face H_d the objective restricts to the 1-D convex function g_d(σ) = α_x(M−d) + α_y σ + α_z(d−σ) + κ √(A + σ² + (d−σ)²), with A = β_x(M−d)². ★ wsObj_truncSeg_eq★ truncSeg_selector_le
Weighted-simplex truncation: the 1-D boundary slice
On the truncation face H_d the objective restricts to the 1-D convex function
g_d(σ) = α_x(M−d) + α_y σ + α_z(d−σ) + κ √(A + σ² + (d−σ)²), with A = β_x(M−d)².
This file computes that restriction (wsObj_truncSeg_eq), shows the selector s⋆
lands in [0,d] (truncSelector_mem), and proves g_d is minimized at s⋆
(truncSeg_selector_le) via the tangent-line inequality of the convex slice.
Objective on the truncation face. For a total budget M and a truncation level d, a linear weight vector α and a quadratic weight vector β, and a curvature coefficient kappa and a face coordinate σ, evaluating the weighted-simplex objective at the truncation-face point (M−d, σ, d−σ) gives the explicit one-dimensional form α₀(M−d) + α₁σ + α₂(d−σ) + κ√(β₀(M−d)² + β₁σ² + β₂(d−σ)²).
Formal statement
Proof (Lean source)
The selector minimizes the boundary slice. Suppose the truncation width is positive, the first-coordinate weight is nonnegative while the other two weights both equal 1, and the SOCP scale is nonnegative. Then for every offset between and , the objective wsObj evaluated at the boundary point truncSegPoint M d applied to the selector truncSelector M d α β κ is at most its value at the boundary point for .
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
truncSeg_cs_sqrtlemma — For a nonnegative baseline component, the inner product of two three-dimensional boundary vectors is no greater than the product of their Euclidean norms.hypothesesA d s σ :ℝhA :0 ≤ AProof (Lean source)
lemma truncSeg_cs_sqrt {A d s σ : ℝ} (hA : 0 ≤ A) : A + s * σ + (d - s) * (d - σ) ≤ Real.sqrt (A + s ^ 2 + (d - s) ^ 2) * Real.sqrt (A + σ ^ 2 + (d - σ) ^ 2) := by set a := Real.sqrt A have ha2 : a ^ 2 = A := by simp [a, Real.sq_sqrt hA] have hsq : (A + s * σ + (d - s) * (d - σ)) ^ 2 ≤ (A + s ^ 2 + (d - s) ^ 2) * (A + σ ^ 2 + (d - σ) ^ 2) := by have hid : (A + s ^ 2 + (d - s) ^ 2) * (A + σ ^ 2 + (d - σ) ^ 2) - (A + s * σ + (d - s) * (d - σ)) ^ 2 = (a * σ - s * a) ^ 2 + (a * (d - σ) - (d - s) * a) ^ 2 + (s * (d - σ) - (d - s) * σ) ^ 2 := by rw [← ha2] ring nlinarith [hid, sq_nonneg (a * σ - s * a), sq_nonneg (a * (d - σ) - (d - s) * a), sq_nonneg (s * (d - σ) - (d - s) * σ)] have hX : 0 ≤ A + s ^ 2 + (d - s) ^ 2 := truncSeg_radicand_nonneg hA have hY : 0 ≤ A + σ ^ 2 + (d - σ) ^ 2 := truncSeg_radicand_nonneg hA calc A + s * σ + (d - s) * (d - σ) ≤ |A + s * σ + (d - s) * (d - σ)| := le_abs_self _ _ ≤ Real.sqrt ((A + s ^ 2 + (d - s) ^ 2) * (A + σ ^ 2 + (d - σ) ^ 2)) := by exact Real.le_sqrt_of_sq_le (by simpa [sq_abs] using hsq) _ = Real.sqrt (A + s ^ 2 + (d - s) ^ 2) * Real.sqrt (A + σ ^ 2 + (d - σ) ^ 2) := by rw [Real.sqrt_mul hX] -
truncSelector_interior_sq_boundlemma — If the truncation offset lies strictly between the two interior guard bounds, then its squared size times the radicand is strictly smaller than the squared truncation scale times the squared interval width.hypothesesA d kappa δ :ℝhd :0 < dhA :0 ≤ Ahk :0 ≤ kappahlo :¬ kappa * d / sqrt (A + d ^ 2) ≤ δhhi :¬ δ ≤ -(kappa * d / sqrt (A + d ^ 2))conclusionδ ^ 2 * (A + d ^ 2) < kappa ^ 2 * d ^ 2Proof (Lean source)
lemma truncSelector_interior_sq_bound {A d kappa δ : ℝ} (hd : 0 < d) (hA : 0 ≤ A) (hk : 0 ≤ kappa) (hlo : ¬ kappa * d / sqrt (A + d ^ 2) ≤ δ) (hhi : ¬ δ ≤ -(kappa * d / sqrt (A + d ^ 2))) : δ ^ 2 * (A + d ^ 2) < kappa ^ 2 * d ^ 2 := by have hrad_pos : 0 < A + d ^ 2 := by nlinarith [hA, sq_pos_of_pos hd] have hBpos : 0 < sqrt (A + d ^ 2) := Real.sqrt_pos.2 hrad_pos have hBsq : sqrt (A + d ^ 2) ^ 2 = A + d ^ 2 := Real.sq_sqrt (le_of_lt hrad_pos) have hlt : δ < kappa * d / sqrt (A + d ^ 2) := lt_of_not_ge hlo have hgt : -(kappa * d / sqrt (A + d ^ 2)) < δ := lt_of_not_ge hhi have h_abs : |δ| < kappa * d / sqrt (A + d ^ 2) := by rw [abs_lt] exact ⟨hgt, hlt⟩ have hright_nonneg : 0 ≤ kappa * d / sqrt (A + d ^ 2) := by positivity have h_abs_abs : |δ| < |kappa * d / sqrt (A + d ^ 2)| := by rwa [abs_of_nonneg hright_nonneg] have hsquare := sq_lt_sq.mpr h_abs_abs field_simp [ne_of_gt hBpos] at hsquare nlinarith [hBsq, hsquare] -
truncSelector_interior_den_poslemma — Under the selector's strict interior guard inequalities, a positive interval width, and nonnegative baseline and scale, the squared-scale denominator minus half the squared offset is positive.hypothesesA d kappa δ :ℝhd :0 < dhA :0 ≤ Ahk :0 ≤ kappahlo :¬ kappa * d / sqrt (A + d ^ 2) ≤ δhhi :¬ δ ≤ -(kappa * d / sqrt (A + d ^ 2))conclusion0 < kappa ^ 2 - δ ^ 2 / 2Proof (Lean source)
lemma truncSelector_interior_den_pos {A d kappa δ : ℝ} (hd : 0 < d) (hA : 0 ≤ A) (hk : 0 ≤ kappa) (hlo : ¬ kappa * d / sqrt (A + d ^ 2) ≤ δ) (hhi : ¬ δ ≤ -(kappa * d / sqrt (A + d ^ 2))) : 0 < kappa ^ 2 - δ ^ 2 / 2 := by have hsq_lt : δ ^ 2 * (A + d ^ 2) < kappa ^ 2 * d ^ 2 := truncSelector_interior_sq_bound hd hA hk hlo hhi have hd2pos : 0 < d ^ 2 := sq_pos_of_pos hd have hratio_le : d ^ 2 ≤ A + d ^ 2 := by nlinarith [hA] have hden_half : δ ^ 2 / 2 < kappa ^ 2 := by nlinarith [hsq_lt, hratio_le, hd2pos] nlinarith -
truncSelector_memlemma — The selector lands in [0,d]. The endpoint/interior selector truncSelector satisfies 0 ≤ s⋆ ≤ d: the two endpoint branches give 0 and d directly, and in the interior branch the guard failures |δ| < κ d / √(A + d²) force δ²(A + d²) < κ² d², whence |s⋆ − d/2| < d/2.hypothesesProof (Lean source)
lemma truncSelector_mem (M d : ℝ) (α β : Fin 3 → ℝ) (kappa : ℝ) (hd : 0 < d) (hβ0 : 0 ≤ β 0) (hk : 0 ≤ kappa) : 0 ≤ truncSelector M d α β kappa ∧ truncSelector M d α β kappa ≤ d := by unfold truncSelector let δ := α 1 - α 2 let A := β 0 * (M - d) ^ 2 have hA : 0 ≤ A := by dsimp [A] exact mul_nonneg hβ0 (sq_nonneg _) dsimp only split_ifs with hlo hhi · exact ⟨le_rfl, le_of_lt hd⟩ · exact ⟨le_of_lt hd, le_rfl⟩ · exact truncSelector_interior_mem hd hA hk hlo hhi
WeightedSimplexCS 2 core · 0 supporting Cauchy–Schwarz for the weighted inner product ⟨s,t⟩_β = Σ βᵢ sᵢ tᵢ on a finite index type, in the squared form weighted_cs_sq and the strict simplex-slice form weighted_cs_simplex_strict. ★ weighted_cs_sq★ weighted_cs_simplex_strict
Weighted Cauchy–Schwarz on the three-point simplex
Cauchy–Schwarz for the weighted inner product ⟨s,t⟩_β = Σ βᵢ sᵢ tᵢ on a finite index type,
in the squared form weighted_cs_sq and the strict simplex-slice form
weighted_cs_simplex_strict. The strict version is used to prove uniqueness for
the weighted-simplex SOCP: on the affine slice Σ sᵢ = Σ tᵢ = M > 0, distinct
points are not positive scalar multiples of each other, so equality in
Cauchy–Schwarz cannot occur.
The squared form is the arbitrary-finite-index
Causalean.Mathlib.Analysis.weighted_inner_sq_le; only the strict version is genuinely
three-dimensional (its proof uses the explicit Lagrange identity).
Weighted Cauchy–Schwarz (squared form). For finitely many coordinates weighted by nonnegative masses β, the square of the weighted inner product of two vectors and is at most the product of their weighted sums of squares .
Formal statement
Proof (Lean source)
Strict weighted Cauchy–Schwarz on the simplex slice. For a nonzero total mass M and positive coordinate weights β, if the coordinates of sum to , the coordinates of sum to , and and are distinct vectors, then the weighted inner product is strictly less than the product of the weighted Euclidean norms .
Formal statement
Proof (Lean source)
WeightedSimplexExists 2 core · 4 supporting For κ > 0 there is an admissible support/multiplier pair (S, λ). ★ exists_admissible
Existence of an admissible support (κ > 0)
For κ > 0 there is an admissible support/multiplier pair (S, λ). Constructed by the
intermediate value theorem applied to the continuous threshold function
G(λ) = Σᵢ (max(λ − αᵢ, 0))² / βᵢ: G is continuous with G(min α) = 0 < κ² and
G large for λ large, so some λ has G(λ) = κ²; then S = {i : αᵢ < λ} is
admissible (the truncation makes the sum over S agree with G(λ), and off S,
αⱼ ≥ λ).
Given three linear coefficients and three weights and a real multiplier, the active-set threshold value is the sum over the three coordinates of the squared positive part of the multiplier minus the coefficient, divided by the corresponding weight.
Existence of an admissible support/multiplier pair (κ > 0). For positive coordinate weights β and a positive SOCP scale κ, there exists a nonempty index set S and a multiplier λ such that , with on S and off S.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
continuous_kktThresholdlemma — The active-set threshold function varies continuously with the multiplier because the weights are fixed real coefficients.Proof (Lean source)
@[fun_prop] lemma continuous_kktThreshold (α β : Fin 3 → ℝ) : Continuous (kktThreshold α β) := by unfold kktThreshold continuity -
kktThreshold_nonneglemma — The active-set threshold is nonnegative when every coordinate has a nonnegative weight, because it sums squared multiplier gaps divided by those weights.Proof (Lean source)
lemma kktThreshold_nonneg (α β : Fin 3 → ℝ) (hβ : ∀ i, 0 ≤ β i) (lam : ℝ) : 0 ≤ kktThreshold α β lam := by unfold kktThreshold exact sum_nonneg fun i _ => div_nonneg (sq_nonneg _) (hβ i) -
kktThreshold_eq_zero_of_lelemma — The active-set threshold is zero when the multiplier is no larger than every coefficient.Proof (Lean source)
lemma kktThreshold_eq_zero_of_le (α β : Fin 3 → ℝ) (lam : ℝ) (hle : ∀ i, lam ≤ α i) : kktThreshold α β lam = 0 := by unfold kktThreshold apply Finset.sum_eq_zero intro i _ have hdiff : lam - α i ≤ 0 := by linarith [hle i] simp [max_eq_right hdiff] -
support_sum_eq_kktThresholdlemma — Summing squared multiplier gaps only over coordinates whose coefficients lie below the multiplier gives exactly the active-set threshold.hypothesesα β :Fin 3 → ℝlam :ℝconclusion(∑ i ∈ Finset.univ.filter (fun i : Fin 3 => α i < lam), (lam - α i) ^ 2 / β i)= kktThreshold α β lamProof (Lean source)
lemma support_sum_eq_kktThreshold (α β : Fin 3 → ℝ) (lam : ℝ) : (∑ i ∈ Finset.univ.filter (fun i : Fin 3 => α i < lam), (lam - α i) ^ 2 / β i) = kktThreshold α β lam := by classical calc (∑ i ∈ Finset.univ.filter (fun i : Fin 3 => α i < lam), (lam - α i) ^ 2 / β i) = ∑ i, if α i < lam then (lam - α i) ^ 2 / β i else 0 := by simpa using (Finset.sum_filter (s := univ) (p := fun i : Fin 3 => α i < lam) (f := fun i => (lam - α i) ^ 2 / β i)) _ = kktThreshold α β lam := by unfold kktThreshold apply Finset.sum_congr rfl intro i _ by_cases hi : α i < lam · have hdiff : 0 ≤ lam - α i := by linarith simp [hi, max_eq_left hdiff] · have hdiff : lam - α i ≤ 0 := by linarith [not_lt.mp hi] simp [hi, max_eq_right hdiff]
WeightedSimplexFace 1 core · 1 supporting At κ = 0 the objective wsObj α β 0 is the linear functional Σ αᵢ tᵢ, whose minimizers over Δ_M are exactly the exposed α-minimizing face exposedMinFace. ★ kappa_zero_face
The κ = 0 exposed face
At κ = 0 the objective wsObj α β 0 is the linear functional Σ αᵢ tᵢ, whose
minimizers over Δ_M are exactly the exposed α-minimizing face exposedMinFace.
The κ = 0 minimizer set is the exposed α-minimizing face. For a simplex budget M, a linear weight vector α, and a candidate point t, t lies in the simplex of budget M and minimizes the linear objective Σᵢ αᵢtᵢ over that simplex if and only if t belongs to the exposed α-minimizing face of the simplex.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
wsObj_kappa_zerolemma — At κ = 0 the weighted-simplex objective collapses to the linear form Σ αᵢ tᵢ.Proof (Lean source)
@[simp] lemma wsObj_kappa_zero (α β : Fin 3 → ℝ) (t : Fin 3 → ℝ) : wsObj α β 0 t = ∑ i, α i * t i := by simp [wsObj]
WeightedSimplexKKT 2 core · 4 supporting Given admissible support/multiplier data (S, λ) for the weighted-simplex SOCP with κ > 0, the induced activeSetPoint lies in Δ_M, has support exactly S, weighted squared norm (Mκ / D)² with D = Σ_{h∈S}(λ−αₕ)/βₕ, objectiv ★ activeSetPoint_value★ activeSetPoint_strict_min
Active-set KKT lemmas (κ > 0)
Given admissible support/multiplier data (S, λ) for the weighted-simplex SOCP with
κ > 0, the induced activeSetPoint lies in Δ_M, has support exactly S, weighted
squared norm (Mκ / D)² with D = Σ_{h∈S}(λ−αₕ)/βₕ, objective value M·λ, and is the
strict minimizer of the SOCP over Δ_M.
Objective value of the active-set point. For a nonnegative total mass M, positive weights on the support S, a positive SOCP scale κ, a nonempty support S, strict activity on S, and the admissibility identity , the objective wsObj evaluated at the induced active-set point equals the closed form .
Formal statement
Proof (Lean source)
Strict minimality of the active-set point (κ > 0). For a positive total mass M, positive coordinate weights β, a positive SOCP scale κ, and a KKT-admissible support/multiplier pair (S, λ), every other point of the simplex has strictly larger objective value than the induced active-set point.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
activeSet_denom_poslemma — The active-set denominator D = Σ_{h∈S} (λ−αₕ)/βₕ is strictly positive: S is nonempty and each summand is positive (λ > αₕ on S, βₕ > 0).hypotheseslam :sharedℝhβ :∀ i ∈ S, 0 < β ihS :S.Nonemptyhactive :∀ i ∈ S, α i < lamconclusion0 < ∑ h ∈ S, (lam - α h) / β hProof (Lean source)
lemma activeSet_denom_pos (hβ : ∀ i ∈ S, 0 < β i) (hS : S.Nonempty) (hactive : ∀ i ∈ S, α i < lam) : 0 < ∑ h ∈ S, (lam - α h) / β h := by exact Finset.sum_pos (fun h hh => div_pos (sub_pos.mpr (hactive h hh)) (hβ h hh)) hS -
activeSetPoint_pos_ifflemma — The active-set point has support exactly S: on S its coordinate is positive, off S it is 0.hypothesesM :sharedℝlam :sharedℝhM :0 < Mhβ :∀ i ∈ S, 0 < β ihS :S.Nonemptyhactive :∀ i ∈ S, α i < lami :Fin 3conclusion0 < activeSetPoint M α β S lam i ↔ i ∈ SProof (Lean source)
lemma activeSetPoint_pos_iff (hM : 0 < M) (hβ : ∀ i ∈ S, 0 < β i) (hS : S.Nonempty) (hactive : ∀ i ∈ S, α i < lam) (i : Fin 3) : 0 < activeSetPoint M α β S lam i ↔ i ∈ S := by constructor · intro hpos by_contra hi simp [activeSetPoint, hi] at hpos · intro hi rw [activeSetPoint, if_pos hi] exact div_pos (mul_pos hM (div_pos (sub_pos.mpr (hactive i hi)) (hβ i hi))) (activeSet_denom_pos α β S lam hβ hS hactive) -
activeSetPoint_memlemma — The active-set point lies in the simplex Δ_M.hypothesesM :sharedℝlam :sharedℝhM :0 ≤ Mhβ :∀ i ∈ S, 0 < β ihS :S.Nonemptyhactive :∀ i ∈ S, α i < lamconclusionInSimplex M (activeSetPoint M α β S lam)Proof (Lean source)
lemma activeSetPoint_mem (hM : 0 ≤ M) (hβ : ∀ i ∈ S, 0 < β i) (hS : S.Nonempty) (hactive : ∀ i ∈ S, α i < lam) : InSimplex M (activeSetPoint M α β S lam) := by constructor · intro i by_cases hi : i ∈ S · rw [activeSetPoint, if_pos hi] exact div_nonneg (mul_nonneg hM (le_of_lt (div_pos (sub_pos.mpr (hactive i hi)) (hβ i hi)))) (le_of_lt (activeSet_denom_pos α β S lam hβ hS hactive)) · simp [activeSetPoint, hi] · let D := ∑ h ∈ S, (lam - α h) / β h have hD : D ≠ 0 := ne_of_gt (activeSet_denom_pos α β S lam hβ hS hactive) calc (∑ i, activeSetPoint M α β S lam i) = ∑ i ∈ S, M * ((lam - α i) / β i) / D := by simp [activeSetPoint, D] _ = M / D * (∑ i ∈ S, (lam - α i) / β i) := by rw [Finset.mul_sum] simp [D, mul_assoc, mul_comm, mul_left_comm, div_eq_mul_inv] _ = M := by rw [show (∑ i ∈ S, (lam - α i) / β i) = D by rfl] field_simp [hD] -
activeSetPoint_normSqlemma — Weighted squared norm of the active-set point: Σ βᵢ tᵢ² = (Mκ)² / D², using the admissibility identity Σ_{i∈S}(λ−αᵢ)²/βᵢ = κ².hypothesesM :sharedℝkappa :sharedℝlam :sharedℝhβ :∀ i ∈ S, 0 < β ihS :S.Nonemptyhactive :∀ i ∈ S, α i < lamhsq :(∑ i ∈ S, (lam - α i) ^ 2 / β i) = kappa ^ 2conclusion(∑ i, β i * activeSetPoint M α β S lam i ^ 2)= (M * kappa) ^ 2 / (∑ h ∈ S, (lam - α h) / β h) ^ 2Proof (Lean source)
lemma activeSetPoint_normSq (hβ : ∀ i ∈ S, 0 < β i) (hS : S.Nonempty) (hactive : ∀ i ∈ S, α i < lam) (hsq : (∑ i ∈ S, (lam - α i) ^ 2 / β i) = kappa ^ 2) : (∑ i, β i * activeSetPoint M α β S lam i ^ 2) = (M * kappa) ^ 2 / (∑ h ∈ S, (lam - α h) / β h) ^ 2 := by let D := ∑ h ∈ S, (lam - α h) / β h have hD : D ≠ 0 := ne_of_gt (activeSet_denom_pos α β S lam hβ hS hactive) calc (∑ i, β i * activeSetPoint M α β S lam i ^ 2) = ∑ i ∈ S, β i * (M * ((lam - α i) / β i) / D) ^ 2 := by simp [activeSetPoint, D] _ = ∑ i ∈ S, (M ^ 2 / D ^ 2) * ((lam - α i) ^ 2 / β i) := by apply Finset.sum_congr rfl intro i hi have hb : β i ≠ 0 := ne_of_gt (hβ i hi) field_simp [hb, hD] _ = (M ^ 2 / D ^ 2) * (∑ i ∈ S, (lam - α i) ^ 2 / β i) := by rw [Finset.mul_sum] _ = (M * kappa) ^ 2 / D ^ 2 := by rw [hsq] ring