MathFin
Map / Choice · Portfolio choice / MathFin.Choice.Portfolio.ConvexQPKKT

KKT conditions for a convex QP with linear inequality constraints

MathFin.Choice.Portfolio.ConvexQPKKTMSC 90C25JEL C61 source

For min c ⬝ᵥ x + ½ x ⬝ᵥ (C *ᵥ x) subject to a k ⬝ᵥ x ≤ b k (k ranging over a finite index set), with C symmetric positive semidefinite: we prove the sufficiency half of the Karush-Kuhn-Tucker theorem (a feasible point satisfying stationarity, dual feasibility and complementary slackness is a global minimizer), and the uniqueness of a feasible KKT point when C is positive definite.

Scope actually proved (read before citing as "the KKT theorem")

Not proved here: KKT necessity, a separate mixed equality/inequality statement, and uniqueness of the multipliers under linearly independent active constraints. We prove:

  • Sufficiency (kkt_sufficient): stationarity + dual feasibility + complementary slackness implies global optimality over the feasible set for every feasible competitor (so x0 itself is a global minimizer whenever it is feasible). This is the direction actually used to certify a candidate solution, and it follows directly from convexity — no constraint qualification is needed.
  • Uniqueness under C positive definite (kkt_point_unique_of_posDef): any two feasible points each satisfying a sufficient-KKT system (possibly with different multipliers) for the same c, C, a, b coincide. A minimizer not known to be a KKT point is not covered, since necessity is not proved.

We do not prove KKT necessity (optimal implies multipliers exist) here. Necessity for inequality-constrained optimization is a genuine theorem of the alternative (Farkas'/Gordan's lemma applied to the active-constraint gradients, under a constraint qualification such as LICQ or Slater). Mathlib has the general cone-separation form of Farkas' lemma (ProperCone.hyperplane_separation in Mathlib.Analysis.Convex.Cone.Dual), but turning it into "the negative gradient lies in the cone generated by the active constraint gradients" for a finitely-generated real polyhedral cone is a separate, substantial development (closedness of a finitely-generated cone, the finite-dimensional Farkas transposition theorem in coordinates) that is out of scope here. Uniqueness of the multipliers when the active constraint gradients are linearly independent (a linear-algebra consequence of stationarity and complementary slackness) is not stated either.

Equality constraints (kkt_sufficient_of_eq): an equality constraint a ⬝ᵥ x = b is exactly the pair of opposed inequalities a ⬝ᵥ x ≤ b and -a ⬝ᵥ x ≤ -b, and a free multiplier is the difference of two nonnegative ones, so sufficiency for the equality-constrained QP is kkt_sufficient applied to that pair. A mixed equality/inequality statement is not stated separately.

We also prove the ratio-test feasible step size lemma (feasible_step_preserved): for a feasible x0 and direction d, stepping to x0 + σ • d preserves every constraint a k ⬝ᵥ x ≤ b k for every σ ∈ [0, σ̂], where σ̂ is any lower bound for the step length at which a constraint with a k ⬝ᵥ d > 0 would first become binding. We use the sign convention "a k ⬝ᵥ d > 0" for the direction that can make an upper-bound constraint a k ⬝ᵥ x ≤ b k newly binding: for a ≤-constraint, increasing σ only threatens feasibility along directions where a k ⬝ᵥ d is positive (it increases a k ⬝ᵥ x), so that is the sign under which the stated feasibility-preservation claim is actually a theorem. That the smallest such ratio is the maximum feasible step (a longer step leaves the feasible set) is not proved.

Main definitions

  • qpObj: the convex QP objective f(x) = c ⬝ᵥ x + ½ x ⬝ᵥ (C *ᵥ x).

Main results

  • qp_grad_expansion: the exact quadratic expansion qpObj c C y - qpObj c C x = (y-x) ⬝ᵥ (c + C *ᵥ x) + ½ (y-x) ⬝ᵥ (C *ᵥ (y-x)) — the algebraic core of convexity, valid for any symmetric C.
  • kkt_sufficient: KKT sufficiency for the inequality-constrained convex QP.
  • kkt_sufficient_of_eq: KKT sufficiency for the equality-constrained convex QP, with multipliers of either sign.
  • kkt_point_unique_of_posDef: uniqueness of the feasible KKT point under C ≻ 0.
  • feasible_step_preserved: the ratio-test feasibility-preservation lemma.

Tags

Karush-Kuhn-Tucker, KKT conditions, convex quadratic programming, complementary slackness, constrained optimization, global optimality, MSC 90C25, JEL C61

Import neighbourhood

Above: what it imports. Below: what imports it.

Declarations 9

defMathFin.qpObjsource
{ι : Type u_1} → [Fintype ι] → (ι → ℝ) → Matrix ι ι ℝ → (ι → ℝ) → ℝ

The convex QP objective f(x) = c ⬝ᵥ x + ½ · x ⬝ᵥ (C *ᵥ x).

theoremMathFin.dotProduct_mulVec_symm_commsource
∀ {ι : Type u_1} [Fintype ι] {C : Matrix ι ι ℝ}, C.IsSymm → ∀ (u v : ι → ℝ), u ⬝ᵥ C.mulVec v = v ⬝ᵥ C.mulVec u

A symmetric matrix's quadratic form is self-adjoint across the dot product: u ⬝ᵥ (C *ᵥ v) = v ⬝ᵥ (C *ᵥ u).

theoremMathFin.qp_grad_expansionsource
∀ {ι : Type u_1} [Fintype ι] (c : ι → ℝ) {C : Matrix ι ι ℝ}, C.IsSymm → ∀ (x y : ι → ℝ), qpObj c C y - qpObj c C x = (y - x) ⬝ᵥ (c + C.mulVec x) + 1 / 2 * (y - x) ⬝ᵥ C.mulVec (y - x)

Exact quadratic expansion: for symmetric C, f(y) - f(x) = (y-x) ⬝ᵥ (c + C *ᵥ x) + ½ (y-x) ⬝ᵥ (C *ᵥ (y-x)).

This is the algebraic content of convexity of f: the last term is ½ the quadratic form of C at d = y - x, so it is ≥ 0 whenever C is positive semidefinite, giving the first-order convexity inequality f(y) ≥ f(x) + d ⬝ᵥ ∇f(x).

theoremMathFin.kkt_complementary_term_nonnegsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {a : κ → ι → ℝ} {b u : κ → ℝ}, (∀ (k : κ), 0 ≤ u k) → ∀ {x0 : ι → ℝ}, (∀ (k : κ), u k * (a k ⬝ᵥ x0 - b k) = 0) → ∀ {y : ι → ℝ}, (∀ (k : κ), a k ⬝ᵥ y ≤ b k) → 0 ≤ ∑ k, u k * (a k ⬝ᵥ x0 - a k ⬝ᵥ y)

The complementary-slackness linear term is nonnegative at any feasible competitor y: 0 ≤ ∑ k, u k * (a k ⬝ᵥ x0 - a k ⬝ᵥ y). The per-term bound is u k * (a k ⬝ᵥ x0 - a k ⬝ᵥ y) = u k * (a k ⬝ᵥ x0 - b k) + u k * (b k - a k ⬝ᵥ y), whose first summand vanishes by complementary slackness and whose second is a product of two nonnegatives.

theoremMathFin.kkt_sufficientsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {c : ι → ℝ} {C : Matrix ι ι ℝ}, C.PosSemidef → ∀ {a : κ → ι → ℝ} {b : κ → ℝ} {x0 : ι → ℝ} {u : κ → ℝ}, (∀ (k : κ), 0 ≤ u k) → c + C.mulVec x0 = -∑ k, u k • a k → (∀ (k : κ), u k * (a k ⬝ᵥ x0 - b k) = 0) → ∀ (y : ι → ℝ), (∀ (k : κ), a k ⬝ᵥ y ≤ b k) → qpObj c C x0 ≤ qpObj c C y

KKT sufficiency for the convex QP min c ⬝ᵥ x + ½ x ⬝ᵥ (C *ᵥ x) subject to ∀ k, a k ⬝ᵥ x ≤ b k: a point x0 satisfying

  • stationarity: c + C *ᵥ x0 = -∑ k, u k • a k (u the multipliers),
  • dual feasibility: u k ≥ 0,
  • complementary slackness: u k * (a k ⬝ᵥ x0 - b k) = 0,

satisfies qpObj c C x0 ≤ qpObj c C y for every feasible y (so x0 is a global minimizer over the feasible set whenever it is itself feasible), provided C is positive semidefinite. No constraint qualification is needed. Note x0's own feasibility is not assumed: complementary slackness alone already forces u k = 0 at every k where a k ⬝ᵥ x0 > b k, so the hypotheses above are in fact slightly more general than "x0 is a feasible KKT point" — the usual application has x0 feasible, but the proof never needs that fact.

theoremMathFin.kkt_point_unique_of_posDefsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {c : ι → ℝ} {C : Matrix ι ι ℝ}, C.PosDef → ∀ {a : κ → ι → ℝ} {b : κ → ℝ} {x0 x1 : ι → ℝ}, (∀ (k : κ), a k ⬝ᵥ x0 ≤ b k) → (∀ (k : κ), a k ⬝ᵥ x1 ≤ b k) → ∀ {u0 : κ → ℝ}, (∀ (k : κ), 0 ≤ u0 k) → c + C.mulVec x0 = -∑ k, u0 k • a k → (∀ (k : κ), u0 k * (a k ⬝ᵥ x0 - b k) = 0) → ∀ {u1 : κ → ℝ}, (∀ (k : κ), 0 ≤ u1 k) → c + C.mulVec x1 = -∑ k, u1 k • a k → (∀ (k : κ), u1 k * (a k ⬝ᵥ x1 - b k) = 0) → x0 = x1

Uniqueness of the KKT point under C ≻ 0: if x0 and x1 each satisfy a sufficient-KKT system (feasibility, stationarity, dual feasibility, complementary slackness) for the same objective c, C and constraints a, b, possibly with different multipliers u0, u1, then x0 = x1. Both points are assumed to be KKT points; a minimizer not known to be one is not covered.

theoremMathFin.kkt_sufficient_of_eqsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {c : ι → ℝ} {C : Matrix ι ι ℝ}, C.PosSemidef → ∀ {a : κ → ι → ℝ} {b : κ → ℝ} {x0 : ι → ℝ}, (∀ (k : κ), a k ⬝ᵥ x0 = b k) → ∀ {ν : κ → ℝ}, c + C.mulVec x0 = ∑ k, ν k • a k → ∀ (y : ι → ℝ), (∀ (k : κ), a k ⬝ᵥ y = b k) → qpObj c C x0 ≤ qpObj c C y

KKT sufficiency with equality constraints: for the convex QP min c ⬝ᵥ x + ½ x ⬝ᵥ (C *ᵥ x) subject to ∀ k, a k ⬝ᵥ x = b k, a feasible point x0 satisfying stationarity c + C *ᵥ x0 = ∑ k, ν k • a k for some multipliers ν (of either sign) satisfies qpObj c C x0 ≤ qpObj c C y for every feasible y, provided C is positive semidefinite.

This is kkt_sufficient for the inequality system a k ⬝ᵥ x ≤ b k, -a k ⬝ᵥ x ≤ -b k indexed by κ ⊕ κ, with the free multiplier ν k split into the nonnegative pair max (-ν k) 0, max (ν k) 0. Complementary slackness holds because x0 is feasible.

theoremMathFin.feasible_step_preservedsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] {a : κ → ι → ℝ} {b : κ → ℝ} {x0 d : ι → ℝ}, (∀ (k : κ), a k ⬝ᵥ x0 ≤ b k) → ∀ {σhat : ℝ}, (∀ (k : κ), 0 < a k ⬝ᵥ d → σhat * a k ⬝ᵥ d ≤ b k - a k ⬝ᵥ x0) → ∀ {σ : ℝ}, 0 ≤ σ → σ ≤ σhat → ∀ (k : κ), a k ⬝ᵥ (x0 + σ • d) ≤ b k

Feasible step size (ratio test): let x0 be feasible and d a direction. If σ̂ is a lower bound for the ratio at which each a k ⬝ᵥ d > 0 constraint becomes binding (i.e. σ̂ * (a k ⬝ᵥ d) ≤ b k - a k ⬝ᵥ x0 for every such k), then every step σ ∈ [0, σ̂] keeps x0 + σ • d feasible. In particular this holds for σ0 = min σ̂ 1 whenever σ̂ ≥ 0.

theoremMathFin.feasible_step_preserved_min_onesource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] {a : κ → ι → ℝ} {b : κ → ℝ} {x0 d : ι → ℝ}, (∀ (k : κ), a k ⬝ᵥ x0 ≤ b k) → ∀ {σhat : ℝ}, 0 ≤ σhat → (∀ (k : κ), 0 < a k ⬝ᵥ d → σhat * a k ⬝ᵥ d ≤ b k - a k ⬝ᵥ x0) → ∀ (k : κ), a k ⬝ᵥ (x0 + min σhat 1 • d) ≤ b k

Corollary: the step size σ0 = min σ̂ 1 preserves feasibility (useful when the direction d is only trusted to be a feasible direction up to unit length).