Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The fractional solution is primal feasible

Proved
PrimalDualOnline.SkiRental.alg_primal_feasible

by moutei · Sep 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

competitive-analysislinear-programmingonline-algorithmsprimal-dualski-rental

Let B≥1B \ge 1B≥1 be the purchase price and k≥0k \ge 0k≥0 the number of ski days. The solution the fractional algorithm holds after kkk days — the buy level xkx_kxk​ together with the rent variables z0,…,zk−1z_0, \dots, z_{k-1}z0​,…,zk−1​ of source days 1,…,k1, \dots, k1,…,k — is feasible for the canonical fractional primal program:

0≤xk≤1,0≤zj≤1  (0≤j<k),xk+zj≥1  (0≤j<k).0 \le x_k \le 1, \qquad 0 \le z_j \le 1 \ \ (0 \le j < k), \qquad x_k + z_j \ge 1 \ \ (0 \le j < k).0≤xk​≤1,0≤zj​≤1  (0≤j<k),xk​+zj​≥1  (0≤j<k).

Note which buy level appears in the covering constraints: the final one, xkx_kxk​, and not the value xjx_jxj​ current on day j+1j+1j+1. That is the correct reading of feasibility for an online algorithm whose primal variables only increase — the solution that must be feasible is the one the algorithm ends with, and an early day's constraint is satisfied a fortiori by the larger final value.

Source correspondence.

  • What the thesis states (p. 18): the primal half of claim (i), justified in one line — "since we set zj=1−xz_j = 1 - xzj​=1−x whenever x<1x < 1x<1, the primal solution produced is feasible."
  • What this Lean theorem states: the three-part box-feasibility predicate, at every horizon kkk.
  • Introduced by the formalization: two things. First, the upper bounds xk≤1x_k \le 1xk​≤1 and zj≤1z_j \le 1zj​≤1 are part of the claim, because the canonical program of this mission is the [0,1][0,1][0,1] relaxation of the source's prose; the source's one-line justification addresses only the covering constraint. Second, because the statement is asserted at every kkk and the recursion freezes the trajectory at the first value reaching 111, the conjunct xk≤1x_k \le 1xk​≤1 taken over all kkk has the effect of asserting that the frozen value is exactly 111 — that is, that the last update does not overshoot. That no-overshoot consequence is genuine content of this formalization and is not something the source states.

Formalization Note. For 0<k<B0 < k < B0<k<B the bound xk≤1x_k \le 1xk​≤1 holds strictly; at k=Bk = Bk=B it holds with equality. The statement asserts nothing about monotonicity of the trajectory, nothing about the closed form, and nothing of the form xj+zj≥1x_j + z_j \ge 1xj​+zj​≥1 at a common index.

Preamble
import Definitions.Def_PrimalDualOnline_SkiRentalLP
import Definitions.Def_PrimalDualOnline_SkiRentalAlg
import Mathlib.Tactic

open PrimalDualOnline.SkiRental
Formal statement
theorem PrimalDualOnline.SkiRental.alg_primal_feasible
    (B : ℕ) (hB : 0 < B) (k : ℕ) :
    PrimalFeasibleBox k (algX B (cOpt B) k)
      (fun j : Fin k => algZ B (cOpt B) (j : ℕ)) := by sorry
Source
Niv Buchbinder, "Designing Competitive Online Algorithms via a Primal-Dual Approach", PhD thesis, Tel Aviv University, 2008, https://www.tau.ac.il/~nivb/download/phd-thsis.pdf, Chapter 3, pp. 18-19 (PDF pp. 34-35): the primal half of claim (i) ("since we set z_j = 1 - x whenever x < 1, the primal solution produced is feasible"). Feasible region as relaxed on p. 17.
Read-back

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

Setting and notation. Two natural numbers are quantified over: a parameter BBB, subject to the single hypothesis B>0B > 0B>0, and an index kkk, subject to no hypothesis at all. Write cB=(1+1B)B−1c_B = \left(1 + \frac{1}{B}\right)^{B} - 1cB​=(1+B1​)B−1, where BBB is cast to a real number (the hypothesis B>0B > 0B>0 is what makes 1/B1/B1/B an ordinary reciprocal rather than the value total division returns at 000; for every B≥1B \ge 1B≥1 this gives cB≥1>0c_B \ge 1 > 0cB​≥1>0).

With c=cBc = c_Bc=cB​ fixed, define a real sequence by

X0=0,Xj+1={Xj(1+1B)+1cB B,if Xj<1,Xj,if Xj≥1,X_0 = 0, \qquad X_{j+1} = \begin{cases} X_j\left(1 + \dfrac{1}{B}\right) + \dfrac{1}{c_B\, B}, & \text{if } X_j < 1,\\[2mm] X_j, & \text{if } X_j \ge 1,\end{cases}X0​=0,Xj+1​=⎩⎨⎧​Xj​(1+B1​)+cB​B1​,Xj​,​if Xj​<1,if Xj​≥1,​

so the sequence grows by a geometric factor plus a fixed additive increment for as long as it is strictly below 111, and is frozen forever at its value from the first index onward at which that value is ≥1\ge 1≥1. Define a second sequence by Zj=1−XjZ_j = 1 - X_jZj​=1−Xj​ if Xj<1X_j < 1Xj​<1, and Zj=0Z_j = 0Zj​=0 if Xj≥1X_j \ge 1Xj​≥1. Both are total functions on N\mathbb{N}N; the same BBB and cBc_BcB​ are used in both.

What the theorem asserts. For every B>0B > 0B>0 and every kkk, the following five statements all hold. The first two concern the single real number XkX_kXk​; the last three are universally quantified over the kkk indices j∈{0,…,k−1}j \in \{0, \dots, k-1\}j∈{0,…,k−1}:

  1. 0≤Xk0 \le X_k0≤Xk​;
  2. Xk≤1X_k \le 1Xk​≤1;
  3. 0≤Zj0 \le Z_j0≤Zj​ for every j<kj < kj<k;
  4. Zj≤1Z_j \le 1Zj​≤1 for every j<kj < kj<k;
  5. 1≤Xk+Zj1 \le X_k + Z_j1≤Xk​+Zj​ for every j<kj < kj<k.

All five are conjoined; none is a hypothesis, and there is no implication in the conclusion. All inequalities are non-strict; the only strict comparison in the development is the internal test Xj<1X_j < 1Xj​<1 inside the definitions.

The index mismatch. The scalar argument is XXX evaluated at index kkk, whereas the family argument supplies ZZZ at indices 0,…,k−10, \dots, k-10,…,k−1 — index kkk is never used for ZZZ, and indices 0,…,k−10,\dots,k-10,…,k−1 are never used for XXX. Consequently conjunct 5 does not assert 1≤Xj+Zj1 \le X_j + Z_j1≤Xj​+Zj​ for matching indices. It asserts that the single value XkX_kXk​, together with each earlier ZjZ_jZj​, sums to at least 111. Unfolding ZZZ: for every j<kj < kj<k, if Xj<1X_j < 1Xj​<1 then Xj≤XkX_j \le X_kXj​≤Xk​; and if Xj≥1X_j \ge 1Xj​≥1 then Xk≥1X_k \ge 1Xk​≥1. So for each fixed kkk the covering conjunct compares XkX_kXk​ against all strictly earlier terms, not a per-index pairing. Because kkk is universally quantified, the family of instances collectively yields 1≤Xk+Zj1 \le X_k + Z_j1≤Xk​+Zj​ for all pairs j<kj < kj<k; the instance at k+1k+1k+1 pairs ZkZ_kZk​ with Xk+1X_{k+1}Xk+1​, but no instance ever pairs ZkZ_kZk​ with XkX_kXk​.

Degenerate cases.

  • k=0k = 0k=0. The index type is empty, so conjuncts 3, 4, 5 are vacuously true. The entire content collapses to 0≤X0≤10 \le X_0 \le 10≤X0​≤1, and X0=0X_0 = 0X0​=0, so this instance asserts 0≤0≤10 \le 0 \le 10≤0≤1 and nothing else.
  • k=1k = 1k=1. The only index is j=0j = 0j=0, with Z0=1Z_0 = 1Z0​=1. Conjuncts 3 and 4 read 0≤1≤10 \le 1 \le 10≤1≤1; conjunct 5 reads 1≤X1+11 \le X_1 + 11≤X1​+1, i.e. X1≥0X_1 \ge 0X1​≥0, where X1=1/(cBB)X_1 = 1/(c_B B)X1​=1/(cB​B).
  • B=1B = 1B=1. c1=1c_1 = 1c1​=1, the update is Xj+1=2Xj+1X_{j+1} = 2X_j + 1Xj+1​=2Xj​+1, and X1=1X_1 = 1X1​=1; the sequence is frozen at 111 from index 111, with Z0=1Z_0 = 1Z0​=1 and Zj=0Z_j = 0Zj​=0 for j≥1j \ge 1j≥1.
  • k=Bk = Bk=B. The statement singles out no index; kkk and BBB are independent, and nothing in the conclusion changes form at k=Bk = Bk=B. BBB enters only through the recursion coefficients and cBc_BcB​.
  • kkk much larger than BBB. Since the recursion freezes XXX at the first value ≥1\ge 1≥1, the sequence is eventually constant. Conjunct 2 is asserted at every kkk, including all kkk past that freezing point; combined with the freeze, asserting Xk≤1X_k \le 1Xk​≤1 for all kkk pins the frozen value to be exactly 111 — i.e. the assertion covers the case of the recursion overshooting 111 rather than excluding it by hypothesis.
  • B=0B = 0B=0 is excluded by the hypothesis, and nothing is asserted there.

What is not asserted. Nothing about any cost, objective value, competitive ratio, or performance guarantee; nothing about cBc_BcB​ being optimal or extremal; nothing about any dual object, duality relation, or linear program; nothing about any online input sequence, request, or adversary. It does not assert monotonicity of XXX, that XkX_kXk​ reaches 111 at any particular index (in particular nothing about XBX_BXB​), that Xk<1X_k < 1Xk​<1 for k<Bk < Bk<B, or any closed form. It makes no claim about ZjZ_jZj​ or XjX_jXj​ for indices j≥kj \ge kj≥k within a given instance, and no claim of the form 1≤Xj+Zj1 \le X_j + Z_j1≤Xj​+Zj​ at a common index. It gives no bounds on the increment, no telescoping identity, and no relation between XXX and ZZZ beyond the five inequalities. It says nothing for B=0B = 0B=0.

Human review
  • Endorsed by Shuze Chen · Sep 16, 2026

  • Endorsed by moutei · Sep 16, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me