Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Claim 2.2.4 — a bin with weight deficit β > 0 has level at most 1 − α − (5/9)β

Proved
BinPacking.FirstFit.weight_deficit_bound

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

approximation-algorithmsbin-packingp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let LLL be a list of reals in (0,1](0,1](0,1] and consider the completed First-Fit packing (respectively Best-Fit packing) of LLL. Let a bin of coarseness α<12\alpha<\tfrac12α<21​ be filled with b1≥⋯≥bmb_1\ge\dots\ge b_mb1​≥⋯≥bm​, and suppose

∑i=1mW(bi)=1−βwith β>0.\sum_{i=1}^m W(b_i)=1-\beta\qquad\text{with }\beta>0.i=1∑m​W(bi​)=1−βwith β>0.

Then either

  1. m=1m=1m=1 and b1≤12b_1\le\tfrac12b1​≤21​, or
  2. ∑i=1mbi≤1−α−59β\displaystyle\sum_{i=1}^m b_i\le 1-\alpha-\tfrac59\betai=1∑m​bi​≤1−α−95​β.

The statement consists of the First-Fit and the Best-Fit version. It converts a weight deficit of a bin into an increase of the coarseness of all later bins, which is what bounds the number of bins of weight less than 111.

Formalization Note The paper prints alternative (i) as "m=1m=1m=1 and b1<12b_1<\tfrac12b1​<21​". That version is false: First-Fit on the list (0.6,0.5)(0.6,0.5)(0.6,0.5) puts 0.50.50.5 alone in the second bin, whose coarseness is 0.40.40.4 and whose weight is W(0.5)=0.7W(0.5)=0.7W(0.5)=0.7, so β=0.3>0\beta=0.3>0β=0.3>0; neither b1<12b_1<\tfrac12b1​<21​ nor 0.5≤1−0.4−160.5\le 1-0.4-\tfrac160.5≤1−0.4−61​ holds. The paper's proof only excludes b1>12b_1>\tfrac12b1​>21​ ("If m=1m=1m=1 and b1>12b_1>\tfrac12b1​>21​, it is impossible that β>0\beta>0β>0"), and the main proof only uses that such a bin contains no element exceeding 12\tfrac1221​. The statement here therefore uses b1≤12b_1\le\tfrac12b1​≤21​. The bin is bin number jjj of the completed run; "m=1m=1m=1 and b1≤12b_1\le\tfrac12b1​≤21​" is written as "the bin is [b][b][b] for some b≤12b\le\tfrac12b≤21​".

Preamble
import Mathlib
import Definitions.Def_BinPacking_FirstFit_Model
import Definitions.Def_BinPacking_FirstFit_W
Formal statement
namespace BinPacking.FirstFit

/-- Claim 2.2.4 (p. 306), with alternative (i) read as `b₁ ≤ 1/2` (the printed `b₁ < 1/2` is a
misprint: FF on `(0.6, 0.5)` is a counterexample): in the completed FF packing (resp. BF
packing) of `L`, if bin `j` has coarseness `α < 1/2` and its `W`-weights sum to `1 − β` with
`β > 0`, then either the bin holds a single item `b₁ ≤ 1/2`, or its level is at most
`1 − α − (5/9)β`. -/
theorem weight_deficit_bound (L : List ℝ) (hL : IsList L) :
    (∀ (j : ℕ) (hj : j < (ffPack L).length) (β : ℝ), coarseness (ffPack L) j < 1 / 2 →
        0 < β → (((ffPack L)[j]).map W).sum = 1 - β →
        (∃ b : ℝ, (ffPack L)[j] = [b] ∧ b ≤ 1 / 2) ∨
          ((ffPack L)[j]).sum ≤ 1 - coarseness (ffPack L) j - 5 / 9 * β) ∧
    (∀ (j : ℕ) (hj : j < (bfPack L).length) (β : ℝ), coarseness (bfPack L) j < 1 / 2 →
        0 < β → (((bfPack L)[j]).map W).sum = 1 - β →
        (∃ b : ℝ, (bfPack L)[j] = [b] ∧ b ≤ 1 / 2) ∨
          ((bfPack L)[j]).sum ≤ 1 - coarseness (bfPack L) j - 5 / 9 * β) := by sorry

end BinPacking.FirstFit
Source
Johnson, Demers, Ullman, Garey, Graham, Worst-Case Performance Bounds for Simple One-Dimensional Packing Algorithms, SIAM J. Comput. 3(4) (1974), p. 306, Claim 2.2.4 (alternative (i) corrected from b₁ < 1/2 to b₁ ≤ 1/2)
Read-back

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

Setting. Let L=(a0,…,an−1)L=(a_0,\dots,a_{n-1})L=(a0​,…,an−1​) be any finite list of reals with 0<ai≤10<a_i\le10<ai​≤1. Let P=(B0,…,Bm−1)P=(B_0,\dots,B_{m-1})P=(B0​,…,Bm−1​) be the completed packing produced by one of these rules:

  • First fit (FF): each item in turn goes into the lowest-indexed bin where it fits (level plus item at most 111), or opens a new bin at the end.
  • Best fit (BF): each item in turn goes into the lowest-indexed bin among those where it fits whose level is maximal among all bins where it fits, or opens a new bin at the end.

With ℓ(B)\ell(B)ℓ(B) the sum of a bin's items, the coarseness of bin jjj is

αj=max⁡(0,max⁡j′<j(1−ℓ(Bj′))),\alpha_j=\max\Big(0,\max_{j'<j}(1-\ell(B_{j'}))\Big),αj​=max(0,j′<jmax​(1−ℓ(Bj′​))),

so α0=0\alpha_0=0α0​=0. WWW is the piecewise-linear function

W(α)={65α,α≤16,95α−110,16<α≤13,65α+110,13<α≤12,1,α>12.W(\alpha)=\begin{cases}\tfrac65\alpha, & \alpha\le\tfrac16,\\ \tfrac95\alpha-\tfrac1{10}, & \tfrac16<\alpha\le\tfrac13,\\ \tfrac65\alpha+\tfrac1{10}, & \tfrac13<\alpha\le\tfrac12,\\ 1, & \alpha>\tfrac12.\end{cases}W(α)=⎩⎨⎧​56​α,59​α−101​,56​α+101​,1,​α≤61​,61​<α≤31​,31​<α≤21​,α>21​.​

Assertion. The statement asserts, separately for the FF packing and for the BF packing: for every bin index j<mj<mj<m and every real β\betaβ such that

αj<12,β>0,∑b∈BjW(b)=1−β,\alpha_j<\tfrac12,\qquad \beta>0,\qquad \sum_{b\in B_j}W(b)=1-\beta,αj​<21​,β>0,b∈Bj​∑​W(b)=1−β,

at least one of the following holds:

  1. bin BjB_jBj​ consists of exactly one item bbb, and b≤12b\le\tfrac12b≤21​;
  2. ℓ(Bj)≤1−αj−59β\ell(B_j)\le 1-\alpha_j-\tfrac59\betaℓ(Bj​)≤1−αj​−95​β.

This is a non-exclusive "or", and alternative 1 allows equality b=12b=\tfrac12b=21​. For each bin, β\betaβ is forced to equal 1−∑b∈BjW(b)1-\sum_{b\in B_j}W(b)1−∑b∈Bj​​W(b). So in effect, the claim concerns bins with αj<12\alpha_j<\tfrac12αj​<21​ whose weight sum is strictly below 111.

Degenerate cases. For the empty list there are no bins and the claim is vacuous. For bin 000 we have α0=0\alpha_0=0α0​=0, and alternative 2 reads ℓ(B0)≤1−59β\ell(B_0)\le 1-\tfrac59\betaℓ(B0​)≤1−95​β. A bin whose weight sum is at least 111 admits no valid β\betaβ, so for that bin the claim is vacuous.

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