Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

p. 853 — dynamic programming recursion for F_s

Proved
GilmoreGomory61.CuttingStock.knapsack_dp_recursion

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

cutting-stockdynamic-programmingknapsackp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1

For the first s+1s+1s+1 piece lengths, with the new type indexed sss in zero-based notation, the knapsack value obeys

Fs+1(x)=max⁡0≤r≤⌊x/ℓs⌋(rbs+Fs(x−rℓs)).F_{s+1}(x)=\max_{0\le r\le\lfloor x/\ell_s\rfloor}\bigl(r b_s+F_s(x-r\ell_s)\bigr).Fs+1​(x)=0≤r≤⌊x/ℓs​⌋max​(rbs​+Fs​(x−rℓs​)).

The finite range for rrr is the paper's bound on the number of pieces of the new type. This relation is the dynamic programming computation used to test pricing for the available stock lengths.

Formalization Note The source uses one-based Fs+1F_{s+1}Fs+1​ with new length ℓs+1\ell_{s+1}ℓs+1​; Lean's new type has index sss. The statement requires positive lengths through this type. Earlier positive lengths are needed for the displayed finite range when negative capacities are permitted by the formal type. At x<0x<0x<0, both sides are −∞-\infty−∞.

Preamble
import Mathlib
import Definitions.Def_GilmoreGomory61_CuttingStock_Knapsack
Formal statement
namespace GilmoreGomory61.CuttingStock

/-- The Fₛ recursion and its finite range from p. 853. Earlier lengths must be positive too. -/
theorem knapsack_dp_recursion {m k : ℕ} (I : Instance m k)
    (b : Fin m → ℝ) (s : ℕ) (hs : s < m)
    (hℓ : ∀ i : Fin m, i.val ≤ s → 0 < I.ℓ i) (x : ℝ) :
    knapF I b (s + 1) x =
      ⨆ r ∈ Finset.range (⌊x / I.ℓ ⟨s, hs⟩⌋₊ + 1),
        (((r : ℝ) * b ⟨s, hs⟩ : ℝ) : EReal) +
          knapF I b s (x - r * I.ℓ ⟨s, hs⟩) := by sorry

end GilmoreGomory61.CuttingStock
Source
Gilmore and Gomory, A linear programming approach to the cutting-stock problem, Oper. Res. 9(6) (1961), p. 853, recursion for F_{s+1}
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 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