Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Claim 3.4.6 — among the FFD positions of elements at most 1/31/31/3, the position order respects the list order

Proved
BinPacking.Decreasing.ffd_position_order

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 real numbers in [1/6,1][1/6,1][1/6,1], let a1≥⋯≥ana_1\ge\dots\ge a_na1​≥⋯≥an​ be LLL in nonincreasing order, and let PFPFPF, f0f_0f0​ and hhh be as in Claim 3.4.5: f0(ai)=(j,k)f_0(a_i)=(j,k)f0​(ai​)=(j,k) when aia_iai​ is the kkk-th element of bin jjj of the FFD packing, and hhh is the largest index with ah>1/3a_h>1/3ah​>1/3 (000 if there is none). Let kjk_jkj​ be the number of elements of bin jjj in PFPFPF. Order positions lexicographically:

(j,k)≤(j′,k′)  ⟺  j<j′  or  (j=j′ and k≤k′).(j,k)\le(j',k')\iff j<j'\ \text{ or }\ \bigl(j=j'\text{ and }k\le k'\bigr).(j,k)≤(j′,k′)⟺j<j′  or  (j=j′ and k≤k′).

Let Sh={f0(ai):i>h}S_h=\{f_0(a_i): i>h\}Sh​={f0​(ai​):i>h} be the positions of PFPFPF filled by elements after the hhh-th. If (j,k),(j′,k′)∈Sh(j,k),(j',k')\in S_h(j,k),(j′,k′)∈Sh​, k<kjk<k_jk<kj​ and (j,k)≤(j′,k′)(j,k)\le(j',k')(j,k)≤(j′,k′), then

index⁡[f0−1(j,k)]≤index⁡[f0−1(j′,k′)].\operatorname{index}\bigl[f_0^{-1}(j,k)\bigr]\le\operatorname{index}\bigl[f_0^{-1}(j',k')\bigr].index[f0−1​(j,k)]≤index[f0−1​(j′,k′)].

In words: among elements at most 1/31/31/3 that are not the last element of their FFD bin, an element in an earlier position of the FFD packing comes no later in the sorted list. The fact is used to show that BFD never needs a bin that FFD did not use.

Formalization Note The paper defines ShS_hSh​ as the positions still empty after BFD has placed a1,…,aha_1,\dots,a_ha1​,…,ah​; by Claim 3.4.5 these are exactly the FFD positions of ah+1,…,ana_{h+1},\dots,a_nah+1​,…,an​, and the statement uses that description. It is phrased on items: for 000-based items i, i' of S=S=S= sortDesc L with index at least hhh (the paper's i>hi>hi>h), whose FFD positions are (binOf, slotOf) (000-based bin and in-bin position), with slotOf + 1 less than the size of the final bin (the paper's k<kjk<k_jk<kj​) and lexicographically ordered positions, the conclusion is i ≤ i'.

Preamble
import Mathlib
import Definitions.Def_BinPacking_Decreasing_Model
Formal statement
namespace BinPacking.Decreasing

/-- Claim 3.4.6 (p. 313), restated through Claim 3.4.5 (the positions of `S_h` are those that
the items after the first `h` fill in the FFD packing `PF`). Let `S = sortDesc L` with
`L ⊆ [1/6, 1]` and `h` the number of elements of `S` exceeding `1/3`. If items `i` and `i'`
of `S`, both after the first `h`, fill positions `(j, k)` and `(j', k')` of `PF`, the item
`i` is not the last one of its bin (`k < k_j`), and `(j, k) ≤ (j', k')` lexicographically,
then `i ≤ i'`. -/
theorem ffd_position_order (L : List ℝ) (hL : IsList L)
    (h6 : ∀ a ∈ L, (1 / 6 : ℝ) ≤ a) (i i' : Fin (sortDesc L).length)
    (hi : ((sortDesc L).filter (fun a => decide ((1 / 3 : ℝ) < a))).length ≤ (i : ℕ))
    (hi' : ((sortDesc L).filter (fun a => decide ((1 / 3 : ℝ) < a))).length ≤ (i' : ℕ))
    (hk : slotOf ffChoice (sortDesc L) i + 1 <
      ((run ffChoice (sortDesc L)).getD (binOf ffChoice (sortDesc L) i) []).length)
    (hle : binOf ffChoice (sortDesc L) i < binOf ffChoice (sortDesc L) i' ∨
      (binOf ffChoice (sortDesc L) i = binOf ffChoice (sortDesc L) i' ∧
        slotOf ffChoice (sortDesc L) i ≤ slotOf ffChoice (sortDesc L) i')) :
    i ≤ i' := by sorry

end BinPacking.Decreasing
Source
Johnson, Demers, Ullman, Garey, Graham, Worst-Case Performance Bounds for Simple One-Dimensional Packing Algorithms, SIAM J. Comput. 3(4) (1974), p. 313, Claim 3.4.6 (order on positions defined just before it; S_h defined p. 311)
Read-back

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

Notation:

  • LLL is a list of reals with every entry in [1/6,1][1/6, 1][1/6,1].
  • S=(s0,…,sn−1)S = (s_0,\dots,s_{n-1})S=(s0​,…,sn−1​) is LLL sorted into nonincreasing order by a stable merge sort.
  • hhh is the number of entries of SSS strictly greater than 1/31/31/3.
  • The first-fit run on SSS processes items in order from no bins and puts each into the lowest-indexed bin whose current sum plus the item is ≤1\le 1≤1, otherwise a new bin at the end. Its final list of bins is the first-fit packing.
  • For a position ppp:
    • bin(p)\mathrm{bin}(p)bin(p) is the index first-fit chooses for sps_psp​ on the bins formed by s0,…,sp−1s_0,\dots,s_{p-1}s0​,…,sp−1​. This is the current number of bins when a new bin is opened.
    • slot(p)\mathrm{slot}(p)slot(p) is the number of items already in that bin just before sps_psp​ is placed.
    • Both are 0-based.

For positions i,i′i, i'i,i′ of SSS, the hypotheses are:

  1. i≥hi \ge hi≥h and i′≥hi' \ge hi′≥h.
  2. slot(i)+1<ℓ\mathrm{slot}(i) + 1 < \ellslot(i)+1<ℓ, where ℓ\ellℓ is the number of items in bin number bin(i)\mathrm{bin}(i)bin(i) of the final first-fit packing (taken as 000 if that bin does not exist). In other words, sis_isi​ is not the last item of its bin in the final packing.
  3. bin(i)<bin(i′)\mathrm{bin}(i) < \mathrm{bin}(i')bin(i)<bin(i′), or else bin(i)=bin(i′)\mathrm{bin}(i) = \mathrm{bin}(i')bin(i)=bin(i′) and slot(i)≤slot(i′)\mathrm{slot}(i) \le \mathrm{slot}(i')slot(i)≤slot(i′). This is the lexicographic comparison (bin(i),slot(i))≤(bin(i′),slot(i′))(\mathrm{bin}(i), \mathrm{slot}(i)) \le (\mathrm{bin}(i'), \mathrm{slot}(i'))(bin(i),slot(i))≤(bin(i′),slot(i′)).

The conclusion is i≤i′i \le i'i≤i′, a non-strict inequality.

Degenerate cases:

  • i=i′i = i'i=i′. The conclusion holds trivially.
  • Nothing to check. If LLL is empty, the statement is vacuous. It is also vacuous if h=nh = nh=n, meaning every entry exceeds 1/31/31/3.
  • Hypothesis 2 can fail. It fails whenever sis_isi​ is the last item in its final bin. Among other cases, it fails when sis_isi​ is the only item of its bin.
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