Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Oracle, Case I: local improvement directions from x∗x^*x∗ and global optimality (corrected objective)

Proved
MegiddoLP.FixedDim.oracle_caseI

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

linear-programmingoptimality-conditionsp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Consider the linear program minimize cTxc^TxcTx subject to Ax≥bAx\ge bAx≥b in the variables x1,…,xdx_1,\dots,x_dx1​,…,xd​, and the hyperplane {xd=0}\{x_d=0\}{xd​=0}. Let x∗x^*x∗ be an optimal solution relative to the hyperplane: x∗x^*x∗ is feasible, xd∗=0x^*_d=0xd∗​=0, and cTx∗≤cTxc^Tx^*\le c^TxcTx∗≤cTx for every feasible xxx with xd=0x_d=0xd​=0. Let I={i:aiTx∗=bi}I=\{i: a_i^Tx^*=b_i\}I={i:aiT​x∗=bi​} be the set of constraints tight at x∗x^*x∗. Consider the two auxiliary systems

(P+)zd=1,aiTz≥0 (i∈I),(P−)zd=−1,aiTz≥0 (i∈I),(P_+)\quad z_d=1,\quad a_i^Tz\ge0\ (i\in I),\qquad\qquad (P_-)\quad z_d=-1,\quad a_i^Tz\ge0\ (i\in I),(P+​)zd​=1,aiT​z≥0 (i∈I),(P−​)zd​=−1,aiT​z≥0 (i∈I),

and say that (P±)(P_\pm)(P±​) has a solution with negative value if some solution zzz has cTz<0c^Tz<0cTz<0. Then:

  1. there is a feasible yyy with yd>0y_d>0yd​>0 and cTy<cTx∗c^Ty<c^Tx^*cTy<cTx∗ if and only if (P+)(P_+)(P+​) has a solution with negative value;
  2. there is a feasible yyy with yd<0y_d<0yd​<0 and cTy<cTx∗c^Ty<c^Tx^*cTy<cTx∗ if and only if (P−)(P_-)(P−​) has a solution with negative value;
  3. (P+)(P_+)(P+​) and (P−)(P_-)(P−​) do not both have solutions with negative value;
  4. if neither has, then x∗x^*x∗ is an optimal solution of the original program.

This tells the oracle on which side of {xd=0}\{x_d=0\}{xd​=0} the optimum lies, or that x∗x^*x∗ is already optimal, by solving problems in d−1d-1d−1 free variables.

Formalization Note (corrected) The page writes the auxiliary objective as ∑j=1d−1cjxj\sum_{j=1}^{d-1}c_jx_j∑j=1d−1​cj​xj​. The direction has xd=±1x_d=\pm1xd​=±1, so its cost is ∑j<dcjzj±cd\sum_{j<d}c_jz_j\pm c_d∑j<d​cj​zj​±cd​, and with the printed objective parts 1 and 2 fail whenever cd≠0c_d\ne0cd​=0. The Lean uses cTzc^TzcTz, which includes the ±cd\pm c_d±cd​ term. The paper's xdx_dxd​ is the last coordinate Fin.last d of Fin (d + 1), so Lean's d+1d+1d+1 is the paper's ddd. The hypothesis on x∗x^*x∗ is optimality among feasible points of the hyperplane, not global optimality.

Preamble
import Mathlib
import Definitions.Def_Polyhedron
Formal statement
/-!
Megiddo, J. ACM 31 (1984), §4 p. 124, Case I of the oracle. The paper's `x_d` is the last
coordinate `Fin.last d` of `Fin (d + 1)`; the tested hyperplane is `{x_d = 0}`. The auxiliary
objective is `c ⬝ᵥ z` with `z_d = ±1`, i.e. the page's `Σ_{j<d} c_j z_j` corrected by the term
`± c_d`.
-/

open Matrix LinearOptimization

namespace MegiddoLP.FixedDim

/-- **Oracle, Case I.** Let `x*` be optimal for `minimize cᵀx` over the feasible points of
`Ax ≥ b` lying on `{x_d = 0}`, and let `I = {i | Aᵢ ⬝ᵥ x* = bᵢ}`. Then
1. some feasible `y` with `y_d > 0` has `cᵀy < cᵀx*` iff some `z` with `z_d = 1`,
   `Aᵢ ⬝ᵥ z ≥ 0` for `i ∈ I` has `cᵀz < 0`;
2. the same with `y_d < 0` and `z_d = -1`;
3. the two auxiliary systems of 1 and 2 do not both have a solution of negative value;
4. if neither does, `x*` is optimal for the original program. -/
theorem oracle_caseI {n d : ℕ} (A : Matrix (Fin n) (Fin (d + 1)) ℝ) (b : Fin n → ℝ)
    (c xs : Fin (d + 1) → ℝ)
    (hxs : IsLpOptimal c (polyhedron A b ∩ {x | x (Fin.last d) = 0}) xs) :
    ((∃ y ∈ polyhedron A b, 0 < y (Fin.last d) ∧ c ⬝ᵥ y < c ⬝ᵥ xs) ↔
      ∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = 1 ∧
        (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0) ∧
    ((∃ y ∈ polyhedron A b, y (Fin.last d) < 0 ∧ c ⬝ᵥ y < c ⬝ᵥ xs) ↔
      ∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = -1 ∧
        (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0) ∧
    ¬ ((∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = 1 ∧
          (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0) ∧
       (∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = -1 ∧
          (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0)) ∧
    ((¬ ∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = 1 ∧
          (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0) →
     (¬ ∃ z : Fin (d + 1) → ℝ, z (Fin.last d) = -1 ∧
          (∀ i, A i ⬝ᵥ xs = b i → 0 ≤ A i ⬝ᵥ z) ∧ c ⬝ᵥ z < 0) →
     IsLpOptimal c (polyhedron A b) xs) := by sorry

end MegiddoLP.FixedDim
Source
Megiddo, Linear Programming in Linear Time When the Dimension Is Fixed, J. ACM 31(1) (1984) 114–127, §4, p. 124 (Case I)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. Let n,d∈Nn, d \in \mathbb{N}n,d∈N, let AAA be a real n×(d+1)n\times(d+1)n×(d+1) matrix with rows AiA_iAi​, and let b∈Rnb \in \mathbb{R}^nb∈Rn. Let c,x∗∈Rd+1c, x^* \in \mathbb{R}^{d+1}c,x∗∈Rd+1. Write xd+1x_{d+1}xd+1​ for the last coordinate of a vector in Rd+1\mathbb{R}^{d+1}Rd+1.

Imported notions. P=polyhedron(A,b)P = \mathrm{polyhedron}(A,b)P=polyhedron(A,b) and "LP-optimal for ccc over a set SSS" come from an imported file whose text is not included here. Their names suggest {x:Ax≥b}\{x : Ax \ge b\}{x:Ax≥b} and optimality of c⋅xc\cdot xc⋅x on SSS.

Hypothesis. x∗x^*x∗ is LP-optimal for ccc over P∩{x:xd+1=0}P \cap \{x : x_{d+1} = 0\}P∩{x:xd+1​=0}.

Auxiliary sets. Let I={i:Ai⋅x∗=bi}I = \{i : A_i\cdot x^* = b_i\}I={i:Ai​⋅x∗=bi​}. Define the two statements

Z+: ∃z∈Rd+1: zd+1=1,  Ai⋅z≥0  ∀i∈I,  c⋅z<0,Z^+ :\ \exists z \in \mathbb{R}^{d+1}:\ z_{d+1} = 1,\ \ A_i\cdot z \ge 0\ \ \forall i \in I,\ \ c\cdot z < 0,Z+: ∃z∈Rd+1: zd+1​=1,  Ai​⋅z≥0  ∀i∈I,  c⋅z<0, Z−: ∃z∈Rd+1: zd+1=−1,  Ai⋅z≥0  ∀i∈I,  c⋅z<0.Z^- :\ \exists z \in \mathbb{R}^{d+1}:\ z_{d+1} = -1,\ \ A_i\cdot z \ge 0\ \ \forall i \in I,\ \ c\cdot z < 0.Z−: ∃z∈Rd+1: zd+1​=−1,  Ai​⋅z≥0  ∀i∈I,  c⋅z<0.

Claim. All four of the following hold:

  1. There is y∈Py \in Py∈P with yd+1>0y_{d+1} > 0yd+1​>0 and c⋅y<c⋅x∗c\cdot y < c\cdot x^*c⋅y<c⋅x∗ if and only if Z+Z^+Z+ holds.
  2. There is y∈Py \in Py∈P with yd+1<0y_{d+1} < 0yd+1​<0 and c⋅y<c⋅x∗c\cdot y < c\cdot x^*c⋅y<c⋅x∗ if and only if Z−Z^-Z− holds.
  3. Z+Z^+Z+ and Z−Z^-Z− do not both hold.
  4. If neither Z+Z^+Z+ nor Z−Z^-Z− holds, then x∗x^*x∗ is LP-optimal for ccc over all of PPP.

Degenerate cases.

  • No such x∗x^*x∗. If no x∗x^*x∗ satisfies the hypothesis under the unseen definition, the statement is vacuous for all data.
  • n=0n = 0n=0. III is empty, so Z±Z^\pmZ± reduce to the existence of zzz with zd+1=±1z_{d+1} = \pm 1zd+1​=±1 and c⋅z<0c\cdot z < 0c⋅z<0. The meaning of PPP when n=0n = 0n=0 is fixed by the unseen definition.
  • d=0d = 0d=0. The space is R1\mathbb{R}^1R1 and the slice is the single point {0}\{0\}{0}.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me