Fractional primal-dual ski rental: exact finite- competitive ratio
ProvedPrimalDualOnline.SkiRental.fractional_competitiveLet be the purchase price of a ski-rental instance and let be the number of ski days, unknown to the algorithm. Run the fractional primal-dual algorithm with the rate
and let be its buy variable after updates, the rent variable of source day , and the primal objective of the solution after days. Then three things hold simultaneously.
1. The buy trajectory is nondecreasing. for all indices. This is the online requirement of the model: a fractional primal variable may never be decreased once raised.
2. The final solution is feasible for the canonical fractional primal program:
3. Its cost is bounded against the offline optimum :
All three are needed for the statement to mean what "online competitive algorithm" means. Component 3 alone bounds a number without certifying that the number is the cost of anything that solves the problem; component 2 supplies that. Component 2 alone would be satisfied by procedures the model forbids; component 1 rules out a procedure that lowers a commitment it has already made. With all three, the conclusion is a genuine competitive guarantee, and the coefficient depends only on the purchase price, not on , so the bound is uniform over all request sequences.
The coefficient is left in exact closed form. Because increases to , one has and the coefficient is strictly greater than at every finite ; it converges to only as , which is a separate statement. A goal asserting -competitiveness at finite would be false.
Source correspondence.
- What the thesis states (p. 18): "Using weak duality theorem (Theorem 2.1) we immediately conclude that the algorithm is -competitive", with claim (i) asserting feasibility of the primal and dual solutions and the model requiring that primal variables not decrease.
- What this Lean theorem states: the conjunction of monotonicity, box feasibility of the final solution, and the cost bound with the coefficient in closed form.
- Introduced by the formalization: collecting the three into one conclusion is the formalization's choice — the source states competitiveness as the headline and feasibility as a separate claim (i), and treats non-decrease as a property of the model rather than a theorem. The exact closed-form coefficient in place of the source's informal " for " is also the formalization's.
Out of scope. This is not the randomized -competitive algorithm. Randomized threshold rounding of this fractional solution is the subject of the planned follow-up mission, Primal-Dual Online Algorithms II: Randomized Rounding for Ski Rental, and nothing here asserts anything about a distribution, an expectation, or an integral solution.
Formalization Note. The covering constraints use the final buy level , not the value current on day ; for a monotone online trajectory the solution required to be feasible is the one the algorithm ends with, and an early day's constraint is satisfied a fortiori. The benchmark is defined independently of the algorithm, and a separate statement certifies it is the least attained objective value of the canonical program. Component 1 does not mention ; for each the theorem restates the same -independent claim.
import Definitions.Def_PrimalDualOnline_SkiRentalLP import Definitions.Def_PrimalDualOnline_SkiRentalAlg import Mathlib.Tactic open PrimalDualOnline.SkiRental
theorem PrimalDualOnline.SkiRental.fractional_competitive
(B : ℕ) (hB : 0 < B) (k : ℕ) :
Monotone (algX B (cOpt B)) ∧
PrimalFeasibleBox k (algX B (cOpt B) k) (fun j : Fin k => algZ B (cOpt B) (j : ℕ)) ∧
algCost B (cOpt B) k ≤ (1 + 1 / cOpt B) * offlineOpt (B : ℝ) k := by sorryRead-back
What the Lean code literally says, in plain math · claude-opus-5
Setup and notation
The declaration takes two natural-number arguments, and , and one hypothesis . There is no hypothesis relating and : is an arbitrary natural number, including and values far exceeding . Throughout, is silently coerced to a real number wherever it appears in arithmetic.
Fix the constant . The theorem instantiates every occurrence of the algorithm's free parameter at this single value; nothing is asserted for any other parameter value.
Define the real sequence by
The "else" branch freezes the value at whatever happens to be; it does not clip it to . Define the companion sequence if , and if ; in particular always. Two further definitions are used verbatim: , and — a definition, not characterized as any optimum. So the algorithm's cost is literally : the final value multiplied by , plus the -values at indices .
The conclusion is a conjunction of exactly three claims, all under the single hypothesis .
Component 1 — Monotonicity of the -sequence
Asserts, with and carrying their usual orders:
This is a non-strict inequality (equality is permitted, and the frozen branch produces equalities). This component quantifies over all pairs of natural indices — the whole infinite sequence — and does not mention at all; for each the theorem simply restates the same -independent claim.
Component 2 — Box feasibility at index
Unfolds to the conjunction of three parts:
- and — the single final iterate lies in the closed unit interval (both non-strict; note this is the same whose defining recursion only guards on ).
- For every index with : and .
- For every index with : .
Part 3 pairs with , the last iterate, and not with the contemporaneous . All three parts are stated with non-strict inequalities. This component depends on , both in the value and in the range of the quantifiers.
Component 3 — The cost inequality
The multiplicative factor depends only on and not on . The inequality is non-strict, oriented with the algorithm's cost on the left.
-dependence summary
Component 1 is independent of (a statement about the entire sequence over ). Components 2 and 3 depend on . The competitive factor itself is independent of and depends on only.
Degenerate and edge cases
- . Both universally quantified parts of Component 2 are vacuous; Component 2 reduces to with . The sum in is empty, so Component 3 reads , and since the right side is ; the assertion at is .
- . , so the bound becomes ; the left side is .
- . , so the right-hand side is constant in , while the left-hand sum formally ranges over terms (each term with being ). No hypothesis excludes this regime.
- . , the factor is exactly , the bound is , and the recursion gives so the guard fails from index onward.
- is excluded by the hypothesis; consequently the reciprocals , are ordinary divisions rather than the junk value. For , , so .
- Strictness of the guard. Every branch tests strictly; at exactly the "else" branches apply.
- Index coercion. The -indices are ; index never appears among the -terms, while the -value used in Components 2 and 3 is exactly .
What is not asserted
- No optimality or lower bound. Nothing says the factor is best possible, and no lower bound is proved against any algorithm, class of algorithms, or adversary.
- No duality content. No dual variables, no dual feasibility, no weak- or strong-duality statement, and no claim that is the optimum of any linear program — is only the definition .
- No online information-constraint formalization. There is no formal model of an adversary or an input sequence, and no restriction stated that decisions at index depend only on the prefix; the "algorithm" is only the explicit recursion above.
- No claim about the sequence beyond the stated bounds: not that , not that reaches at any particular index, not that for , not that for , and no closed form.
- No per-time feasibility. Feasibility is asserted only for the pair ; no claim is made about at intermediate times.
- No integrality or randomization. Only box-relaxed quantities appear; no integral solution, no rounding, no distribution, no expected-cost claim.
- No asymptotics. Nothing about or , nothing about monotonicity of the factor in , not even the positivity .
- No statement for , and no claim for parameter values other than .
- No tightness, uniqueness, or minimality of the cost, and no claim that is the minimum of over feasible points.
Confirmed by the mission captain (proposal self-audit).